Sign in

Patrick is a software engineer from New England. Today, he resides in Seattle where he enjoys playing chess and ice hockey.
Close-up photograph of a ruby gemstone
Photo by Joshua Fuller on Unsplash

Years ago, I worked on a very large Ruby on Rails codebase that used constants to hold lists of credit card transaction states. For example:

class Txn
= [:authenticated, :to_settle]
DONE_STATES = [:settled, :declined]

However, we had a bug where a settled transaction would return true when ACTIONABLE_STATES was called on it.

# true

This was obviously wrong because :settled is not in ACTIONABLE_STATES! After hours of searching, we found the offending code in a completely different part of the codebase.

def some_method

all_states.each do |state|
# ... …

Photo by Luca Bravo on Unsplash

Assigning a static reference to an instance method call could be perilous. Let’s take a look at an example Java class to examine why:


public class Foo {
public static String foo = Config.getInstance().getFoo();

Seems pretty innocuous in itself, but ostensibly we’re just assigning static reference in Foo to a Config singleton call. For our purposes, assume Config has both setters and getters for values we want to store configurations for. …

Getting your blog post to play nicely with Safari Reader—my preferred way of consuming blogs—isn’t always obvious. This post documents my findings in how to optimize a blog for Safari Reader if you’re publishing outside of Medium (e.g. Jekyll).

Use the <article> tag

Safari Reader will look for a couple of container tags, but for a blog post <article> makes the most semantic sense. I recommend wrapping all content that you would want to appear in the reader. For example, You'll notice that my header image is inside of my <article> tag, which informs Safari Reader to include it.

The title should be a <h1> tag

Additionally, it should be the…

There’s been some significant infrastructure changes under the hood of Quasars and I wanted to talk about them here.

What changed

In another blog post I had talked about how Quasars uses Blue/Green Deployments, but as of today, that is no longer the case. In reality, very little has changed. Instead of having two web servers being toggled between with a floating IP, these two web servers fulfill requests behind a load balancer.

The rationale

Quasars is a hobby project. As such, it serves an important role of being a conduit in which I can learn new technologies. Kubernetes is one of these technologies…

I am the creator and administrator of, a social link-sharing web application (like reddit or hackernews) for astrophysics. It’s a fun side project that keeps me from getting rusty with Ruby on Rails because, sadly, I don’t use Ruby for my day job anymore. Plus I get to talk and think about space! What’s more fun than that?

Because is a side project, it was important to keep its server costs low. However, just having a single box wasn’t an acceptable solution either: does have some users, so I need to have some way to prevent downtime…

Synthesizing a full major out of MIT’s OpenCourseWare

MIT’s OpenCourseWare is an amazing resource—I often can’t believe that it exists at all. For the unfamiliar: OpenCourseWare is a collection of some of MIT’s classes, often complete with lecture videos, problems sets, quizzes, and answers. Oh, it’s also completely free.

There’s a significant drawback though (well, two drawbacks considering you can do all of these classes and never get a degree): You’re left to your own devices to choose what classes to take and in what order. …

How likely it is for each digit of pi to appear? Let’s find out by charting the digits of pi into a frequency graph.

  • Are there patterns?
  • If not, is it suitable for random number generation?


The more data I can collect, the more apparent patterns (if any) will appear. I wrote this Python script (below) that searches for each instance of each digit. For this project I will analyze 1,000,000 digits of pi.

import matplotlib.pyplot as plt
import numpy as np

with open('pi.txt') as f:
read_data =

# 0 1…

In 2012 I, with two other nerdy roommates, switched to Dvorak. Five years later (four of them spent as a Software Engineer) I am switching back to Qwerty. In fact, I am struggling at 30 WPM (a 70% reduction in speed) to write this post now.

The Dvorak Simplified Keyboard, patented in 1936

Why did I switch in the first place?

Patrick Brown

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store