Skip to content

Instantly share code, notes, and snippets.

View griffinmichl's full-sized avatar

Griffin Michl griffinmichl

View GitHub Profile
function queue(concurrency = 1) {
let running = 0
const taskQueue = []
const runTask = (task) => {
running++
task(() => {
running--
if (taskQueue.length > 0) {
runTask(taskQueue.shift())
function debounce(func, wait) {
let timeout
return function(...args) {
const context = this
clearTimeout(timeout)
timeout = setTimeout(() => func.apply(context, args), wait)
}
}
function sayHello() {
0x4d9f3f6648b51d4D88ecb037aFAc9839347e1A4C
const mapDispatchToProps = dispatch => ({
toggleOpen: () => dispatch({
type: 'TOGGLE_TRUE',
meta: {
component: 'ThisComponent',
},
}),
toggleClosed: dispatch({
type: 'TOGGLE_FALSE',
meta: {
const removeCreativeEpic = (action$) =>
action$.ofType('REMOVE_CREATIVE')
.groupBy(action => action.payload.campaignId)
.mergeMap(
groupedAction$ => groupedAction$
.concatMap(action => makeAjax(action)
.map(response => ({
type: 'REMOVE_CREATIVE_SUCCESS',
payload: response,
})
@griffinmichl
griffinmichl / README.md
Created September 10, 2016 20:26 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)
function rob(root) {
const memo = new Map()
function rob_helper(node) {
if (node === null) return 0
if (memo.get(node)) {
return memo.get(node)
}
let keep = node.val
function sayHello(x) {
console.log(x)
}
const debouncedSayHello = debounce(sayHello, 100)
debouncedSayHello(1)
debouncedSayHello(2)
debouncedSayHello(3)
setTimeout(() => debouncedSayHello(4), 200)
function isChar(key) {
return characters.includes(key);
}
function isSpace(key) {
return key === 'space'
}
const keyup$ = Observable.fromEvent(promptInput, 'keyup')
.map(keycode)
function getCharInRange(first, last) {
const charactersInRange = R.compose(R.map(keycode), R.range)
return charactersInRange(first, last)
}
const keystroke$ = getCharInRange(65, 91).reduce((acc$, char) =>
acc$.merge(Observable.zip(
DOM
.select(':root')
.events('keydown')