mkdir passport-local
npm init
# Use default values for npm init prompts
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
| /** | |
| * Returns a hash code for a string. | |
| * (Compatible to Java's String.hashCode()) | |
| * | |
| * The hash code for a string object is computed as | |
| * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] | |
| * using number arithmetic, where s[i] is the i th character | |
| * of the given string, n is the length of the string, | |
| * and ^ indicates exponentiation. | |
| * (The hash value of the empty string is zero.) |
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
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
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 readline = require('readline') | |
| const blank = '\n'.repeat(process.stdout.rows) | |
| console.log(blank) | |
| readline.cursorTo(process.stdout, 0, 0) | |
| readline.clearScreenDown(process.stdout) |
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 toTitleCase(str) { | |
| return str.replace(/\w\S*/g, function(txt){ | |
| return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
| }); | |
| } | |
| // or in ES6: | |
| var text = "foo bar loo zoo moo"; | |
| const ucfirst = text => text.toLowerCase() |
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
| // test |
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
| history | grep -e "\d\+\s\+git checkout [^-.]\+" | awk '{ print $NF }' | tail -n 10 |
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
| /** | |
| * This is based on https://getbootstrap.com/docs/4.1/utilities/spacing/ | |
| */ | |
| $directioMap: ( | |
| top: t, | |
| right: r, | |
| left: l, | |
| bottom: b | |
| ); |