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
| #!/bin/bash | |
| # allow color coding the console output. | |
| # simple, but effective way to getting visual oomph to the screen | |
| red='\033[0;31m' | |
| green='\033[0;32m' | |
| yellow='\033[0;33m' | |
| white='\033[0;37m' | |
| end_color='\033[0;37m' |
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
| # inspired by https://gist.github.com/nicholascloud/5372443 | |
| function npmls() { | |
| npm ls --depth=0 | grep -v "^\/.*" | sed "s/└── //g" | sed "s/├── //g" | |
| } |
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 pbhighlight() { | |
| HTML=`highlight --inline-css -O html --style=tcsoft $@ | hexdump -ve '1/1 "%.2x"'`; | |
| osascript -e "set the clipboard to «data HTML${HTML}»" | |
| } | |
| which can be used as `pbhighlight file.java` to copy highlighted source to your clipboard for pasting. May require installation of "highlight" if that's not included, "brew install highlight" |
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
| /** | |
| * A simple illustration of how to use the npm `limiter` package to create a rate limiting wrapped api call. | |
| */ | |
| const TokenBucket = require('limiter').TokenBucket; | |
| function makeActualApiCall (args) { | |
| console.log(`makeActualApiCall invoked @${new Date()} - in ms: ${Date.now()}`); | |
| } |
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
| v8.8.1 | |
| 5.4.2 | |
| data-check@0.0.0-development /Users/sramam/trial/data-check | |
| ├─┬ @types/chalk@2.2.0 | |
| │ └── chalk@2.3.0 deduped | |
| ├── @types/circular-json@0.4.0 | |
| ├── @types/node@8.0.53 | |
| ├── @types/semver@5.4.0 | |
| ├─┬ ajv@5.3.0 | |
| │ ├── co@4.6.0 |
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 fs = require('fs'); | |
| const dir = '/tmp'; | |
| const now = Date.now(); | |
| const tmp = Date.now(); | |
| const dates = { | |
| _31days: new Date(now - 31 * 24 * 60 * 60 * 1000), | |
| _30days: new Date(now - 30 * 24 * 60 * 60 * 1000), | |
| _29days: new Date(now - 29 * 24 * 60 * 60 * 1000), | |
| _28days: new Date(now - 28 * 24 * 60 * 60 * 1000), |
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
| import * as delay from 'delay'; | |
| (<any>Symbol).asyncIterator = Symbol.asyncIterator || Symbol.for("Symbol.asyncIterator"); | |
| async function* g() { | |
| yield 1; | |
| await delay(100); | |
| yield* [2, 3]; | |
| yield* (async function *() { |
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
| /** | |
| script adapted from https://www.youtube.com/watch?v=pXUsW6VRQak | |
| */ | |
| function myFunction() { | |
| var sheetName = 'Sheet1'; | |
| var formId = '1LnmQRJX0l586EvNeXYNLujO2vqhqB-Grtfe1J5zfFWI'; | |
| var title = 'Form Title here'; | |
| var description = | |
| 'Form description here.' + | |
| 'This should really be moved to a cell in the sheet.' + |
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 pReduce = require('p-reduce'); | |
| const pMap = require('p-map'); | |
| const delay = require('delay'); | |
| // const batches = [['a'], ['b', 'c'], ['d', 'e', 'f', 'g'], ['h'], ['i'], ['j', 'k']]; | |
| const batches = [['a', 'b', 'c', 'd', 'e', 'f', 'g'], ['h'], ['i'], ['j', 'k']]; | |
| const step = 2000; | |
| const max = 5000; |
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 StateMachine = require('javascript-state-machine'); | |
| const Account = StateMachine.factory({ | |
| init: 'open', | |
| transitions: [ | |
| // open state | |
| {name: 'deposit', from: 'open', to: 'open'}, | |
| {name: 'withdraw', from: 'open', to: 'open'}, | |
| {name: 'available', from: 'open', to: 'open'}, |