I hereby claim:
- I am leebradley on github.
- I am carelessgenie (https://keybase.io/carelessgenie) on keybase.
- I have a public key ASB7XfbJUZwPr4cNn2Twz692kIKxCLCD3dq1o8qgMgMzMgo
To claim this, I am signing this object:
// Based on Gist by DutchGhost | |
// https://gist.github.com/DutchGhost/d8604a3c796479777fe9f5e25d855cfd | |
// Changes: | |
// - Conditional compilation to support either 64 or 32-bit | |
// - Added panic error message | |
// - Added convenience function parse_unwrap | |
// - Added tests | |
#![feature(const_if_match)] | |
#![feature(const_panic)] |
# Useful helper script to ensure you're always double-checking your commands | |
cat <<EndOfMessage >> ~/.git-sure.sh | |
#!/bin/bash | |
read -r -p "Are you sure? [y/n] " response; | |
if [[ "$response" =~ ^(yes|y)$ ]]; then git $@; fi; | |
EndOfMessage | |
chmod +x ~/.git-sure.sh | |
if [ -f ~/.zshrc ]; then |
[ | |
{ | |
"repository": "", | |
"project": "", | |
"login": "", | |
"host": "", | |
"engine": "http", | |
"password": "", | |
"disabled": "remove to enable" | |
}, |
class LoggingButton extends React.Component { | |
// This syntax ensures `this` is bound within handleClick. | |
// Warning: this is *experimental* syntax. | |
handleClick = () => { | |
console.log('this is:', this); | |
} | |
render() { | |
return ( | |
<button onClick={this.handleClick}> |
class App extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
clicked: false | |
}; | |
} | |
onButtonPress() { | |
// Will error out if "this" is not accessible |
I hereby claim:
To claim this, I am signing this object:
function getFontColorFromBackgroundColor (bgColor) { | |
if (!bgColor.match(/#[0-9a-z]{6}/i)) { | |
return 'white'; | |
} | |
const [r, g, b] = [1, 3, 5].map((o) => parseInt(bgColor.slice(o, o + 2), 16)); | |
const greyscale = (0.2125 * r) + (0.7154 * g) + (0.0721 * b); | |
return (greyscale > 127) ? 'black' : 'white'; | |
} |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This Gist was automatically created by Carbide, a free online programming environment.