Skip to content

Instantly share code, notes, and snippets.

View walski's full-sized avatar

Thorben Starsy walski

View GitHub Profile
@walski
walski / inject_this.rb
Created April 24, 2012 17:08 — forked from cowboyd/inject_this.rb
Injecting an value into a binding
def inject_this_as_reference(block, this_object)
block.binding.eval("lambda {|v| @this = v}").call(this_object)
end
def inject_this_as_method(block, this_object)
block.binding.eval('self.singleton_class').send(:define_method, :this) {this_object}
end
fn = lambda { "this is #{@this}"}
inject_this_as_reference fn, "Radical!" #=> This is Radical!
@walski
walski / hack.sh
Created March 31, 2012 11:41 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@walski
walski / app.js
Created October 23, 2010 20:58 — forked from ahx/app.js
/*global Handlebars */
// "jsonp!/user/123?callback=?", "text!/user.mustache"
var userData = {
name: "Thorben"
};
//var userData = Model.new({
#!/bin/sh
# Rails 3 - Quick install via CURL
# This will not install using Gem; can update via git-pull
# curl -L# http://gist.github.com/279171.txt | sh
# Tested on OSX and Ubuntu/Debian
# -- Bryan Goines
git clone git://github.com/rails/rails.git