Public Gists by therealadam

Gravatar
Tue Oct 27 18:38:20 -0700 2009
1
2
3
# attribute_mapper is a plugin I worked on a little at FiveRuns
# and later extracted because I think it's rad. It's a better way to do
# enumerated values in your models.
Gravatar
Sat Sep 05 09:04:40 -0700 2009
1
2
3
require 'rubygems'
require 'validatable'
 
Gravatar
Sat Aug 29 07:20:20 -0700 2009
1
2
3
module BlameTheCompiler
  
  def method_added(name)
Gravatar
Thu May 28 06:08:21 -0700 2009
1
2
3
# A shoulda macro for verifying a class has the writer attribute readers,
# writers and accessors. NOTE: I could be silly for wanting this. But it was
# there. So here it is.
Gravatar
Tue Apr 21 08:43:44 -0700 2009
1
2
3
require 'test/unit'
require 'rubygems'
require 'activesupport'
Gravatar
Sun Feb 22 21:01:06 -0800 2009
1
2
3
diff --git a/vm/compiler.c b/vm/compiler.c
index cfd6f57..64e098d 100644
--- a/vm/compiler.c
Gravatar
Mon Jan 19 17:29:52 -0800 2009
1
2
3
not_found do
  'Bonk'
end
Gravatar
Mon Jan 19 07:11:09 -0800 2009
1
2
3
require 'test/unit'
require 'rubygems'
require 'shoulda'
Gravatar
Mon Dec 29 16:41:50 -0800 2008
1
2
3
def whack(objects)
  objects.inject({}) { |results, o| result.update(o.send('table_name') => o.send('delete_all'] }
end
Gravatar
Sun Nov 23 19:36:16 -0800 2008
1
2
3
#
# I wanted to build a really common example app but use Git as the backend
# instead of a database or the filesystem. And so here we are.
Gravatar
Sun Oct 19 11:44:40 -0700 2008
1
2
3
  def dateChosen(sender)
    puts 'action!'
  end
Gravatar
Tue Sep 30 19:04:33 -0700 2008
1
2
3
#!/usr/bin/env ruby
#
# Seeking to answer man's eternal question "I wonder how many little Git
Gravatar
Wed Sep 24 22:07:52 -0700 2008
1
2
3
class Issue < ActiveRecord::Base
  after_create :send_notification
 
gist: 7367 'with' keyword for Ruby, if...
Gravatar
Tue Aug 26 15:00:33 -0700 2008
1
2
3
module Kernel
  def with(obj, &block)
    obj.instance_eval(&block)
Gravatar
Thu Aug 21 10:10:54 -0700 2008
1
2
3
window = 14
 
latest = Time.parse('12:00 AM')