My (@pongstr) opinion about shorthand coding techniques
Shorthand code is not really a replacement for normal coding but it is very handy and useful in some cases. There are tons of opinions and debates around this but, again it all comes down what is necessary for your codebase and using it responsibly.
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
int64_t ipow(int64_t base, uint8_t exp) { | |
static const uint8_t highest_bit_set[] = { | |
0, 1, 2, 2, 3, 3, 3, 3, | |
4, 4, 4, 4, 4, 4, 4, 4, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 255, // anything past 63 is a guaranteed overflow with base > 1 |
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
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf
The form @identifierName
is a symbol literal. Within any single module or script, two identitical symbol literals refer to the same symbol. Two identical symbol literals in separate modules or scripts refer to different symbols. A symbol literal may appear as a propery name or as a primary expression.
When a symbol literal appears as a primary expression, it is shorthand for this.@identifierName
.
When a symbol literal appears as a property name, the corresponding symbol is used as the property key during evaluation.
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/bash | |
yarn cache clean | |
npm cache clean --force | |
sudo rm -rfv /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} | |
sudo rm -rfv ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.yarnrc ~/.node_repl_history | |
sudo rm -rfv /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp | |
sudo rm -rfv /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm* | |
sudo rm -rfv /usr/local/include/node /usr/local/include/node_modules | |
sudo rm -rfv /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d | |
sudo rm -rfv /opt/local/include/node /opt/local/bin/node /opt/local/lib/node |
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
class CSSStyleRecord { | |
constructor( | |
/** @type {{ target: Element, propertyName: string, oldValue: string, newValue: string }} */ | |
init | |
) { | |
Object.assign(this, init) | |
} | |
} | |
class CSSStyleObserver { |
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
/* | |
Made by Elly Loel - https://ellyloel.com/ | |
With inspiration from: | |
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/ | |
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/ | |
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE | |
Notes: | |
- `:where()` is used to lower specificity for easy overriding. | |
*/ |