Andrea Giammarchi

@webreflection.bsky.social

getOrInsertComputed in Map/WeakMap is actually pretty cool, it simplifies caching a lot and it's not limited to synchronous values, example: const cache = new Map; const asText = async page => fetch(page).then(r => r.text()); await cache.getOrInsertComputed('index', asText);

whenever I read posts like "don't us JS Array reduce" I'm like: const gcd = (a, b) => (b ? gcd(b, a % b) : a); const lcm = (a, b) => (a * b) / gcd(a, b); [2, 3, 4, 5].reduce((p, c) => lcm(p, c)); // 60 [12, 18, 36].reduce((p, c) => gcd(p, c)); // 6 I mean ... 🤷

apparently my account has been compromised on bsky ... it's honestly the only service out there that never offered me (until today), or enforced, 2FA, it was kinda inevitable, yet my deepest apologies if my account spam/scammed you by any mean 🙏

in case anyone is interested, I am documenting what I am working on regularly (each week) with links and every other detail needed to understand where I come from and where I am heading. This is OSS to me, nobody can blame me for not being transparent 😇 github.com/WebReflectio...

GitHub - WebReflection/standup: Updates around my OSS contributions.

Updates around my OSS contributions. Contribute to WebReflection/standup development by creating an account on GitHub.

github.com

in today "nobody asked for it, thanks!" news, the recent issue filed against flatted module (333M downloads per months) kinda "scared" me to the point I rewrote the whole thing in a binary friendly format: flatted-view: please test it, thank you 🙏 github.com/WebReflectio...

GitHub - WebReflection/flatted-view: Flatted like approach brought to Uint8Array compatible values.

Flatted like approach brought to Uint8Array compatible values. - WebReflection/flatted-view

github.com

in today "good morning OSS" news, @golang receives its first *flatted* implementation, making flatted now usable in JS, TS, Python, PHP and, ultimately Go 🥳 Huge thank to Harald Fielker for helping out (writing everything), lets' go beyond 300M Downloads! github.com/WebReflectio...

GitHub - WebReflection/flatted: A fast and minimal circular JSON parser.

A fast and minimal circular JSON parser. Contribute to WebReflection/flatted development by creating an account on GitHub.

github.com

today I’ve quickly glued together two libraries that makes custom elements without shadow dom as fast and as simple as it can get and for every browsers … after reading the N post about ShadowDOM issues with CSS. You can stop that madness already 👋 github.com/WebReflectio...

GitHub - WebReflection/elements: HTML & SVG Custom Elements.

HTML & SVG Custom Elements. Contribute to WebReflection/elements development by creating an account on GitHub.

github.com

JS Proxy are wonderful, penalized by TS inability to actually understand/deal with these but the things that these unlock are incredible! It might be a niche use case but if you need cached results, here my next go-to library: github.com/WebReflectio...

GitHub - WebReflection/cached-proxy: A cached Proxy with optional timeouts per property to simplify complex remote scenarios.

A cached Proxy with optional timeouts per property to simplify complex remote scenarios. - WebReflection/cached-proxy

github.com