Skip to content

Instantly share code, notes, and snippets.

View benlesh's full-sized avatar
🐶
☕ 🔥 🔥 this is fine

Ben Lesh benlesh

🐶
☕ 🔥 🔥 this is fine
View GitHub Profile
@benlesh
benlesh / RxJS-impact-estimates.md
Created November 7, 2026 15:39
An estimation of the impact monthly basis as of November 2026

How many people encounter RxJS in a month?

Working estimate, 7 November 2026. This document covers current monthly human reach, not historical reach, cumulative downloads, or the wider Observable ecosystem.

There is no public service that counts how many distinct people receive or execute RxJS. The best we can do is identify real deployments, use reported audiences where they exist, and make the assumptions visible.

My working estimate is about 750 million distinct people per month receiving RxJS-bearing client software. A broader assumption about TikTok's web deployment puts it at roughly one billion. A substantially discounted scenario is about 435 million. These are model outputs, not measured counts, statistical confidence intervals, or proven lower bounds.

I would describe the present evidence as consistent with several hundred million monthly recipients, and plausibly around a billion. The difference between the scenarios is mostly whether TikTok's observed desktop-web RxJS b

@benlesh
benlesh / convert-wav-to-mp3.bat
Created June 20, 2023 14:15
Convert all WAV files in a directory to MP3 files.
REM NOTE that this does NOT uninstall ffmpeg when done
@echo off
setlocal enabledelayedexpansion
echo Current directory: %cd%
REM Set the download URL for FFmpeg
set "ffmpeg_url=https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
@benlesh
benlesh / README.md
Last active May 8, 2019 18:49
Valid JS Identifiers JSON

All Valid JS Identifiers As JSON

Created by fiddling with code written by Mathias Bynens for https://mothereff.in/js-variables

MIT License from his project should be honored.

const source$ = Observable.interval(1000).take(3); // 0, 1, 2
// waits 3 seconds, then logs "2".
// because the observable takes 3 seconds to complete, and
// the interval emits incremented numbers starting at 0
async function test() {
console.log(await source$.toPromise());
}
const click$ = Observable.fromEvent(button, 'clicks');
/**
* Waits for 10 clicks of the button
* then posts a timestamp of the tenth click to an endpoint
* using fetch
*/
async function doWork() {
await click$.take(10)
.forEach((_, i) => console.log(`click ${i + 1}`));
return await fetch(
Observable.defer(async function() {
const a = await promiseDelay(1000).then(() => 1);
const b = a + await promiseDelay(1000).then(() => 2);
return a + b + await promiseDelay(1000).then(() => 3);
})
.subscribe(x => console.log(x)) // logs 7
function getErroringPromise() {
console.log('getErroringPromise called');
return Promise.reject(new Error('sad'));
}
Observable.defer(getErroringPromise)
.retry(3)
.subscribe(x => console.log);
// logs "getErroringPromise called" 4 times (once + 3 retries), then errors
// An observable that emits 10 multiples of 100 every 1 second
const source$ = Observable.interval(1000)
.take(10)
.map(x => x * 100);
/**
* returns a promise that waits `ms` milliseconds and emits "done"
*/
function promiseDelay(ms) {
return new Promise(resolve => {
setTimeout(() => resolve('done'), ms);
// An observable that emits 10 multiples of 100 every 1 second
const source$ = Observable.interval(1000)
.take(10)
.map(x => x * 100);
/**
* returns a promise that waits `ms` milliseconds and emits "done"
*/
function promiseDelay(ms) {
return new Promise(resolve => {
setTimeout(() => resolve('done'), ms);
@benlesh
benlesh / path-evaluation.js
Last active November 3, 2016 20:25
Primitive path evaluation implementation with refs
console.clear();
const path = ["list", 0];
const path0 = ["list", 20, 'name']; // ref ref
const path1 = ["list", [0, 1], "name"];
const path2 = ["list", [0, 1, { from: 3, length: 2 }], "name"];
const path3 = ["list", [0, 1, { from: 3, length: 2 }, { from: 7, to: 9 }], "name"];
const path4 = ["list", { to: 5 }, ["name", "rating"]];
const jsonGraph = {