Skip to content

Instantly share code, notes, and snippets.

View joshuaclayton's full-sized avatar

Josh Clayton joshuaclayton

View GitHub Profile
class Person
def self.region(str, &blk)
self.class_eval(&blk)
end
end
class Joe < Person
def name; "Joe"; end
region "speaking" do
@joshuaclayton
joshuaclayton / post.rb
Created September 14, 2011 03:59 — forked from avdi/post.rb
Just a tease...
class Post
include FigLeaf
include ActiveModel::Validations
# ...
end
@joshuaclayton
joshuaclayton / gist:1689665
Created January 27, 2012 16:38 — forked from kornypoet/gist:1689638
Rspec #initialize behavior
class Foo
attr_accessor :bar
def initialize(bar, validator = BarValidator)
validator.validate!(bar)
@bar = bar
end
end
class BarValidator
@joshuaclayton
joshuaclayton / hack.sh
Created April 13, 2012 20:17 — 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
#
@joshuaclayton
joshuaclayton / 0_reuse_code.js
Created September 22, 2015 14:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console