-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
524 lines (469 loc) · 29.7 KB
/
index.html
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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PMBook 6 Cheat sheets for memorize PMP exam formulas. PMP Formulas Complete Certification.</title>
<meta name="description" content="PMP formulas resource page consists of complete list of Important PMP formulas and calculations essential for the PMP certification examination." />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- Optional theme -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/colorPicker.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div class="container" class="cheat_sheet_b">
<div class="row">
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_acr">
<li class="title">Acronyms</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">PV</span>Present value</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">FV</span>Future Value</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">NPV</span>Net Present Value</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">ROI</span>Rate of Interest</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">IRR</span>Internal Rate of Return</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">BCR</span>Benefit Cost Ratio</li>
<li class="bullet-item " data-link="pmp_ps"><span class="acronym">CBR</span>Cost Benefit Ratio</li>
<li class="bullet-item " data-link="pmp_pta"><span class="acronym">PTA</span>Point of Total Assumption</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">CV</span>Cost Variance</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">SV</span>Schedule Variance</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">AC</span>Actual Cost</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">PV</span>Present Value</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">CPI</span>Cost Performance Index</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">SPI</span>Schedule Performance Index</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">EAC</span>Estimate at Complete</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">BAC</span>Budget at Complete</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">TCPI</span>To Complete Performance Index</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">ETC</span>Estimate To Complete</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">EV</span>Earned Value</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">VAC</span>Variance at Completion</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">EMV</span>Expected Monetary Value</li>
<li class="bullet-item " data-link="pmp_evm"><span class="acronym">EVM</span>Earned Value Management</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_ps">
<li class="title">Project Selection</li>
<li class="bullet-item ">$PV = {FV \over (1+r)^n}$</li>
<li class="bullet-item ">$FV = {PV * (1+r)^n}$</li>
<li class="bullet-item ">NPV = Pick the biggest number</li>
<li class="bullet-item ">ROI = Pick the biggest number</li>
<li class="bullet-item ">IRR = Pick the biggest number</li>
<li class="bullet-item ">$Payback\ Period = {Initial\ Investment \over Cash\ Inflow\ per\ Period}$</li>
<li class="bullet-item ">$BCR = {Benefit \over Cost}$<span class="c-r">Bigger the better</span></li>
<li class="bullet-item ">$CBR = {Cost \over Benefit}$</li>
<li class="bullet-item ">Opportunity Cost = Value of project not being chosen</li>
<li class="notes ">
<table>
<tbody>
<tr><td class="acronym">r</td><td>Interest rate</td></tr>
<tr><td class="acronym">n</td><td>Period of time</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_risk">
<li class="title">Risk</li>
<li class="bullet-item ">$$EMV = P * I$$</li>
<li class="notes ">
<table>
<tbody>
<tr><td class="acronym">P</td><td>Probability</td></tr>
<tr><td class="acronym">I</td><td>Impact</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_evm">
<li class="title">Earned Value Management (EVM)</li>
<li class="bullet-item ">$EV = {PV \over AC}$</li>
<li class="bullet-item ">$CV = EV - AC$<span class="c-r">>=0 Under budget (good)</span>
</li>
<li class="bullet-item ">$SV = EV - PV$<span class="c-r">>= 0 Ahead schedule (good)</span>
</li>
<li class="bullet-item ">$CPI = {EV \over AC}$<span class="c-r">>= 1 Under budget (good)</span>
</li>
<li class="bullet-item ">$SPI = {EV \over PV}$ <span class="c-r">>= 1 Ahead of schedule (good)</span>
</li>
<li class="bullet-item ">$TCPI = { BAC - EV \over BAC - AC}$<span class="c-r"><= 1 is good</span>
</li>
<li class="d-m"></li>
<li class="bullet-item ">$EAC = {BAC \over CPI}$ <span class="c-r">no variances</span>
</li>
<li class="bullet-item ">$EAC = AC + ETC$ <span class="c-r">with variances</span>
</li>
<li class="bullet-item ">$EAC = AC + (BAC - EV)$ <span class="c-r">typical</span>
</li>
<li class="bullet-item ">$EAC = AC + {BAC - EV \over CPI}$ <span class="c-r">atypical</span>
</li>
<li class="d-m"></li>
<li class="bullet-item ">$ETC = EAC - AC$</li>
<li class="bullet-item ">$VAC = BAC - EAC$</li>
<li class="d-m"></li>
<li class="bullet-item ">$CPI^C = {EV^C \over AC^C}$</li>
<li class="bullet-item ">$PV = {FV \over (1+r)^n}$</li>
<li class="bullet-item ">$Percent\ complete = { EV \over BAC } * 100$</li>
<li class="notes">
<table>
<tbody>
<tr><td class="acronym">C</td><td>Cumulative</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="row" style="page-break-before:always;">
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_hv">
<li class="title">Hard Values </li>
<li class="bullet-item ">1 sigma = 68.26%</li>
<li class="bullet-item ">2 sigma = 95.46%</li>
<li class="bullet-item ">3 sigma = 99.73%</li>
<li class="bullet-item ">6 sigma = 99.99%</li>
<li class="d-m"></li>
<li class="bullet-item ">Control Limits = 3 sigma from mean</li>
<li class="bullet-item ">Control Specification = Defined by customer</li>
<li class="bullet-item ">Rought Order of Magnitude (ROM) = -25% to + 75%</li>
<li class="bullet-item ">Preliminary (Budget) estimate = -15% to + 50%</li>
<li class="bullet-item ">Definitive estimate = -5% to + 10%</li>
<li class="bullet-item ">Final estimate = 0%</li>
<li class="d-m"></li>
<li class="bullet-item ">Float on the critical path = 0 days</li>
<li class="bullet-item ">Pareto Diagram = 80/20</li>
<li class="d-m"></li>
<li class="bullet-item ">Crashing a project = Crash least expensive tasks on critical path</li>
<li class="bullet-item last">Time a Project Manager spends communication = 90%</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_commun">
<li class="title">Communications</li>
<li class="bullet-item ">$$Communication\ Channels = n * {n - 1 \over 2}$$</li>
<li class="notes">
<table>
<tbody>
<tr><td class="acronym">n</td><td>number members in the team (include project manager)</td></tr>
<!-- <tr><td class="acronym">7%</td><td>of communication message is contained in words</td></tr>
<tr><td class="acronym">38%</td><td>in vocal pitch</td></tr>
<tr><td class="acronym">55%</td><td>in body language</td></tr> -->
</tbody>
</table>
</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_network">
<li class="title">Network Diagram </li>
<li class="bullet-item ">Active Duration = EF - ES + 1</li>
<li class="bullet-item ">Active Duration = LF - LS + 1</li>
<li class="bullet-item ">Total Float = LS - ES <span class="c-r">0 for Critical Path</span></li>
<li class="bullet-item ">Total Float = LF - EF<span class="c-r">0 for Critical Path</span></li>
<li class="bullet-item ">Free Float (FF) = ES of following - ES of present - DUR of Present</li>
<li class="d-m"></li>
<li class="bullet-item ">EF = ES + Duration - 1</li>
<li class="bullet-item ">LF = LS + Duration - 1</li>
<li class="d-m"></li>
<li class="bullet-item ">ES = EF of Predecessor + 1</li>
<li class="bullet-item ">LS = LF - Duration + 1</li>
<li class="notes last">
<table>
<tbody>
<tr><td class="acronym">EF</td><td>Early Finish</td></tr>
<tr><td class="acronym">ES</td><td>Early Start</td></tr>
<tr><td class="acronym">LF</td><td>Late Finish</td></tr>
<tr><td class="acronym">LS</td><td>Late Start</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_pta">
<li class="title">Point of Total Assumption (PTA)</li>
<li class="bullet-item ">$$PTA = {CP - TP \over BSR} + TC$$ <div style="font-style:italic;font-size:0.7rem;text-align:center;width:100%;">Only applies to Fixed Price incentive fee contracts</div></li>
<li class="notes">
<table>
<tbody>
<tr><td class="acronym">CP</td><td>Ceiling Price</td></tr>
<tr><td class="acronym">TP</td><td>Target Price</td></tr>
<tr><td class="acronym">BSR</td><td>Buyers Share Ratio</td></tr>
<tr><td class="acronym">TC</td><td>Target Cost</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_pd">
<li class="title">Probability distribution </li>
<li class="bullet-item ">$$Normal\ (PERT\ /\ EAD) ={P + 4M + O \over 6}$$</li>
<li class="bullet-item ">$$Triangular\ Deviation = {P + M + O \over 3}$$</li>
<li class="bullet-item ">$$Standart\ Deviation = {P + O \over 6}$$</li>
<li class="bullet-item ">$$Variance\ of\ activity = ({P - O \over 6})^2$$</li>
<li class="notes">
<table>
<tbody>
<tr><td class="acronym">EAD</td><td>Expected Activity Duration</td></tr>
<tr><td class="acronym">PERT</td><td>Program Evaluation and Review Technique</td></tr>
<tr><td class="acronym">P</td><td>Pessimistic Value</td></tr>
<tr><td class="acronym">M</td><td>Most Probable value</td></tr>
<tr><td class="acronym">O</td><td>Optimistic Value</td></tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--<div style="text-align:center;"><img src="images/hierarchy_of_needs.png" width="200px"></div>-->
<div class="row" style="page-break-before:always;">
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_motivational_theories">
<li class="title">Motivational theories</li>
<li class="bullet-item ">Maslow’s hierarchy of needs <br/>
Self-actualization: morality, creativity, spontaneity, problem solving, lack of prejudice, acceptance of facts <br/>
Esteem:self-esteem, confidence, achievement, respect of others, respect by others.<br/>
Love & Belonging: friendship, family, sexual intimacy<br/>
SAFETY: body, employment, resources, morality, the family, health, property<br/>
Physiological Needs:breathing, food, water, sex, sleep, homeostasis, excretion
</li>
<li class="bullet-item ">McGregor Theory X, Y; Z (assurance of permanent job position)</li>
<li class="bullet-item ">McClelland’s Need Theory<div style="text-align:center;"><img src="images/needs-illustration.png" width="200px"></div></li>
<li class="bullet-item ">Victor Vroom Expectancy theory<div style="text-align:center;"><img src="images/Expectancy theory.png" width="200px"></div></li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_conflicts_reasons">
<li class="title">7 reasons of conflicts on projects</li>
<li class="bullet-item ">Schedule</li>
<li class="bullet-item ">Project priorities</li>
<li class="bullet-item ">Human resources</li>
<li class="bullet-item ">Technical opinions and performance trade-offs</li>
<li class="bullet-item ">Administrative procedures</li>
<li class="bullet-item ">Personality conflict</li>
<li class="bullet-item ">Cost and budget</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_coflict_management_style">
<li class="title">Conflict management style</li>
<li class="bullet-item ">Confronting / Problem-solving<span class="c-r"></span></li>
<li class="bullet-item ">Collaborating<span class="c-r">win-win</span></li>
<li class="bullet-item ">Compromising<span class="c-r">lose-lose</span></li>
<li class="bullet-item ">Smoothing / Accommodating<span class="c-r">lose/win</span></li>
<li class="bullet-item ">Forcing<span class="c-r">win-lose</span></li>
<li class="bullet-item ">Withdrawal / Avoiding<span class="c-r">no winners/no losers</span></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row" style="page-break-before:always;">
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_qm_ct">
<li class="title">Quality Mgmt and Control tools</li>
<li class="bullet-item ">Network diagram</li>
<li class="bullet-item ">PDPC</li>
<li class="bullet-item ">Matrix diagram</li>
<li class="bullet-item ">Affinity diagram</li>
<li class="bullet-item ">Prioritization Metrics</li>
<li class="bullet-item ">Interrelationship digraphs</li>
<li class="bullet-item ">Tree diagram</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_quality_tools">
<li class="title">Common Quality Tools</li>
<li class="bullet-item ">Check sheet</li>
<li class="bullet-item ">Control chart</li>
<li class="bullet-item ">Cause-and-effect diagram</li>
<li class="bullet-item ">Histogram</li>
<li class="bullet-item ">Flow chart</li>
<li class="bullet-item ">Pareto chart</li>
<li class="bullet-item ">Tree diagram</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_common_inputs">
<li class="title">Common Inputs</li>
<li class="bullet-item ">Enterprise Environment Factors</li>
<li class="bullet-item ">Organizations Process Assets</li>
<li class="bullet-item ">Project Documents</li>
<li class="bullet-item ">Project Management Plan</li>
<li class="bullet-item ">Project Charter</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_common_outputs">
<li class="title">Common Outputs</li>
<li class="bullet-item ">Work Perfomance Data</li>
<li class="bullet-item ">Work Performance Information</li>
<li class="bullet-item ">Work Perfomance Report</li>
<li class="bullet-item ">Change Request</li>
<li class="bullet-item ">Updates</li>
<li class="bullet-item ">Deliverable</li>
<li class="bullet-item ">Issue Log</li>
</ul>
</div>
</div>
</div>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-12 cheat_sheet_b">
<ul class="cheat_sheet" id="pmp_common_tools_techniques">
<li class="title">Common Tools & Techniques</li>
<li class="bullet-item ">Expert Judgement</li>
<li class="bullet-item ">Meetings</li>
<li class="bullet-item ">PM Info System (PMIS)</li>
<li class="bullet-item ">Analytical Techniques</li>
<li class="bullet-item ">Facilitation Techniques</li>
<li class="bullet-item ">Group Decision-Macking Techniques</li>
</ul>
</div>
</div>
</div>
</div>
<div class="row footer hidden-print">
<div class="col-xs-12 cheat_sheet_b ">
Formulas and Terms for PMP Exam. Based on PMI PMBOK 6. <a href=https://github.com/MaxLazar/pmp-cheet-sheets>GitHub Source</a>
</div>
</div>
</div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-142853951-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-142853951-2');
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/colorPicker.min.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}, "HTML-CSS": { webFont: "Gyre-Termes" }, styles: {} });
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML-full"></script>
<script type="text/javascript">
$( document ).ready(function() {
$(".cheat_sheet").each(function(e) {
var $_color = localStorage.getItem( $(this).attr("id"));
$(this).data("color", ($_color) ? $_color : "#0079BD");
$(this).find('.title:first').append('<a class="cp-background hidden-print" href="#"><i class="fa fa-gear"></i></a>');
});
$(".cp-background").colorPicker({
colors: [
"#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#0079BD", "#2196f3","#03a9f4",
"#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107",
"#ff9800","#ff5722","#795548","#9e9e9e","#607d8b","#000000","#ffffff"
],
onSelect: function(ui, color){
var $_ul = ui.parents("ul:first");
$_ul.data("color", color);
localStorage.setItem($_ul.attr("id"), color);
makeup($_ul);
}
});
$(".cheat_sheet").each(function(e) {
makeup($(this));
});
function makeup (obj) {
var $_color = obj.data('color');
var $_id = obj.attr('id');
var $_zebra_bg = increase_brightness($_color, '83');
var $_zebra_text = getContrastYIQ($_zebra_bg);
var $_text_color = getContrastYIQ($_color);
obj.find(".title").css("background-color", $_color).css("color", $_text_color);
obj.find(".bullet-item:odd").css("background-color", $_zebra_bg);
//.css("color", $_zebra_text);
obj.find(".d-m").css("border-top", "2px solid " + $_color);
obj.find(".notes").css("border-top", "3px solid " + $_color);
obj.find(".notes").css("background-color", $_zebra_bg);
obj.css("border-bottom", "3px solid " + $_color);
$("[data-link='" + $_id+ "']").css("border-left", "2px solid " + $_color);
}
function increase_brightness(hex, percent){
// strip the leading # if it's there
hex = hex.replace(/^\s*#|\s*$/g, '');
// convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`
if(hex.length == 3){
hex = hex.replace(/(.)/g, '$1$1');
}
var r = parseInt(hex.substr(0, 2), 16),
g = parseInt(hex.substr(2, 2), 16),
b = parseInt(hex.substr(4, 2), 16);
return '#' +
((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) +
((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) +
((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1);
}
function getContrastYIQ(hex){
// strip the leading # if it's there
hex = hex.replace(/^\s*#|\s*$/g, '');
// convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`
if(hex.length == 3){
hex = hex.replace(/(.)/g, '$1$1');
}
var r = parseInt(hex.substr(0, 2), 16),
g = parseInt(hex.substr(2, 2), 16),
b = parseInt(hex.substr(4, 2), 16);
var yiq = ((r*299)+(g*587)+(b*114))/1000;
return (yiq >= 128) ? 'black' : 'white';
}
});
</script>
</body>
</html>