Skip to content

Instantly share code, notes, and snippets.

View mulder's full-sized avatar

Nicholas Mulder mulder

  • Wealthsimple
  • Waterloo, Ontario
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mulder on github.
  • I am mulder (https://keybase.io/mulder) on keybase.
  • I have a public key whose fingerprint is FB42 6F57 4384 DDB5 CE0D CB53 4341 E202 3926 9967

To claim this, I am signing this object:

def self.new(t);t.class==Class ? t.new : t;end;def method_missing(*a);c=Kernel.const_get(a[0]) rescue(nil);c ? c.new(*a[1..-1]) : super; end
@mulder
mulder / random_time.rb
Created November 24, 2009 16:06
Random Time
def random_time(no_older_then = 432000, now = Time.now)
oldest = now - no_older_then
Time.at(rand(no_older_then) + oldest.to_i)
end
Help me I git reset --hard
It is possible to recover it if Git hasn't garbage collected yet.
Get an overview of dangling commits with fsck:
$ git fsck --lost-found
dangling commit b72e67a9bb3f1fc1b64528bcce031af4f0d6fcbf
Recover the dangling commit with rebase:
Relation.find_all_by_to_type('Content::Article').each {|r| r.from_type,r.from_id,r.to_type,r.to_id = r.to_type,r.to_id,r.from_type,r.from_id; r.save}
@mulder
mulder / .gems
Created November 27, 2009 15:39
Host Jekyll site on Heroku!
jekyll
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development, :test do
gem "rspec-rails", ">= 2.0.0.rc"
gem 'remarkable_activerecord', '4.0.0.alpha4'
rails new bdd_sandbox -T
My First Spec
should work
should do something
Matcher Demo
should demo simple eql matcher
should demo true/false matcher
should demo be_a matcher
should demo collection matchers
Finished in 0.03168 seconds
gem install bundler
bundle install