My Recent Pastes (540 and counting)
Pastes by rsl (540 and counting)
Below are the 15 most recent pasties by rsl.
April 20, 2008
3:15PM EDT
by rsl
View all 8 lines
def foo bar :baz => "baz", :quux => "quux" end it ...
April 19, 2008
3:22PM EDT
by rsl
# To shut up whining about writing to the nil logger class NilClass def debug(*args) end end
April 19, 2008
1:15PM EDT
by rsl
View all 20 lines
module Foo def self.included(base) base.extend ClassMethods end
April 19, 2008
1:12PM EDT
by rsl
View all 8 lines
module Foobar def self.included(base) base.class_eval do validates_presence_of :public, :message => "must be set" # ..., just for you. ;)
April 18, 2008
5:32PM EDT
by rsl
View all 20 lines
[5:14pm] zenspider: dying... workout hurty [5:14pm] xsdg: zenspider: :o) [5:14pm] xsdg: workouts are supposed to hurt :o) [5:14pm] zenspider: xsdg: yes, they are... but mine are... special [5:14pm] xsdg: explain?
April 18, 2008
10:47AM EDT
by rsl
View all 15 lines
module LiveSearch def self.included(base) base.extend ClassMethods end
April 18, 2008
10:38AM EDT
by rsl
View all 33 lines
# I can't take credit for this. Thank/blame toretore. ;) module RFC2822 Regex = begin alpha = "a-zA-Z"
April 15, 2008
11:56AM EDT
by rsl
NoMethodError: undefined method `debug' for nil:NilClass /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2313:in `remove_attributes_protected_from_mass_assignment'
April 14, 2008
9:27AM EDT
by rsl
View all 7 lines
def each_pixel get_pixels(0, 0, columns, rows).each_with_index do |p, n| yield(p, n%columns, n/columns) end
April 12, 2008
9:33AM EDT
by rsl
export GEM_HOME="/Library/Ruby/Gems/1.8" export GEM_PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8" export PATH="/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin:$PATH" export EDITOR='/usr/bin/mate -w' export APXS2='/opt/local/apache2/bin/apxs'
April 11, 2008
2:47PM EDT
by rsl
@category = Category.find # some conditions to load the right category, not all of them. @tutorials = @category.tutorials.find # some conditions here to load the right categories.
April 11, 2008
12:09PM EDT
by rsl
@category = @categories.select{|c| c.root.tagname == "tutorials"}
April 11, 2008
9:45AM EDT
by rsl
export GEM_HOME="/Library/Ruby/Gems/1.8" export GEM_PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8" export PATH="/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin:$PATH" export EDITOR='/usr/bin/mate -w'
April 10, 2008
3:25PM EDT
by rsl
Question.find_by_sql("SELECT AVG(value) FROM ( SELECT value FROM answers WHERE question_id=1 ORDER BY value LIMIT ( SELECT COUNT(*)/4 FROM answers WHERE question_id=1 ), (SELECT 2*(COUNT(*)/4) FROM answers WHERE question_id=1) ) as T;")