The linked GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics that might be interesting for most of us. (e.g. Ruby, Rails, Git, Unix..)
Here is an excerpt of all the Ruby TILs Show archive.org snapshot that were new to me. I encourage you to take your time to skim over the original list as well!
Hash#assoc
can be used to grab both the key and value from a hashRSpec.configure do |config|
config.example_status_persistence_file_path = "tmp/failed_specs.txt"
end
# Then, run "rspec --only-failures"
RubyVM::InstructionSequence#compile
can be used to compile Ruby code on the fly. It offers a #disasm
method for further inspection.{ key: [1,2] }.each { |key, (x, y)| puts "#{x}- #{y}" }
freeze
to constants of a given file# frozen_string_literal: true
binding.local_variables.inspect
String#split
takes a second argument to limit the number of applied splits$!
global variable contains the last exception that was raised in the current call stackbundle outdated
compares the versions of all gem dependencies against the gem servergem environment
%r|/foo/bar|
stub_request(:post, %r|/api/posts|)
count
can be used like "count by":[1,2,3].count { |x| x.odd? }
bundle install --jobs 4
bundle _1.16.6_ --version
puts "I am #@name"
String#squeeze
is like String#squish
but replaces multiple subsequent occurrences of a given character with a single one let(:order) do
create(:order, name: "My Order").tap do |order|
create(:item, name: "Burger", order: order, price: 4.99)
create(:item, name: "Fries", order: order, price: 2.99)
end
end
Float#next_float
Float#previous_float
copy('data')
.git show :/regex
Show archive.org snapshot
git log -L12:25:README.md
Show archive.org snapshot
git add -p
with single key presses
Show archive.org snapshot
git stash -k
Show archive.org snapshot