My Recent Pastes (141 and counting)
All Pasties (129 and counting)
Below are summaries of the 15 most recent pasties by Brian Donovan.
November 06, 2007
6:23PM EDT
by Brian Donovan
View more (36 lines)
1 2 3 4 5 |
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 more (6 lines)
1 2 3 4 5 |
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 more (6 lines)
1 2 3 4 5 |
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 more (14 lines)
1 2 3 4 5 |
#!/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 more (41 lines)
1 2 3 4 5 |
class ConfigFile
attr_accessor :file, :environment
def initialize(file, environment)
@file, @environment = file, environment
|
August 14, 2007
5:38PM EDT
by Brian Donovan
View more (15 lines)
1 2 3 4 5 |
# 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 more (16 lines)
1 2 3 4 5 |
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 more (10 lines)
1 2 3 4 5 |
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 more (27 lines)
1 2 3 4 5 |
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 more (8 lines)
1 2 3 4 5 |
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 more (10 lines)
1 2 3 4 5 |
>> def foo >> 'bar' >> end => nil >> method(:foo) |
July 14, 2007
8:01PM EDT
by Brian Donovan
View more (23 lines)
1 2 3 4 5 |
$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 more (75 lines)
1 2 3 4 5 |
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 more (55 lines)
1 2 3 4 5 |
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 more (16 lines)
1 2 3 4 5 |
<?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>
|
Pastie