Flask and AngularJS Workshop (YHack 2015)

My friend Mike and I recently prepared a quick Flask and AngularJS workshop for YHack 2015 (the first YHack in which the two of us did not serve as directors!). Our talk teaches basic backend and frontend web development via the development of a basic blackjack game.



You can follow along on your own using our workshop code.

Squirrel Watching

A squirrel perched on a branch

The following short story recently went viral in China. I’ve translated it into English, taking some artistic license in the process. You can read it in Chinese here (original author is unknown).

It’s a warm summer afternoon and a mother and her son are sitting side by side in the backyard. The son, at home from college, is buried in a book. The mother’s attention is fixed on the twin oak trees facing them, shading them from the sun’s unforgiving beams.

Suddenly, a squirrel hops down from the branches of the larger of the two oak trees, lands in the bed of mulch surrounding the tree, and promptly darts into the bushes. The mother turns to her son and asks him, “What is that?”

He looks up and murmurs, “A squirrel.” His gaze immediately turns back to the book.

The mother nods thoughtfully and watches the squirrel quiver in the bushes. A few moments later, she asks him again, “What is that?”

He reluctantly raises his head, follows his mother’s gaze over to the same bushes, and frowns. “Mom, I just told you. That’s a squirrel.”

Just as he is about to look away, the squirrel scurries over to the smaller oak tree. The mother points and asks yet again, “What is that?”

The son closes his book shut, “It’s a squirrel, Mom, a squirrel!”

Her eyes, fixed intently on the squirrel, do not notice her son’s annoyed glare. She smiles as the squirrel picks up an acorn and begins to nibble at it. Gingerly, she asks, “What is that?”

The son throws his arms in the air and cries out, “You’ve asked me the same thing like ten times already! It’s a squirrel, what don’t you understand?”

Without a word, she stands up and turns her back on her son. Confused, incredulous, and still fuming, he calls back, “What, you’re leaving?”

She holds her palm up, instructing him not to follow, and walks into the house. He turns back to the two oak trees. Amidst all the noise, the squirrel has scampered away. Sighing, he throws his book down in frustration.

A few moments later, the mother returns. In her hands is a small diary, corners frayed. She opens it up to a specific entry and hands it to him. “Read this.”

He reads:

December 17, 1995

Today, I took my two-year-old son to the park. While we were camped out in the grass, a squirrel scrambled near us. Twenty-one times he asked me, “What is that?” Twenty-one times I answered, “That’s a squirrel, honey.” And every time I answered him, I would hug him tightly… over and over and over. How could I possibly be annoyed by such pure innocence and curiosity…

Investigating the Relative Age Effect at Yale

An apple sitting on a pile of books

I just finished reading Malcolm Gladwell’s best-seller, Outliers. Naturally, I was curious about some of his claims and decided to do a little investigating of my own.

Gladwell starts the book by suggesting the existence of the following “iron law” of Canadian hockey: “in any elite group of hockey players — the very best of the best — 40 percent of the players will have been born between January and March, 30 percent between April and June, 20 percent between July and September, and 10 percent between October and December.”

Why would this be the case? It turns out that Canadian hockey leagues impose an eligibility cut-off date of January 1, meaning that a child born in January competes in the same league as a child born in December, almost an entire year later. These extra months of maturity, according to a study conducted by psychologist Roger Barnsley, give an unfair advantage to kids born earlier in the year — by virtue of being older, these kids tend to be larger, more coordinated, and more “talented” than their peers. Those that are deemed more talented go on to enjoy the rewards of better coaching, increased self-confidence, and more opportunities, creating a self-fulfilling prophecy that is driven entirely by an arbitrary cut-off.

This phenomenon is known as the relative age effect. And both Gladwell and Barnsley suggest that it occurs within academia and education as well. Like hockey leagues, schools have an eligibility cut-off date (usually, the end of summer) and often separate students based on relative merit (gifted student programs). To further this argument, Gladwell points to the research of economists Kelly Bedard and Elizabeth Dhuey, who have noted that “at four year colleges in the United States… students belonging to the relatively youngest group in their class are underrepresented by about 11.6 percent.”

