Skip to content

Instantly share code, notes, and snippets.

Avatar
🌈
It's complicated?

Ryan Davis zenspider

🌈
It's complicated?
View GitHub Profile
View ar_sti_assoc_create_type_check.rb
raise "remove me: this bug has been fixed in rails 6" if RAILS6
module PatchPolymorphicCheck
ON_BAD_CREATE = :log
POOP = "💩".freeze
def _handle_create_type(inst, meth, &block)
klass = inst.class
actual = klass.name
expect = inst[klass.inheritance_column]
View gist:1925f73c0a7a156bbd36e7e475b806ca
original stacktrace size: 11658
compressed stacktrace size: 275 (0.31s)
GEMS/arel-6.0.4/lib/arel/visitors/to_sql.rb:167:in `table_exists?'
GEMS/arel-6.0.4/lib/arel/visitors/to_sql.rb:175:in `column_for'
GEMS/arel-6.0.4/lib/arel/visitors/to_sql.rb:732:in `quoted'
GEMS/arel-6.0.4/lib/arel/visitors/to_sql.rb:151:in `visit_Arel_Nodes_Casted'
GEMS/arel-6.0.4/lib/arel/visitors/reduce.rb:13:in `visit'
GEMS/arel-6.0.4/lib/arel/visitors/mysql.rb:35:in `visit_Arel_Nodes_Bin'
GEMS/arel-6.0.4/lib/arel/visitors/reduce.rb:13:in `visit'
@zenspider
zenspider / anonymous-gist.
Created Aug 13, 2020
better backtrace cmd for pry-byebug
View anonymous-gist.
class Byebug::PryProcessor
CMDS = %i[
backtrace
down
finish
frame
next
step
up
]
View hash.rb
Dir.chdir "#{base_dir}/tmp" do
bee = WorkerBee.new
bee.trap_interrupt!
bee.periodic { puts bee.counts.join "\t"; cleanup_empties }
bee.input(*gems)
bee.work(3) { |path| unpack_gem path, skip }
bee.compact
bee.work { |path| Dir.glob("#{path}/**/*", File::FNM_DOTMATCH) }
bee.flatten
View fail.rb
#!/usr/bin/env ruby -ws
$f ||= false # fast
require "fileutils"
FileUtils.mkdir_p "results"
class Array
def human_sort
View travis_current_failures.rb
#!/usr/bin/env ruby
require "isolate"
Isolate.now! name:"travis-2020-05-08" do
gem "travis"
gem "pry"
gem "octokit"
end
View commit_by_owner.rb
#!/usr/bin/env ruby -ws
$y ||= false
require "pp"
abort "need a commit message" if ARGV.empty?
msg = ARGV.join " "
View *vc-diff*.diff
diff --git a/railties/test/test_unit/reporter_test.rb b/railties/test/test_unit/reporter_test.rb
index 81b7ab19a1..25b711cc99 100644
--- a/railties/test/test_unit/reporter_test.rb
+++ b/railties/test/test_unit/reporter_test.rb
@@ -72,7 +72,7 @@ def woot; end
@reporter.record(errored_test)
@reporter.report
- expect = %r{\AE\n\nError:\nTestUnitReporterTest::ExampleTest#woot:\nArgumentError: wups\n \n\nrails test .*test/test_unit/reporter_test\.rb:\d+\n\n\z}
+ expect = %r{\AE\n\nError:\nTestUnitReporterTest::ExampleTest#woot:\nArgumentError: wups\n some_test.rb:4\n\nrails test .*test/test_unit/reporter_test\.rb:\d+\n\n\z}
View travis_logs_dl.rb
#!/usr/bin/env ruby
require "isolate"
Isolate.now! name:"travis-2020-05-08" do
gem "travis"
gem "pry"
end
require "travis"
View gist:6052691d0e25a27c1619e776bc2633da
10020 % ./your_example_is_bullshit.rb
Warming up --------------------------------------
null (50) 29.399k i/100ms
eager (50) 28.822k i/100ms
lazy (50) 12.676k i/100ms
null (17576) 32.000 i/100ms
eager (17576) 32.000 i/100ms
lazy (17576) 7.302k i/100ms
Calculating -------------------------------------
null (50) 314.131k (± 1.7%) i/s - 1.588M in 5.055265s
You can’t perform that action at this time.