Skip to content

Instantly share code, notes, and snippets.

[alias]
co = checkout
st = status
br = branch
re = rebase
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
cat = cat-file -t
type = cat-file -t
dump = cat-file -p
[color "branch"]
@davidmfoley
davidmfoley / octopress_heroku_publish.sh
Created May 18, 2012 16:20
Deploy octopress to heroku without crufting your repo with generated files
#! /bin/sh
# For octopress/heroku: generate site, deploy, and tag as "deploy-yyyy-mm-dd"
# This allows you to keep your public/ assets out of git,
# and only add them just before deploying
BRANCH=`git symbolic-ref -q HEAD | sed 's/refs\/heads\///'`
SHA=`git rev-parse --short HEAD`
@davidmfoley
davidmfoley / restore_db_from_heroku_backup.sh
Created May 2, 2012 16:09
Heroku/Rails: restore local development db from heroku
#! /bin/bash
# First you need to have the "pgbackups" addon in your heroku app, for example:
# $ heroku addons:add pgbackups:auto-week
# your database name here
DB_NAME='foobar_development'
# grab the data directory for postgres from the running process
DATA_DIR=`ps ax |grep [/]post | sed "s/^.*\-D //" | sed "s/ .*$//"`
@zerowidth
zerowidth / paginated_collection.js
Created November 18, 2010 22:04
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");