The test for this small change to a shopping cart object passes, but only because it makes the same logical error that the implementation code does. Can you spot what it is doing wrong? And if so, what would the correct `cart.total` be once the code is fixed?
Ruby + Rails : Shuffle
by @skillstopractice.com
Shuffled up remix of the Ruby + Rails : Distilled archival feed. Most of the posts there are somewhat timeless. So why not throw some old ones in the gem tumbler and see what comes out?
This seemingly pointless change made a very significant performance difference. Can you guess why? The answer is in the PR: github.com/okuramasafum...
Made a patch for Ruby that I think is cool, but probably can't be on by default. It emits a warning when an object is mutated from a thread that didn't create the object (patch is here: github.com/ruby/ruby/co...)
When you're working on libraries, you sometimes get to implement the weirdest tests ever. How about we test if a method can be called in a trap context without crashing due to mutex synchronization? #ruby #testing #rspec #sentry #threadsarehard
just learned about mermaid.js.org idek where I would use this, but it looks so cool (also im a sucker for sequence diagrams)
Using HTTP request body for #Rails routing: Slack integration case study. Check it out here: pankowecki.pl/posts/slack-...
types in Ruby value objects hot or not? from @lucianghinda.com recent blogpost
It doesn't take much to make Arel more ergonomic.
Sometimes this code works just fine (see its output in the console for an example) But run it enough times and you'll find two different broken behaviors as well. Read the code and see if you can figure out what they are without trying to run the program. What's the root cause of the issue?
Just dropped 0.1.13 of `url-builder` gem, which adds support for path traversal on URIs. You can read more about it at github.com/rubymonolith...
When creating data types in Ruby, I often make a factory method that does 2 things you can't do in an initializer: 1 - if the argument is nil, return nil 2 - if the argument is already of the data type, return it https://gist.github.com/davetron5000/1a6b394f4295f1b70062baab013d297f#file-factory-rb
Interesting fact about #RubyLang, frozen empty strings and methods that operate on them, like byteslice in this example: it returns a new empty string instance! If your app allocates tons of empty strings, you could easily optimize it 🙂 Things I learn when reviewing PRs in sentry-ruby SDK!
Free sample of my "Bug Hunt : Volume 1" guidebook is now live. Check it out here: bh-1.skillstopractice.com (10 of 56 exercises included) Please preorder if you expect the full guide will be useful to you after trying the sample. Much more to say on all this, but for now, happy hunting!