Skip to content

Instantly share code, notes, and snippets.

@jdar
jdar / gist:4463481
Last active December 10, 2015 16:48 — forked from anonymous/gist:4420790
I'm sad that this is the solution.
class Log1Buffer < ::Array
for meth in PUBLIC_METHODS = %w(debug info warn error fatal).map(&:to_sym)
eval "define_method(:#{meth}){|*a| push [:#{meth}, *a] }"
end
end
1.9.3p194 :062 > buffer.debug "something"
=> [[:fatal, "something"]]
class Log2Buffer < ::Array
@jdar
jdar / gist:182486
Created September 7, 2009 18:03 — forked from rhynix/gist:182485
map.resources :users, :except=>[:new, :create]
map.resources :users, :only=>[:new,:create], :as => :register
# Creates these routes
users GET /users(.:format) {:controller=>"users", :action=>"index"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
POST /register(.:format) {:controller=>"users", :action=>"create"}