Created
September 30, 2009 16:29
-
-
Save jlong/198222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Console | |
alias profile="vi ~/.bash_profile" | |
alias ls="ls -p -G -h" | |
# Desktop Programs | |
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'" | |
alias photoshop="open -a '/Applications/Adobe Photoshop CS4/Adobe Photoshop.app'" | |
alias illustrator="open -a '/Applications/Adobe Illustrator CS4/Adobe Illustrator.app'" | |
alias preview="open -a '/Applications/Preview.app'" | |
alias xcode="open -a '/Developer/Applications/Xcode.app'" | |
alias coda="open -a '/Applications/Coda.app'" | |
alias tm="mate" | |
# Ruby | |
alias stdlib="mate /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/" | |
alias gems="mate /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Environment Variables | |
export PS1="\u@\h:\w$ " | |
export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:$PATH | |
export MANPATH=$MANPATH:/opt/local/share/man:/usr/local/git/man | |
export INFOPATH=$INFOPATH:/opt/local/share/info | |
export EDITOR=vi | |
export CVS_RSH=ssh | |
export DEPLOY_TO=staging | |
# Auto completion for Gemedit. Awesomeness. | |
complete -C "/usr/bin/gemedit --complete -e mate" gemedit | |
# View man documentation in Preview | |
pman () | |
{ | |
man -t "${1}" | open -f -a /Applications/Preview.app/ | |
} | |
# disk usage per directory | |
usage () | |
{ | |
if [ $1 ] | |
then | |
du -hd $1 | |
else | |
du -hd 1 | |
fi | |
} | |
# External | |
source ~/.aliases | |
source ~/.projects | |
source ~/.git-completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names | |
# *) local and remote tag names | |
# *) .git/remotes file names | |
# *) git 'subcommands' | |
# *) tree paths within 'ref:path/to/file' expressions | |
# *) common --long-options | |
# | |
# To use these routines: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh). | |
# 2) Added the following line to your .bashrc: | |
# source ~/.git-completion.sh | |
# | |
# 3) You may want to make sure the git executable is available | |
# in your PATH before this script is sourced, as some caching | |
# is performed while the script loads. If git isn't found | |
# at source time then all lookups will be done on demand, | |
# which may be slightly slower. | |
# | |
# 4) Consider changing your PS1 to also show the current branch: | |
# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' | |
# | |
# The argument to __git_ps1 will be displayed only if you | |
# are currently in a git repository. The %s token will be | |
# the name of the current branch. | |
# | |
# To submit patches: | |
# | |
# *) Read Documentation/SubmittingPatches | |
# *) Send all patches to the current maintainer: | |
# | |
# "Shawn O. Pearce" <[email protected]> | |
# | |
# *) Always CC the Git mailing list: | |
# | |
# [email protected] | |
# | |
case "$COMP_WORDBREAKS" in | |
*:*) : great ;; | |
*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" | |
esac | |
__gitdir () | |
{ | |
if [ -z "$1" ]; then | |
if [ -n "$__git_dir" ]; then | |
echo "$__git_dir" | |
elif [ -d .git ]; then | |
echo .git | |
else | |
git rev-parse --git-dir 2>/dev/null | |
fi | |
elif [ -d "$1/.git" ]; then | |
echo "$1/.git" | |
else | |
echo "$1" | |
fi | |
} | |
__git_ps1 () | |
{ | |
local g="$(git rev-parse --git-dir 2>/dev/null)" | |
if [ -n "$g" ]; then | |
local r | |
local b | |
if [ -d "$g/rebase-apply" ] | |
then | |
if test -f "$g/rebase-apply/rebasing" | |
then | |
r="|REBASE" | |
elif test -f "$g/rebase-apply/applying" | |
then | |
r="|AM" | |
else | |
r="|AM/REBASE" | |
fi | |
b="$(git symbolic-ref HEAD 2>/dev/null)" | |
elif [ -f "$g/rebase-merge/interactive" ] | |
then | |
r="|REBASE-i" | |
b="$(cat "$g/rebase-merge/head-name")" | |
elif [ -d "$g/rebase-merge" ] | |
then | |
r="|REBASE-m" | |
b="$(cat "$g/rebase-merge/head-name")" | |
elif [ -f "$g/MERGE_HEAD" ] | |
then | |
r="|MERGING" | |
b="$(git symbolic-ref HEAD 2>/dev/null)" | |
else | |
if [ -f "$g/BISECT_LOG" ] | |
then | |
r="|BISECTING" | |
fi | |
if ! b="$(git symbolic-ref HEAD 2>/dev/null)" | |
then | |
if ! b="$(git describe --exact-match HEAD 2>/dev/null)" | |
then | |
b="$(cut -c1-7 "$g/HEAD")..." | |
fi | |
fi | |
fi | |
if [ -n "$1" ]; then | |
printf "$1" "${b##refs/heads/}$r" | |
else | |
printf " (%s)" "${b##refs/heads/}$r" | |
fi | |
fi | |
} | |
__gitcomp_1 () | |
{ | |
local c IFS=' '$'\t'$'\n' | |
for c in $1; do | |
case "$c$2" in | |
--*=*) printf %s$'\n' "$c$2" ;; | |
*.) printf %s$'\n' "$c$2" ;; | |
*) printf %s$'\n' "$c$2 " ;; | |
esac | |
done | |
} | |
__gitcomp () | |
{ | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
if [ $# -gt 2 ]; then | |
cur="$3" | |
fi | |
case "$cur" in | |
--*=) | |
COMPREPLY=() | |
;; | |
*) | |
local IFS=$'\n' | |
COMPREPLY=($(compgen -P "$2" \ | |
-W "$(__gitcomp_1 "$1" "$4")" \ | |
-- "$cur")) | |
;; | |
esac | |
} | |
__git_heads () | |
{ | |
local cmd i is_hash=y dir="$(__gitdir "$1")" | |
if [ -d "$dir" ]; then | |
for i in $(git --git-dir="$dir" \ | |
for-each-ref --format='%(refname)' \ | |
refs/heads ); do | |
echo "${i#refs/heads/}" | |
done | |
return | |
fi | |
for i in $(git ls-remote "$1" 2>/dev/null); do | |
case "$is_hash,$i" in | |
y,*) is_hash=n ;; | |
n,*^{}) is_hash=y ;; | |
n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; | |
n,*) is_hash=y; echo "$i" ;; | |
esac | |
done | |
} | |
__git_tags () | |
{ | |
local cmd i is_hash=y dir="$(__gitdir "$1")" | |
if [ -d "$dir" ]; then | |
for i in $(git --git-dir="$dir" \ | |
for-each-ref --format='%(refname)' \ | |
refs/tags ); do | |
echo "${i#refs/tags/}" | |
done | |
return | |
fi | |
for i in $(git ls-remote "$1" 2>/dev/null); do | |
case "$is_hash,$i" in | |
y,*) is_hash=n ;; | |
n,*^{}) is_hash=y ;; | |
n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; | |
n,*) is_hash=y; echo "$i" ;; | |
esac | |
done | |
} | |
__git_refs () | |
{ | |
local cmd i is_hash=y dir="$(__gitdir "$1")" | |
if [ -d "$dir" ]; then | |
if [ -e "$dir/HEAD" ]; then echo HEAD; fi | |
for i in $(git --git-dir="$dir" \ | |
for-each-ref --format='%(refname)' \ | |
refs/tags refs/heads refs/remotes); do | |
case "$i" in | |
refs/tags/*) echo "${i#refs/tags/}" ;; | |
refs/heads/*) echo "${i#refs/heads/}" ;; | |
refs/remotes/*) echo "${i#refs/remotes/}" ;; | |
*) echo "$i" ;; | |
esac | |
done | |
return | |
fi | |
for i in $(git ls-remote "$dir" 2>/dev/null); do | |
case "$is_hash,$i" in | |
y,*) is_hash=n ;; | |
n,*^{}) is_hash=y ;; | |
n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; | |
n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; | |
n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;; | |
n,*) is_hash=y; echo "$i" ;; | |
esac | |
done | |
} | |
__git_refs2 () | |
{ | |
local i | |
for i in $(__git_refs "$1"); do | |
echo "$i:$i" | |
done | |
} | |
__git_refs_remotes () | |
{ | |
local cmd i is_hash=y | |
for i in $(git ls-remote "$1" 2>/dev/null); do | |
case "$is_hash,$i" in | |
n,refs/heads/*) | |
is_hash=y | |
echo "$i:refs/remotes/$1/${i#refs/heads/}" | |
;; | |
y,*) is_hash=n ;; | |
n,*^{}) is_hash=y ;; | |
n,refs/tags/*) is_hash=y;; | |
n,*) is_hash=y; ;; | |
esac | |
done | |
} | |
__git_remotes () | |
{ | |
local i ngoff IFS=$'\n' d="$(__gitdir)" | |
shopt -q nullglob || ngoff=1 | |
shopt -s nullglob | |
for i in "$d/remotes"/*; do | |
echo ${i#$d/remotes/} | |
done | |
[ "$ngoff" ] && shopt -u nullglob | |
for i in $(git --git-dir="$d" config --list); do | |
case "$i" in | |
remote.*.url=*) | |
i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Changes into the project's directory. All of my projects are stored in | |
# ~/Workspaces/. Some of them are still on subversion, thus the need for all | |
# of the checks on "trunk". They often have one or more of the following | |
# subdirectories: application, prototype, mockups, artwork, or website. | |
# The command takes to parameters: the name of the project and the sub- | |
# directory. The application subdirectory is assumed if nothing is passed. | |
project () | |
{ | |
if [[ -e ~/Workspaces/$1/trunk ]] | |
then | |
if [ $2 ] | |
then | |
cd ~/Workspaces/$1/trunk/$2 | |
else | |
if [[ -e ~/Workspaces/$1/trunk/$1 ]] | |
then | |
cd ~/Workspaces/$1/trunk/$1 | |
else | |
cd ~/Workspaces/$1/trunk | |
fi | |
fi | |
else | |
if [ $2 ] | |
then | |
if [[ -e ~/Workspaces/$1/assets/$2 ]] | |
then | |
cd ~/Workspaces/$1/assets/$2 | |
else | |
cd ~/Workspaces/$1/$2 | |
fi | |
else | |
if [[ -e ~/Workspaces/$1/application ]] | |
then | |
cd ~/Workspaces/$1/application | |
else | |
cd ~/Workspaces/$1 | |
fi | |
fi | |
fi | |
} | |
alias pr=project | |
alias ws="cd ~/Workspaces; ls" | |
# Wiseheart Design | |
wd () | |
{ | |
project wiseheartdesign $1 | |
} | |
complete -W "application prototype mockups artwork website portfolio" wd | |
# MemberHub | |
mh () | |
{ | |
project memberhub $1 | |
} | |
complete -W "application prototype mockups artwork website upload" mh | |
# Broadsword | |
bs () | |
{ | |
project broadsword $1 | |
} | |
complete -W "application prototype mockups artwork" bs | |
# Radiant | |
ra () | |
{ | |
project radiant $1 | |
} | |
complete -W "application prototype mockups artwork" ra | |
# Announce It | |
ai () | |
{ | |
project announceit $1 | |
} | |
complete -W "application prototype mockups artwork" ai | |
# Recursive Creative | |
rc() | |
{ | |
project recursive $1 | |
} | |
complete -W "mockups artwork website" rc | |
# RoleModel Software | |
rms() | |
{ | |
project rolemodel $1 | |
} | |
complete -W "mockups artwork website" rms | |
# NorthScale | |
ns() | |
{ | |
project northscale $1 | |
} | |
complete -W "prototype mockups artwork" ns | |
# Karate for Life | |
k4l() | |
{ | |
project karate4life $1 | |
} | |
complete -W "prototype mockups artwork" k4l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment