Speeding Up Your Heroku Jekyll Site

Cache the hell out of all the things

This post is part of a series on hosting Jekyll with Heroku.


Something I missed about hosting my site on an Apache server, was how easy it was to turn on compression and caching. I finally spent an afternoon a few months ago to figure out how to do that on Heroku. It’s actually pretty simple. In fact, it’s easier than Apache, it’s just that the unknown can be scary sometimes.

config.ru Is Where the Magic Happens

Open up your config.ru, that’s where we’ll be putting the code. First thing we’ll do is to enable Rack::Deflater.

# config.ru

require 'rack'
use Rack::Deflater

This part of the file enables compression on our assets. We’ll make that work in the next part.

#config.ru

use Rack::TryStatic,
  :gzip => true,
  header_rules: [
    [:all, {'Cache-Control' => 'public, max-age=86400', 'Vary' => 'Accept-Encoding'}],
    [['css', 'js'], {'Cache-Control' => 'public, max-age=604800'}]
  ]

The gzip part lets us use the compression we enabled earlier, and header_rules caches the hell out of everything, so that people don’t have to re-download resources.

That’s it! With only a few lines of code, you can drastically speed up your site on Heroku.

Pricing Strategy for Creatives | A List Apart

Jason Blumer gives a few reasons as to why charging by the hour doesn’t work, but his first makes so much sense, it maddens me that I ever billed hourly:

When you charge by the hour, you and your client begin your relationship with diametrically opposed desires. You want to bill more hours, they want you to bill fewer hours. That is a sucky place to start a relationship.

This post is from 2012, but it’s just as applicable now. Something I’ve been doing recently is to give clients my daily or weekly rate for smaller tasks. I then use those rates to calculate how I should price their bigger projects. This way, nothing is tied to the hours I dedicate to something, and our interests are better aligned.

MacBook Pro USB-C Move Is a New Gold Rush | Computerworld

Jonny Evans writing for Computerworld:

Apple’s decision to move to Thunderbolt 3/USB-C in its new MacBook Pro with Touch bar models generated some heat but is also fostering a boom in MacBook Pro hubs. These hubs are designed to add support for earlier flavors of USB, Lightning, HDMI and other interconnect standards.

I recently purchased a MacBook Pro, and wrote a brief review on it. I’d been doing some research on Thunderbolt 3/USB-C hubs, when I came across this article. The Elgato Thunderbolt 3 hub looks pretty great, and essential if you end up buying the new LG UltraFine 5K Display. Which, as I wrote a few days ago is one of your two options if you want a retina 27-inch display.

I don’t understand buying the OWC DEC unless you’re interested in being transported back to 2005 when MacBook Pros were three inches thick. The HyperDrive doesn’t make sense either. I want to connect the hub to the back of a monitor, not my laptop. Second, if the placement of the USB-C connections is moved, or if it’s upgraded to four on each side in a later iteration, this product is immediately obsolete.

In the end, none of these options is really ideal per se, but the Elgato Thunderbolt 3 hub is about as close as we’ll get in this weird and awkward transition period.

The Outwork Myth | Signal v. Noise

Jason Fried:

People make it because they’re talented, they’re lucky, they’re in the right place at the right time, they know how to work with other people, they know how to sell, they know what moves people, they can tell a story, they can see the big and small picture in every situation, and they know how to do something with an opportunity. And so many other reasons. Working harder than other people is not the reason.

I adore this man. Bravo 👏🏽

‘Clean Your Desk’ : My Amazon Interview Experience by Shivan Kaul Sahib

Shivan Kaul Sahib describes his second round interview at Amazon:

My second round interview involved me being on line with a proctor (from ProctorU), whose job was to provide tech support and make sure I don’t cheat. As preamble, the proctor made me download some software, one of which spun up a UI for chatting with the proctor and giving them access to my machine so they can take control of my entire computer, including mouse. The proctor then proceeded to shut down all my running applications for me (I never realized what an unnerving experience it is to see your mouse move on your screen under someone else’s bidding). Then, my system settings were messed around with to make sure I can’t take screenshots. Of course, my camera and microphone are taken control of as well.

After similarly Big Brother’ing around for a while, I’m asked to raise my laptop and show my desk through the webcam, which I do. At this point I was told:

“Clean your desk.”

What?! I can’t even. Hiring in tech is completely and utterly messed up.

Defining a Microblog Post by Manton Reece

Some of you may have heard of Manton Reece’s Indie Microblogging Kickstarter. If you haven’t, check it out. We need to start moving away from Twitter, people; it’s mostly toxic waste. I emailed Manton to ask if his microblogging service will work with Jekyll. He responded with a resounding yes, and a link to what he defines as a microblog:

From my perspective, a microblog post has these qualities:

  • Must have an RSS feed.
  • Does not have an RSS item title.
  • Contains short post text, 280 characters or less.

That’s easy enough. I’m getting ready for my Twitter exit.

Senior vs. Junior Thinker by Helen Tran

Helen Tran on how Senior Designers identify a problem differently from Junior Designers:

When being described a problem, a Senior Designer will likely ask more questions than their Junior counterpart. This is to ensure that the person describing the problem is clear about the problem to begin with. Sometimes what’s being described is a symptom of a problem.

There’s the root cause (the system’s problem) and then there are the system antics or the unexpected results of the system. These antics are what people tend to mistake for the actual problem itself.

Insightful post. An article like this always helps you see where you’re doing a better job than when you started, and where you still have to improve.

Displays for Designers and Developers | Bjango

Marc Edwards on the Bjango blog:

If you’re considering an external display for your Mac, there’s a few important decisions to make. Apple doesn’t sell external displays any more, so you can’t just default to their wisdom. That’s an issue, because not all displays are well suited for Macs.

Welp, the display landscape is pretty bleak. If you want a retina (what Apple classifies it as) 27-inch display, you have two options. Two. The Dell UP2715k is not only ugly to me, but requires you to sign away your first-born. The LG UltraFine 5K display is an almost ideal solution, but the I/O is limited, and its design doesn’t scream Apple collaboration.1

I still wonder what some of the thinking behind the latter was. I understand it’s a feat of engineering that the monitor is able to do so much through one cable, but why not offer a more diverse array of connections on the back, while using two USB-C ports? My suggestion feels so obvious, that I’m positive I’m ignorant to other constraints and problems they faced while designing the display.

It’s a tough situation. On one hand, you can wait and see if any other display maker will release something good, but then you risk missing the introductory pricing currently being offered for the new LG monitor. I’m still using my Apple Thunderbolt Display, but it’s going on five years now, and its retina-less screen is more perceptible with every day that passes.

My plan for now is to wait as close as I can to March 31st, when the LG UltraFine 5K will return to full price.

  1. You may be thinking, “Wait, the 5K iMac has a retina display!” I didn’t really count that one because you can’t use it as an external display.