Say No to Randos (in Your Database)

When I used my first ORM, I wondered “why didn’t they include a random() method?” It seemed like such an easy thing to add. While there are many reasons you may want to pull a record out of your database at random, you shouldn’t be using SQL’s ORDER BY RANDOM() unless you’ll only be randomizing a limited number of records. In this post, we’ll examine how such a simple looking SQL operator can cause a lot of performance pain, and a few different techniques we can use to fix it.

Keep Reading


Self Hosted Config: Introducing the Sprockets manifest.js

Have you ever felt like a framework was getting in the way instead of helping you go faster? Maybe you’re stuck on some simple task that would be easy to do manually, but your framework is making you jump through configuration hoops. I end up getting lost in a sea of documentation (or no documentation), and the search for that one magical config key takes just a tad bit too long. It’s a productivity sink, and worse than the time delay it adds to my frustration throughout the day. When I hit ETOOMUCHFRUSTRATION, then I’m definitely fighting the framework. One way to alleviate this configuration fatigue is by making configuration consistent and composable. That’s what Sprocket’s new “manifest.js” seeks to do.

Keep Reading


WTF is a Source Map

These days web assets such as JS and CSS aren’t simple text files. Instead, they’re typically minified or come from a complex build process involving compiling or transpiling. For example, CSS can be generated from a SASS file. JS can be compiled from ES6 using Babel. These toolchains make working with assets easier for developers, and make following best practices such as minification much easier. Yet, there’s a problem. What do we do when there’s a error? If there’s an exception in your JS and it’s minified, you will have short variable names which are all on one line and it’s impossible to see where the error comes from. Source maps seek to solve this problem.

Keep Reading


80% Smaller Rails Page Size With Rack Deflate

Do you have 5 minutes? Do you want to decrease the “over the wire” size of your Rails app by 80%? Sure you do! I added Rack::Deflate to CodeTriage.com, the best way to get started in Open Source, and went from a page size of 85,523 bytes to 15,568 bytes (over the wire). You can verify with this retro looking web based compression tool.

Keep Reading


WTF is a Thread

What exactly is a thread? Many developers have been exposed to threads and processes over their careers without actually knowing how they work. Knowing more about our tools makes us better developers. To answer “WTF is a Thread”, I took an operating systems course at Georgia Tech and then put my own spin on the information:

Keep Reading


I know how to code, I can code in anything

Every time I talk to a recent grad I hear a variation of the phrase “I know how to code, I can code in anything”. This is, on the surface, true for some bits like boolean logic and loops. Where it starts to fail for me is when I need to leverage a language’s ecosystem. I’m a Ruby programmer at heart (for the last 10+ years), yet I’m being forced to write in other languages through my CS Masters classes at Georgia Tech. I know I’m a competent coder, but can I really “code in anything”? How much does skill in one language translate to another?

Keep Reading


Lifelong Rubyist makes some Python code 5x Faster

I’ve been writing Ruby code for the past 10+ years, and recently due to my masters courses, I’ve been writing a lot of Python. While there are many differences, one area of similarity is their performance characteristics and how code can be optimized. In this post I’m going to look at a bit of Python code I optimized recently, and then compare the process of making this code faster to the process of how I make Ruby code faster.

Keep Reading


RubyKaigi 2017 Day 1

This is my third RubyKaigi and my first in Hiroshima. This is also the first time where I’m not speaking (though I am on the waitlist).

Keep Reading


Gaijin Guide to RubyKaigi

Okay Gaijin you think you’re ready for RubyKaigi? I’m no expert, but I’ve been a few times and I want to share what I wish someone had told me about attending the conference as an outsider.

Keep Reading


How August 2017 RubyGems Vulnerabilities were patched on Heroku

This is less a blog post and more of an FYI. This is pretty much verbatim of a snippit I wrote to respond to people asking about the Rubygems vulnerabilities. The TLDR; push to Heroku using any supported Ruby version and you’re safe. If you’re not using a supported Ruby version upgrade your app. The vulnerabilites were fairly low impact, but you should still take steps to protect yourself.

Keep Reading


Subscribe to my Newsletter 😻 🤠

Join the hundreds of developers who get new code, writing, and interesting programming links delivered to their inboxes every week.