Skip to content

Instantly share code, notes, and snippets.


Patrick Ryan CodeOtter

  • CodeOtter
  • Los Angeles
View GitHub Profile
CodeOtter / its2019AndWeCanFinallyDoPrivateVariables.js
Last active Mar 12, 2019
How to sanely make private variables in modern JavaScript
View its2019AndWeCanFinallyDoPrivateVariables.js
// Using the WeakMap approach, the variables are kept outside of public access and when the instance of
// SomeClass is no longer referenced, all of its variables will be GCed as well
const instances = new WeakMap()
class SomeClass {
constructor (privateVar1, privateVar2, privateVar3) {
instances.set(this, {


We're rapidly approaching a world where flow-based programming is taking the lead, but there isn't any useful notation to represent all of the complexities of flow management. Let's assume a basic flow that takes a click event, extracts the X and Y coordinates from it, and moves a player based on the extracted values.

+----------+     +-----------+               +------------+
| getClick +-----> extractXY +---------------> movePlayer |
+----------+     +-----------+   xyChannel   +------+-----+
CodeOtter /
Last active Jul 25, 2016
Create a new emotion

I wrote a book in 2005 that suggested the military wouldn't invent AI first. Instead, it would be the financial sector. I reasoned that as more and more humans come online through mobile devices, more and more data would be generated: video, audio, social, geospatial, and other domains yet to be popularized. (Looking at you, voxel clouds!)

Eventually, we would generate hundreds of exabytes per second. I reasoned that Moore's Law would hit a point where quantum problems with heat would slow it down, forcing transistor counts to scale horizontally (via clouds and specialization) instead of through innovation at the atomic scale.

This means while storage prices go down, processing costs to extract first move advantage shoot through the roof. Unlike their Soviet counterparts, the West would not be able to hire half of the population to analyze the data. It couldn't even hire 200% of the population to analyze that pipeline.

Thus, financial markets start to tackle the problem one bite at a time to find foo