Skip to content

Instantly share code, notes, and snippets.

View apavamontri's full-sized avatar

Anusidh Pavamontri apavamontri

View GitHub Profile
@apavamontri
apavamontri / gist:1786074
Created February 10, 2012 03:19
Display current git branch at the command prompt (OS X)
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
WHITE="\[\033[1;37m\]"
GRAY="\[\033[0;37m\]"
BLUE="\[\033[0;34m\]"
@apavamontri
apavamontri / post-to-fb-wall-ruby
Created June 15, 2012 04:34
Post to Facebook walk with Ruby
require 'net/http'
require 'net/https'
class FacebookJob < Struct.new(:id, :access_token, :message, :link, :picture, :name, :description, :caption, :icon)
def perform
uri = URI.parse('https://graph.facebook.com/me/feed')
params = {'access_token' => access_token, 'message' => message, 'link' => link, 'picture' => picture, 'name' => name, 'description' => description, 'caption' => caption, 'icon' => icon }
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
@apavamontri
apavamontri / sublime-text-2-user-settings
Created June 18, 2012 06:12
Sublime Text 2 OS X User settings
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Color Scheme - Default/GrandsonOfObsidian.tmTheme",
"font_face": "Droid Sans Mono",
"font_size": 13,
"hot_exit": false,
"remember_open_files": false,
"shift_tab_unindent": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
@apavamontri
apavamontri / beyond-compare-with-git
Created June 21, 2012 03:42
Using Beyond Compare with Git
git config --global diff.tool bc3
git config --global difftool.bc3.path "c:/program files (x86)/beyond compare 3/bcomp.exe"
@apavamontri
apavamontri / fancy-git-log-in-terminal
Created July 7, 2012 05:01
Fancy git log in terminal
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
@apavamontri
apavamontri / remove all gem
Created August 31, 2012 04:48
Remove/uninstall all gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@apavamontri
apavamontri / gist:3856717
Last active October 11, 2015 12:07
Sublime Text Windows User Settings
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Base16/base16-default.dark.tmTheme",
"font_face": "Droid Sans Mono",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,
@apavamontri
apavamontri / gist:4239429
Created December 8, 2012 09:08
Google Chrome developer tool theme
/**********************************************/
/*
/* Tomorrow Skin by Ben Truyman - 2011
/*
/* Based on Chris Kempson's Tomorrow Theme:
/* https://github.com/ChrisKempson/Tomorrow-Theme
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@apavamontri
apavamontri / .gitconfig
Created December 26, 2012 03:29
Git config file to use Beyond Compare 3 as Difftool in Windows
[user]
name = Anusidh Pavamontri\n
email = apavamontri@gmail.com\n
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
dt = difftool
mt = mergetool
[core]
autocrlf = true
@apavamontri
apavamontri / python-virtualenv-virtualenvwrapper-brew
Last active December 15, 2019 08:22
Install Python + virtualenv + virtualenvwrapper with brew on Mac OS X 10.8 Mountain Lion
# installation
brew doctor
brew install python
pip install virtualenv virtualenvwrapper
# Add following to .bash_profile
export PATH=/usr/local/bin:/usr/local/mysql/bin:/usr/local/share/python:$PATH:~/bin
export WORKON_HOME=$HOME/.virtualenvs