View hash_assign_vs_merge.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require "benchmark/ips" | |
hash1 = {} | |
hash2 = {} | |
Benchmark.ips do |x| | |
x.report("assign") do |
View fibonacci.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module PatternMatching | |
def self.extended(base) | |
base.class_eval do | |
@__pn_methods = {} | |
end | |
end | |
def __pn_methods |
View output.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) Dry::Configurable::DSL compiles but deprecates giving a default as positional argument | |
Failure/Error: expect(logger.string).to match(/#{FileUtils.pwd}.*default value as positional argument to settings is deprecated/) | |
expected "/Users/jodosha/.gem/ruby/3.0.1/gems/rspec-core-3.10.1/lib/rspec/core/example.rb:262:in `block in run...ed and will be removed in the next major version\nProvide a `default:` keyword argument instead\n\n" to match /\/Users\/jodosha\/Code\/dry-rb\/dry-configurabl | |
e.*default value as positional argument to settings is deprecated/ | |
Diff: | |
@@ -1,2 +1,3 @@ | |
-/\/Users\/jodosha\/Code\/dry-rb\/dry-configurable.*default value as positional argument to settings is deprecated/ |
View rake.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⚡ bundle exec rake | |
/Users/jodosha/.rubies/ruby-3.0.1/bin/ruby -I/Users/jodosha/.gem/ruby/3.0.1/gems/rspec-core-3.10.1/lib:/Users/jodosha/.gem/ruby/3.0.1/gems/rspec-support-3.10.2/lib /Users/jodosha/.gem/ruby/3.0.1/gems/rspec-core-3.10.1/exe/rspec /Users/jodosha/Code/hanami/monolith-template/spec/suite --pattern **/*_spec.rb | |
An error occurred while loading ./spec/suite/main/features/home_spec.rb. | |
Failure/Error: class Action < Hanami::Action | |
TypeError: | |
no implicit conversion of nil into String | |
# /Users/jodosha/.gem/ruby/3.0.1/gems/hanami-controller-2.0.0.alpha2/lib/hanami/action/configuration.rb:410:in `public_directory' | |
# /Users/jodosha/.gem/ruby/3.0.1/gems/hanami-controller-2.0.0.alpha2/lib/hanami/action/application_configuration.rb:81:in `public_send' |
View config.ru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/setup" | |
require "hanami/api" | |
require "hanami/api/container" | |
class Routes | |
def url(name) | |
"/#{name}" | |
end |
View benchmark.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
require_relative "./method_overloading" | |
class Foo | |
include MethodOverloading | |
def call(number) | |
"foo #{number}" | |
end | |
end |
View thread_current.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
Thread.current[:request_id] = 'abc123' | |
puts "main thread: #{Thread.current[:request_id]}" | |
Thread.new do | |
puts "inner thread: #{Thread.current[:request_id]}" | |
end.join |
View memory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "pathname" | |
require "memory_profiler" | |
class Env | |
def load!(*) | |
end | |
end |
View bench.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "benchmark/ips" | |
require "set" | |
INPUT = 100.times.map { "my-test-string" }.freeze | |
Benchmark.ips do |x| | |
x.report("Array#uniq") { INPUT.uniq } | |
x.report("Set#to_a") { Set.new(INPUT).to_a } |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "rack" | |
gem "puma" | |
gem "guard-puma" |
NewerOlder