I hereby claim:
- I am dmi3y on github.
- I am dmi3y (https://keybase.io/dmi3y) on keybase.
- I have a public key ASAtmc2GMZ8OtZQRJZLlVe99TEiNvRTmc3IlhYKp_d8RJwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env node | |
| const sumit = (sum, it) => sum + it | |
| // Christmas is around us! | |
| const christmasPresentsPerDays = (days = 12) => { | |
| const bag = []; | |
| for (let i = 0; i < days; i++) { | |
| bag.push(i + 1 + bag[i - 1] || 1); | |
| } | |
| return bag.reduce(sumit, 0); |
| #!/usr/bin/env node | |
| console.log('Nishtyak!') |
| function padding(num, sep) { | |
| var numarr = num['toString']().split('') | |
| var numarrLen = numarr.length | |
| var out = [] | |
| for (;numarrLen--;) { | |
| var num = numarr[numarrLen] | |
| out.unshift(num) | |
| if (numarr.length !== numarrLen && num % 3 === 0) out.unshift(sep) | |
| } | |
| return out.join('') |
| function sortJsonByKeys (json) { | |
| let out = {} | |
| let keys = Object.keys(json) | |
| keys.sort() | |
| keys.forEach((key) => { | |
| if (typeof json[key] === 'object') { | |
| out[key] = sortJsonByKeys(json[key]) | |
| } else { | |
| out[key] = json[key] | |
| } |
| function mapRomanToArabic (roman) { | |
| switch(roman) { | |
| case 'I': | |
| return 1 | |
| case 'V': | |
| return 5 | |
| case 'X': | |
| return 10 | |
| case 'L': | |
| return 50 |
| function calcFromStr(str) { | |
| var ops = ['*','/','+','-']; | |
| var reg = /(\b\D)/; | |
| var calc = str.split(reg); | |
| function calculator(l, op, r) { | |
| switch( op ) { | |
| case '*': | |
| return l*r; |
| // http://jsbin.com/mapena/edit?js,console | |
| // http://stackoverflow.com/questions/1885557/simplest-code-for-array-intersection-in-javascript | |
| function findIntersctions(a, b) { | |
| var ai = 0; | |
| var bi = 0; | |
| var out = []; | |
| while( ai < a.length && bi < b.length ) { | |
| if( a[ai] > b[bi] ) { |
| Function.method('inherits', function (parent) { | |
| this.prototype = new parent(); | |
| var d = {}, | |
| p = this.prototype; | |
| this.prototype.constructor = parent; | |
| this.method('uber', function uber(name) { | |
| if (!(name in d)) { | |
| d[name] = 0; | |
| } | |
| var f, r, t = d[name], v = parent.prototype; |
| function setCountDown(n) { | |
| n = n || 5; | |
| for ( var i = 0; i <= n; i++ ) { | |
| (function() { | |
| var j = n - i; | |
| setTimeout(function() { | |
| console.log(j); | |
| }, 1000 * i); | |
| }()); | |
| } |