Skip to content

Instantly share code, notes, and snippets.

View CodeOtter's full-sized avatar
🎯
Focusing

Patrick Ryan CodeOtter

🎯
Focusing
  • CodeOtter
  • Los Angeles
View GitHub Profile
@CodeOtter
CodeOtter / its2019AndWeCanFinallyDoPrivateVariables.js
Last active March 12, 2019 04:32
How to sanely make private variables in modern JavaScript
// 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, {
privateVar1,
privateVar2,
@CodeOtter
CodeOtter / FlowNote.md
Last active August 8, 2022 16:25
FlowNote

FlowNote

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
CodeOtter / emotion.md
Last active August 8, 2022 16:23
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