Skip to content

Instantly share code, notes, and snippets.

View griffinmichl's full-sized avatar

Griffin Michl griffinmichl

View GitHub Profile
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 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')
const array = []
array[2] = 2
console.log(array)
//[,,2]
console.log(array.length)
//3
const iteratee = (elem, cb) => setTimeout(() => cb(null, elem*2), 100)
map([1,2,3], iteratee, (err, result) => {
if (err) {
console.log(err)
} else {
console.log(result)
}
})
// [2, 4, 6]
function map(collection, iteratee, callback) {
let running = collection.length
const results = []
collection.forEach((value, index) =>
iteratee(value, (err, data) => {
if (err) {
callback(err)
return
}
results[index] = data