I'm leaving Twitter

I joined Twitter in December 2008. I was at the beginning of my career and eager to see what the web design and development field was up to. I enjoyed the platform’s brevity and the immediate consumption of information it allowed...

Day of the Dead

We recently took a trip to Puerto Vallarta, Jalisco, to witness the Day of the Dead celebrations. It shares similar timing with Halloween and folks down there celebrate both. There were many trick-or-treaters out and about, but the main attractions were the Catrinas, and folks down there celebrate both...

Using PurgeCSS with Rails

We leverage CSS frameworks like Bootstrap or Tailwind in our applications, but we likely won't use *all* elements from the framework. This means that we’re serving larger CSS files than we need to. Wouldn’t it be great if there was a way only to include the...

How to minify and add vendor prefixes in Rails 7

If you fire up a new Rails 7 project, you’ll probably be missing a couple of tools you should have: minification and vendor prefixing. Minification takes our JavaScript and CSS assets and squishes everything down by removing whitespace to make file sizes smaller. Adding vendor prefixes helps normalize the way our...

Fixing page jump in Rails websites using Turbo

This was a very annoying problem that had a straightforward fix but was hard to track down.

You have a Rails website using Hotwire/Turbo that is, after clicking a link, skipping to the top before navigating to the requested page. The steps needed to replicate are:

  1. Scroll to the bottom of the...

Regex match for spaces outside of HTML tags

Let’s say you are truncating a blog post to produce an excerpt for multiple posts in an index view. In Ruby on Rails, we can use the truncate() method like:

You might already notice a pitfall with this implementation. By setting escape to false, we are allowing HTML...

How to prepare Rails assets before running tests

I’m currently building a Rails 7 app that was started with rails new myapp --css=bootstrap. This means Rails set up my app to use esbuild to compile all my CSS and JavaScript assets. This new --css flag provided by Rails is a fantastic improvement over previous implementations like...

Pinched nerve

My creative drive is writing checks my body can’t cash. It has come to my attention that, as an Elder Millenial, I can’t combine new office equipment with increased hours working and expect to walk away unscathed. Multiplying the directional change in my gaze by the number of hours at my desk has resulted in a pi...

Using Clearance with Rails 7

For some time now, the Ruby on Rails community has anointed Devise as its preferred authentication solution. I’ve repeatedly used Devise, and it’s great. Not all of us have the time or expertise to roll our own auth, so it’s fantastic a solution exists that is widely adopted. It was only natural that I’d reach fo...