My Recent Pastes (141 and counting)

Pastes by Brian Donovan (141 and counting)

Pages:

Below are the 15 most recent pasties by Brian Donovan.

November 06, 2007
6:23PM EDT
by Brian Donovan

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

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

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

#!/usr/bin/ruby

class Array
  def to_sentence
    return first.to_s if size < 2

August 15, 2007
2:02PM EDT
by Brian Donovan

class ConfigFile
  attr_accessor :file, :environment
  
  def initialize(file, environment)
    @file, @environment = file, environment

August 14, 2007
5:38PM EDT
by Brian Donovan

  # 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

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

  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

  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

class Activity < ActiveRecord::Base
  belongs_to :user
  serialize :context
  
  def self.find_recent(limit=5)

July 30, 2007
3:59PM EDT
by Brian Donovan

>> def foo
>> 'bar'
>> end
=> nil
>> method(:foo)

July 14, 2007
8:01PM EDT
by Brian Donovan

$LOADED_SCRIPTS = {}

def absrequire(file)
  found_candidate = false
  files = ["#{file.sub(/\.rb$/, '')}.rb", file].uniq

July 14, 2007
7:53PM EDT
by Brian Donovan

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

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

<?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>

Next page