Skip to content

Instantly share code, notes, and snippets.

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one

Drive Markdown is a strict subset of markdown supporting the following syntax:

name syntax example
bold **bold** bold
heading1 # heading # heading
heading(N<5) ### heading (N=3) ### heading
link [link](https://google.com) link
ordered list ab ab
unordered list ab ab

hi

em

function formDataFrom(obj: { [key: string]: string | number }) {
let formData = new FormData()
for (let key in obj) {
formData.append(key, String(obj[key]))
}
return formData
}
export default formDataFrom
@rt2zz
rt2zz / PrependableListView.js
Created October 22, 2015 05:42
Prependable List View
/**
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
*
* Facebook, Inc. ("Facebook") owns all right, title and interest, including
* all intellectual property and other proprietary rights, in and to the React
* Native CustomComponents software (the "Software"). Subject to your
* compliance with these terms, you are hereby granted a non-exclusive,
* worldwide, royalty-free copyright license to (1) use and copy the Software;
* and (2) reproduce and distribute the Software as part of your own software
* ("Your Software"). Facebook reserves all rights not expressly granted to
let scrollEnhanced = (Inner) => {
return class ScrollEnhanced extends Component {
render () {
return <Inner {...this.props} {...scrollEnhancedStuff} />
}
}
}
// ... later
class A extends Component {
doSomething = async () => {
this.setState({pending: true})
try {
await doSomething()
} catch (err) {
} finally {
this.setState({pending: true})
@rt2zz
rt2zz / excerpt.js
Created November 29, 2015 21:19
disable persistStore in node environment
if (typeof self === 'object') persistStore(store)
return (state: State = defaultState, action: Action) => {
let { _persist, ...rest } = state || {}
let restState: State = rest
switch (action.type) {
case PERSIST:
if (state._persist) {
console.warn(
'redux-persist: unexpected _persist state before PERSIST action is handled. If you are doing hmr or code-splitting this may be a valid use case. Please open a ticket, requires further review.'
)
// time iterator (read: debounce)
if (timeIterator === null) {
timeIterator = setInterval(processNextReducer, debounce)
}
function flush () {
storesToProcess.forEeach(processNextReducer)
}
function processNextReducer () {