Skip to content

Instantly share code, notes, and snippets.

View jackdempsey's full-sized avatar

jack dempsey jackdempsey

View GitHub Profile
diff --git a/rack-debug.gemspec b/rack-debug.gemspec
index fb6004e..bd85e7f 100644
--- a/rack-debug.gemspec
+++ b/rack-debug.gemspec
@@ -42,14 +42,26 @@ http://github.com/github/rack-debug
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
- s.add_runtime_dependency(%q<ruby-debug>, [">= 0.10"])
+ if RUBY_VERSION < '1.9'
#!/usr/bin/env ruby
class Foo
def self.facing(arg)
puts "in facing with arg #{arg}"
end
{:front => 'A', :back => 'AB', :left => 'AA', :right => 'AC'}.each_pair do |side, letters|
instance_eval %{ def self.#{side}_facing; facing '#{letters}'; end }
end
class Component < ActiveRecord::Base
belongs_to :cabinet
belongs_to :component_model
has_many :port, :as => :device, :extend => CreatePortFromModel
has_many :sub_components
def elevation
orientation + elevation_index.to_s
end
ElevatedIndex = lambda {|comp| comp.elevated_index}
def self.foo
all.group_by { |user| ElevatedIndex.call(user) }
end
def elevated_index
rand(2)
end
class Object
def m
(self.methods - Object.new.methods).sort
end
end
~ > beet -d -r rails3/auth/devise
# this is designed for rails 3
gem 'devise', :version => '1.1.2'
generate "devise:install"
generate "devise User"
generate "devise:views"
rake "db:migrate"
rvm rubies
jruby-1.5.1 [ i386-java ]
ruby-1.8.7-p248 [ i386 ]
ruby-1.8.7-tv1_8_7_174 [ i386 ]
ruby-1.9.1-p378 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]
~ > rvm use jruby
# Automatically turns on autosave and thus also validates
accepts_nested_attributes_for :phone_numbers, :emails, :addresses,
:allow_destroy => true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
...
ERROR (src/unixy.c:165: errno: No such file or directory) Failed to open PID file ./run/mongrel2.pid for writing.
ERROR (src/mongrel2.c:163: errno: Unknown error: 0) Failed to make the PID file ./run/mongrel2.pid
ERROR (src/mongrel2.c:280: errno: Unknown error: 0) Major failure in chroot/droppriv, aborting.
ERROR (src/mongrel2.c:305: errno: Unknown error: 0) Exiting due to error.
src/mongrel2 > mkdir logs run tmp
src/mongrel2 > mongrel2 tests/config.sqlite localhost
...
diff --git a/Rakefile b/Rakefile
index 13f1f9f..423c097 100644
--- a/Rakefile
+++ b/Rakefile
@@ -4,4 +4,4 @@
require File.expand_path('../config/application', __FILE__)
require 'rake'
-Rails::Application.load_tasks
+SignInMiddlewareExample::Application.load_tasks