Skip to content

Instantly share code, notes, and snippets.

View developit's full-sized avatar
🦊
write, the codes

Jason Miller developit

🦊
write, the codes
View GitHub Profile
@developit
developit / gtimedToSRT.js
Created January 23, 2026 18:42 — forked from Dobby233Liu/gtimedToSRT.js
Translates YouTube timed text to SRT. WTFPL. WIP.
// parse-ms
// MIT License, copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
// Modified by Dobby233Liu in slight cooperation with MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
@developit
developit / *shell-mcp.md
Last active January 14, 2026 19:01
Ultra-lightweight MCP server for shell execution

shell-mcp

Ultra-lightweight MCP server for shell execution with session management.

Features

  • Zero runtime dependencies - All dependencies are dev-only
  • Persistent shell sessions - Run multiple commands in the same shell context
  • Background processes - Start long-running commands that continue in the background
  • One-off commands - Execute single commands without session overhead
@developit
developit / README.md
Created December 4, 2025 00:04
tiny-ai-client: ~1.3KB zero-dep streaming AI client with tool calling

Tiny AI Client

A minimalist, zero-dependency OpenAI-compatible streaming client with automatic tool calling.

Features

  • ~1.3KB gzipped - Zero dependencies
  • Dual API support - Responses (default) and Completions modes
  • Streaming - Async generator with typed chunks
  • Tool calling - Inline handlers or callback dispatch

Claude generates this anti-pattern due to shallow pattern matching across incompatible mental models:

Why It's Wrong

Every getter access creates a new computed signal with fresh subscriptions:

obj.fullName; // Creates computed signal #1
obj.fullName; // Creates computed signal #2 (never cleaned up!)
import { useState, useEffect } from 'preact/hooks';
const cache = new Map<string, any>();
const inflight = new Map<string, Promise<any>>();
export interface SWRResponse<T> {
data: T | undefined;
error: Error | null;
loading: boolean;
}

DOM Audit Logger

A little library for auditing DOM modifications.

Features

  • Tracks DOM modifications (textContent, innerHTML, className)
  • Extensible audit system for custom operations
  • Formatted audit trail output
  • Event-based subscription for real-time monitoring
import {
signal,
effect,
useSignal,
type useSignalEffect,
type Signal,
type ReadonlySignal,
} from '@preact/signals';
import { VNode, type ComponentChildren } from 'preact';
import {
@developit
developit / .gitignore
Last active January 4, 2026 21:11
run2: Node, but faster
node_modules
@developit
developit / run
Last active January 4, 2026 21:13
chmod +x run
#!/usr/bin/env node
/* eslint-disable no-param-reassign, no-fallthrough, guard-for-in, require-atomic-updates */
const path = require('node:path');
const {Worker} = require('node:worker_threads');
const DEBUG = {parsing: false, timing: false};
const debugEnv = process.env.DEBUG;
if (debugEnv) {
for (const name in DEBUG) {

computedWithMemo()

It's computed(), but with a second argument that gets passed each newly returned value in order to produce a string cache key. If you return the same cache key as the previous run of the computed, no update will be performed (no effects, no renders, etc).

JSFiddle Demo

- computed(
-   () => ['an', 'unstable', 'return', 'value'],
- )