Skip to content

Instantly share code, notes, and snippets.

View richardgill's full-sized avatar

Richard Gill richardgill

View GitHub Profile
@richardgill
richardgill / heyFocus.sh
Last active March 3, 2017 14:10
HeyFocus Do Not Disturb Slack
# Get slack tokens from here: https://api.slack.com/custom-integrations/legacy-tokens
# You need: npm install -g dja/node-slack-dnd-cli
# You need: mkdir -p ~/Applications/NCutil && curl https://raw.githubusercontent.com/jacobsalmela/NCutil/master/NCutil.py -o ~/Applications/NCutil/NCutil.py && chmod u+x ~/Applications/NCutil/NCutil.py
# On Focus
export PATH=$PATH:/usr/local/bin:/Users/username/.nvm/versions/node/v7.6.0/bin/
SLACK_TOKEN="x" slack -o true -d 1000
SLACK_TOKEN="x" slack -o true -d 1000
SLACK_TOKEN="x" slack -o true -d 1000
@richardgill
richardgill / Preferences.sublime-settings - USER
Created February 15, 2017 11:09
Sensible Sublime Settings
{
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
],
"font_size": 15,
@richardgill
richardgill / circle.yml
Last active February 10, 2017 20:07
Yarn Build
machine:
node:
version: 7.4.0
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
dependencies:
override:
- yarn install --pure-lockfile
cache_directories:
@richardgill
richardgill / setup.sh
Created January 21, 2017 17:29
Python project setup for Milan
pip install virtualenv
#Intialise venv for project you're working on
virtualenv -p python3 venv
#Needs to be run to venv shiz up. (Put it in your ~/.bash_profile)
source venv/bin/activate
#!/bin/bash
node_modules/.bin/nodemon -w ../my-common-module --exec "rsync -av --progress --exclude=node_modules --exclude .git ../my-common-module/ ./node_modules/my-common-module/"
import React from 'react'
export default (props) => <Text {…props} style={[myCustomStyle, props.style]} />
@richardgill
richardgill / routes.js
Created December 2, 2016 16:38
How to define all your routes in one place to avoid things getting messy
import { Navigator } from 'react-native'
export default {
component1: (order = null) => ({
component: require('./components/component1').default,
}),
component2: (prop1) => ({
component: require('./components/component2').default,
passProps: { prop1: prop1 },
sceneConfig: Navigator.SceneConfigs.FloatFromRight,
@richardgill
richardgill / navigator.js
Created December 2, 2016 16:35
Gives you an idea of the sorts of things we needed from a general purpose navigator
import React, { Component } from 'react'
import { Navigator, StatusBar, View } from 'react-native'
import customNavigatorScenes from '../../common/customNavigatorScenes'
import style from './style'
import ErrorListener from './errorListener'
import NetworkConnectivity from '../networkConnectivity'
import _ from 'lodash'
import { brandPrimary } from '../../styleVariables'
import { reduxComponentName } from '../../common/reduxComponentName'
@richardgill
richardgill / normalizeStyle.js
Created December 2, 2016 16:31
Makes React Native components look more consistent on different device sizes. The base size is an iPhone 6.
import _ from 'lodash'
import { Dimensions, PixelRatio } from 'react-native'
import { platformIsIos } from 'expresso-common/common/platform'
const { height } = Dimensions.get('window')
const iphone6Height = 667
const pixelRatio = PixelRatio.get()
const fieldsToNormalize = [
'fontSize',
'lineHeight',
@richardgill
richardgill / JWT Example.md
Last active July 7, 2017 10:05
JWT Example (Java)

#Login via HTTP JSON api to get JWT token

##Client does login request

POST https://myapplication.com/login, body: {username: 'richardgill', password: 'password'}

Server receives request. Takes credentials and checks they are correct.

Server uses secret key: "secretkey123!" to generate a jwt token. (Using jwt library)