Skip to content

Instantly share code, notes, and snippets.

View michal-weglarz's full-sized avatar
🐳

Michał Węglarz michal-weglarz

🐳
View GitHub Profile
@albertms10
albertms10 / nestedObjectPaths.ts
Last active January 29, 2026 10:57
TypeScript — all possible paths of an object
/**
* Object type that represents all possible paths of an object,
* including optional members.
* @template T The object type to get the paths from.
* @see https://stackoverflow.com/a/76131375/10851645
* @see https://gist.github.com/albertms10/5a8b83e436a1689aa4b425ec22058301
* @example
* interface Package {
* name: string;
* man?: string[];
@staltz
staltz / introrx.md
Last active May 7, 2026 01:31
The introduction to Reactive Programming you've been missing
@vectorsize
vectorsize / linearScale.js
Last active December 20, 2022 14:30
Quick linear scale inspired by d3.js scales, based on the processing.org map() function.takes in an object with a domain array and a rage array, gives you back a function that receives a value and returns the scaled value.
// based on https://github.com/processing/processing/blob/a6e0e227a948e7e2dc042c04504d6f5b8cf0c1a6/core/src/processing/core/PApplet.java#L5093
var scale = function(opts){
var istart = opts.domain[0],
istop = opts.domain[1],
ostart = opts.range[0],
ostop = opts.range[1];
return function scale(value) {
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));