This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Provider, Client, createClient} from 'urql' | |
import NextApp, {AppContext} from 'next/app' | |
const isServer = typeof window === 'undefined' | |
type Props = { | |
client: Client | |
} | |
const withURQL = (App: typeof NextApp) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sagaMiddleware.run(rootSaga, someArg) | |
function* someSaga(someArg, action) { | |
// ... | |
} | |
function* rootSaga(someArg) { | |
yield takeEvery('SOME_ACTION', someSaga, someArg) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main.js | |
const api = new Api({ accessToken: '...', options: {} }) | |
sagaMiddleware.run(rootSaga, api) | |
// saga.js | |
function* fetchUser(api, action) { | |
try { | |
const user = yield call(api.fetchUser, action.payload.userId); | |
yield put({ type: "USER_FETCH_SUCCEEDED", user: user }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* fetchUser(action) { | |
const api = new Api({ accessToken: '...', options: {} }) | |
try { | |
const user = yield call(api.fetchUser, action.payload.userId); | |
yield put({ type: "USER_FETCH_SUCCEEDED", user: user }); | |
} catch (e) { | |
yield put({ type: "USER_FETCH_FAILED", message: e.message }); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import {StyleSheet, View, ViewProperties, NativeComponent} from 'react-native'; | |
const top = 'env(safe-area-inset-top)'; | |
const right = 'env(safe-area-inset-right)'; | |
const bottom = 'env(safe-area-inset-bottom)'; | |
const left = 'env(safe-area-inset-left)'; | |
const styles = StyleSheet.create({ | |
all: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addFileToFolder(accessToken, fileId, folderId) { | |
const ps = new URLSearchParams({ | |
addParents: folderId | |
}); | |
fetch(`https://www.googleapis.com/drive/v3/files/${fileId}?${ps}`, { | |
method: "PATCH", | |
headers: { | |
Authorization: `Bearer ${accessToken}` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
log_file="/var/log/am_i_up.log" | |
log() { | |
echo "$(date) $1" >> $log_file | |
} | |
if ping -c 1 8.8.8.8 > /dev/null 2>&1; then | |
log "network up" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
li.moments { | |
display: none !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# autocompletion for bash from homebrew | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
# generate a 3-character password section | |
_pw_section() { | |
env LC_CTYPE=C tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('loaded'); | |
alert('oh noes'); |
NewerOlder