Skip to content

Instantly share code, notes, and snippets.

Avatar
©️
 ​[object Object] :trollface:

Aaron Patterson tenderlove

©️
 ​[object Object] :trollface:
View GitHub Profile
View blah.diff
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index d68fa16..fe4f7a6 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -259,5 +259,13 @@ module ActionController
lambda { |env| new.dispatch(name, ActionDispatch::Request.new(env)) }
end
end
+
+ def self.dispatch(name, req)
View Rakefile
task :isolate # stub
task :irb => :isolate do
require 'tempfile'
Tempfile.open(['lol', '.rb']) do |f|
f.write 'begin; require "my_gem"; rescue LoadError; end'
f.close
dash_i = File.dirname f.path
dash_r = File.basename f.path
ruby "-Ilib -S irb -I #{dash_i} -r #{dash_r}"
end
View crash.txt
[aaron@higgins rubygems (master)]$ ruby -d -I lib -S gem install minitst -V
Exception `LoadError' at /Users/aaron/git/rubygems/lib/rubygems.rb:1194 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/aaron/git/rubygems/lib/rubygems.rb:1203 - cannot load such file -- rubygems/defaults/ruby
Exception `NoMethodError' at /Users/aaron/git/rubygems/lib/rubygems/specification.rb:1949 - undefined method `to_ary' for #<Gem::Specification:0x007fc19b8c6450>
Exception `NoMethodError' at /Users/aaron/git/rubygems/lib/rubygems/specification.rb:1949 - undefined method `to_ary' for #<Gem::Specification:0x007fc19c018258>
Exception `NoMethodError' at /Users/aaron/git/rubygems/lib/rubygems/specification.rb:1949 - undefined method `to_ary' for #<Gem::Specification:0x007fc19c061e08>
Exception `NoMethodError' at /Users/aaron/git/rubygems/lib/rubygems/specification.rb:1949 - undefined method `to_ary' for #<Gem::Specification:0x007fc19c083418>
Exception `NoMethodError' at /Users/aaron/git/ru
View gist:9012886
1) Error:
CascadedEagerLoadingTest#test_cascaded_eager_association_loading_with_duplicated_includes:
RuntimeError:
/Users/aaron/git/rails/activerecord/lib/active_record/associations/alias_tracker.rb:13:in `initialize'
/Users/aaron/git/rails/activerecord/lib/active_record/associations/join_dependency.rb:96:in `new'
/Users/aaron/git/rails/activerecord/lib/active_record/associations/join_dependency.rb:96:in `initialize'
/Users/aaron/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:346:in `new'
/Users/aaron/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:346:in `construct_join_dependency'
/Users/aaron/git/rails/activerecord/lib/active_record/relation/finder_methods.rb:350:in `construct_relation_for_association_calculations'
/Users/aaron/git/rails/activerecord/lib/active_record/relation/calculations.rb:109:in `calculate'
View argh.rb
require 'active_record'
require 'minitest/autorun'
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
class Message < ActiveRecord::Base
connection.create_table(table_name)
connection.create_table :message_threads_messages, id: false do |t|
t.references :message
t.references :message_thread
View omg.diff
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 31b8d27..1680951 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -30,17 +30,29 @@ module ActiveRecord
unless owner.new_record?
records.flatten.each do |record|
raise_on_type_mismatch!(record)
- record.save! if record.new_record?
end
View error.rb
require 'active_record'
require 'minitest/autorun'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(adapter: "postgresql", host: "localhost", database: "test")
class User < ActiveRecord::Base
connection.create_table table_name, force: true do |t|
end
has_many :profile_views
View itr_index.rs
fn yay(left: &str) {
for (idx, c) in left.char_indices() {
println!("{} {}", idx, c);
}
}
fn main() {
yay("hello !!! こんにちは!");
}
View omg.diff
diff --git a/lib/sprockets/cache_wrapper.rb b/lib/sprockets/cache_wrapper.rb
index 8301e67..c4c9f96 100644
--- a/lib/sprockets/cache_wrapper.rb
+++ b/lib/sprockets/cache_wrapper.rb
@@ -38,21 +38,6 @@ module Sprockets
end
end
- class IndexWrapper < CacheWrapper
- def initialize(*args)
View change.diff
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb
index 8272a55..e8083a5 100644
--- a/activerecord/lib/active_record/associations/belongs_to_association.rb
+++ b/activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -46,8 +46,9 @@ module ActiveRecord
def update_counters(record)
with_cache_name do |name|
return unless different_target? record
- record.class.increment_counter(name, record.id)
- decrement_counter name