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
// opens either the file/path passed in as the first argument, or the current directory in Atom | |
atom() { | |
path=${1-"$(pwd)"} | |
echo "opening $path in Atom..." | |
open -a /Applications/Atom.app "$path" | |
} |
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'); |
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
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
var express = require('express'); | |
var app = express(); | |
var subapp = require('subapp'); | |
// forwards routes starting with subapp to the subapp, stripping the prefix | |
app.use('/subapp', subapp); |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
) | |
func viewHandler(w http.ResponseWriter, r *http.Request) { | |
w.Header().Set("Date", fmt.Sprintf("%s", time.UTC())) |
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
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
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* 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 }); | |
} | |
} |
OlderNewer