Skip to content

Instantly share code, notes, and snippets.

@sladg
sladg / FINDINGS.md
Created June 25, 2026 10:24
Deep-path TypeScript types at scale — ergonomics & benchmarks

Deep-path types at scale — ergonomics & benchmarks

One contract (DeepKey / DeepValue / DeepKeyFiltered / ArrayOfChanges / BoolLogic / MathExpr over a large state object), six implementation approaches, measured from 4.7k to 96k paths under two TypeScript engines. The question throughout: what keeps the type-checker (and the editor) cheap as the state grows past ~5–6k paths, where the union approach OOMs.

Path convention: [*] = Record/index key, [n] = array element, .?? = any/never sentinel.


@sladg
sladg / Cargo.toml
Last active June 24, 2026 17:39
type-profiler: per-symbol TypeScript instantiation + RAM profiler
[package]
name = "type-profiler"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "type-profiler"
path = "src/main.rs"
[dependencies]
0.0.0.0 clientsettings.api.roblox.com
0.0.0.0 roblox.com
0.0.0.0 www.roblox.com
0.0.0.0 12masterov.com
@sladg
sladg / Autocomplete.tsx
Last active September 9, 2024 07:58
FloatingUI - codesandbox copy
import "./styles.css";
import { forwardRef, useRef, useState } from "react";
import {
autoUpdate,
size,
flip,
useId,
useDismiss,
useFloating,
useInteractions,
@sladg
sladg / next-fs-patcher.js
Created November 20, 2023 14:54
Code to put on top of `server.js` to alter behaviour of Next's internal caching
const fs = require('fs')
const path = require('path')
const { patchFs } = require('@aleung/fs-monkey')
const resolveToTmp = (pathLike) => {
const isCacheDir = pathLike.includes('.next/cache')
if (!isCacheDir) return pathLike
const endPath = pathLike.split('.next/cache/')[1]
console.log('patcher.js: resolveToTmp', endPath)
@sladg
sladg / useReptchaEnterpise.ts
Last active April 24, 2026 13:07
No-dependency implementation of Google's Recaptcha Enterprise.
<!--
// inside _app.tsx
import Script from 'next/script';
// inside custom App component.
<Script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" />
-->
import { useEffect, useState } from 'react';
@sladg
sladg / Shopify GTM integration
Created March 29, 2023 10:08
Free way how to connect your GTM onto Shopify without additional plugins or apps.
// use "{{ 'analytics-head.js' | asset_url | script_tag }}" inside your liquid files. Namely `theme.liquid`.
var layerName = 'customDataLayer'
var gtmId = 'GTM-XXXXXX'
// ------------------------------
// Load GTM in head, initialize dataLayer.
;(function (w, d, s, l, i) {
console.log('Initializing GTM ...')
w[l] = w[l] || []
@sladg
sladg / CloudCompare from source
Created February 26, 2023 22:07
Build CloudCompare with Conda (Qt5, GDAL, PDAL support). Compiles from source, CLI works.
# meta.yaml (use conda build ./path-to-directory-with-this-file
package:
name: cloudcompare
version: v2.12.4
source:
git_url: https://github.com/CloudCompare/CloudCompare.git
git_rev: v2.12.4
build:
@sladg
sladg / PotreeConverter from source
Last active February 26, 2023 22:26
Build PotreeConverter via Conda. Compatible with Linux (use fork for MacOS)
# meta.yaml (use conda build ./path-to-directory-with-this-file
package:
name: potreeconverter
version: 2.1.1
source:
git_url: https://github.com/potree/PotreeConverter.git
git_rev: 2.1.1
@sladg
sladg / generate-prisma-stack.sh
Last active June 1, 2023 21:50
Generate Prisma layer for Lambda functions in AWS. Tested on Linux and MacOS with Postgres as target.
# 1 - generate node_modules layer,
# 2 - reference layer in CDK code,
# 3 - profit.
#!/bin/sh
set -e
LAMBDA_FOLDER=nodejs
PRISMA_CLI_BINARY_TARGETS=rhel-openssl-1.0.x