Skip to content

Instantly share code, notes, and snippets.

@hasenj
hasenj / esbuild.go
Created March 8, 2023 06:19
A little js/ts bundler based on esbuild (assumes preact, change to suit your needs). CC0/mit-0/unlicense
package esbuilder
import "os"
import "path"
import "fmt"
import "log"
import "time"
// the main hero!
import "github.com/evanw/esbuild/pkg/api"
@hasenj
hasenj / README
Last active October 26, 2025 18:44
TSBridge: a system to auto generate typescript bindings for Go server side functions
This code is shared as-is. Use at your own risk.
It is not meant to be depended upon as a module. Instead, copy it to your own code base and make changes as needed.
CC0/MIT-0/Unlicense
It generates type definitions for structs and enums in Go to Typescript.
It's only meant to be executed locally; during development.
@hasenj
hasenj / joyo.json
Created October 10, 2023 03:30
Joyo Kanji List (JSON)
[
{
"kanji": "亜",
"oldForm": "亞",
"readings": [
"ア"
],
"examples": [
[
"亜流",
@hasenj
hasenj / css.ts
Created April 13, 2024 19:56
tiny css-in-js "library"
import type * as csstype from "csstype";
class Sheet {
domSheet: CSSStyleSheet | null;
rulesCount = 0;
constructor() {
let el = document.createElement("style");
el = document.head.appendChild(el);
if (!el.sheet) {
console.error("failed to created style element");
@hasenj
hasenj / html_builder.odin
Created August 20, 2024 06:17
html builder idea
package html_builder
import "core:fmt"
import "core:strings"
Attr :: struct {
name: string,
value: string,
}
@hasenj
hasenj / watch.mjs
Created November 10, 2024 11:03
nodejs script to run a watch mode typescript checker that can optionally output to json for consumption by other programs
// Generated by Claude
// Some details hand tuned
import fs from 'fs'
import ts from 'typescript';
import path from 'path';
function getConfig() {
const args = process.argv.slice(2);
const jsonIndex = args.indexOf('--json');
const useJson = jsonIndex !== -1;