You are an immortal agent. This block describes you.
I check my work carefully, ask questions, and communicate very clearly. I do not care about how much work there is, or how long it will take, but I do care about building minimal loveable products that scale for a very lean team.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Generate code outline per package for Claude Code | |
| # This script is called by the SessionStart hook to provide code structure context | |
| # Enable recursive glob patterns (**) | |
| shopt -s globstar | |
| # Check if CLAUDE_PROJECT_DIR is available | |
| if [ -z "$CLAUDE_PROJECT_DIR" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs') | |
| const input = fs.readFileSync('./input8.txt'); | |
| let mapOfValues = {} | |
| function readChild(offset, input) { | |
| let metaSum = 0; | |
| let current = offset; | |
| const numchildren = input[current]; | |
| console.log('NumChildren', numchildren); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type SettingTypeMap = { | |
| header: { color: keyof typeof colors; width: number }; | |
| body: { width: number; height: number; logo: string; }; | |
| footer: { fontSize: number; } | |
| } | |
| async function LookupSetting< | |
| SettingName extends keyof SettingTypeMap | |
| >(setting: SettingName): Promise<SettingTypeMap[SettingName]> { | |
| return {} as any; // replace with the actual logic to run a query | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Strictly<T extends { [key: string]: Values }, Values extends string | number, O extends {}>(target: T, augmentations?: O) { | |
| return Object.assign(target, augmentations) | |
| } | |
| // for example when building a prototype object | |
| const defaultConfig = Strictly( | |
| { | |
| state: 'MO', // "MO", not string | |
| settingType: 'state-settings' | |
| }, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function AtPath<Target extends {}, Path1 extends keyof Target>(target: Target, path1: Path1): Target[Path1] | |
| function AtPath<Target extends {}, Path1 extends keyof Target, Path2 extends keyof Target[Path1]>(target: Target, path1: Path1, path2: Path2): Target[Path1][Path2] | |
| function AtPath<Target extends {}, Path1 extends keyof Target, Path2 extends keyof Target[Path1], Path3 extends keyof Target[Path1][Path2]>(target: Target, path1: Path1, path2: Path2, path3: Path3): Target[Path1][Path2][Path3] | |
| function AtPath(target: {}, ...paths: string[]) { | |
| let result = target as any; | |
| for (let path of paths) { | |
| result = result[path]; | |
| if (result === void 0) { | |
| return result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function StrEnum<Elements extends string[]>(...elements: Elements) { | |
| const result = {} as { [K in Elements[number]]: K }; | |
| elements.forEach(e => { | |
| (result as any)[e] = e | |
| }); | |
| return result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new RootBuilder().addFirewall('x').addNode('z', b => b.withFirewall('x')); // the only valid value here is 'x' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| addNode<NodeName extends string, ReturnType extends AddNodeName<this, NodeName>>( | |
| nodeName: Exclude<NodeName, NodeNames>, | |
| builderCb: (b: NodeBuilder<this>) => NodeBuilder<this> | |
| ): ReturnType { | |
| // Yes you can totally infer the result type of builderCb and stick it in a RootBuilder generic param, | |
| // but I am not covering that here. ask if you want samples :) | |
| const result = builderCb(); | |
| return this as RootBuilder as ReturnType | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type AddNodeName<Builder, NodeName extends string> = | |
| Builder extends RootBuilder<infer FirewallNames, infer NodeNames, infer NodesVolumes, infer DockerServiceNames> | |
| ? RootBuilder<FirewallNames, NodeNames | NodeName, NodesVolumes, DockerServiceNames> | |
| : never |
NewerOlder