Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rob-at-thewebfellas's full-sized avatar

Rob Anderton rob-at-thewebfellas

View GitHub Profile
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
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'
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
# 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>",
Dir[File.join(Rails.root, 'lib', 'patches', '**', '*.rb')].sort.each { |patch| require(patch) }
@rob-at-thewebfellas
rob-at-thewebfellas / modules.rb
Created April 27, 2009 07:47
Deletable attachment module for Paperclip
ActiveRecord::Base.send(:include, TheWebFellas::HasDeletableAttachment)
@rob-at-thewebfellas
rob-at-thewebfellas / track.rb
Created March 14, 2009 13:13
Getting MP3 information with Paperclip
class Track < ActiveRecord::Base
#
# All the usual stuff
#
before_save :update_mp3_info
#
# More stuff
#