-
Notifications
You must be signed in to change notification settings - Fork 6
/
texting.js
503 lines (448 loc) · 12.6 KB
/
texting.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
const fetch = require('node-fetch');
// async function
const Pointss = [
{
p: { x: 53.55903, y: 103.74277 },
a: [53.55903, 103.74277],
c: 'What are your products or services?'
},
{
p: { x: 57.319145, y: 112.10878 },
a: [57.319145, 112.10878],
c: 'Why is your product or service unique or needed?'
},
{
p: { x: 45.771553, y: 91.066795 },
a: [45.771553, 91.066795],
c: 'How does your product or service solve the problem?'
},
{
p: { x: -7.9406934, y: 67.01128 },
a: [-7.9406934, 67.01128],
c: 'What is your business?'
},
{
p: { x: 38.50291, y: 86.21665 },
a: [38.50291, 86.21665],
c: "How will your product or service solve your customer's problem?"
},
{
p: { x: -13.609276, y: 71.53021 },
a: [-13.609276, 71.53021],
c: 'What is your business and what does it do?'
},
{
p: { x: 8.023912, y: 28.005163 },
a: [8.023912, 28.005163],
c: 'Who are your customers and who is your target market?'
},
{
p: { x: -22.050316, y: -43.844353 },
a: [-22.050316, -43.844353],
c: 'What are your key marketing plans?'
},
{
p: { x: 43.364727, y: -8.495335 },
a: [43.364727, -8.495335],
c: "What is your startup's business model?"
},
{
p: { x: 47.345737, y: 0.44594556 },
a: [47.345737, 0.44594556],
c: 'What is your business model?'
},
{
p: { x: 33.55904, y: 73.17918 },
a: [33.55904, 73.17918],
c: 'Why do your target customers need your solution?'
},
{
p: { x: 20.614914, y: 80.53535 },
a: [20.614914, 80.53535],
c: 'Why will customers buy from you?'
},
{
p: { x: -16.387508, y: -37.27822 },
a: [-16.387508, -37.27822],
c: 'What are your key marketing and sales strategies?'
},
{
p: { x: 4.094114, y: 19.475288 },
a: [4.094114, 19.475288],
c: 'Who is your target market?'
},
{
p: { x: 19.746296, y: 44.113266 },
a: [19.746296, 44.113266],
c: 'Do you have any existing traction, such as users, paying customers, or partnerships?'
},
{
p: { x: 93.01094, y: 17.208616 },
a: [93.01094, 17.208616],
c: 'What are your key milestones and objectives for your business?'
},
{
p: { x: -11.869589, y: -25.77251 },
a: [-11.869589, -25.77251],
c: 'What is your go-to-market strategy?'
},
{
p: { x: -102.545975, y: -67.06987 },
a: [-102.545975, -67.06987],
c: 'What are your costs?'
},
{
p: { x: 86.47686, y: 27.307432 },
a: [86.47686, 27.307432],
c: 'What are your key goals for your business?'
},
{
p: { x: -93.95409, y: -70.05509 },
a: [-93.95409, -70.05509],
c: 'What are your costs of goods sold and customer acquisition costs?'
},
{
p: { x: -57.010174, y: 1.2699447 },
a: [-57.010174, 1.2699447],
c: 'How will you generate revenue?'
},
{
p: { x: 56.86996, y: 3.3810604 },
a: [56.86996, 3.3810604],
c: 'What are the key elements of your business model?'
},
{
p: { x: -59.674145, y: 8.803825 },
a: [-59.674145, 8.803825],
c: 'How do you plan to generate revenue?'
},
{
p: { x: 109.05481, y: 5.8969674 },
a: [109.05481, 5.8969674],
c: 'What are the key milestones your startup has achieved so far?'
},
{
p: { x: 1.0332764, y: 2.40216 },
a: [1.0332764, 2.40216],
c: 'How will you reach your target market?'
},
{
p: { x: 105.377106, y: -42.262424 },
a: [105.377106, -42.262424],
c: 'What is the problem your startup is solving?'
},
{
p: { x: -157.48007, y: -2.0208962 },
a: [-157.48007, -2.0208962],
c: 'What are your key competitive advantages?'
},
{
p: { x: 89.15603, y: 35.903774 },
a: [89.15603, 35.903774],
c: 'What are your long-term goals for the business?'
},
{
p: { x: -2.6846876, y: -4.7632165 },
a: [-2.6846876, -4.7632165],
c: 'How will you reach and engage your target market?'
},
{
p: { x: -46.22875, y: 11.519539 },
a: [-46.22875, 11.519539],
c: 'How will you generate revenue with your business model?'
},
{
p: { x: 37.16744, y: -69.437706 },
a: [37.16744, -69.437706],
c: 'What are the risks and challenges associated with your business?'
},
{
p: { x: -114.97277, y: 88.35114 },
a: [-114.97277, 88.35114],
c: 'What are your expansion plans?'
},
{
p: { x: 73.57562, y: 10.768791 },
a: [73.57562, 10.768791],
c: 'What are the key areas you will focus on in your business?'
},
{
p: { x: 100.992004, y: -36.438892 },
a: [100.992004, -36.438892],
c: 'How does your startup solve the problem better than other existing solutions?'
},
{
p: { x: -166.40001, y: -2.8954608 },
a: [-166.40001, -2.8954608],
c: 'What is your competitive landscape?'
},
{
p: { x: 45.625847, y: -75.96174 },
a: [45.625847, -75.96174],
c: 'What are the key risks and challenges facing your business?'
},
{
p: { x: -94.7716, y: -49.920826 },
a: [-94.7716, -49.920826],
c: 'How much will it cost to start and operate your business?'
},
{
p: { x: -41.903522, y: -107.86035 },
a: [-41.903522, -107.86035],
c: 'Why is now the right time to start this business?'
},
{
p: { x: -113.170364, y: -68.56816 },
a: [-113.170364, -68.56816],
c: 'What are your key expenses and how will they be covered?'
},
{
p: { x: 48.445854, y: -67.52311 },
a: [48.445854, -67.52311],
c: 'What are the key risks and challenges you face in your business?'
},
{
p: { x: 128.32259, y: -63.851677 },
a: [128.32259, -63.851677],
c: 'What problem are you solving?'
},
{
p: { x: -95.19956, y: 1.0390553 },
a: [-95.19956, 1.0390553],
c: 'How long will it take to become profitable?'
},
{
p: { x: -93.792404, y: 10.715869 },
a: [-93.792404, 10.715869],
c: 'When do you expect to become profitable?'
},
{
p: { x: -84.91379, y: 5.1121964 },
a: [-84.91379, 5.1121964],
c: 'How soon do you expect to generate profits?'
},
{
p: { x: 37.763306, y: -148.35744 },
a: [37.763306, -148.35744],
c: 'What are your key financial metrics?'
},
{
p: { x: 49.52504, y: -148.91037 },
a: [49.52504, -148.91037],
c: 'What are your key performance indicators (KPIs)?'
},
{
p: { x: -91.490654, y: 78.2895 },
a: [-91.490654, 78.2895],
c: 'How much money do you need to get started or scale up? for what purpose?'
},
{
p: { x: 118.278725, y: 12.530243 },
a: [118.278725, 12.530243],
c: 'What are your key milestones/traction to date?'
},
{
p: { x: -170.98708, y: 6.2690744 },
a: [-170.98708, 6.2690744],
c: 'What is the competition like and how will you differentiate yourself?'
},
{
p: { x: -103.4321, y: 85.1796 },
a: [-103.4321, 85.1796],
c: 'What are your plans for using the capital?'
},
{
p: { x: 132.9472, y: -85.02592 },
a: [132.9472, -85.02592],
c: 'How will you reach them?'
},
{
p: { x: 71.636215, y: 31.780804 },
a: [71.636215, 31.780804],
c: 'What are your key value propositions?'
},
{
p: { x: 134.72058, y: -69.43259 },
a: [134.72058, -69.43259],
c: 'What is the problem that you are solving?'
},
{
p: { x: -45.027103, y: -116.52308 },
a: [-45.027103, -116.52308],
c: 'Why is now the right time to enter this market?'
},
{
p: { x: -78.18653, y: 52.877174 },
a: [-78.18653, 52.877174],
c: 'How do you plan to use the investment funds to grow your business?'
},
{
p: { x: 104.06626, y: 42.281933 },
a: [104.06626, 42.281933],
c: 'What are your key strategies for achieving your goals?'
},
{
p: { x: 145.60976, y: -63.752296 },
a: [145.60976, -63.752296],
c: 'What is your solution?'
},
{
p: { x: 16.782646, y: -146.20396 },
a: [16.782646, -146.20396],
c: 'What are your financial projections?'
},
{
p: { x: -175.1996, y: 17.288923 },
a: [-175.1996, 17.288923],
c: 'Who is on your team and what relevant experience do they bring?'
},
{
p: { x: -92.94262, y: 31.830072 },
a: [-92.94262, 31.830072],
c: 'What are the potential rewards for investing in your company?'
},
{
p: { x: 63.805767, y: -76.146965 },
a: [63.805767, -76.146965],
c: 'What are your key strategies for mitigating these risks and challenges?'
},
{
p: { x: 24.196049, y: -147.11852 },
a: [24.196049, -147.11852],
c: 'What are your key financial projections?'
},
{
p: { x: 153.29965, y: -56.499928 },
a: [153.29965, -56.499928],
c: 'How does your solution work?'
},
{
p: { x: -69.80166, y: 111.92236 },
a: [-69.80166, 111.92236],
c: 'How much money have you raised so far and from which investors?'
},
{
p: { x: 117.148865, y: 23.269657 },
a: [117.148865, 23.269657],
c: 'What are the key milestones you plan to achieve in the next 12 months?'
},
{
p: { x: -75.47471, y: 79.17846 },
a: [-75.47471, 79.17846],
c: 'How will you use the funding?'
},
{
p: { x: -77.81687, y: 71.01826 },
a: [-77.81687, 71.01826],
c: 'How will you use the funds raised?'
},
{
p: { x: -69.8426, y: 130.2267 },
a: [-69.8426, 130.2267],
c: 'How much capital do you need to raise?'
},
{
p: { x: -70.02895, y: 120.93709 },
a: [-70.02895, 120.93709],
c: 'How much money do you need to raise from investors?'
}
]
const points = Pointss.map(x => x.p)
//Pythagorean theorem to find the distance between any two points.
const distance = (a, b) => {
return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
};
// takes an array of points, and a point, and returns new array of points and distance sorted by distance from the point
const sortByDistance = (points, point) => {
return points.map(p => {
return {
p: p,
d: distance(p, point)
};
}).sort((a, b) => {
return a.d - b.d;
});
};
const cal = sortByDistance(points, points[0]);
// the first point is the point itself, so we remove it
cal.shift();
// max distance between two points
const maxDistance = cal[cal.length - 1].d;
console.log(maxDistance);
// min distance between two points
const minDistance = cal[0].d;
console.log(minDistance);
// the distance between the first and last point
const dBetweenFirstAndLast = maxDistance - minDistance;
// the distance between the first and last point divided by the number of points
const dBetweenFirstAndLastDividedByPoints = dBetweenFirstAndLast / points.length;
// find the point that is the furthest away from the first point
const furthestPoint = cal[cal.length - 1].d;
/* function that get the url from user and return the valid url if the url do not have http or https */
const getUrl = (url) => {
// lowercased url
const lowerCasedUrl = url.toLowerCase();
if (lowerCasedUrl.indexOf('http://') === -1 && lowerCasedUrl.indexOf('https://') === -1) {
return `http://${lowerCasedUrl}`;
}
return url;
};
(async function () {
console.log(getUrl("maila.ai"))
// const tasks = async () => {
// const data = await fetch('https://jsonplaceholder.typicode.com/todos/1').then(response => response.json());
// console.log(data, new Date())
// const data2 = await fetch('https://jsonplaceholder.typicode.com/todos/2').then(response => response.json());
// console.log(data2, new Date())
// const data3 = await fetch('https://jsonplaceholder.typicode.com/todos/3').then(response => response.json());
// console.log(data3, new Date())
// return { data, data2, data3 }
// }
// for (let i = 0; i < 30; i++) {
// console.log(i);
// tasks();
// }
// console.log('end');
return "done";
}
)();
/**
Blog title: How to start a personal blog
Blog sections:
1. Pick a personal blog template
2. Develop your brand
3. Choose a hosting plan and domain name
4. Create a content calendar
5. Optimize your content for SEO
6. Build an email list
7. Get the word out
---
Blog title: A real-world example on Improving JavaScript performance
Blog sections:
1. Why I needed to Improve my JavaScript performance
2. Three common ways to find performance issues in Javascript
3. How I found the JavaScript performance issue using console.time
4. How does lodash cloneDeep work?
5. What is the alternative to lodash cloneDeep?
6. Conclusion
---
Blog title: Is a Happy Life Different from a Meaningful One?
Blog sections:
1. Five differences between a happy life and a meaningful one
2. What is happiness, anyway?
3. Is the happiness without pleasure?
4. Can you have it all?
---
Blog title: 5 Strategies to overcome writer's block
Blog Sections:
1. Understand the root of your writer's block
2. Get organized
3. Set realistic writing goals
4. Take a break
5. Reward yourself
*/
const data = {
text: "something has gone away ther",
numResults: 3,
tone: "formal",
}