Skip to content

Instantly share code, notes, and snippets.

View jm's full-sized avatar
💫
Livin' life. Or something.

Jeremy McAnally jm

💫
Livin' life. Or something.
View GitHub Profile
m = mail(:to => "[email protected]", :from => "[email protected]", :body => "fail", :subject => "yeah")
m['X-Custom-Thing'] = whatever
@jm
jm / attr.rb
Created June 19, 2010 18:49 — forked from danielwellman/attr.rb
class ClassWithAttr
def self.my_attr_accessor(attr_name)
define_method("#{attr_name}=") do |arg|
instance_variable_set("@#{attr_name}", arg)
end
define_method(attr_name) do
instance_variable_get("@#{attr_name}")
end
end
class Bar
attr_reader :hash
def method_missing(m, *args)
if m.to_s =~ /((set|get)_(.+))/
case $2
when 'set'
self.class.send(:define_method,$1, lambda {|value| @hash ||= {}; @hash[$3] = value})
send($1, args[0])
when 'get'
self.class.send(:define_method,$1, lambda {@hash ||= {}; @hash[$3]})
class PostsController < ApplicationController
respond_to :html, :xml
def index
@posts = Post.all
respond_with @posts
end
def show
root@mycomp:/home# gem --version
1.2.0
root@mycomp:/home# gem update --system
Updating RubyGems...
Nothing to update
root@mycomp:/home# gem install rubygems-update --version=1.3.0
root@mycomp:/home# update_rubygems
# Tons of text...
First, rewinding head to replay your work on top of it...
Applying: Improve rewindable input test coverage so tests fail when you remove the middleware
error: actionpack/test/controller/request/multipart_params_parsing_test.rb: does not exist in index
error: actionpack/test/controller/request/url_encoded_params_parsing_test.rb: does not exist in index
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Renaming actionpack/test/controller/request/multipart_params_parsing_test.rb => actionpack/test/dispatch/request/multipart_params_parsing_test.rb
Auto-merging actionpack/test/dispatch/request/multipart_params_parsing_test.rb
CONFLICT (rename/modify): Merge conflict in actionpack/test/dispatch/request/multipart_params_parsing_test.rb
Renaming actionpack/test/controller/request/url_encoded_params_parsing_test.rb => actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
class A
@@foo = "from A"
end
class B < A
@@foo = "from B"
end
# What's the value of @@foo in A now...?
[codestuff (master)]$ sudo gem install session
Bulk updating Gem source index for: http://gems.github.com
ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 403 fetching http://gems.rubyforge.org/yaml
class ShapeController < AC::Base
SHAPES = { 'square' => Shape::Square, 'circle' => Shape::Circle }
def create
s = SHAPES[params[:shape]].create(params)
end
end
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git'
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git'
gem 'mislav-will-paginate'
gem 'ruby-openid'
gem 'rubyist-aasm'
rakefile "bootstrap.rake", <<CODE
namespace :app do