-
Typecasting in Ruby and Rails
I recently had the need to typecast string values passed as query parameters to a controller action to their appropriate type. In solving this problem, I've learned a lot about Rails' typecasting layer, Ruby's typecasting methods, as well as a handful of edge cases. The result was a typecasting function that I think has a lot to offer.
Continue reading … -
Introducing: Togglicons
Togglicons offers a single SCSS mixin for bringing customizable toggling icons into your web application.
Continue reading … -
A Simple Tree Building Algorithm
It is, unfortunately, not that often that I get the opportunity to devise an algorithm to solve a problem at work. Most work simply doesn’t require that kind of thinking. But I thoroughly enjoy that kind of thinking, and thus thoroughly enjoyed the most recent opportunity I had to employ it. The problem was simple (though I have simplified and abstracted it for this post as well): we have a database table of
Continue reading …things
, and thesethings
have a parent-child hierarchy, and we need to display a tree of thesethings
in our UI. So, let’s dig in. -
An Example of an ERB Component
An example of building an "ERB component", that is, an ERB partial that has ansome flexibility around their HTML output articulated via an interface in the
Continue reading …render
call. -
A function for generating HTML attribute values
How might I write a function that was as flexible as possible in its type signature, and yet still predictable and sane in its output of HTML attribute values?
Continue reading … -
Accessing Values from Nested Hashes
How can you access values from a nested (i.e. multidimensional) hash without throwing errors when the shape of the hash is not strictly fixed?
Continue reading … -
Cleaning up Git repos
Let's write down so we remember how to delete [1] old remote branches, [2] already-merged remote branches, and [3] already-merged local branches.
Continue reading …