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 repl = require('pretty-repl') | |
const options = { | |
prompt: ' ', | |
} | |
repl.start(options) |
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
```shell | |
$ sg run --pattern '<Link $PROPS><a>$CONT</a></Link>' --rewrite '<Link $PROPS>$CONT</Link>' --lang js --update-all | |
``` |
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
code ~/.zshrc | |
# add => "setopt HIST_IGNORE_ALL_DUPS" | |
omz reload | |
cp $HISTFILE ${HISTFILE}.backup | |
awk '!a[$0]++' ${HISTFILE}.backup > $HISTFILE |
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 crypto = require('crypto'); | |
const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { | |
modulusLength: 2048, | |
publicKeyEncoding: { | |
type: 'pkcs1', | |
format: 'pem' | |
}, | |
privateKeyEncoding: { | |
type: 'pkcs8', |
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
aliases: | |
- &restore-yarn-cache | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- &save-yarn-cache | |
paths: | |
- node_modules |
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 normalColor = number => number > 255 ? 255 : number < 0 ? 0 : number | |
const toHEX = color => Number(normalColor(color)).toString(16).toUpperCase() | |
const normalHEX = hex => ((hexi = toHEX(hex)) => hexi.toString().length < 2 ? '0' + hexi : hexi)() | |
const rgb = (r,g,b) => normalHEX(r) + normalHEX(g) + normalHEX(b) | |
Test.assertEquals(rgb(0, 0, 0), '000000') | |
Test.assertEquals(rgb(0, 0, -20), '000000') | |
Test.assertEquals(rgb(300,255,255), 'FFFFFF') | |
Test.assertEquals(rgb(173,255,47), 'ADFF2F') |
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
#!/usr/bin/env node | |
if (process.platform == 'win32') { | |
process.exit(0) | |
} | |
const { spawn } = require('child_process') | |
const packages = ['webpack'] | |
const yarnAdd = ['yarn', 'add', '-D'] |
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
export NPM_TOKEN="00000000-0000-0000-0000-000000000000" | |
# .npmrc | |
package-lock=false | |
//registry.npmjs.org/:_authToken=${NPM_TOKEN} |
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 start = new Date() | |
const hrstart = process.hrtime() | |
const simulateTime = 500 | |
setTimeout(function(argument) { | |
// execution time simulated with setTimeout function | |
const end = new Date() - start | |
const hrend = process.hrtime(hrstart) | |
console.info('Execution time: %dms', end) |
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
<div id="root"></div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.21.1/babel.min.js"></script> | |
<script> | |
Babel.registerPreset("custom-preset", { | |
presets: [ | |
[Babel.availablePresets["es2015"]], | |
], | |
plugins: [ | |
Babel.availablePlugins["syntax-jsx"], | |
[Babel.availablePlugins["transform-react-jsx"], { |
NewerOlder