testing list
- top
- in
- in
- top
- in
- in
#!/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() { |
/* | |
Removes the minimum leading whitespace for each line in a pre > code tag. | |
Also optionally escapes html if you include the "nuke-html" class | |
When writing HTML snippets for slides or blogs, it's a pain to have to do this: | |
</div> <!-- original indentation level --> | |
<pre><code class="html"><ul class="demo"> | |
<li>No order here</li> | |
<li>Or here</li> | |
<li>Or here</li> |
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}) |
/* 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) |
# 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=() |
// css.js | |
export default { | |
button: { | |
default: "...", // class names | |
error: "..." | |
} | |
} | |
// MyComponent.js |
body { | |
background: pink; | |
} |
testing list
/* | |
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') |
.wrapped { | |
.occurrence { display: flex; flex-direction: row-reverse !important; min-height: 0 !important; } | |
.occurrence h1 { width: 80%; } | |
.category { display: none; } | |
} | |
@yp-conference-days-tabs-underline-color: @teal; | |
@yp-conference-days-tabs-tab-num-items: 3; | |
@yp-conference-days-content-card-hover-filter: opacity(90%); | |
@yp-conference-days-content-card-comedy-background-color: #94959D; | |
@yp-conference-days-content-card-comedy-text-color: #5C5C5E; |