Skip to content

Instantly share code, notes, and snippets.

@JLarky
JLarky / remove-old-unused.ts
Created February 4, 2026 11:15
script to remove unused files but leave some metadata after removing it
#!/usr/bin/env bun
import { existsSync, readdirSync, statSync, writeFileSync, unlinkSync, readFileSync } from 'node:fs'
import { exit } from 'node:process'
import { join } from 'node:path'
import { $ } from 'bun'
const targetDir = process.argv[2]
if (!targetDir) {
@JLarky
JLarky / hyperterm-quake.md
Created December 12, 2021 01:49
drop-down terminal (quake, tilda, yakuake style) for hyper terminal
@JLarky
JLarky / 00_README.md
Last active December 27, 2025 05:32
useChildFormStatus

Why is useFormStatus always returning pending false?

So you are trying out that new fangled useFormStatus hook but it doesn't actually react to the status of your form?

Now you tried to Google it and all you get is RTFM "go read docs again". Because hook useFormStatus shows you the status of parent form, not a sibling one.

Let's explain that in English.

  • <form><Spinner></form> works
  • `` doesn't
@JLarky
JLarky / com.chrome.devtools.json.ts
Created July 15, 2025 20:30
Astro .well-known/appspecific/com.chrome.devtools.json.ts
// put this in src/pages/.well-known/appspecific/com.chrome.devtools.json.ts
import type { APIRoute } from "astro"
import { join } from "node:path"
// https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md
export const GET: APIRoute = () => {
return new Response(
JSON.stringify({
"workspace": {
"root": join(import.meta.dirname, "../../../../../.."),
@JLarky
JLarky / README.md
Created August 1, 2022 17:29
Ultimate example of solidjs context hook with nice type-safe (TypeScript) wrappers and reduced boilerplate by using `ReturnType`
@JLarky
JLarky / index.ts
Created July 22, 2025 16:15
lift-html solid counter
import { liftHtml } from '@lift-html/core';
import html from "solid-js/html";
import { createSignal } from "solid-js";
import { render } from "solid-js/web";
const css = /*css*/ `
* { font-size: 200%; }
span {
width: 4rem;
@JLarky
JLarky / .zshrc
Created May 24, 2025 01:59
tmp function with zsh
# tmp function
function tmp() {
local tmp_dir=$(mktemp -d)
echo "Created temporary directory: $tmp_dir"
cd $tmp_dir
}
@JLarky
JLarky / DebugJSON.astro
Last active April 11, 2025 07:59
Debug JSON with json.pub for Astro
---
type Props = {
json: unknown;
};
---
<view-as-json><pre data-target="view-as-json:pre" set:text={JSON.stringify(Astro.props.json, null, 2)} /></view-as-json>
<script is:inline type="module">
// @ts-ignore
import { liftHtml } from 'https://esm.sh/@lift-html/core@0.0.4';
@JLarky
JLarky / README.md
Last active April 11, 2025 07:58
Debug JSON with json.pub for Astro
@JLarky
JLarky / HydrationCounter.astro
Created April 5, 2025 03:34
nice and easy "did my React had hydration errors?" script https://x.com/JLarky/status/1908362375490867547
---
declare global {
interface Window {
had_hydration_error?: string;
}
}
---
<script>
const prefix = 'Uncaught Error: ';