-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcognitiveBiases.1d.js
502 lines (413 loc) · 13.2 KB
/
cognitiveBiases.1d.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
#!/usr/bin/env /usr/local/bin/node
/*
# <bitbar.title>Cognitive Bias A Day</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Arik Liber</bitbar.author>
# <bitbar.author.github>https://github.com/LeonLiber/cognitive-bias-a-day</bitbar.author.github>
# <bitbar.desc>A BitBar ❤️ plugin showing you a fresh cognitive bias every day 🙊</bitbar.desc>
# <bitbar.image>https://raw.githubusercontent.com/LeonLiber/cognitive-bias-a-day/master/screenshot.png</bitbar.image>
# <bitbar.dependencies>npm install bitbar wikipedia-js striptags</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/LeonLiber/cognitive-bias-a-day</bitbar.abouturl>
*/
const bitbar = require('bitbar');
const wikipedia = require('wikipedia-js');
const striptags = require('striptags');
const fs = require('fs')
//Data. Source: https://github.com/busterbenson/public/blob/master/cognitive-bias-cheat-sheet.json
const data = {
"name": "biases",
"children": [
{
"name": "1. Too Much Information",
"children": [
{
"name": "We notice things already primed in memory or repeated often.",
"children": [
{"name": "Availability heuristic"},
{"name": "Attentional bias"},
{"name": "Illusory truth effect"},
{"name": "Mere exposure effect"},
{"name": "Context effect"},
{"name": "Cue-dependent forgetting"},
{"name": "Mood-congruent memory bias"},
{"name": "Frequency illusion"},
{"name": "Baader-Meinhof Phenomenon"},
{"name": "Empathy gap"},
{"name": "Omission bias"},
{"name": "Base rate fallacy"}
]
},
{
"name": "Bizarre/funny/visually-striking/anthropomorphic things stick out more than non-bizarre/unfunny things.",
"children": [
{"name": "Bizarreness effect"},
{"name": "Humor effect"},
{"name": "Von Restorff effect"},
{"name": "Picture superiority effect"},
{"name": "Self-relevance effect"},
{"name": "Negativity bias"}
]
},
{
"name": "We notice when something has changed.",
"children": [
{"name": "Anchoring"},
{"name": "Conservatism"},
{"name": "Contrast effect"},
{"name": "Distinction bias"},
{"name": "Focusing effect"},
{"name": "Framing effect"},
{"name": "Money illusion"},
{"name": "Weber–Fechner law"}
]
},
{
"name": "We are drawn to details that confirm our own existing beliefs",
"children": [
{"name": "Confirmation bias"},
{"name": "Congruence bias"},
{"name": "Post-purchase rationalization"},
{"name": "Choice-supportive bias"},
{"name": "Selective perception"},
{"name": "Observer-expectancy effect"},
{"name": "Experimenter's bias"},
{"name": "Observer effect"},
{"name": "Expectation bias"},
{"name": "Ostrich effect"},
{"name": "Subjective validation"},
{"name": "Continued influence effect"},
{"name": "Semmelweis reflex"}
]
},
{
"name": "We notice flaws in others more easily than flaws in ourselves.",
"children": [
{"name": "Bias blind spot"},
{"name": "Naïve cynicism"},
{"name": "Naïve realism"}
]
}
]
},
{
"name": "2. Not Enough Meaning",
"children": [
{
"name": "We find stories and patterns even in sparse data",
"children": [
{"name": "Confabulation"},
{"name": "Clustering illusion"},
{"name": "Insensitivity to sample size"},
{"name": "Neglect of probability"},
{"name": "Anecdotal fallacy"},
{"name": "Illusion of validity"},
{"name": "Masked man fallacy"},
{"name": "Recency illusion"},
{"name": "Gambler's fallacy"},
{"name": "Hot-hand fallacy"},
{"name": "Illusory correlation"},
{"name": "Pareidolia"},
{"name": "Anthropomorphism"}
]
},
{
"name": "We fill in characteristics from stereotypes, generalities, and prior histories",
"children": [
{"name": "Group attribution error"},
{"name": "Ultimate attribution error"},
{"name": "Stereotyping"},
{"name": "Essentialism"},
{"name": "Functional fixedness"},
{"name": "Moral credential effect"},
{"name": "Just-world hypothesis"},
{"name": "Argument from fallacy"},
{"name": "Authority bias"},
{"name": "Automation bias"},
{"name": "Bandwagon effect"},
{"name": "Placebo effect"}
]
},
{
"name": "We imagine things and people we're familiar with or fond of as better",
"children": [
{"name": "Out-group homogeneity bias"},
{"name": "Cross-race effect"},
{"name": "In-group bias"},
{"name": "Halo effect"},
{"name": "Cheerleader effect"},
{"name": "Positivity effect"},
{"name": "Not invented here"},
{"name": "Reactive devaluation"},
{"name": "Well-traveled road effect"}
]
},
{
"name": "We simplify probabilities and numbers to make them easier to think about",
"children": [
{"name": "Mental accounting"},
{"name": "Appeal to probability fallacy"},
{"name": "Normalcy bias"},
{"name": "Murphy's Law"},
{"name": "Zero sum bias"},
{"name": "Survivorship bias"},
{"name": "Subadditivity effect"},
{"name": "Denomination effect"},
{"name": "Magic number 7+-2"}
]
},
{
"name":"We think we know what other people are thinking",
"children": [
{"name": "Illusion of transparency"},
{"name": "Curse of knowledge"},
{"name": "Spotlight effect"},
{"name": "Extrinsic incentive error"},
{"name": "Illusion of external agency"},
{"name": "Illusion of asymmetric insight"}
]
},
{
"name": "We project our current mindset and assumptions onto the past and future",
"children": [
{"name": "Telescoping effect"},
{"name": "Rosy retrospection"},
{"name": "Hindsight bias"},
{"name": "Outcome bias"},
{"name": "Moral luck"},
{"name": "Declinism"},
{"name": "Impact bias"},
{"name": "Pessimism bias"},
{"name": "Planning fallacy"},
{"name": "Time-saving bias"},
{"name": "Pro-innovation bias"},
{"name": "Projection bias"},
{"name": "Restraint bias"},
{"name": "Self-consistency bias"}
]
}
]
},
{
"name": "3. Need To Act Fast",
"children": [
{
"name": "To act, we must be confident we can make an impact and feel what we do is important",
"children": [
{"name": "Overconfidence effect"},
{"name": "Social desirability bias"},
{"name": "Third-person effect"},
{"name": "False consensus effect"},
{"name": "Hard-easy effect"},
{"name": "Lake Wobegone effect"},
{"name": "Dunning-Kruger effect"},
{"name": "Egocentric bias"},
{"name": "Optimism bias"},
{"name": "Forer effect"},
{"name": "Barnum effect"},
{"name": "Self-serving bias"},
{"name": "Actor-observer bias"},
{"name": "Illusion of control"},
{"name": "Illusory superiority"},
{"name": "Fundamental attribution error"},
{"name": "Defensive attribution hypothesis"},
{"name": "Trait ascription bias"},
{"name": "Effort justification"},
{"name": "Risk compensation"},
{"name": "Peltzman effect"}
]
},
{
"name": "To stay focused, we favor the immediate, relatable thing in front of us",
"children": [
{"name": "Hyperbolic discounting"},
{"name": "Appeal to novelty"},
{"name": "Identifiable victim effect"}
]
},
{
"name": "To get anything done, we tend to complete things we've invested time & energy in.",
"children": [
{"name": "Sunk cost fallacy"},
{"name": "Irrational escalation"},
{"name": "Escalation of commitment"},
{"name": "Generation effect"},
{"name": "Loss aversion"},
{"name": "IKEA effect"},
{"name": "Unit bias"},
{"name": "Zero-risk bias"},
{"name": "Disposition effect"},
{"name": "Pseudocertainty effect"},
{"name": "Processing difficulty effect"},
{"name": "Endowment effect"},
{"name": "Backfire effect"}
]
},
{
"name": "To avoid mistakes, we tend to preserve our autonomy and group status, and avoid irreversible decisions.",
"children": [
{"name": "System justification"},
{"name": "Reverse psychology"},
{"name": "Reactance"},
{"name": "Decoy effect"},
{"name": "Social comparison bias"},
{"name": "Status quo bias"}
]
},
{
"name": "We favor options that appear simple or have more complete information over more complex, ambiguous options.",
"children": [
{"name": "Ambiguity bias"},
{"name": "Information bias"},
{"name": "Belief bias"},
{"name": "Rhyme as reason effect"},
{"name": "Bike-shedding effect"},
{"name": "Law of Triviality"},
{"name": "Delmore effect"},
{"name": "Conjunction fallacy"},
{"name": "Occam's razor"},
{"name": "Less-is-better effect"}
]
}
]
},
{
"name": "4. What Should We Remember?",
"children": [
{
"name": "We edit and reinforce some memories after the fact",
"children": [
{"name": "Misattribution of memory"},
{"name": "Source confusion"},
{"name": "Cryptomnesia"},
{"name": "False memory"},
{"name": "Suggestibility"},
{"name": "Spacing effect"}
]
},
{
"name": "We discard specifics to form generalities",
"children": [
{"name": "Implicit associations"},
{"name": "Implicit stereotypes"},
{"name": "Stereotypical bias"},
{"name": "Prejudice"},
{"name": "Negativity bias"},
{"name": "Fading affect bias"}
]
},
{
"name": "We reduce events and lists to their key elements",
"children": [
{"name": "Peak–end rule"},
{"name": "Leveling and sharpening"},
{"name": "Misinformation effect"},
{"name": "Serial recall effect"},
{"name": "List-length effect"},
{"name": "Duration neglect"},
{"name": "Modality effect"},
{"name": "Memory inhibition"},
{"name": "Primacy effect"},
{"name": "Recency effect"},
{"name": "Part-list cueing effect"},
{"name": "Serial position effect"},
{"name": "Suffix effect"}
]
},
{
"name": "We store memories differently based on how they were experienced",
"children": [
{"name": "Levels of processing effect"},
{"name": "Absent-mindedness"},
{"name": "Testing effect"},
{"name": "Next-in-line effect"},
{"name": "Google effect"},
{"name": "Tip of the tongue phenomenon"}
]
}
]
}
]
};
function currentDay() {
var now = new Date();
var start = new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
var day = Math.floor(diff / oneDay);
return day;
}
function getBiases() {
var biases = [];
data.children.forEach(function(item){
var bias = {
group: item.name
};
item.children.forEach(function(item){
bias.description = item.name;
item.children.forEach(function(item){
bias.bias = item.name;
biases.push(Object.assign({}, bias));
});
});
});
return biases;
}
var biases = getBiases();
var biasIndex = currentDay() % biases.length;
wikipedia.searchArticle({query: biases[biasIndex].bias, format: "html", summaryOnly: true}, function(err, result){
//Get wikipedia
var lines = [];
try {
if(err) {
lines.push('Wikipedia not available');
lines.push('Please check your internet connection');
} else {
var currentLine = '';
result = striptags(result).split(' ');
result.forEach((word, i) => {
currentLine += ' '+word;
if(i%12 === 0 && i >0) {
lines.push(currentLine);
currentLine = '';
} else {
}
});
}
if(lines.length === 0) {
lines.push(`Unable to find '${biases[biasIndex].bias}' on Wikipedia 😞`);
}
} catch (e) {
lines = ['There was an error getting more info from Wikipedia 😅, please refresh'];
}
//Send result
bitbar([
{
text: '💡',
dropdown: false
},
bitbar.sep,
{
text: biases[biasIndex].bias,
color: '#34860D',
href: 'https://en.wikipedia.org/w/index.php?search=' + biases[biasIndex].bias
},
bitbar.sep,
{
text: biases[biasIndex].group.substr(2, biases[biasIndex].length),
color: '#34860D'
},
bitbar.sep,
{
text: biases[biasIndex].description,
color: '#34860D'
},
bitbar.sep,
{
text: lines.join("\n")
},
bitbar.sep,
{
text: `📅 Day ${currentDay()}, biase #${biasIndex} of ${biases.length} total`
}
]);
});