List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
| // Find if user has set a preference and react to changes | |
| (function initializeTheme(){ | |
| syncBetweenTabs() | |
| listenToOSChanges() | |
| enableTheme( | |
| returnThemeBasedOnLocalStorage() || | |
| returnThemeBasedOnOS() || | |
| returnThemeBasedOnTime(), | |
| false) | |
| }()) |
| Just run the script in your terminal like this... | |
| node script-file.js > log-file.txt | |
| This tells the shell to write the standard output of the command node script-file.js to your log file instead of the default, which is printing it to the console. | |
| This is called redirection and its very powerful. Say you wanted to write all errors to a separate file... | |
| node script-file.js >log-file.txt 2>error-file.txt | |
| Now all console.log are written to log-file.txt and all console.error are written to error.txt |
type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
| Commit type | Emoji |
|---|---|
| Initial commit | 🎉 :tada: |
| Version tag | 🔖 :bookmark: |
| New feature | ✨ :sparkles: |
| Bugfix | 🐛 :bug: |
| # Version key/value should be on his own line | |
| PACKAGE_VERSION=$(cat package.json \ | |
| | grep version \ | |
| | head -1 \ | |
| | awk -F: '{ print $2 }' \ | |
| | sed 's/[",]//g') | |
| echo $PACKAGE_VERSION |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.