testing list
- top
- in
- in
- top
- in
- in
| /* | |
| I wanted to turn my favicon gray on my development site, so I made this gist. | |
| This is really useful for spotting which tab is which. | |
| */ | |
| (() => { | |
| if (window.location.origin.indexOf("localhost") === -1) { return } | |
| const current = document.querySelector('link[rel*="icon"]') | |
| const img = document.createElement("img") | |
| img.onload = () => { | |
| const canvas = document.createElement('canvas') |
testing list
| body { | |
| background: pink; | |
| } |
| // css.js | |
| export default { | |
| button: { | |
| default: "...", // class names | |
| error: "..." | |
| } | |
| } | |
| // MyComponent.js |
| # Put this in .bash_aliases or .bashrc | |
| # USAGE: | |
| # eemacs a.py b.py c.py | |
| # eemacs `grep SomeClass * -rl` | |
| # grep SomeClass * -rl | grep -v migrations | grep models.py > SOME_CLASS | |
| # eemacs `cat SOME_CLASS` | |
| function eemacs { | |
| DNE=() |
| #!/usr/bin/env bash | |
| # This script gives alembic django style migrations | |
| # Revision id is auto-incremented and autogenerate is the default behavior | |
| # Alter this line to point to migrations folder | |
| NEXT_ID=`ls path/to/db/versions/* | grep -P '/\d{4}_.*\.py'|wc -l` | |
| NAME="" | |
| FLAG="--autogenerate" | |
| function usage() { |
| /* solution 1 */ | |
| onSubmit(data) { | |
| Promise.resolve(this.props.submit(data)).then( | |
| (result) => this.setState({ result: result }) | |
| ) | |
| } | |
| /* solution 2 */ | |
| onSubmit(data) { | |
| const result = this.props.submit(data) |
| class HexBoard extends React.Component { | |
| state = {} | |
| onMouseDown = cell => () => { | |
| this.props.select && this.props.select(cell) | |
| this.setState({selected: cell}) | |
| } | |
| onMouseOver = cell => () => { | |
| if (this.props.hover && this.state.hover !== cell) { | |
| this.props.hover(cell) | |
| this.setState({hover: cell}) |