Skip to content

Instantly share code, notes, and snippets.

Chris Zetter zetter

Block or report user

Report or block zetter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zetter
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/iconfont.dev.svg
require 'nokogiri'
file = ARGV[0]
svg = File.open(file)
document = Nokogiri::XML(svg)
@zetter
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
https://gist.github.com/zetter/7387018
To use:
+ Set the path to an existing directory where you want to save the
pages.
+ 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
zetter / find_git_remote_branches.sh
Created Oct 31, 2013
List the remote branches that with a last commit that you authored.
View find_git_remote_branches.sh
# 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`;
done
}
# show filtered remote branches
function find_git_remote_branches {
@zetter
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
STDOUT.reopen(@write_io)
@zetter
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 https://macromates.com/download — the reason we still label it alpha is mainly because the manual is incomplete.

The preliminary manual is at http://manual.textmate.org/ and we have a dozen or so blog posts about 2.0 features at https://macromates.com/blog/categories/textmate-2/ but you can also email the mailing list or contact support with any questions, see https://macromates.com/contact.

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

Do:

  • 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:

Textmate

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

PhantomJS

@zetter
zetter / frozen_string.rb
Created Sep 10, 2013
Sytax for declaring frozen strings
View frozen_string.rb
class String
def -@
self.freeze
end
end
#> x = -"abc" #=> "abc"
#> x[1] = 'd'
# RuntimeError: can't modify frozen String
@zetter
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("https://github.com/"+ARGV[0]).read[/dd\>([^,]*)/,1]
@zetter
zetter / default_whenever.rb
Last active Dec 19, 2015 — forked from evizitei/default_whenever.rb
Setup whenever on engineyard for all deployed applications that have the whenever gem bundled on the util instance called 'util'
View default_whenever.rb
#
# Cookbook Name:: whenever
# Recipe:: default
#
# for the until instance named 'util'
if node[:name] == 'util'
ey_cloud_report "whenever" do
message "Starting whenever recipe"
end
@zetter
zetter / linkconverter.js
Created Nov 9, 2012
Why links should not say 'click here'. Requires jQuery
View linkconverter.js
$('a').each(function(i, a){a=$(a);var t=a.text();a.text('here');a.before('click ');a.after(' to go to '+t);})
You can’t perform that action at this time.