My Recent Pastes (141 and counting)
Pastes by Brian Donovan (141 and counting)
Below are the 15 most recent pasties by Brian Donovan.
November 06, 2007
6:23PM EDT
by Brian Donovan
View all 36 lines
Request: REQUEST_URI: /jobs (2007-11-06 15:22:15)
Params: {"format"=>nil, "action"=>"index", "id"=>nil, "controller"=>"jobs"}
Cookies: {}
wrong number of arguments (1 for 0) - (ArgumentError)
/opt/local/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:57:in `index'
October 29, 2007
1:24PM EDT
by Brian Donovan
View all 6 lines
Unable to marshal class 0x3009f4 = Array! Unable to marshal class 0x3009f4 = Array! Unable to marshal class 0x3009f4 = Array! Module#attr_writer creates a setter for each given attribute name Exception: you need to use all the arguments (ArgumentError)
August 21, 2007
5:19PM EDT
by Brian Donovan
View all 6 lines
class String
def self.random(length=10)
chars = ("A".."Z").to_a + ("a".."z").to_a + ("0".."9").to_a
(0...length).map { chars[rand(chars.size)] }.join
end
August 17, 2007
11:53PM EDT
by Brian Donovan
View all 14 lines
#!/usr/bin/ruby
class Array
def to_sentence
return first.to_s if size < 2
August 15, 2007
2:02PM EDT
by Brian Donovan
View all 41 lines
class ConfigFile
attr_accessor :file, :environment
def initialize(file, environment)
@file, @environment = file, environment
August 14, 2007
5:38PM EDT
by Brian Donovan
View all 15 lines
# Silences any stream for the duration of the block. # # silence_stream(STDOUT) do # puts 'This will never be seen' # end
August 13, 2007
4:07PM EDT
by Brian Donovan
View all 16 lines
module Enumerable
def mdetect
each { |o| v = yield(o); return v if v }
return nil
end
August 10, 2007
12:25PM EDT
by Brian Donovan
View all 10 lines
def update
@widget = Widget.find(params[:id])
redirect_to :action => 'index' and return unless @widget.editable_by?(current_user)
if @widget.update_attributes(params[:widget])
August 10, 2007
12:15PM EDT
by Brian Donovan
View all 27 lines
def update
@widget = Widget.load_widget_from_memcache(params[:widget_memcache_id])
redirect_to :action => 'list' and return unless @widget
redirect_to :action => 'list' and return unless @widget.editable_by?(current_user)
handle_attached_picture @widget
August 08, 2007
2:52PM EDT
by Brian Donovan
View all 8 lines
class Activity < ActiveRecord::Base belongs_to :user serialize :context def self.find_recent(limit=5)
July 30, 2007
3:59PM EDT
by Brian Donovan
View all 10 lines
>> def foo >> 'bar' >> end => nil >> method(:foo)
July 14, 2007
8:01PM EDT
by Brian Donovan
View all 23 lines
$LOADED_SCRIPTS = {}
def absrequire(file)
found_candidate = false
files = ["#{file.sub(/\.rb$/, '')}.rb", file].uniq
July 14, 2007
7:53PM EDT
by Brian Donovan
View all 75 lines
require '../src/absrequire'
describe 'absrequire' do
before :all do
@original_cwd = File.expand_path(File.dirname(__FILE__))
July 14, 2007
2:32PM EDT
by Brian Donovan
View all 55 lines
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Array #:nodoc:
module Grouping
# Iterate over an array in groups of a certain size, padding any remaining
July 13, 2007
7:56PM EDT
by Brian Donovan
View all 16 lines
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
