Skip to content

Instantly share code, notes, and snippets.

View brennancheung's full-sized avatar

Brennan Cheung brennancheung

View GitHub Profile
const http = req => console.log(req)
const withAuth = token => next => req => next({ ...req, token })
const withMethod = verb => next => req => next({ ...req, method: verb })
const withUrl = url => next => req => next({ ...req, url })
const compose = (...handlers) => {
const fns = [...handlers].reverse()
return fns.reduce(
(next, fn) => fn(next),
http
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'L9'
Plugin 'int3/vim-extradite'
Plugin 'scrooloose/syntastic'
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'L9'
Plugin 'int3/vim-extradite'
Plugin 'scrooloose/syntastic'
class SearchBar extends React.Component {
state = {
searchTerm
}
onSearchTermChange = (data) => this.setState(...)
handleSearch = () => ...
handleClear = () => ...
let newArr = []
for (let i = 0; i < arr.length; i++) {
let item = arr[i]
newArr.push(fn(item)
}
let newArr = []
for (let i = 0; i < arr.length; i++) {
let item = arr[i]
let newValue = fn(item)
newArr.push(newValue)
}
const newArr = arr.map(fn)
let newArr = arr.reduce(
(accum, item) => { accum.push(fn(item)); return accum },
[]
)
mov [varName], ax
// constants.js
export const SET_FOO = 'SET_FOO'
// actions.js
import { SET_FOO } from './constants'
export const setFoo = foo => ({ type: SET_FOO, payload: foo })