This file contains hidden or 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
# Add these functions to your shell profile, i.e. ~/.bash_profile or ~/.zshrc | |
# Delete local branches that no longer exist in the remote | |
function git-branch-cleanup { | |
git fetch -p && for branch in `git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'`; do git branch -D $branch; done | |
} | |
# Display the branches in the order you last worked on them | |
# https://stackoverflow.com/a/2514279/446542 | |
function git-branch-history { |
This file contains hidden or 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
{ | |
"name": "my-react-project", | |
"version": "1.0.0", | |
"scripts": { | |
"build": "node_modules/.bin/awesome-build build react es2015 sass ./dist", | |
"watch": "node_modules/.bin/awesome-build watch react es2015 sass" | |
}, | |
"devDependencies": { | |
"awesome-build": "^x.x.x" | |
}, |
This file contains hidden or 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 React from 'react'; | |
import request from 'superagent'; | |
// This import syntax requires the babel transform-export-extensions plugin | |
import dispatcher, {actions} from '../lib/dispatcher'; | |
export default class AddContact extends React.Component { | |
submitHandler(event) { | |
request.post('/api/contacts') | |
.send({ | |
firstName: this.refs.firstName.value, |
This file contains hidden or 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 gulp = require('gulp'); | |
var zip = require('gulp-zip'); | |
var del = require('del'); | |
var install = require('gulp-install'); | |
var runSequence = require('run-sequence'); | |
var awsLambda = require("node-aws-lambda"); | |
gulp.task('clean', function(cb) { | |
del(['./dist', './dist.zip'], cb); | |
}); |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 util = require("util"), | |
BaseThing = require("./base_thing"); | |
// Constructor function | |
var Thing = module.exports = function(attrs){ | |
this.attrs = attrs; | |
// Priveleged method can be invoked by public methods | |
this.privelegedMethod = function() { | |
} |
This file contains hidden or 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
from PIL import Image | |
import math | |
import glob | |
width, height = [165, 254] | |
files = glob.glob('./photos/*.jpg') | |
num_columns = 5 | |
canvas_width = num_columns * width | |
canvas_height = int(math.ceil(len(files) / float(num_columns))) * height |