The Story of Two Incredibly Productive Days of Coding

ben profile image Ben Halpern ・3 min read

Two days ago I made this tweet:

With the various responsibilities of day-to-day operations, onboarding new developers, and general procrastination, I had let slip the only coding task I had that was at all tied to a deadline. Two days is plenty of time to code up a quick feature... or maybe not. That's the problem. When I went to take on this task, I really had no idea how long it would take.

The feature in question is a native video player for dev.to, and since it's Thursday, our launch day, you can see it in action here:

We had picked JWPlayer as service that fit our immediate requirements for the player and hosting of the videos. It seemed like the right choice for what we want now: a lightweight, customizable video player library and simple hosting service, as well as what we want in the future: additional configuration, scalable solutions for bigger operations. But I had not read any of the documentation and we were not entirely sure about the direction. Two days is plenty of time if things go smoothly. Two days is not a lot of time at all if you hit roadblocks. We could fall back on other options, but we wanted this to go well so we wouldn't have to ship something held together with duct tape, only to be replaced later. What we ended up with is a minimum viable product we can build on top of, rather than one we'll need to fully replace in the future.

And guess what... It went remarkably smoothly and I actually finished the whole project in about 90 minutes. I felt kind of silly about that tweet after how smoothly this process went. By Tuesday afternoon, I was done.

With the extra time on my hands, in addition to catching up on other things and helping other developers on their tasks, I decided to lean in a bit harder on this feature by adding automatic timestamp links to comments, similar to how YouTube does it.

Here is an example:

Love the web app analogy at 4:30, about changing the wheels of a truck as it moves. Also, I've noticed I have a tendency of wanting to make a feature perfect being rolling it out. As a very junior dev, it's refreshing to hear how y'all are making the move.

This feature also went incredibly smoothly. Feeling pretty good about the whole thing, I TDD'd this process really nicely and even wrote the needed regex myself without looking it up.

Here is the Ruby code appended to the comment html processing method to make this happen:

def wrap_timestamps_if_video_present!
    return unless commentable.video.present?
    self.processed_html = processed_html.gsub(/(([0-9]:)?)(([0-5][0-9]|[0-9])?):[0-5][0-9]/) {|s| "<a href='#{commentable.path}?t=#{s}'>#{s}</a>"}

The process was not without some yak shaving. In order to implement the timestamp link, I wanted to make sure the application's cache and our CDN both ignore the time query parameter, so that we aren't serving different versions of the page for every different parameter. This was an overdue task that affects many other parts of this web application. It meant providing a whitelist of parameters our application will ever care about to the CDN through VCL configuration. I'm glad I got the opportunity to do this. It was mostly a matter of reading the docs and was pretty simple to implement once I understood the whole thing.

Forecasts are hard to make, not only because any technical problem has a lot of unknown layers of complication, but because the demands on our time are equally hard to predict. I was pulled of my "heads down time" countless times in the last few days to deal with small issues, answer emails, or otherwise become preoccupied. I try to limit these interruptions, but they happen.

This process was supremely productive and satisfying. I hope you enjoy the video series and future video content on the platform. Right now, video upload is purely an admin feature. If you'd like to upload your own videos for distribution to the dev.to community, email yo@dev.to.

Posted on by:

ben profile

Ben Halpern


A Canadian software developer who thinks he’s funny. He/Him.


markdown guide

Automatic timestamp links are an awesome feature :) Great job


Really good job! I didn't know JWPlayer, seems great!


I love how transparent you are and share your experience. Well done on the video player :)


Very cool stuff Ben! Thanks for sharing.

I love it when a feature takes a significant fraction of the time that I estimated. It's a good feeling.