- Undesired results from Silver Searcher / Grep etc.
- Automcomplete of CLI commands involving package.json
- Failing to install changes when the version doesn’t change, as is common with git identifiers
- Tendency for enterprise registry URLs to get published accidentally
- Everything that was wrong with shrinkwrap
- Failure to believe in semantic versioning
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
| Object.assign(Reflect.ownKeys(HTMLElement.prototype), Reflect.ownKeys(Element.prototype)) |
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
| p = f => new Proxy(f, Object.create({ store: [], apply(target, thisArg, argumentsList) { | |
| this.store.push(...argumentsList); | |
| return this.store.length < target.length ? p(target.bind(thisArg, ...this.store)) : target(...this.store); | |
| }})) |
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
| # Plain Ol' Node | |
| node --max-old-space-size=1024 app.js # increase to 1gb | |
| node --max-old-space-size=2048 app.js # increase to 2gb | |
| node --max-old-space-size=3072 app.js # increase to 3gb | |
| node --max-old-space-size=4096 app.js # increase to 4gb | |
| node --max-old-space-size=5120 app.js # increase to 5gb | |
| node --max-old-space-size=6144 app.js # increase to 6gb | |
| # For pm2 | |
| pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb |
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
| > ø`The shell is ${'SHELL'}`(process.env) | |
| > ø`The editor is ${'EDITOR'}`(process.env) | |
| > let ø = (strings, ...fieldNamesOrSymbols) => object => { console.info(strings, fieldNamesOrSymbols, object, typeof object); return strings.reduce((result, string, position) => `${result}${string}${fieldNamesOrSymbols[position]?object[fieldNamesOrSymbols[position]]:''}`, '') } | |
| > Ω`The year is ${'getFullYear'}`(d) | |
| > Ω = (strings, ...fieldNamesOrSymbols) => object => { console.info(strings, fieldNamesOrSymbols, object, typeof object); return strings.reduce((result, string, position) => `${result}${string}${fieldNamesOrSymbols[position]?object[fieldNamesOrSymbols[position]]():''}`, '') } |
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
| class PlainEnglishLetter extends String { | |
| constructor (characterString) { | |
| super() | |
| const cc = characterString.charCodeAt(0) | |
| if (characterString.length === 1 && (cc >= 65 && cc <= 122) && !(cc > 90 && cc < 97)) { | |
| this.cc = cc | |
| this.characterString = characterString | |
| const handler = { | |
| get: function(target, name) { |
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
| // CP.execSync('zsh -xl') <- example of getting all environment variable sets in the current ZSH load. Seems to not work for the subshells it's based on | |
| // Determine if $SHELL (convention used by Bash & ZSH) is a path to ZSH & add a $PATH with the CWD NPM bin path prepended to the current user's zshrc file | |
| !!~CP.execSync('echo $SHELL').toString().match(/(?!(^\/bin\/))([a-z]+)(?=(\n$))/g) || CP.execSync('echo \'export PATH=./node_modules/.bin:$PATH\' >> ~/.zshrc') |
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
| Object.keys(scripts).forEach(n => { const script = scripts[n]; n = n.replace(/(:| |_)/g, '-');const path=`${bin}${n}`;const exists = FS.existsSync(path); FS.writeFileSync(path, `#!/usr/bin/env sh\n\n npx -c "${script}"`, { flag: "ax+"});console.info(`[unleash:usain] ${n} now available at ${path}`); }) |
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 http = require('http'), | |
| httpProxy = require('http-proxy'), | |
| HttpProxyRules = require('http-proxy-rules'); | |
| let proxyConfiguration = { | |
| rules: { | |
| '.*/test': 'http://localhost:8080/cool', // Rule (1) | |
| '.*/test2/': 'http://localhost:8080/cool2/' // Rule (2) | |
| }, | |
| default: 'http://localhost:8080' // default target |