Skip to content

Instantly share code, notes, and snippets.

View ruby-parsing-bug.markdown

A parsing bug in ruby 1.9.2 allowed you to pass blocks to methods preceded by a comma. The bug only affected blocks with do/end and was fixed in 1.9.3.

$ rvm use ruby 1.8.7

[1].inject :+, do |x| 1 end
# => SyntaxError: compile error
zetter / SuperReCSS.markdown
Created Mar 21, 2012
Modified ReCSS to reload styles on window focus
View SuperReCSS.markdown

Only tested in chrome, shove this in a bookmarklet:

javascript:void(function(){var r=(function(){var i,a,s;a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {var h=s.href.replace(/(&|%5C?)forceReload=\d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf())}}}); window.addEventListener('focus',r,false)})();

View for_sale.markdown

For Sale

Make me an offer!

Plug & Battery


  • Ten Stories About Smoking
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);})
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"
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]
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 / 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 / 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: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