testing list
- top
- in
- in
- top
- in
- in
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) |
#!/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() { |
# 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; |
// You'll want to change any place with a query selector to match your document. Otherwise this should be work for drag and drop | |
// I also am working with a massive spaghetti code mess, hence the global window funciton and the timeouts | |
// window.makeManagerDashSearch() should be called any time after the table is loaded (or even initiated as it refreshes itself | |
// also the final timeout with hiding the original search could probably be better accomplished with css | |
function debounce(func, wait, immediate) { | |
var timeout, wait = wait || 1000; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { |