├── .gitignore ├── views ├── error.hjs ├── result.hjs ├── layout.hjs └── index.hjs ├── bower.json ├── package.json ├── app.js ├── bin └── www ├── routes └── index.js └── public └── stylesheets └── style.css /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bower_components 3 | -------------------------------------------------------------------------------- /views/error.hjs: -------------------------------------------------------------------------------- 1 |
{{ error.stack }}
4 |
--------------------------------------------------------------------------------
/views/result.hjs:
--------------------------------------------------------------------------------
1 |
2 | {{< layout }}{{$ content }}
3 |
4 | We are sorry.
', 11 | 'small': 'Your data is small.But it can still be useful!
', 13 | 'medium': 'Your data is not big.You can probably analyze it on a single computer.
', 15 | 'biggish': 'Your data is biggish.You can still rent a machine in the ' + 17 | 'cloud that can just load all of it at once.
', 18 | 'big': 'Congratulations, your data is big.But there is still a good ' + 20 | 'chance that you can analyze it on a regular computer. Often you ' + 21 | 'can simply drop irrelevant variables. Or try sampling, ' + 22 | 'you can fit good predictive models with just ' + 23 | '1% of the data! Explore these options before buying a ' + 24 | 'huge computer cluster and hiring a team of 10 to manage it.
', 25 | 'huge': 'You are kidding, right?', 26 | 'unknown': 'Can you please just behave yourself and use the form to select the unit? Thanks much!', 27 | 'nodata': 'So you have no data? That\'s OK, you can still live a happy life.' 28 | }; 29 | 30 | router.get("/result", function(req, res, next) { 31 | var size = req.query.size || "0"; 32 | var unit = req.query.unit; 33 | var result = classify_size(size, unit); 34 | res.render('result', { 'title': 'Tadaaaaam', 35 | 'size': size, 36 | 'unit': unit, 37 | 'result': results[result] }); 38 | }); 39 | 40 | // We just calculate in TB 41 | function classify_size(size, unit) { 42 | if (unit == 'MB') { 43 | size = size / 1000 / 1000; 44 | } else if (unit == 'GB') { 45 | size = size / 1000; 46 | } else if (unit == 'PB') { 47 | size = size * 1000; 48 | } else if (unit == 'EB') { 49 | size = size * 1000 * 1000; 50 | } else if (unit == 'ZB') { 51 | size = size * 1000 * 1000 * 1000; 52 | } else if (unit == 'YB') { 53 | size = size * 1000 * 1000 * 1000 * 1000; 54 | } else if (unit == 'TB') { 55 | // do nothing, in TB 56 | } else { 57 | return 'unknown'; 58 | } 59 | 60 | // Unit is TB now 61 | if (size == 0) { 62 | return 'nodata'; 63 | } else if (size < .1) { 64 | return 'tiny'; 65 | } else if (size < .5) { 66 | return 'small'; 67 | } else if (size < 1) { 68 | return 'medium'; 69 | } else if (size < 2) { 70 | return 'biggish'; 71 | } else if (size < 1000 * 1000) { 72 | // 1000 PB (eBay has a 90PB data warehouse....) 73 | return 'big'; 74 | } else { 75 | return 'huge'; 76 | } 77 | } 78 | 79 | module.exports = router; 80 | -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | 2 | /* em pure-hidden values */ 3 | 4 | /* pure-hidden-xs */ 5 | @media screen and (max-width:35.438em) { 6 | .pure-visible-sm{display:none} 7 | .pure-visible-md{display:none} 8 | .pure-visible-lg{display:none} 9 | .pure-visible-xl{display:none} 10 | .pure-hidden-xs{display:none} 11 | body { font-size: 150%; } 12 | } 13 | /* pure-hidden-sm */ 14 | @media screen and (min-width:35.5em) and (max-width:47.938em) { 15 | .pure-visible-xs{display:none} 16 | .pure-visible-md{display:none} 17 | .pure-visible-lg{display:none} 18 | .pure-visible-xl{display:none} 19 | .pure-hidden-sm{display:none} 20 | body { font-size: 150%; } 21 | } 22 | /* pure-hidden-md */ 23 | @media screen and (min-width:48em) and (max-width:63.938em) { 24 | .pure-visible-xs{display:none} 25 | .pure-visible-sm{display:none} 26 | .pure-visible-lg{display:none} 27 | .pure-visible-xl{display:none} 28 | .pure-hidden-md{display:none} 29 | body { font-size: 200%; } 30 | } 31 | /* pure-hidden-lg */ 32 | @media screen and (min-width:64em) and (max-width:79.938em) { 33 | .pure-visible-xs{display:none} 34 | .pure-visible-sm{display:none} 35 | .pure-visible-md{display:none} 36 | .pure-visible-xl{display:none} 37 | .pure-hidden-lg{display:none} 38 | body { font-size: 300%; } 39 | } 40 | /* pure-hidden-xl */ 41 | @media screen and (min-width:80em) { 42 | .pure-visible-xs{display:none} 43 | .pure-visible-sm{display:none} 44 | .pure-visible-md{display:none} 45 | .pure-visible-lg{display:none} 46 | .pure-hidden-xl{display:none} 47 | body { font-size: 300%; } 48 | } 49 | 50 | /* 51 | When setting the primary font stack, apply it to the Pure grid units along 52 | with `html`, `button`, `input`, `select`, and `textarea`. Pure Grids use 53 | specific font stacks to ensure the greatest OS/browser compatibility. 54 | */ 55 | html, button, input, select, textarea, 56 | .pure-g [class *= "pure-u"] { 57 | /* Set your content font stack here: */ 58 | font-family: 'Exo 2', sans-serif; 59 | } 60 | 61 | .button-submit, 62 | .button-white { 63 | text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); 64 | } 65 | 66 | .button-submit { 67 | color: white; 68 | background: rgb(66, 184, 221); 69 | } 70 | 71 | .huge-form { 72 | margin-top: 100px; 73 | text-align: center; 74 | } 75 | 76 | .small-form { 77 | margin-top: 50px; 78 | margin-left: 10px; 79 | margin-right: 10px; 80 | text-align: center; 81 | } 82 | 83 | .small-form button { 84 | margin-top: 10px; 85 | } 86 | 87 | .right-input { 88 | text-align: right; 89 | } 90 | 91 | html { 92 | position: relative; 93 | min-height: 100%; 94 | } 95 | 96 | body { 97 | margin: 0 0 40px; /* bottom = footer height */ 98 | } 99 | 100 | footer { 101 | position: absolute; 102 | left: 0; 103 | bottom: 0; 104 | height: 30px; 105 | width: 100%; 106 | text-align: center; 107 | margin-bottom: 10px; 108 | font-size: 50%; 109 | } 110 | 111 | .result-size { 112 | margin-top: 80px; 113 | text-align: center; 114 | } 115 | 116 | .result { 117 | margin-top: 40px; 118 | text-align: center; 119 | } 120 | 121 | .result-result { 122 | color: red; 123 | font-weight: bold; 124 | } 125 | 126 | p.note { 127 | color: #555; 128 | font-size: 75%; 129 | } 130 | --------------------------------------------------------------------------------