Ruby Block Precedence

Ruby has two succinct ways of representing a block: However, there is a slight difference as demonstrated next, where we select our training days. The short form: Versus the long form: Uh oh..what happened to our output, where did our training days go? The reason this happened is because in the long form the puts […]

# frozen_string_literal

If you are coding in Ruby 2.3 or newer, using RuboCop, you may have noticed this warning: What is this? To improve performance, there were plans in Ruby 3 to use frozen string literals by default. In the end, this feature implementation was dropped. However, you can still use this magic comment, which must appear […]

Ruby Block Scope

Ruby makes good use of anonymous functions (code blocks) which the calling functions yield arguments to: Under the hood, the upto method is looping from 1 to 3, and on each loop it yields the index to the associated code block (anonymous function). The value yielded to the block is received in the n argument, […]

Installing Yarn and ChromeDriver for Rails

In addition to my previous post on installing Rails in Ubuntu, here are the instructions to install Yarn and ChromeDriver: curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add – echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt update sudo apt install yarn chromium-chromedriver sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin