Feb 14 2017

Recently, I needed to create a small, temporary web application for testing purposes. I definitely didn't want to deal with Rails for this purpose. In fact, it was small enough that I just wanted to have everything in one file. So:

  • Sinatra for the...
read more
author image
Feb 14 2017
Apr 20 2016

When I pair with people I reach for binding.pry a whole lot sooner than they do. I also stay in there longer. Here's some of the stuff I've found valuable in a binding.pry session that keeps me there instead of in my editor.

read more

author image
Apr 20 2016
Jan 15 2016

I've been using git for, what, 8 years now? You'd think I'd get it. But I constantly find myself confused by the complexities of git. So this past wow week, I went back and did some reading of the free Pro Git book. And I came to a conclusion. Much...

read more
author image
Jan 15 2016
Dec 02 2015

Setting up a CDN is something that almost any site can benefit from. Up until fairly recently however, they were cost prohibitive for many sites. With Cloudflare and Cloudfront -- among others -- becoming more mainstream, there's no reason not to...

read more
author image
Dec 02 2015
Jun 05 2015

Several of us in the engineering "pit" at PatientsLikeMe have eschewed the traditional desk and chair work setup. At this point a couple of us are on big rubber balls, and four of us are at standing desks. One lucky guy even has a standing desk with...

read more
author image
Jun 05 2015
Mar 04 2015

A while ago I wrote a little quiz for our staff so people could see how good they are at recognizing their co-workers. At some point, we started getting some rollbar errors from it that looked something like this:

  ActiveRecord::InvalidForeignKey
read more
author image
Mar 04 2015
Feb 01 2015

Intro

As ruby developers, we often learn to handle nils as follows:

def some_method(some_var)
  some_var.try!(:some_method)
end

or

def some_method(some_var)
  some_var.some_method if some_var
end

If we don't do this, we will get the dreaded "NoMethodError...

read more
author image
Feb 01 2015
Dec 19 2014

Last month, Amy, Nat, Michael, Jon and I went to RubyConf 2014 in San Diego. I'd never been West of Salt Lake City before (unless you count a trip to Japan in when I was a teenager) so I was really excited about a trip to sunny California. Plus I was...

read more
author image
Dec 19 2014
Oct 17 2014

I joined PatientsLikeMe in July to contribute to the Open Research Exchange's quality assurance efforts. As I write, what comes to mind is a friend's thoughts about how quality assurance is a bit of a misnomer based on common word usage. I'm not here...

read more
author image
Oct 17 2014
Aug 05 2014

There are so many loggers already, surely one of them will work

Recently I've been working on a few projects that run as background tasks on our servers. Since there's no user interface, I wanted robust logging so that we can monitor the tasks and...

read more
author image
Aug 05 2014
Jul 21 2014

Hi. I'm Jon. I'm the newest Rails dev at PatientsLikeMe. I've done plenty of web development before, but this is my first time working with Rails. In this post I'm going to talk about my first attempt to do something non-trivial with routes.

The task sounded straightforward. We had a set of pages that were already developed and deployed. But we wanted to also show them on a separate tab elsewhere, with a different set of URLs. So most of the work would be taking place in routes, with the controllers recycling a handful of views that already existed. Here's how it went.

read more

author image
Jul 21 2014
Jul 17 2014

Some time ago, our charts developer, Mike Danziger, noticed a strange issue that was showing up for some user-entered lab results. See if you can spot it:

Lab result graph for HDL, showing a ridiculously precise latest result

Surely this user didn't actually enter a result of 119.66000000000001 mg/dL for their cholesterol reading. No blood test is that precise, right?

No, of course they didn't. What we're seeing here is a result of floating-point error. Floating-point error happens because in most cases, computers represent fractional numbers in base 2, in which it's often impossible to represent a base-10 fraction in a finite number of digits, so rounding happens. These tiny errors can become larger the more calculations you perform, due to compounding effects.

read more

author image
Jul 17 2014
Jul 08 2014

Welcome to our new tech blog, which is a reboot of our old tech blog.

The old tech blog was running in PHP. Wordpress maybe? Who knows or cares. Anyway, the ops guys said something like "Hey, none of you lazy developers have written a blog post in over a year, and we've got this unpatched PHP instance running, we're going to take the damn thing down." Actually they were much nicer than that. But that's what they should have said.

None of us lazy developers objected. How could we? It was true. But silently we thought, "Having a tech blog is a good thing!" On the other hand, we didn't want to ask ops to patch PHP only to have them send the same email again in a year. Plus we wanted to do something cooler than PHP and Wordpress, I mean really.

read more

author image
Jul 08 2014
Jun 10 2014

git

We have a carefully thought out git branching strategy for the PLM Web site, but I kept screwing it up, so clearly I didn't have it all straight in my head. I figured writing about it would be a good way to make sure I understand it, and might be useful for others when considering their own processes.

read more

author image
Jun 10 2014
Dec 24 2012

What is WOW Week?

PatientsLikeMe has built our own version of Google’s “20% Time” that we call “WOW Week”. WOW Week is a week of unstructured development time for engineers, where they can work on anything to improve our products as long as they demo their progress in front of the company at the end of the week.

The engineering team works in 2-week long development sprints. After three development sprints in a row, we have a “Technical Debt” week and a WOW Week.

read more

author image
Dec 24 2012
Dec 14 2012

Today, we're releasing Robomo, a web application for tracking feature requests. Robomo is simple to use, fast, and fun. We've developed Robomo internally at PatientsLikeMe and have been using it ourselves for over a year. It's become an indispensable part of our workflow here, and now it's available to anyone who wants to use it.

read more

author image
Dec 14 2012
Apr 06 2011

will_paginate is one of those gems that always makes me smile. Back in the dark ages of Spring MVC & Hibernate I specifically remember being part of an estimation that decided that adding pagination to an admin page would take 2 days. Today that seems crazy of course, but I don’t think it was a bad estimate at the time since there really wasn’t any built-in support for that. Fast forward to now and as we all know pagination is one of those things that take about 2 minutes to implement. Progress!

So pagination is great and a pretty much solved problem, but it’s always irked me that it requires 2 very similar queries per request. Is there anything to be done about that? Let’s see.

read more

author image
Apr 06 2011
Mar 22 2011

How To Count Distinct Items Over Sliding Time Windows in Postgres

As a member of PatientsLikeMe's Data team, from time to time we're asked to compute how many unique users did action X on the site within a date range, say 28 days, or several date ranges (1,14,28 days for example). It's easy enough to do that for a given day, but to do that for every day over a span of time (in one query) took some thinking. Here's what I came up with.

read more

author image
Mar 22 2011
Feb 28 2011

How to fix bad url generation when you are using url_for inside a nested controller

Problem:

I have a nested resource, say: members/:member_id/timelines/:id Inside my nested controller (timelines_controller) I use:

url_for(:controller =>'patients', :action => 'view', :id=> @patient.id)

The url generator decides that since I am nested inside ‘members’ I want my url to look like this: members/patients/:id

In fact, no I do not want my url to look like that. That url does not work. Do not want.

read more

author image
Feb 28 2011