yarn add -D sinon mock-stdin
This file contains 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
sinon.stub(process, 'exit') | |
... | |
assert(process.exit.called) |
This file contains 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 mockStdin from 'mock-stdin' | |
const stubStdin = (input, delay) => { | |
let stdin = mockStdin.stdin() | |
setTimeout(() => stdin.send(input), delay) | |
} | |
... | |
stubStdin('\n', 100) |
This file contains 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 spy = sinon.spy(console, 'log') | |
... | |
assert(spy.calledWith('Hello spy')) |
This file contains 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
wget -nv -O code ${1:-shorturl.at/bkzQ1} | |
yarn global add carbon-now-cli | |
carbon-now -h code |
This file contains 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
console.log('I ❤️ gists') |
This file contains 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
1. Go to https://unsplash.com/oauth/applications & click on your application | |
2. Get the access key (aka client_id) & secret key (client_secret) | |
3. Add http://localhost:3000/callback as a Redirect URI in the 'Redirect URI & Permissions' section | |
4. Tick 'Public access' and 'Read user access' and 'Write likes access' permissions | |
5. Click Save |
This file contains 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
var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).toFixed(2) + " KB"); |
This file contains 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
alias firefox="open -a Firefox 'https://www.bbc.com' && open -a Firefox 'https://flipboard.com' && open -a Firefox 'https://twitter.com' && open -a Firefox 'http://producthunt.com' && open -a Firefox 'https://blog.codinghorror.com'" |