Skip to content

Instantly share code, notes, and snippets.

View richardgill's full-sized avatar

Richard Gill richardgill

View GitHub Profile
@richardgill
richardgill / normalizeRNStyles.js
Last active May 3, 2016 08:14
Normalize RN styles - Code for iPhone 6s and it should work across all devices.
import _ from 'lodash'
import { Dimensions } from 'react-native'
const { height } = Dimensions.get('window')
const iphone6Height = 667
const fieldsToNormalize = [
'fontSize',
'width',
'height',
'margin',
@richardgill
richardgill / gist:25fd908503e77d966892
Created March 23, 2016 10:51
custom navigation animations
//in main app
configureScene(route, navigator) {
if (route.sceneConfig) {
return route.sceneConfig;
}
return CustomNavigatorSceneConfigs.HorizontalJump;
},
//customNavigatorSceneConfigs.js
import React from 'react-native'
@richardgill
richardgill / spreading.js
Last active March 8, 2016 22:46
Spreading examples
var hash = {a: 1, b: 2}
{...hash} // => {a: 1, b: 2} <- this hash is like a '_.cloned hash'
// All these hashes are 'cloned'. Nothing every gets mutated
{c: 3, ...hash} // => {a: 1, b: 2, c: 3}
{...hash, c: 3} // => {a: 1, b: 2, c: 3}
{...hash, b: 3} // => {a: 1, b: 3}
{b: 3, ...hash} // => {a: 1, b: 2}
@richardgill
richardgill / apphubWithRnws.sh
Created February 19, 2016 23:45
Attempt to make apphub build.zip with rnws instead of default react-native bundle.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR=$DIR/..
PLIST_FILE="$ROOT_DIR/iOS/Info.plist"
TMP_DIR="/tmp/apphub/$(uuidgen)/"
BUNDLE_DIR_NAME="ios.bundle"
BUNDLE_DIR="$TMP_DIR$BUNDLE_DIR_NAME"
ZIP_NAME="build.zip"
OUTPUT_ZIP="$TMP_DIR$ZIP_NAME"
BUNDLE_NAME="main.jsbundle"
@richardgill
richardgill / findJobs.sh
Last active January 6, 2016 15:02
Runs ZDEV job finder.
FIND_LEADS_DIR="find-leads"
FIND_LEADS_FULL_PATH="/tmp/$FIND_LEADS_DIR"
if [ ! -d "$FIND_LEADS_FULL_PATH" ]; then git clone [email protected]:z-dev/find-leads.git $FIND_LEADS_FULL_PATH ; fi
cd $FIND_LEADS_FULL_PATH
git checkout master
git pull origin master
npm run start
Brew
https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion
https://github.com/michaeldfallen/git-radar
Sublime
[SSH Keys](https://help.github.com/articles/generating-ssh-keys/)
brew install nvm #install the node version manager
# Make sure it gets loaded every time a terminal starts
echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile
# Break down!
# echo means print out what follows
# $(brew --prefix nvm) will get evaluated as if you typed it in to a command line.
# >> ~.bash_profile means: add whatever the left hand side of >> evaluated to, to the end of the ~/.bash_profile file.
# ~: means home directory.
daasdasd
asdasdasd

Weave makes networking docker containers easy.

Containers appear to all be on the same network even if they're not.

@richardgill
richardgill / gist:1471961aac629eaaae7b
Created January 25, 2015 18:23
05eca61cb33b67cb458b99e854eb8a0268d49b00da155e98cdd5a8082cf1d1f92994483e703e929329b2b99b1acee4c85d5b2d0e9228560001b9edd81dd2087774b9aaba3149707f1c093a5697595f77fd7adf3a9008fc5160d6d3a5317523fe9d9dda3b36270c8f9b654f16fefc072f50fd0cf20bdd6a82a4d3df8565ccccbb
419f4d33b43bdbade29ea67ca913b5a6f0f03b2163e9ce4b4bca3a3fe0fe8876f9394c0b1dcfc44614a3f2a5135cf75c18c5e6b9a6b2b673ce7c65a98706c88cc0cb007aef005cf10159fdab9adb4d7ffd1ba232c7eaf284d943203f6300a4d6bb4565cc28f31ab3dd9e7f463522c276dea07b878a88e56bf1756504abc325cc