Skip to content

Instantly share code, notes, and snippets.

View davidmfoley's full-sized avatar

Dave Foley davidmfoley

View GitHub Profile
@davidmfoley
davidmfoley / gist:733617
Created December 8, 2010 17:44
.profile: git aliases
alias gs='git status'
alias gf='git fetch'
alias gm='git merge'
alias gmom='git merge origin/master'
alias gr='git rebase'
alias grom='git rebase origin/master'
alias grc='git rebase --continue'
alias grpo='git remote prune origin'
alias gru='git remote update --prune'
@davidmfoley
davidmfoley / vimrc snippet
Created February 11, 2011 01:11
.vimrc hack to add rspec and jasmine navigation to/from spec (app, javascript, etc)
function! FindOrCreateAlternate()
let buflist = []
let bufcount = bufnr("$")
let currbufnr = 1
let current = fnamemodify(expand("%"), ':p')
if current =~ '/spec/'
if current =~ '/spec/javascripts/'
let altname = substitute(current, "/spec/","/public/", 'g')
@davidmfoley
davidmfoley / gist:859064
Created March 7, 2011 19:38
VIM: populate quickfixes with any methods that flog >= 10.0
" flog wrappers
function! FlogFile()
let current = fnamemodify(expand("%"), ':p')
call FlogAnalyze(current)
endfunction
function! FlogAll()
call FlogAnalyze('app lib -g')
endfunction
@davidmfoley
davidmfoley / gist:923364
Created April 16, 2011 18:12
Example javascript namespace declaration helper
// Replace App with your root namespace name.
//
// use like:
// App.declare('foo.bar.baz', function(){});
// App.foo.bar.baz();
// or
// App.declare('some.namespaceName', {foo : function(){}, bar:function(){}});
// App.some.namespaceName.foo();
var App = {};
@davidmfoley
davidmfoley / analdiffist-git-log.txt
Created May 4, 2011 02:35
Best set of commits I've done in a while
|
* commit aa1e16dfb818f2e7b5c27883aad5ccfa14eea4da
| Author: Dave Foley <davidmfoley@gmail.com>
| Date: Sun Mar 27 07:07:42 2011 -0400
|
| fixing stupid 6AM bug
|
* commit 46f5a2bff1199ec7004589550c33410548c65647
| Author: Dave Foley <davidmfoley@gmail.com>
| Date: Sun Mar 27 07:06:49 2011 -0400
@davidmfoley
davidmfoley / gist:978761
Created May 18, 2011 15:06
Drop all mongodb tmp collections
names = db.getCollectionNames(); for (var i = 0; i < names.length; i++) { if (names[i].substring(0,4) =='tmp.') { print(names[i]); db.getCollection(names[i]).drop(); }}
@davidmfoley
davidmfoley / gist:1038439
Created June 21, 2011 17:50
Good idea or bad idea?
#
# rspec shared examples for standard resource post to /create handling
#
# usage:
# it_should_behave_like "handles POST create"
#
# good idea or bad?
#
shared_examples_for 'handles POST create' do
before :all do
@davidmfoley
davidmfoley / gist:1107331
Created July 26, 2011 17:44
VIM: flip between test and production files (rails/rspec)
function! FindOrCreateAlternate()
let buflist = []
let bufcount = bufnr("$")
let currbufnr = 1
let altname = AlternateFileName()
while currbufnr <= bufcount
if(buflisted(currbufnr))
let currbufname = bufname(currbufnr)
let curmatch = tolower(currbufname)
@davidmfoley
davidmfoley / gist:1126260
Created August 4, 2011 20:57
update and prune all remotes except heroku
alias gru='git remote show | sed '\''/heroku/d'\'' | xargs -I {} git remote update {} --prune'
@davidmfoley
davidmfoley / gist:1340336
Created November 4, 2011 20:02
BASH Prompt
export PS1='\[\e[35;40m\]\h:\[\e[36;40m\]\W\[\e[32;40m\]$(__git_ps1 "(%s)") \[\e[33;40m\]\$\[\e[0m\] '