Skip to content

Instantly share code, notes, and snippets.

componentWillMount() {
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => true,
onMoveShouldSetResponderCapture: () => true,
onMoveShouldSetPanResponderCapture: () => true,
onPanResponderGrant: (e, {dx, dy}) => {
this.state.pan.setOffset({x: dx, y: dy});
this.state.pan.setValue({x: 0, y: 0});
componentWillMount() {
this._responder = PanOrTapResponder.create({
onPressIn: () => {
// Called after the ~30ms delay to make sure
// this gesture is not a pan but rather a tap.
this.setState({highlightUnderlay: true});
},
onPress: () => {
@pcottle
pcottle / hack.sh
Created March 31, 2012 16:53 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2266714/hack.sh | sh
#
@pcottle
pcottle / why does this not exist!?!?
Created July 1, 2012 05:05
color string parser
/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* @link http://www.phpied.com/rgb-color-parser-in-javascript/
* @license Use it if you like it
* MODIFICATIONS by Peter Cottle :D
*/
function Color(color_string)
{
// if it's an object, just clone and return
@pcottle
pcottle / gist:3336177
Created August 13, 2012 01:18
My vimrc
set incsearch
set wildmenu
set ruler
set ignorecase
set smartcase
set noerrorbells
set modeline
set ls=2
set cursorline
imap ii <Esc>
@pcottle
pcottle / bashrc
Last active October 8, 2015 13:07
bashrc
export EDITOR=vim
source ~/git-completion.bash
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
import multiAgents
class TrivialProblem(object):
""" make a tree that looks like this:
root (4)
/ \
min left (4) min right (2)
/ \ / \
4 3 2 deeper (1000)
@pcottle
pcottle / Custom.css
Created October 5, 2012 03:55 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@pcottle
pcottle / .gitconfig
Created December 5, 2012 17:40
gitconfig
[user]
name = Peter Cottle
email = petermcottle@gmail.com
[core]
editor = /usr/bin/vim -f
excludesfile = /Users/pcottle/.gitignore_global
[alias]
unstage = reset HEAD --
[help]
autocorrect = 1
var _ = require('underscore');
var fs = require('fs');
// Haha, this is so tricky. so we have a template for index.html to stick
// in the hashed JS and style files -- that template also contains
// templates used in the app. in order to avoid evaluating those
// templates, we change the regexes so we can effectively nest templates
_.templateSettings.interpolate = /\{\{(.+?)\}\}/g;
_.templateSettings.escape = /\{\{\{(.*?)\}\}\}/g;
_.templateSettings.evaluate = /\{\{-(.*?)\}\}/g;