Skip to content

Instantly share code, notes, and snippets.

def irb_load(fn, priv = nil)
path = search_file_from_ruby_path(fn)
raise LoadError, "No such file to load -- #{fn}" unless path
load_file(path, priv)
end
def search_file_from_ruby_path(fn)
if /^#{Regexp.quote(File::Separator)}/ =~ fn
return fn if File.exist?(fn)
@carlhuda
carlhuda / evil.css
Created November 25, 2009 11:10 — forked from nex3/evil.css
#foo
.bar .baz
#bang {color: blue}
@carlhuda
carlhuda / evil.css
Created November 25, 2009 11:19 — forked from nex3/evil.css
#foo {font-size: 10em}
#foo .bar {color: green}
#foo .bop {color: blue}
catch(:EXISTS) do
@jobs.each_index do |i|
if @jobs[i] and (@jobs[i][0] == key ||
@jobs[i][1] == key ||
@jobs[i][1].context.main.equal?(key))
@jobs[i] = nil
throw :EXISTS
end
end
IRB.fail NoSuchJob, key
Rails 3.0.pre (git)
Loaded suite DepotTest
Started
................F..F......EE................
Finished in 3.577538 seconds.
1) Failure:
test_21.2_Routing_Requests(DepotTest)
[/Users/carlhuda/Developer/Source/awdwr/checkdepot.rb:988
/Users/carlhuda/.rvm/gems/ruby/1.8.7/gems/gorp-0.9.0/lib/gorp/test.rb:48:in `instance_eval'
"/Users/carlhuda/.rvm/jruby-head/bin/jruby -I/Users/carlhuda/Developer/Source/bundler/spec/support/../../lib -r /Users/carlhuda/Developer/Source/bundler/tmp/bundled_app/vendor/gems/environment -e \"puts \\$:\""
irb(main):013:0> ActionView::Base.ancestors.include?(ActionView::Helpers)
=> true
irb(main):015:0> ActionView::Base.ancestors.include?(ActionView::Helpers::CacheHelper)
=> false
irb(main):016:0> ActionView::Helpers.ancestors.include?(ActionView::Helpers::CacheHelper)
=> true
irb(main):017:0> ActionView::Base.ancestors
=> [ActionView::Base, #<Module:0x101d54a88>, ActionDispatch::Routing::Helpers, ActionController::PolymorphicRoutes, WillPaginate::ViewHelpers, ActionView::Context, ActionView::CompiledTemplates, ActionView::Helpers, ActiveSupport::Benchmarkable, ActionView::Rendering, ActionView::Partials, ERB::Util, Object, Mocha::ObjectMethods, Base64::Deprecated, Base64, ActiveSupport::Dependencies::Loadable, Arel::Sql::ObjectExtensions, Arel::ObjectExtensions, Kernel]
irb(main):018:0> ActionView::Helpers.ancestors
[carlhuda@Carlhudas-iMac bundler (env_bundle_refactor)]$ spec -c spec/bundler/directory_spec.rb -e 'Faking gems with directories with a simple directory structure stubbing out a gem with a directory -- 1 can bundle --cached'
F
1)
NoMethodError in 'Faking gems with directories with a simple directory structure stubbing out a gem with a directory -- 1 can bundle --cached'
undefined method `filename' for #<Bundler::Environment:0x1017309e0>
/Users/carlhuda/Developer/Source/bundler/tmp/bundled_app/Gemfile:3:in `evaluate'
/Users/carlhuda/Developer/Source/bundler/spec/support/helpers.rb:43:in `build_manifest'
/Users/carlhuda/Developer/Source/bundler/spec/support/helpers.rb:41:in `chdir'
/Users/carlhuda/Developer/Source/bundler/spec/support/helpers.rb:41:in `build_manifest'
$ bundle install
Source: Fetching remote index for `http://gemcutter.org`... done.
Source: Processing index... Done.
Source: Cloning `git://github.com/rails/rails.git`... Done.
Source: Processing index... Done.
Resolving dependencies... Done.
* text-hyphen (1.0.0)
* Downloading...
* Installing...
* activesupport (3.0.pre)
module TopLevel
class Foo
def to_s
"<An instance of Foo>"
end
alias inspect to_s
class << self
def to_s
"<Foo's metaclass>"