A gtk+adwaita markdown editor in ~600 lines that uses a webview with marked.js and katex for rendering markdown. This is made as a self contained uv script to be very portable
| #!/usr/bin/env -S uv run --script | |
| # /// script | |
| # dependencies = [] | |
| # /// | |
| import argparse | |
| import sys | |
| def build_tree(items, delim=None): |
| #!/usr/bin/env python3 | |
| import re | |
| import sys | |
| def parse_version(version_str): | |
| """Parse version string, marking date/timestamp components""" | |
| parts = [] | |
| for x in re.findall(r"\d+", version_str): |
Small helper script to convert a PDF into markdown by converting pages to images and running an LLM-based OCR prompt on each image.
Requirements
- pdftoppm (poppler-utils) — to convert PDF pages to PNG images
- aichat CLI — to run the OCR prompt against each page image
I really don't like TailwindCSS and recently I discovered that llms are good at writing ViteJS plugins and did some experiments that came out pretty well in opinion.
Note. I know about styled-components, EmotionCSS and vanilla-extract and others but I don't like to write CSS-as-JS and some of the libraries do not support ViteJS or are too much tied to the React ecosystem and can't be used with Preact.
I really like to write CSS by hand but I get that Tailwind gives the ability to write everything directly in the same files keeping related things together. In an ideal world I think I would just ditch HTML+CSS and have the separation at components+layout and colors+styles, or just have a single language like in SwiftUI or Jetpack Compose.
| // | |
| // Library | |
| // | |
| const newValueToUpdater = newValue => (typeof newValue === 'function' ? newValue : () => newValue) | |
| const hooks = { | |
| state: (hookContext, initialValue) => { | |
| if (!hookContext.initialized) { | |
| hookContext.initialized = true |
| package lang | |
| import ( | |
| "fmt" | |
| "regexp" | |
| "strings" | |
| "unicode" | |
| ) | |
| type parser struct { |
MDN has documentation about Proxy.
const api = createObjectMapper('https://example.org/base-path/')
await api.users['user-id-1'].get()