With this knowledge in hand, I decided to poke around and see if I could find any interesting patterns at Yale, hoping to answer the following question: does the relative age effect impact your chances of making it to Yale?

Since I’m currently an undergrad at Yale, I have access to the walled-off Yale Facebook, a directory that contains basic biographical and contact information for all current undergraduate students. Here’s the scraped and compiled data, which includes the class of 2015 up to the class of 2019 (5565 students total, 5381 of which have their birthdays listed):

  • January: 475
  • February: 405
  • March: 468
  • April: 479
  • May: 461
  • June: 445
  • July: 446
  • August: 428
  • September: 443
  • October: 481
  • November: 425
  • December: 425

Birth months at Yale

It seems that the relative age effect doesn’t apply: Yale undergrads are born evenly throughout the year, with a range of 76, a mean of around 448, and a fairly low standard deviation of around 25. And the most unpopular birth month is February, which also happens to be the shortest month of the year. If we adjust for the 10 or so lost days of February between the classes of 2015 and 2019, the data would show even less variance than it does now.

However, it can’t hurt to point out that the graph has three local maximums, two of which might be relevant to the relative age effect: one around October (close to the start of school in the Northern hemisphere), one in March and April (close to the start of school in the Southern hemisphere) and one in January (which I don’t have a relavant explanation for).

It’s also worth noting that according to data compiled by Amitabh Chandra of Harvard University, the second half of September is the most common time of year for U.S.-born babies (approximately 81% of the Yale population hold U.S. citizenship or permanent resident status), providing an alternate explanation for that particular local maximum.

There are, unfortunately, some limitations to what we can do with this data. The Yale Facebook does not list birth years, which makes it impossible to filter out students who may have entered school a year early, or who may have skipped a grade or two. However, if we assume that these kids do exist in the pool, we might be able to say that the relative age effect did not play a role in their development — that is, for the truly precocious, relative age differences do not play a major role in their educational development. This isn’t a certain conclusion, however, since the other side of the coin in not having birth years is that we also are unable to filter out students who may have purposely “redshirted” before starting kindergarten or who may have taken a gap year in between high school and college, thus making them older than their peers by the time they enter college.

But empirically, at least, it appears that most early age biases at Yale have been erased or never existed in the first place. 1

Could it be that Yale admissions officers are familiar with the relative age effect and consciously adjust for this in their admissions process? This is possible, but probably unlikely.

Here’s another possibility: as mentioned earlier, 19% of Yale students are listed as international students. What if, out of this 19%, almost every student that attended school in the Southern hemisphere was born in the months of March and April, balancing out a presumably lower amount of students in the Northern hemisphere that were also born in those months? If true, this could have created the local maximum that we see in March and April. And while relying purely on geography is an imperfect filter for determining when school starts, it should at least give us a working estimate to play with.

When I went to test this hypothesis, I quickly discovered that this was not the case. Of the 83 students with addresses in the Southern hemisphere (Argentina, Australia, Botswana, Brazil, Chile, Indonesia, Kenya, Mauritius, New Zealand, Peru, Rwanda, Singapore, South Africa, Swaziland, Tanzania, Uganda, Zimbabwe), only 14 were born in March and April. The most common birth months were actually June and July.

The best explanation I’ve seen thus far comes from Maria Konnikova from The New Yorker. In her “Youngest Kid, Smartest Kid?” essay, Konnikova suggests that while older kindergarten students do benefit from their age, “by the time they get to eighth grade, any disparity has largely evened out — and, by college, younger students repeatedly outperform older ones in any given year.” Older students, she argues, become bored and complacent, while younger students embrace their underdog statuses and are forced to strive and push themselves harder, developing a work ethic that even Gladwell can appreciate.

Thanks to Jonathan Chang for reading a draft of this essay.

  1. Note: this experiment only tests for the relative age bias. I am positive that there are many other biases and barriers in this data set that can not be explained solely by age.

Single threading

Birthday candles

Hi, tomorrow is your sister’s birthday. You forgot mom’s.


My mother’s birthday was two days ago and I completely forgot. My sister’s birthday is tomorrow. Chances are, I might have forgotten her birthday too if my father didn’t text me a few hours ago.

