Recently I’ve been working as a Rails developer. I’ve always enjoyed Ruby and I’m grateful for the chance to learn more about this magical language. However, I found myself grappling with a huge code base, and an unfamiliar business domain. Overcoming inertia is often the biggest challenge on a new project. It seems that projects […]

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

On Writing Software

Software development is huge, it’s everywhere, into everything. It’s easy to get lost. Am I a kernel developer, an enterprise developer, or a game developer? And it’s easy to feel disillusioned when we find our skills and knowledge lacking on certain tasks as we resort more and more to Google and Stack Overflow. On top […]