Skip to content

Instantly share code, notes, and snippets.

View atom.rb
class Atom
attr_reader :symbol
def initialize(symbol)
@symbol = symbol
def ==(other)
self.symbol == other.symbol
zetter / phantomjs
Last active Jan 3, 2016
Filter out userSpaceScaleFactor warning on phantomjs on Mavericks
View phantomjs
/usr/local/bin/phantomjs_original $@ 2> >(grep -v userSpaceScaleFactor 1>&2)
zetter / parse_icons_from_icomoon.rb
Created Dec 9, 2013
Parse the icon file from icomoon and print out a ruby hash of character names to characters.
View parse_icons_from_icomoon.rb
# Usage:
# run the file with the dev.svg from icomoon (not the plain svg)
# ruby parse_icons_from_icomoon.rb /path/to/
require 'nokogiri'
file = ARGV[0]
svg =
document = Nokogiri::XML(svg)
zetter / transaction_download.applescript
Last active Dec 27, 2015
Halifax Online Banking Transaction Downloader Applescript
View transaction_download.applescript
Halifax Online Banking Transaction Downloader Applescript
To use:
+ Set the path to an existing directory where you want to save the
+ Open Safari with a single window and tab and login to Halifax Online.
+ Load up the first page of the transactions for the account you want to save.
+ Run this script.
zetter /
Created Oct 31, 2013
List the remote branches that with a last commit that you authored.
# list remote branches with committer name and email
function git_remote_branches_with_author {
for branch in `git branch -r | grep -v /HEAD`; do
echo -en "$branch ";
echo -e `git show -s --pretty=format:"%an %ae" $branch`;
# show filtered remote branches
function find_git_remote_branches {
zetter / gist:7133549
Last active Dec 26, 2015 — forked from ericboehs/gist:7125105
Fix to work with current version of poltergeist. Don't recommend using.
View gist:7133549
module Capybara::Poltergeist
class Client
def redirect_stdout
prev_stdout = STDOUT.dup
prev_stderror = STDERR.dup
prev_stdout.autoclose = false
$stdout = @write_io
zetter / gist:7133394
Last active Dec 26, 2015
Textmate Mavericks annocement
View gist:7133394

Dear Sir/Madam,

Forgive me for this unsolicited (one time) service announcement.

I am writing because you have a TextMate license. If you wish to update to OS X 10.9 (Mavericks) and are still using TextMate 1.x then you should be aware that some bundle items will fail due to ruby 2.0 now being the default.

Our recommended fix is to upgrade to TextMate 2.0, which is a free¹ update and can be downloaded from — the reason we still label it alpha is mainly because the manual is incomplete.

The preliminary manual is at and we have a dozen or so blog posts about 2.0 features at but you can also email the mailing list or contact support with any questions, see

zetter / gist:7133389
Last active Dec 26, 2015
Rails development on OSX Mavericks
View gist:7133389


  • Install mavericks
  • Reinstall Command line tools[1] or Xcode (you may have problems using git and other tools even if they are already installed before you do this)
  • run brew update

Known problems:


Texmate 1 won't work very well with the updated system ruby. You should use a recent Textmate 2 alpha.


zetter / frozen_string.rb
Created Sep 10, 2013
Sytax for declaring frozen strings
View frozen_string.rb
class String
def -@
#> x = -"abc" #=> "abc"
#> x[1] = 'd'
# RuntimeError: can't modify frozen String
zetter / top_language_golf.rb
Created Jul 31, 2013
Code Golf. Get the top language from a users github profile. Run with the username, e.g. 'ruby top_language_golf.rb zetter'
View top_language_golf.rb
require 'open-uri';puts open(""+ARGV[0]).read[/dd\>([^,]*)/,1]