Today, I came across a bug in our code that was introduced when two different Ruby classes included the same module. I had a constant declared within the module and thought I had it defined such that each class would include its own copy of the constant.
Posted by andrew On March 23, 2017
Posted by andrew On September 10, 2016
Lately at my new gig, I’ve been working to eliminate duplicate code. As is typical with almost every project I have ever been involved in, my current project has accumulated lots of tech-debt. What starts as a simple cut and paste job for a hot fix and good intentions of fixing shortly afterwards results in countless near-duplicate files that only differ in a few key lines of logic.
I don’t trust myself to be able to simply eye the differences, so I looked into a way that I could get the differences between the two files as git would report it. I found the following solution posted on Stack Overflow:
git diff HEAD:PATH_TO_A_FILE_COMMITTED_TO_GIT PATH_TO_FILE_TO_COMPARE
Posted by andrew On May 21, 2015
I’ve created a new gem called StrongLikeBull that suggests what parameters to permit in your strong parameters configuration based on what request parameters a controller action receives.
Posted by andrew On October 3, 2014
For several years, I’ve thought about maintaining a blog but never sat down long enough to make it happen. Sure, I’d manage to get a few posts written before I lost interest and moved on to something else. I’m kinda ADD like that.
Well… I think it’s time for me to try again. I have watched for some time as my coworkers maintain their own tech blogs, are often linked to in Ruby Weekly and Hacker News, and even publish books. I wondered how they had enough energy to continue doing techie things after a long day at the office. Although I realize that there is pressure to stay on top of your game, I think also that they really enjoy writing, sharing, and learning on the side, particularly about the things they are most passionate about.