Defining a Module on a Class from an Included Module

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.

Read More

Early Hints of Personality

A few days before our son’s birthday, my wife and I stayed up late looking at old pictures and videos of our little guy. I showed her a video I had made when he and I took a trip to the zoo during some father / son bonding time. As a one-and-a-half year toddler, he was fascinated watching a couple of older kids playing the drums. He stood nearby completely memorized until they finished and had walked away. He took a quick look at the drums before deciding to walk away into some nearby plants. I asked him if he wanted to try them out and he gave a slight head shake.

I decided to press the matter by tapping the drums a few times myself to see if I could make them interesting enough for him to come and try playing them himself. My plan worked perfectly. He came back and tried out the drums. I did it. Great Dad moment, right???…

Read More

Comparing Two Different Files with Git

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

I plan on using this approach initially to start eliminating some of the 18 layouts that exist in our project. Many of these layouts are near-identical, differing only in the javascripts and stylesheets they include, as well as potentially an extra conditional snippet of code or a yield statement. I am thinking I can combine the vast majority of these layouts into two or three different layouts. At the same time, I am preparing a gem to be able to handle similarities in layouts in general, and should have it released within the next two months. It will be part of a series of blog posts that I plan to release entitled “Building Reusable UI Components”. Stay tuned.

Here I Am, Once Again

Oops I did it again. I started another blog with high ambitions and motivation. Nearly two years later, I have all of three posts to point to… four if you include the mini-post you’re reading now. Not exactly the model of self-discipline or accomplishment.

But, I’m ready to start again. Over the last two years, I’ve gathered together a list of things I want to write about. Some are deeper in nature. Some are observations, particularly observations related to becoming a first time parent and about moving over half-way across the country and living in one of the weirdest and yet best places I’ve ever been: Boulder, CO. Some are multi-part tutorials and demonstrations of some of the technology I’ve either learned about or created myself. Some are as basic as reproducing my first published work here. And finally some are very very basic, such as including an About Me page, or a link to my resume.

Well, stay tuned. It’s coming, hopefully sooner than later. Once again, I have high ambitions and motivation. And this time around, I’m not in the midst of a life-changing experience of being thrust into the world of parenting.

Strong-Like-Bull – A Lesson in Recursion

&TL;DR;

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.

Read More

How We Hacked Together a 4-Night, 5-Day Anniversary Trip to Miami for $640.92

I had a hard time figuring out how to categorize this blog post. While it does not quite fit into the coding category, the problem-solving, algorithmic-type approach I applied to making this work is a natural result of my computer science education. I’d like to share how I was able to utilize three different rewards cards to hack together a last minute trip to Miami this month, and only spend $640.92, which included four nights at a Marriott hotel, a five day car rental, a $138 anniversary dinner, $160 upgrades to seats with more leg room (since I am over 6′ and my wife was 8-months pregnant), a $63 Uber ride home from the airport, and a $20 cash payment to the awesome kid next door who took care of our fur child Taco. Did we skimp the rest of the time during our trip? Not exactly… Let me explain.

Read More

Introduction

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.

Read More

Loading...
X