Skip to content

Instantly share code, notes, and snippets.

Rob Anderton rob-at-thewebfellas

Block or report user

Report or block rob-at-thewebfellas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rack.rb
module Rack
module Utils
def parse_query(qs, d = nil)
params = {}
(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
k, v = p.split('=', 2).map { |x| unescape(x) }
if cur = params[k]
if cur.class == Array
params[k] << v
View paired.rb
c = Mongo::Connection.paired([['localhost', 27017], ['localhost', 27018]])
=> #<Mongo::Connection:0x1016c2418 @size=1, @checked_out=[], @connection_mutex=#<Mutex:0x1016c2300>, @logger=nil, @id_lock=#<Mutex:0x1016c22d8>, @options={}, @sockets=[], @nodes=[["localhost", 27017], ["localhost", 27018]], @timeout=5.0, @port=nil, @queue=#<ConditionVariable:0x1016c2238>, @auths=[], @slave_ok=nil, @host=nil, @safe_mutex=#<Mutex:0x1016c2260>>
c.database_info
Mongo::ConnectionFailure: Failed to connect socket: getaddrinfo: nodename nor servname provided, or not known
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:548:in `checkout_new_socket'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:582:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:578:in `synchronize'
View new_s3_gem_and_other_fixes.diff
From 007fcd79294ebcb97c5e0beb25a65c24928812cf Mon Sep 17 00:00:00 2001
From: Rob Anderton <rob.anderton@thewebfellas.com>
Date: Tue, 30 Mar 2010 16:44:52 +0100
Subject: [PATCH 1/5] fix problems with newer versions of test/unit
---
test/helper.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/helper.rb b/test/helper.rb
View paperclip.rb
# S3 backend for paperclip plugin. Copy the file to:
# +config/initializers/+ directory
#
# Example configuration for CNAME bucket:
#
# has_attached_file :image,
# :s3_host_alias => "bucket.domain.tld",
# :url => ":s3_alias_url",
# :styles => {
# :medium => "300x300>",
View _run_first.rb
Dir[File.join(Rails.root, 'lib', 'patches', '**', '*.rb')].sort.each { |patch| require(patch) }
@rob-at-thewebfellas
rob-at-thewebfellas / modules.rb
Created Apr 27, 2009
Deletable attachment module for Paperclip
View modules.rb
ActiveRecord::Base.send(:include, TheWebFellas::HasDeletableAttachment)
@rob-at-thewebfellas
rob-at-thewebfellas / track.rb
Created Mar 14, 2009
Getting MP3 information with Paperclip
View track.rb
class Track < ActiveRecord::Base
#
# All the usual stuff
#
before_save :update_mp3_info
#
# More stuff
#
You can’t perform that action at this time.