Skip to content

Instantly share code, notes, and snippets.

View dmvaldman's full-sized avatar

David Valdman dmvaldman

View GitHub Profile
dmvaldman / thealignmentgame.js
Last active September 8, 2023 19:12
Play the alignment game
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('path'), require('fs')) :
typeof define === 'function' && define.amd ? define(['path', 'fs'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.alignmentgame = factory(global.require$$0, global.require$$1));
})(this, (function (require$$0, require$$1) { 'use strict';
var src = {};
// Not trying to hack you. This is the base64 of gltk.wasm.js (an LP solver), which you can verify by converting to base64.
// Since googlescript doesn't allow synchronous loading of WASM modules, I need to include it here manually.
dmvaldman /
Last active December 10, 2021 23:27
Make your code backwards (and compatible)!

[Originally posted here in 2016]

In Lewis Carroll’s Through the Looking Glass, Alice finds a mysterious book that’s “all in some language [she doesn’t] know”. It begins with


sevot yhtils eht dna,gillirb sawT’ ebaw eht ni elbmig dna eryg diD ,sevogorob eht erew ysmim llA .ebargtuo shtar emom eht dnA

dmvaldman /
Last active June 1, 2024 00:20
Promises as EventEmitters

Promises as EventEmitters

I was trying to understand JavaScript Promises by using various libraries (bluebird, when, Q) and other async approaches.

I read the spec, some blog posts, and looked through some code. I learned how to

Keybase proof

I hereby claim:

  • I am dmvaldman on github.
  • I am dmvaldman ( on keybase.
  • I have a public key whose fingerprint is CE17 F140 B122 57E0 919E FE50 7AF7 BE80 F4D6 1202

To claim this, I am signing this object:

dmvaldman /
Last active February 23, 2024 16:24
Descartes, Berkeley and Functional Reactive Programming

Descartes, Berkeley and Functional Reactive Programming

By @dmvaldman

Functional Reactive Programming (FRP) is generating buzz as an alternative to Object Oriented Programming (OOP) for certain use cases. However, an internet search quickly leads a curious and optimistic reader into the rabbit-hole of monads, functors, and other technical jargon. I’ve since emerged from this dark and lonely place with the realization that these words are mere implementation details, and that the core concepts are far more universal. In fact, the groundwork was laid down many centuries before the first computer, and has more to do with interpretations of reality, than structuring programs. Allow me to explain.

There’s an old thought experiment that goes like this: