Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am granth on github.
  • I am granth (https://keybase.io/granth) on keybase.
  • I have a public key ASB_NEH5NkH1XPdv_R8l78hNyhDW6QxriSw6D6QPMXiYRwo

To claim this, I am signing this object:

@granth
granth / delayed_job_airbrake.rb
Created March 28, 2012 04:54
delayed_job exception notification with airbrake
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
::Airbrake.notify_or_ignore(error)
super
end
end
@granth
granth / gist:1005312
Created June 2, 2011 20:57
git prompt
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 "⚡"
return
fi
@granth
granth / gist:940639
Created April 25, 2011 15:06
repair busted iTunes file locations with macirb
# repair busted iTunes file locations with macirb
framework 'ScriptingBridge'
itunes = SBApplication.applicationWithBundleIdentifier("com.apple.itunes")
load_bridge_support_file 'iTunes.bridgesupport'
class SBElementArray
def [](value)
self.objectWithName(value)
# Rack file for local Rubygems server, using YARD
require "rubygems"
require "yard"
libraries = {}
Gem.source_index.find_name('').each do |spec|
libraries[spec.name] ||= []
libraries[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)
end
// http://1kbgrid.com as a sass file.
@for !i from 1 through !number_of_columns
.grid_#{!i}
width = (!column_width + !gutter_width) * !i - !gutter_width
.column
margin = "0 #{!gutter_width / 2}"
overflow: hidden
float: left
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 "⚡"
return
-- 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 = 'http://pinboard.in/add?next=same' +
'&url=' + encodeURIComponent(location.href) +
'&title=' + encodeURIComponent(document.title);
"
do JavaScript pinboardBookmarklet in document 1
# available domain names
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
domainavailable() {
if whois $1 | grep "No match for" &>/dev/null; then
echo "$1 is available"
return 0
else
echo "$1 is not available"
return 1;
fi
tell application "Twitterrific"
set peep to screen name of selection
set twid to id of selection
open location "http://twitter.com/" & peep & "/status/" & twid
end tell