How did this happen? With our fancy calendar apps and all their incessant push notifications, how could I possibly forget the birthdays of the most important people in my life? 1

Here’s my lame excuse: I’ve been so busy preparing for finals, writing papers, and working on my projects that I literally wasn’t thinking about anything else. The notebook that I carry around in my back pocket hasn’t had a new entry scribbled in it in over a week. I’ve been living from day to day, from class to class, from assignment to assignment. And I’ve basically lost track of the concept of time.

I didn’t even know the date.

This is me running on single threaded processing — moving from one task to another and being so absorbed in it that I forget everything else important to me. It’s just too easy to lose track of things when you’re working on hard problems or when you’re working through a lot of stress. Naturally, you start to lose mental cycles.

But that’s just so dangerous, even if it only happens rarely: being so insular and so single-threaded makes you lose perspective on the world. The people I love are so much more important to me than schoolwork, my health is so much more important to me than my pride, and solving big, meaningful problems is so much more important to me than solving the problem of picking where to go for lunch.

I hope I’m never so single-threaded, so single-minded, and so insular in my thoughts that I forget about the bigger picture and everything else that’s important to me. I need to force myself out of these self-imposed bubbles and take in all the little details around me.

Because frankly, I’m ashamed.

  1. Here’s the real kicker: I actually don’t have their birthdays in my calendar because I thought that it was impossible for me to ever forget them. It also just feels too impersonal and inappropriate for people so close to me.

Great Products are Aspirational


What makes a product like Instagram so much more such successful than other, similar photography apps? What makes Apple computers so much more popular in the public eye? What makes Moleskine the de facto notebook for creative types?

These questions have been discussed ad nauseum and many convincing answers have already been suggested: these products had superior branding, were well designed, launched at the right times with the right set of features, and were technologically better (okay, maybe not the Moleskine). They executed relentlessly, found the right initial set of users, and then expanded quickly to capture the rest of the general public. All of these answers are satisfactory, but I think there’s another deeper explanation for why these products are so successful.

Good products must be useful. But to be great, they must also be aspirational. 1 Fundamentally, good products need to solve a problem; for the people that need them, they are utilities. If they’re better designed, better marketed, easier to use, and better timed than other products on the market, then the gears will be more greased for the product to succeed. But without achieving utility, even the best designed, best marketed products may not become massively successful.

To go from good to great, products have to connect with people who don’t necessarily need them. This means that they are aspirational products to those who don’t have the problem (yet!), but want to be a part of the group that does. Let’s look at some examples.


  • Utility product: a mobile editor for photos (with a social network built on top)
  • Aspirational product: attracts everyday people with phones who want to have more interesting lives and cooler photos to share

Apple MacBook

  • Utility product: a laptop
  • Aspirational product: attracts creative types who want to use what their heroes use — for example, many musicians use Logic Pro, many directors and filmmakers use Final Cut Pro, and many programmers use Macs for its Unix-based OS


  • Utility product: a notebook to write in
  • Aspirational product: attracts people who want to write more, become more thoughtful, and seem more intelligent


  • Utility product: a payment gateway that scales upwards
  • Aspirational product: attracts entrepreneurs who are currently building or are planning on building a SaaS startup or other online business


  • Utility product: lightweight, mountable camera
  • Aspirational product: attracts people who want to live an extreme lifestyle

Product Hunt

  • Utility product: a place to launch your product and receive community feedback
  • Aspirational product: attracts a community of people who want to become creators and makers

So the product is 1) instantly useful to the people who need it and is 2) able to attract people who want to need it. Over time, many of these aspirational users may become utility users, allowing the product to continue to grow and expand its active user base. Aspirational Stripe users will build businesses that process so many transactions that they need the API to operate. By using their Moleskines more, non-writers will become writers (or at the very least, will consume more Moleskines as they attempt to write).

One could perhaps argue that superb branding creates this utilitarian-aspiration split, but I disagree. Building a product that has this sort of behavior will naturally lead to better branding, not the other way around, although I’m sure there are exceptions where better branding leads to aspirational desires.

  1. Note that by “aspirational,” I don’t necessarily mean that they are so expensive that they are out of the reach of the general public. I mean products that people yearn to use and desire to become part of the ingroup of.