- Always use Typescript.
- I like descriptive TypeScript type names (no one-letter type names for me). I also prefer the Array generic over the bracket syntax.
- Prefer types over interfaces.
- When writing HTML author with semantic HTML, using div and span as a very last resort. Try not to over use aria-label.
- Always use plain CSS, never use tailwind.
- Prefer function declarations (placed at bottom of scope).
- Be terse
- Suggest solutions that I didn’t think about—anticipate my needs
- Treat me as an expert
- Be accurate and thorough
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
| in_thinking=false | |
| while read -r line; do | |
| thinking=$(echo "$line" | jq -r '.message.content[]? | select(.type == "thinking") | .thinking // empty' 2>/dev/null) | |
| text=$(echo "$line" | jq -rj '.message.content[]? | select(.type == "text") | .text // empty' 2>/dev/null) | |
| if [ -n "$thinking" ]; then | |
| if [ "$in_thinking" = false ]; then | |
| printf '\r\n───────────────\r\n💭 ' | |
| in_thinking=true |
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
| import * as acorn from "acorn"; | |
| import fs from "node:fs"; | |
| import path from "node:path"; | |
| const file = '/path/to/js/file.js'; | |
| const allNodes = new Map<string, TreeNode>(); | |
| class TreeNode { |
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
| // https://fettblog.eu/typescript-react-generic-forward-refs/ | |
| declare module "react" { | |
| function forwardRef<T, P = {}>( | |
| render: (props: P, ref: React.Ref<T>) => React.ReactElement | null | |
| ): (props: P & React.RefAttributes<T>) => React.ReactElement | null; | |
| } | |
| // Usage | |
| // Just write your components like you're used to! |
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
| <form> | |
| <fieldset> | |
| <input | |
| type="text" | |
| placeholder=" " | |
| id="first-name" | |
| minlength="5" | |
| required | |
| /> | |
| <label for="first-name">Full name</label> |
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
| /* https://github.com/lorenzodelijser/lint-html-with-css */ | |
| :root { | |
| --lint: 2px dotted red; | |
| --lintw: 2px dashed #ffc107 | |
| } | |
| /* Debug inputs and labels without id or for attribute */ | |
| /* Are you sure your code is ok? Explicit relation between an input and its label is always better. Use id and for attributes to do so. */ | |
| /* By Geoffrey Crofte */ |