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
| # Pass the env-vars to MYCOMMAND | |
| eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
| # … or ... | |
| # Export the vars in .env into your shell: | |
| export $(egrep -v '^#' .env | xargs) |
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 zoneMachine = Machine( | |
| { | |
| id: "zoneMachine", | |
| initial: "preparing", | |
| context: { error: undefined, zone: undefined }, | |
| states: { | |
| preparing: { | |
| invoke: { | |
| src: "detectLocationSupport", | |
| id: "detectLocationSupport", |
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
| # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. | |
| export PATH="$PATH:$HOME/.rvm/bin" | |
| function fuzzy_open() { | |
| code $(fd $1) | |
| } |
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 validateEmail(email) { | |
| var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| return re.test(String(email).toLowerCase()); | |
| } | |
| function validatePassword(password) { | |
| return password.length >= 5 && password.length < 60; | |
| } | |
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
| Machine({ | |
| initial: "ready", | |
| context: { | |
| value: "" | |
| }, | |
| states: { | |
| updating: { | |
| entry: "updateInputValue", | |
| on: { | |
| '': [ |
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 statechart2 = { | |
| id: "zoneMachine", | |
| initial: "preparing", | |
| context: { | |
| error: undefined, | |
| zone: undefined | |
| }, | |
| states: { | |
| preparing: { | |
| invoke: { |
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
| npx ytdl --print-url [YTB_URL] | npx open-pip-cli |
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 iframeEl = document.createElement('iframe'); | |
| document.body.appendChild(iframeEl); | |
| console.log(Object.keys(window).filter(key => !(key in iframeEl.contentWindow))); |
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
| # Set upstream automatically on `git push` | |
| `git config --global push.default current` | |
| ## The reference to the last branch is saved into `-` in git. | |
| # Checkout to the previous branch | |
| `git checkout -` | |
| # Merge into the last branch | |
| `git merge -` |
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
| /** | |
| * Takes arguments in the form of --arg-name value and puts them into an object (argMap). | |
| * Argument keys begin with double hyphens and additional hyphens are converted to camelCase. | |
| * | |
| * E.g. `node quick-argument-parser.js --test-arg1 'value1' --test-arg2 'value2'` will create argMap with the value: | |
| * ``` | |
| * { | |
| * testArg1: 'value1', | |
| * testArg2: 'value2' | |
| * } |