Skip to content

Instantly share code, notes, and snippets.

Avatar

Griffin Michl griffinmichl

View GitHub Profile
View ethereum
0x4d9f3f6648b51d4D88ecb037aFAc9839347e1A4C
View toggleReducer.js
const mapDispatchToProps = dispatch => ({
toggleOpen: () => dispatch({
type: 'TOGGLE_TRUE',
meta: {
component: 'ThisComponent',
},
}),
toggleClosed: dispatch({
type: 'TOGGLE_FALSE',
meta: {
View example.js
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 Sep 10, 2016 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)
View README.md
View houserobber3.js
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
View word$.js
function isChar(key) {
return characters.includes(key);
}
function isSpace(key) {
return key === 'space'
}
const keyup$ = Observable.fromEvent(promptInput, 'keyup')
.map(keycode)
View match_key_events.js
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')
View array_index.js
const array = []
array[2] = 2
console.log(array)
//[,,2]
console.log(array.length)
//3
View async_map_example.js
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]
View async_map.js
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