Skip to content

Instantly share code, notes, and snippets.

/*
MIT License
Copyright (c) 2026 Learned By Error
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

_hyperscript Language Reference for AI Context

This work is marked CC0 1.0

Overview

_hyperscript is a scripting language for HTML, designed for DOM manipulation and event handling. It uses English-like syntax embedded in HTML attributes: _="..." or data-script="...".


HTMX Reference for AI Context

This work is marked CC0 1.0

Overview

HTMX extends HTML with attributes that enable AJAX requests, CSS transitions, WebSockets, and Server-Sent Events directly in markup. Responses are HTML fragments, not JSON.

Core principle: Server returns HTML, HTMX swaps it into the DOM.

@lbe
lbe / pool_bench_test.go
Created November 28, 2025 05:06
Go benchmark that compares several pooling strategies
// Pool Benchmarks (Standalone Gist)
//
// This single-file Go benchmark compares several pooling strategies:
// - Interface sync.Pool with pointer indirection (e.g., *[]byte, *bytes.Buffer)
// - Generic value slice pool (SlicePool[T])
// - Generic pointer pool (PtrPool[T])
// - Minimal ResettablePool (calls Reset() on Put)
//
// Usage:
//
//Originally github.com/dietsche/rfsnotify
//Modified to use Walkdir instead of Walk
// Package rfsnotify implements recursive folder monitoring by wrapping the excellent fsnotify library
package rfsnotify
import (
"errors"
"io/fs"
"os"
@lbe
lbe / main.go
Last active March 15, 2024 20:11
Go demo code lazy initialization with sync.OnceValue
/*
This code is released under the MIT license - https://opensource.org/license/mit
*/
package main
import (
"database/sql"
"log"
"sync"
#!/usr/bin/env perl
use Mojolicious::Lite -signatures;
use Mojo::File;
use Mojo::Util qw(getopt);
use Pod::Usage;
use version 0.77;
my $VERSION = "0.01";
@lbe
lbe / PKGBUILD
Created December 17, 2022 19:35
ARCH Linux xrdp 0.9.21.1 PKGBUILD
# Maintainer: Brian Bidulock <[email protected]>
# Contributo: Jianhui Z <[email protected]>
# Contributo: Tau Tsao <realturner at gmail.com>
# Contributor: Tomasz Zok <tomasz.zok [at] gmail.com>
# Contributor: techryda <techryda at silentdome dot com>
# Contributor: Mathias R. <[email protected]>
pkgname=xrdp
pkgver=0.9.21.1
pkgrel=3
@lbe
lbe / popcount.c
Last active August 14, 2022 07:54
sqlite3 extension to calculate the bit population - not working!
/* compile osx
* gcc -bundle -fPIC -O3 -o popcount.dylib popcount.c
* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
Macos Montery 12.2 on a 2018 Macbook Pro with a 6 Core I9, perl 5.34
In this case, all three runs resulted in a consistent sequence. Earlier runs resulted in _signature_scalar,
_array_unpack and _ref_direct having differen orders in some runs giving how little difference there is the
performance of each of these.
Rate _ref_unpack _ref_shift _signatures_array _signatures_ref _array_shift _ref_direct _array_unpack _signatures_scalar _array_direct
_ref_unpack 6720430/s -- -0% -8% -12% -16% -25% -27% -29% -65%
_ref_shift 6743088/s 0% -- -8% -12% -15% -25% -27% -29% -65%
_signatures_array 7309942/s 9% 8% -- -4% -8% -19% -21% -23% -62%