Quick Tip: Routes for a Non-Resourceful Rails Controller


Let’s say you have a few routes that are all related, but don’t really map to the usual resources. For example, a login/logout controller named SessionsController doesn’t really fit the usual resourceful route model. Head past the break for all the details.

Read More

SASS Antipattern: The Selector Bomb


SASS is a really powerful tool, which sometimes means that one has to be careful. It can generate all kinds of insane CSS that is hard for debugging and hard for the browser to parse and apply. Now and then, you have to take a step back and ask yourself if you really need to use SASS for the task at hand. I’d like to attempt to coin a new term for an anti-pattern that I, and many others, have stumbled upon.

Read More

Multiple Background Images in CSS

Image showing how the HTML and CSS in this blog post render

Nearly every software developer who works with front-end code has probably used the CSS property background-image. What some might not know is that background-image can take many images and set how those images are positioned. This could be particularly useful if you don’t have full control over the HTML that is being generated for whatever reason. You could also have multiple elements and use an nth-of-type selector to achieve the same effect. Click through for the code and a JSFiddle demo.

Read More

Quick Tip: Parsing a Config String in Ruby


Recently I came across the need to parse a bit of a config file, in this kind of format: “Category=filetype;…” Here is how one would do such a thing using split, inject and map.

Read More