Skip to content

Instantly share code, notes, and snippets.

@peterwongpp
peterwongpp / gist:2994714
Created June 26, 2012 09:43
My Shell Command Line Format - colored, with Git support and shortened
# return the current git branch name
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
# return the string of state of the branch
parse_git_dirty() {
D="$(git status 2> /dev/null | tail -n1 | awk '{ print $1 }' )"
if [ "$D" = "nothing" ] ; then
echo -e "(clean) "
@peterwongpp
peterwongpp / gist:2994721
Created June 26, 2012 09:45
shell function to start and stop services in a more readable way
start() {
case "$1" in
mysql)
# cd /usr/local/Cellar/mysql/5.5.25 ; /usr/local/Cellar/mysql/5.5.25/bin/mysqld_safe &
/usr/local/bin/mysql.server start
;;
postgresql)
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
# to install postgres gem: env ARCHFLAGS="-arch x86_64" gem install pg
;;
@peterwongpp
peterwongpp / Preferences.sublime-settings
Created January 15, 2013 11:40
Sublime text 2 config
{
"auto_complete_commit_on_tab": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Nil/Tubnil.tmTheme",
"default_line_ending": "unix",
"dummy": true,
"ensure_newline_at_eof_on_save": true,
"font_size": 12.0,
"highlight_line": true,
"highlight_modified_tabs": true,