Skip to content

Instantly share code, notes, and snippets.

View emson's full-sized avatar

Ben Emson emson

View GitHub Profile
@emson
emson / dotfile.sh
Created March 2, 2012 13:48
dotfile.sh allows you to sync all your '.files' using Dropbox
#!/bin/sh
REPO=$HOME/Dropbox/Dotfiles
PLATFORM=$(uname)
die() {
echo "fatal: $1"
exit 1
}
@emson
emson / cdf.sh
Created December 2, 2011 09:30
Script to cd to the last opened finder directory
# function to change directory to the one set in the last opened finder.
cdf () {
currFolderPath=$( /usr/bin/osascript <<" EOT"
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
@emson
emson / .gvimrc
Created October 26, 2011 07:57
Piotr's .gvimrc
if has("gui_macvim")
" Command-T for CommandT
macmenu &File.New\ Tab key=<D-T>
map <D-t> :CommandT<CR>
imap <D-t> <Esc>:CommandT<CR>
" Command-Return for fullscreen
macmenu Window.Toggle\ Full\ Screen\ Mode key=<D-CR>
" Command-Shift-F for Ack
@emson
emson / .vimrc
Created October 26, 2011 07:56
Piotr's .vimrc
if $SHELL =~ 'bin/fish'
set shell=/bin/sh
endif
" Needed on some linux distros.
" see http://www.adamlowe.me/2009/12/vim-destroys-all-other-rails-editors.html
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
@emson
emson / mysql_utils.sh
Created September 27, 2011 11:26
Quick and dirty MySQL utils
#!/bin/bash
function is_file_exists() {
local f="$1"
[[ -f "$f" ]] && return 0 || return 1
}
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
@emson
emson / .bash_profile
Created September 9, 2011 14:00
My .bash_profile
# Ben's .bash_profile file
# path settings
PATH="/usr/local/bin:/usr/local/sbin:$PATH" # if not already present
PATH="$PATH:/usr/local/mysql/bin"
PATH="$PATH:/usr/local/mysql/support-files/"
PATH="$PATH:~/scripts:"
export PATH=$PATH
export EDITOR='mate'
@emson
emson / .vimrc
Created August 22, 2011 17:29
My .vimrc file
" .vimrc based on Ryan Tomayco's vim file
" https://github.com/rtomayko/dotfiles/blob/rtomayko/.vimrc
" ---------------------------------------------------------------------------
" General
" ---------------------------------------------------------------------------
set nocompatible " essential