Skip to content

Instantly share code, notes, and snippets.

View campbell's full-sized avatar

Pete Campbell campbell

View GitHub Profile
#!bash
echo 'Applying ~/.git-completion.bash code-completion stuff...'
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
" Install Vundle first:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"
" Launch vim and run :PluginInstall
" http://stackoverflow.com/questions/10778078/vim-colorscheme-executing-but-not-changing-colors
set t_Co=256
" https://github.com/tpope/vim-pathogen
# remap prefix to Control + q
set -g prefix C-q
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
@campbell
campbell / gist:6041801
Created July 19, 2013 19:34
Database management for Heroku production apps. Backup locally and restore to either the local or production database.
namespace :msc do
namespace :db do
APP = 'fake-app-namer'
desc 'Backup the Postgres db'
task :backup => :environment do
`heroku pgbackups:capture --app #{APP}`
`curl -o #{backup_filename} \`heroku pgbackups:url --app #{APP}\``
end
@campbell
campbell / run-git-bisect-function.md
Created March 31, 2015 19:08
Automated GIT BISECT Bash function

Use this script to automatically find where a SPEC fail was introduced. You can add it to .bash_profile.

Syntax: run_git_bisect <bad SHA> <good SHA> <failing test file:number>

function run_git_bisect() {
  [ "$#" -eq 3 ] || die "You must provide the bad SHA, good SHA and the failing test filename[:number]"
  
 git bisect reset
class Outer
puts Module.nesting
A = 'outer'
end
puts Outer::A #=> outer
class Outer
class Inner
puts Module.nesting
puts A #=> outer