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 obj = { "foo": "bar" }; | |
const p = "foo"; | |
const { [p]: val } = obj; | |
console.log(val); | |
> "bar" | |
// Real world | |
const { [f]: param = false } = getContextParams(CONTEXT); |
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
update-using = "!f(){ CUR_BRANCH=$(git rev-parse --abbrev-ref HEAD); git checkout "$1" && git pull && git push --no-verify origin "$1":"$1" && git checkout $CUR_BRANCH && git rebase "$1"; }; f" | |
# 1) Grabs the name of the branch you're on | |
# 2) Checks out the REL branch you specified | |
# 3) Updates the REL branch from upstream | |
# 4) Hydrates the REL branch on origin | |
# 5) Checks out your feature branch again [from step 1] | |
# 6) Begins rebasing REL onto your feature branch | |
# Set upstream branch | |
# git branch --set-upstream-to upstream/REL_ENUDDEN |
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
/* eslint-disable import/prefer-default-export */ | |
const queryArray = arr => arr.map((v) => { | |
const a = v.split('='); // Split by the kvp separator (=) | |
return { | |
name: a.shift(), // Grab text before the first equal sign (the key) | |
value: a.join('=') // Grab the value (everything after the first equals) | |
}; | |
}); |
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
/* eslint-disable import/prefer-default-export */ | |
import { initialStates } from '../reducers'; | |
const defaultPropDef = { | |
value: null, | |
writable: false, | |
configurable: true, | |
enumerable: true | |
}; |
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
#!/bin/sh | |
yarn run test-eslint | |
RESULT=$? | |
[ $RESULT -ne 0 ] && exit 1 | |
yarn run test-jest | |
RESULT=$? | |
[ $RESULT -ne 0 ] && exit 1 | |
exit 0 |
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 environment = process.env.NODE_ENV; | |
const stream = fs.createWriteStream("src/services/environment.js"); | |
stream.once('open', function(fd) { | |
stream.write('const env = "'+environment+'"\n'); | |
stream.write('export default env'); | |
stream.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
// http://stackoverflow.com/questions/160550/zip-code-us-postal-code-validation | |
const validZipcode = (zipcode) => zipcode.match(/(^\d{5}$)|(^\d{5}-\d{4}$)/); |
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 numberVerified = (number) => R.isEmpty(number) ? false : number.match(/^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/); | |
const formatPhone = (number) => { | |
// http://stackoverflow.com/questions/6204867/fastest-way-to-remove-hyphens-from-a-string-js | |
const new_number = number.replace(/-/g, ''); | |
return Number(new_number); | |
}; |
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
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 12, | |
// font family with optional fallbacks | |
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', | |
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
cursorColor: 'rgba(248,28,229,0.8)', |
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 maxlimitCheck = () => this.tags.length >= TOTAL_TAGS; | |
const checkScrollLimit = () => { | |
if (!LIMIT_REACHED) { | |
const scrollingTrue = true; | |
PARAMS.start += this.limit; | |
maxlimitCheck() ? LIMIT_REACHED = true : fetchTags(scrollingTrue); | |
} | |
}; |