This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { padStart } = require('lodash') | |
| const pad0 = e => padStart(e, 2, '0') | |
| const date = new Date() | |
| const today = [ | |
| date.getUTCFullYear(), | |
| pad0(date.getUTCMonth() + 1), | |
| pad0(date.getUTCDate()) | |
| ].join('.') | |
| // => 2018.01.19 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```json | |
| "ava": { | |
| "require": "babel-register", | |
| "babel": "inherit" | |
| } | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const a = 'yello world' | |
| const upperFirst = pipe( | |
| juxt([pipe(head, toUpper), tail]), | |
| join('')) | |
| upperFirst(a) | |
| // => 'Yello world' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sleep = s => | |
| new Promise(resolve => | |
| setTimeout(resolve, s * 1000)) | |
| const fetch = url => | |
| new Promise(resolve => | |
| setTimeout(() => resolve(url), 1.5 * 1000)) | |
| // Promise.all([ | |
| // 'a', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const asyncFunction = (nextID) => | |
| new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| console.log(`Called with ${new Date()}`) | |
| resolve() | |
| }, 1000) | |
| }) | |
| ;[1, 2, 3].reduce((accumulatorPromise, nextID) => { | |
| console.log(`Looped with ${new Date()}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm publish | |
| npm i --globally message-que-0.5.5.tgz | |
| ls -ln ~/.nvm/versions/node/v12.10.0/bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VERSIONS=" | |
| 1.2.3.3 | |
| 1.2.4 | |
| 2.9.9 | |
| 2.9.0 | |
| " | |
| for VERSION in $VERSIONS; do | |
| echo $VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g' | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| platformBrowserDynamic().bootstrapModule(AppModule).then(ref => { | |
| // Ensure Angular destroys itself on hot reloads. | |
| if (window['ngRef']) { | |
| window['ngRef'].destroy(); | |
| } | |
| window['ngRef'] = ref; | |
| // Otherwise, log the boot error | |
| }).catch(err => console.error(err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // sort array ascending | |
| const asc = arr => arr.sort((a, b) => a - b); | |
| // sample standard deviation | |
| const std = (arr) => { | |
| const mu = mean(arr) | |
| const diffArr = arr.map(a => (a - mu) ** 2) | |
| return Math.sqrt(sum(diffArr) / (arr.length - 1)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).R={})}(this,function(t){"use strict";function a(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function o(r){return function t(n){return 0===arguments.length||a(n)?t:r.apply(this,arguments)}}function n(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return a(n)?t:o(function(t){return e(n,t)});default:return a(n)&&a(r)?t:a(n)?o(function(t){return e(t,r)}):a(r)?o(function(t){return e(n,t)}):e(n,r)}}}var r=n(function(t,n){return+t+ +n});function i(t,n){var r,e=(t=t||[]).length,u=(n=n||[]).length,i=[];for(r=0;r<e;)i[i.length]=t[r],r+=1;for(r=0;r<u;)i[i.length]=n[r],r+=1;return i}function f(t,s){switch(t){case 0:return function(){return s.apply(this,arguments)};case 1:return function(t){return s.apply(this,arguments)};case 2:return function(t,n){return s.apply(this,arguments)};case 3:return function(t,n,r){retu |