Skip to content

Instantly share code, notes, and snippets.

function gr {
## If the current working directory is inside of
## a git repository, this function will change
## it to the git root (ie, the directory that
## contains the .git/ directory), and then print
## the new directory.
git branch > /dev/null 2>&1 || return 1
cd "$(git rev-parse --show-cdup)".
pwd
Feb 10 10:19:07 macbook runner[6847]: Administrator authorization granted.
Feb 10 10:19:07 macbook Installer[6748]: ================================================================================
Feb 10 10:19:07 macbook Installer[6748]: User picked Standard Install
Feb 10 10:19:07 macbook Installer[6748]: Choices selected for installation:
Feb 10 10:19:07 macbook Installer[6748]: Install: "Syncplicity"
Feb 10 10:19:07 macbook Installer[6748]: syncplicityPreflight.pkg : com.syncplicity.syncplicity.preflight.pkg : 1.0
Feb 10 10:19:07 macbook Installer[6748]: Install: "Syncplicity"
Feb 10 10:19:07 macbook Installer[6748]: syncplicity.pkg : com.syncplicity.syncplicity.syncplicity.pkg : 1.1
Feb 10 10:19:07 macbook Installer[6748]: Install: "SyncpCMPlugin"
Feb 10 10:19:07 macbook Installer[6748]: syncpcmplugin.pkg : com.syncplicity.syncplicity.syncpcmplugin.pkg : 1.1
#!/usr/bin/env ruby
require 'net/imap'
# Source server connection info.
SOURCE_HOST = 'mail.example.com'
SOURCE_PORT = 993
SOURCE_SSL = true
SOURCE_USER = 'username'
SOURCE_PASS = 'password'
gistname = ENV['TM_FILEPATH'] ? ENV['TM_FILEPATH'].split('/')[-1] : "file" << "." << get_extension
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")
require "gist"
# Add extension for supported modes based on TM_SCOPE
# Cribbed from http://github.com/defunkt/gist.el/tree/master/gist.el
def get_extension
scope = ENV["TM_SCOPE"].split[0]
case scope
Updating libxml-ruby
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb update
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... no
checking for atan() in -lm... yes
Colorize ls output under OS X Leopard. Place this in your .bash_profile.
# Delete a remote branch off the remote server
git push origin :<remote branch name>
def write(content, private_gist)
url = URI.parse('http://gist.github.com/gists')
req = Net::HTTP.post_form(url, data(nil, nil, content, private_gist))
copy req['Location']
end