Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am granth on github.
  • I am granth ( on keybase.
  • I have a public key ASB_NEH5NkH1XPdv_R8l78hNyhDW6QxriSw6D6QPMXiYRwo

To claim this, I am signing this object:

granth / delayed_job_airbrake.rb
Created March 28, 2012 04:54
delayed_job exception notification with airbrake
View delayed_job_airbrake.rb
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
granth / gist:1005312
Created June 2, 2011 20:57
git prompt
View gist:1005312
export PS1='\[\033]0;\w\007\[\033[0;32m\]\W\[\033[0;38m\] $(git_branch)$(prompt_status "%s") '
prompt_status() {
local branch=$(__git_ps1 "%s")
if [ -n "$branch" ]; then
if git_dirty; then
echo "⚡"
granth / gist:940639
Created April 25, 2011 15:06
repair busted iTunes file locations with macirb
View gist:940639
# repair busted iTunes file locations with macirb
framework 'ScriptingBridge'
itunes = SBApplication.applicationWithBundleIdentifier("")
load_bridge_support_file 'iTunes.bridgesupport'
class SBElementArray
def [](value)
# Rack file for local Rubygems server, using YARD
require "rubygems"
require "yard"
libraries = {}
Gem.source_index.find_name('').each do |spec|
libraries[] ||= []
libraries[] <<, spec.version.to_s, nil, :gem)
View 1kbgrid.sass
// as a sass file.
@for !i from 1 through !number_of_columns
width = (!column_width + !gutter_width) * !i - !gutter_width
margin = "0 #{!gutter_width / 2}"
overflow: hidden
float: left
View git-status
export PATH=$HOME/bin:/usr/local/bin:/usr/local/git/bin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/X11R6/bin:$PATH
source /usr/local/git/contrib/completion/git-completion.bash
prompt_status() {
local branch=$(__git_ps1 "%s")
if [ -n "$branch" ]; then
if git_dirty; then
echo "⚡"
View Add Pinboard Bookmark
-- save as "Add Pinboard Bookmark.scpt" in ~/Library/Scripts/Applications/Safari
-- assign it ⌘D in FastScripts to use instead of Safari's bookmarks
tell application "Safari"
set pinboardBookmarklet to "
document.location = '' +
'&url=' + encodeURIComponent(location.href) +
'&title=' + encodeURIComponent(document.title);
do JavaScript pinboardBookmarklet in document 1
View gist:62046
# available domain names
domainavailable() {
if whois $1 | grep "No match for" &>/dev/null; then
echo "$1 is available"
return 0
echo "$1 is not available"
return 1;
View gist:56935
tell application "Twitterrific"
set peep to screen name of selection
set twid to id of selection
open location "" & peep & "/status/" & twid
end tell