Skip to content

Instantly share code, notes, and snippets.

View benwoodward's full-sized avatar
💭
Working on spoken.app

Ben Woodward benwoodward

💭
Working on spoken.app
View GitHub Profile
@benwoodward
benwoodward / .bash_profile
Created February 27, 2012 15:39
Use MacVim as default EDITOR with Git on iTerm command line
export EDITOR='mvim -f --nomru -c "au VimLeave * !open -a iTerm"'
@benwoodward
benwoodward / .gitconfig
Created February 28, 2012 10:40
Push only your local branch by default when using `git push`
; `git config --global push.default current`
[push]
default = current
@benwoodward
benwoodward / .gitconfig
Created February 29, 2012 21:55
Configure fugitive.vim / git web--browse to open browser when using :Gbrowse (for some reason wasn't working).
; `open` on OS X opens the default browser
; when passed a URL
git config --global web.browser open
@benwoodward
benwoodward / Event.rb
Created March 2, 2012 16:40
mongomapper multiple has many relationships
class Event
many :attendees, :class_name => "User"
many :interested, :class_name => "User"
end
@benwoodward
benwoodward / .inputrc
Created March 6, 2012 09:54
Some useful dotfile configs
set completion-ignore-case On
@benwoodward
benwoodward / consecutive_split.rb
Created March 22, 2012 16:00
Match every group of two words with ruby
"one two three four".split.each_cons(2).map { |v| v.join(" ") }
# => "one two", "two three", "three four"
@benwoodward
benwoodward / word_wrap.rb
Created March 22, 2012 16:36
Split long words every 10 characters
s = 'supercalifragelisticexpealodocious'
s.scan(/\S{10}/).join('-\n')
# => "supercalif-\\nragelistic-\\nexpealodoc"
@benwoodward
benwoodward / .editrc
Created March 22, 2012 23:05
vi-mode in irb / rails console
# cat .editrc bind -v
bind -v
@benwoodward
benwoodward / .vimrc
Last active October 4, 2015 04:28
Vim shortcut to emove trailing whitespace
" remove trailing whitespace (don't use on binary files!!)
map <leader>tws :%s/\s\+$//<CR>
" go to previous file
map <Leader>p <C-^>
@benwoodward
benwoodward / .gitconfig
Created May 9, 2012 09:21
Working setup for p4merge with git 1.7 upwards.
[merge]
tool = p4merge
keepBackup = false
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
external = p4diff