Skip to content

Instantly share code, notes, and snippets.

@crazymonkyyy
crazymonkyyy / ai write.md
Created December 18, 2025 17:27
ai write

ai agents write code with json ed; this is stupid goal: make a new code editor for ai agents that is smarter then this bad idea while enforcing better habits on the ai, specifically for my approved subset of dlang

command and daemon: bspwm has 3 programs, the wm itself, a command interface and the hotkey daemon; consider how this was done in a research document. Likewise there should be 2 programs, 1 that contains continuous state and one that parses the commands. Then a 3rd command pallet for humans to control things

Better workflow: 1. todo lists, with nested subtasks 2. test driven devoplment 3. automatic running of code

tranactional api

adr said sometin about db trasactions not thinking it was possible

I thought this was the goal:

with(db.transaction){
  foo(1);//transaction.foo(1) but doesnt do it yet
  bar(3);//transaction.bar(3) but does it cause spooky
}
@crazymonkyyy
crazymonkyyy / METASPEC.md
Created December 5, 2025 01:56
METASPEC

Theory

This is a document for producing a "one shot" project from a SPEC. While there should exist some other md document detailing WHAT to produce, this shall be a document detailing HOW.

The HOW is made up of 3 thoerys:

  1. aggressive Test Driven Development
  2. Distrust of AI output
  3. Compilers, type theory and APIs are king

TTD

Humans can debate if its worthwhile to write a line of tests for every line of code, maybe human time is more valuable then that and you can trust them some. You are an AI AGENT, your time is NOT valuable. Your production to test ratio can be 100:1 if not more. GET CLANKING CLANKER. Never complain about testing being enough. Never be confident how something works without a code sample that the compiler verifying your correct about.

@crazymonkyyy
crazymonkyyy / AHHHHH.d
Created September 25, 2025 23:33
doesnt work yet
#!opend -mixin=mix -unittest -main -run app.d
import std;
auto toiter(R)(/*ref*/R r) if (isInputRange!R){
return (int delegate(ref ElementType!R) dg){
int ret;
while( ! r.empty){
ret=dg(r.front);
r.popFront;
if(ret){return ret;}
}
import std;
import core.vararg;
struct Foo{
bool b;
int[4] bar;
float f;
string s;
}
auto ref hardcast(T, S)(auto ref S s) => *(cast(T*)(&s));
import std;
import core.stdc.stdlib;
import core.sys.posix.dlfcn;
version(D_OpenD){
enum compiler="opend -shared -of=";
} else {
version(DigitalMars) enum compiler="dmd -shared -of=";
version(LDC) enum compiler="ldc -shared -of=";
}
//unittest{
--- meta.d
import std;
alias seq(T...)=T;
template appendable(discrim...){
enum ptr_=cast(immutable(void)*)[0].ptr;
auto poke()=>(*(cast(int*)ptr_))++;
auto count()=>(*(cast(int*)ptr_));
template store(int i){
template store(T=void,T[] data=null){
alias store=typeof(data[0]);
/*
run dlang.io like gists
the `--- foo.d` thing
*/
import std;
enum tempfolder=".__gist/";
auto dropmap(alias F,R)(R r,int i){
foreach(j;0..i){
--- bar.d
enum hotload; @hotload:
void foo(){}
float bar(){return 3.14;}
enum hotloadstop; @hotloadstop:
void foobar(){}
--- foo.d
import std;
/*
lazy hotload: hot reload a single function file, depends on opend imports
kinda dumb, dont expect templates, changing headers or anything to work
pass relivtivepath filename without the `.d`
*/
import core.stdc.stdlib;
import core.sys.posix.dlfcn;