[1]
Default scrollbars on a dark theme website are just the ugliest thing. This page covers all the pseudo selectors needed to style the scrollbar.
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /static/https://www.w3schools.com/howto/howto_css_custom_scrollbar.asp
[2]: /thoughts/
Thoughts
Link based "commentary" style posts, commenting on a web link
858 posts
latest post 2026-05-13
Publishing rhythm
[1]
Wincent (Greg Hurrel) has a pretty solid and fast zshrc. I recently grabbed his completion section and it seems to be working better than whatever I had.
zsh completion snippet
#
# Completion
#
fpath=($HOME/.zsh/completions $fpath)
autoload -U compinit
compinit -u
# Make completion:
# - Try exact (case-sensitive) match first.
# - Then fall back to case-insensitive.
# - Accept abbreviations after . or _ or - (ie. f.b -> foo.bar).
# - Substring complete (ie. bar -> foobar).
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]}' '+m:{[:upper:]}={[:lower:]}' '+m:{_-}={-_}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# Colorize completions using default `ls` colors.
zstyle ':completion:*' list-colors ''
# Allow completion of ..<Tab> to ../ and beyond.
zstyle -e ':completion:*' special-dirs '[[ $PREFIX = (../)#(..) ]] && reply=(..)'
# $CDPATH is overpowered (can allow us to jump to 100s of directories) so tends
# to dominate completion; exclude path-directories from the tag-order so that
# they will only be used as a fallback if no completions are found.
zstyle ':completion:*:complete:(cd|pushd):*' tag-order 'local-directories named-directories'
# Categorize completion...
Change Autocomplete Styles in WebKit Browsers | CSS-Tricks
We got a nice tip from Lydia Dugger via email with a method for changing the styles that WebKit browsers apply to form fields that have been autocompleted.
CSS-Tricks · css-tricks.com [1]
All the hover, select, autofil, focus combinations have left me confused on how to consistently get my form elements styled in dark mode
This snippet from CSS tricks has fixed all the different states for me to give me full control.
/* Change Autocomplete styles in Chrome*/
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
border: 1px solid green;
-webkit-text-fill-color: green;
-webkit-box-shadow: 0 0 0px 1000px #000 inset;
transition: background-color 5000s ease-in-out 0s;
}
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://css-tricks.com/snippets/css/change-autocomplete-styles-webkit-browsers/
[2]: /thoughts/
GitHub - florimondmanca/arel: Lightweight browser hot reload for Python ASGI web apps
Lightweight browser hot reload for Python ASGI web apps - florimondmanca/arel
GitHub · github.com [1]
arel is a “Lightweight browser hot reload for Python ASGI web apps”
I just implemented this on my thoughts website using fastapi [2], and it’s incredibly fast and lightweight. There just two lines of js that make a web socket connection back to the backend that watches for changes.
When in development mode, this snippet gets injected directly on the page and does a refresh when arel detects a change.
const ws = new WebSocket("ws://localhost:5000/hot-reload");
ws.onmessage = () => window.location.reload();
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/florimondmanca/arel
[2]: /fastapi/
[3]: /thoughts/
main.py [1]
python
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
hot_reload = arel.HotReload(paths=[arel.Path(".")])
app.add_websocket_route("/hot-reload", route=hot_reload, name="hot-reload")
app.add_event_handler("startup", hot_reload.startup)
app.add_event_handler("shutdown", hot_reload.shutdown)
templates.env.globals["DEBUG"] = _debug
templates.env.globals["hot_reload"] = hot_reload
@app.get("/")
def index(request: Request):
return templates.TemplateResponse("index.html", context={"request": request})
# run:
# DEBUG=true uvicorn main:app --reload
I just discovered arel [2] for hot reloading python applications when content changes from this snippet that implements it for fatapi.
On app startup add the /hot-reload routes if in DEBUG mode.
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
hot_reload = arel.HotReload(paths=[arel.Path(".")])
app.add_websocket_route("...
External Link
X (formerly Twitter) · twitter.com [1]
I need to learn regex capture groups better. This is so dang powerful. I really like the \v that bob uses here, it really does cut down on the terseness of all the special characters.
I wanted to replace all occurrences of:
name,[email protected],0,171,,2023-09-21
With:
name,[email protected]
Easy to do with Python, but what about a bit of > regex in Vim?
:%s/\v([^,]+,[^,]+),.*/\1/
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/bbelderbos/status/1709525676154368055
[2]: /thoughts/
External Link
X (formerly Twitter) · twitter.com [1]
HATEOAS gonna hate. More and more htmx [2] seems like the js library for backend devs. So rather than making 55 rest calls here, just make an endpoint that does what you want it to do with one, or a few requests.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/teej_dv/status/1708258701008593173
[2]: /htmx/
[3]: /thoughts/
Open source, not open contribution with Ben Johnson (Changelog Interviews #433)
This week we're talking with Ben Johnson. Ben is known for his work on BoltDB, his work in open source, and as a freelance Go developer. Late January when Ben open sourced his newest project Litest...
Changelog · changelog.com [1]
Ben Johnson was on the Changelog a few years back covering his work on litestream, and talks about why he chose to go open source, but not open contribution.
You should have a good reason to move off of sqlite.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://changelog.com/podcast/433
[2]: /thoughts/
Point-in-time recovery - Wikipedia
en.wikipedia.org [1]
I just learned that the term PITR means Point In Time Recovery. I have never seen this term, but it is most often referred to in relation to database recoveries.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://en.wikipedia.org/wiki/Point-in-time_recovery
[2]: /thoughts/
-
Very inspiring talk, TLDR, you probably don’t need a database server. sqlite will probably be faster, simpler to maintain, and simpler to test your application.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
GitHub - benbjohnson/litestream: Streaming replication for SQLite.
Streaming replication for SQLite. Contribute to benbjohnson/litestream development by creating an account on GitHub.
GitHub · github.com [1]
`litestream` is a sick cli tool for steaming replicas of sqlite. It automatically does daily snapshots, and streams all of the writes to the replica live.
install # [2]
Install is fast using installer, no compilation, just copy the binary and run.
curl https://i.wayl.one/benbjohnson/litestream
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/benbjohnson/litestream
[2]: #install
[3]: /thoughts/
Why I Built Litestream - Litestream
Despite an exponential increase in computing power, our applications require more machines than ever because of architectural decisions made 25 years ago. You can eliminate much of your complexity ...
litestream.io [1]
As applications scale to the edge, to put compute as close to the user as possible, database queries back to the master node get slower and slower. Enter sqlite replication, put the database wtih the application code and replicate from master.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://litestream.io/blog/why-i-built-litestream/
[2]: /thoughts/
I'm All-In on Server-Side SQLite
Ben Johnson has joined Fly.io
Fly · fly.io [1]
SQLite is the next big database trend. with more horizontal scaling, close to user read heavy applications, having your database in the same application stack makes a lot of sense. Tools like litestream are going to enable global distribution in an impressive way.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://fly.io/blog/all-in-on-sqlite-litestream/
[2]: /thoughts/
LiteFS Cloud: Distributed SQLite with Managed Backups
Documentation and guides from the team at Fly.io.
Fly · fly.io [1]
Fly.io’s solution to sqlite managed backups.I definitely want to look into this a bit, but moreso the tech under the hook litestream.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://fly.io/blog/litefs-cloud/
[2]: /thoughts/
GitHub - jpillora/installer: One-liner for installing binaries from Github releases
One-liner for installing binaries from Github releases - jpillora/installer
GitHub · github.com [1]
This is a sick looking bash script generator for installing binaries off of github releases. it reccomends curl into bash, but you could curl into install.sh and toss that in your dotfiles repo or wherever.
Install installer with installer
curl -s https://i.jpillora.com/installer | bash
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/jpillora/installer
[2]: /thoughts/
How to run pods as systemd services with Podman
Podman is well known for its seamless integration into modern Linux systems, and supporting systemd is a cornerstone in these efforts. Linux commonly uses th...
redhat.com [1]
podman comes with a nice command for generating systemd service files (units).
$ podman pod create --name=my-pod
635bcc5bb5aa0a45af4c2f5a508ebd6a02b93e69324197a06d02a12873b6d1f7
$ podman create --pod=my-pod --name=container-a -t centos top
c04be9c4ac1c93473499571f3c2ad74deb3e0c14f4f00e89c7be3643368daf0e
$ podman create --pod=my-pod --name=container-b -t centos top
b42314b2deff99f5877e76058ac315b97cfb8dc40ed02f9b1b87f21a0cf2fbff
$ cd $HOME/.config/systemd/user
$ podman generate systemd --new --files --name my-pod
/home/vrothberg/.config/systemd/user/pod-my-pod.service
/home/vrothberg/.config/systemd/user/container-container-b.service
/home/vrothberg/.config/systemd/user/container-container-a.service
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.redhat.com/en/blog/podman-run-pods-systemd-services
[2]: /thoughts/
Pagefind
Pagefind is a fully static search library that aims to perform well on large sites, while using as little of your users’ bandwidth as possible, and without hosting any infrastructure.
Pagefind · pagefind.app [1]
Pagefind is absolutely insane. I’ve tried a number of static site searches, and found them all hard to get get going, clunky and not the best experience as a user or developer.
I setup pagefind in about 2 minutes on my site where it found and indexed 833 pages in 2 minutes.
The only downside I see so far is that it is a lot of bandwidth to the user. On simulated slow 3G you can definitly feel it, but not terrible. Anything slower and its going to start feeling frustrating.
edit: I have actually fully deployed it on waylonwalker.com, and its fast!
create the index
npx -y pagefind --site public --serve
Then I put this on a page, it looks really nice on a white background, but would need some work to drop into a dark theme.
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<div id="search"></div>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", s...
-
Dang Mariah, killing it with continuous learning perspective.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
External Link
X (formerly Twitter) · twitter.com [1]
Kinda mindblown that this is even possible. This is so far outside of my current thinking that i didn’t even think of an elegant way to implement semantic search accross images and text at the same time. I know it happens at Google, but I envision that as still text search accross tags and meta data about the image.
Based on the number of responses CLIP is the thing that does this.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://twitter.com/simonw/status/1700528222382027039
[2]: /thoughts/
GitHub - aca/emmet-ls: Emmet support based on LSP.
Emmet support based on LSP. Contribute to aca/emmet-ls development by creating an account on GitHub.
GitHub · github.com [1]
This is the greatest nvim emmet plugin I have tried. In the past I had tried the vim plugin a few times and just could not get a good flow with the keybindings and found it confusing for my occasional use. emmet-ls just uses lsp-completion, so its the same flow as other completions.
You can try it out by installing with :Mason
config # [2]
local lspconfig = require('lspconfig')
local configs = require('lspconfig/configs')
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.emmet_ls.setup({
-- on_attach = on_attach,
capabilities = capabilities,
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
init_options = {
html = {
options = {
-- For possible options, see: https://github.com/emmetio/emmet/blob/master/src/config.ts#L79-L267
["bem.enabled"] = true,
},
},
}
})
Note
This post is a thought [3]. It’s a sho...
LLM now provides tools for working with embeddings
LLM is my Python library and command-line tool for working with language models. I just released LLM 0.9 with a new set of features that extend LLM to provide tools …
Simon Willison’s Weblog · simonwillison.net [1]
Simon’s llm cli is getting quite interesting. I really want to run some clustering on my website content.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://simonwillison.net/2023/Sep/4/llm-embeddings/
[2]: /thoughts/
Formatter
How to use the Biome formatter.
Biome · biomejs.dev [1]
Tried out biome today and it worked better than prettier on jinja templates, I might adopt this over prettier.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://biomejs.dev/formatter/
[2]: /thoughts/
htmx ~ The disable-element Extension
htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypert...
v1.htmx.org [1]
An extension to disable elements during flight of an htmx [2] request, Looks super useful for things like a create or delete button where the server would end up with an error if you double delete or double create. This eliminates an error path that the user might see under normal use of the ui.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://v1.htmx.org/extensions/disable-element/
[2]: /htmx/
[3]: /thoughts/
htmx ~ hx-indicator Attribute
The hx-indicator attribute in htmx allows you to specify the element that will have the `htmx-request` class added to it for the duration of the request. This can be used to show spinners or progre...
htmx.org [1]
The htmx-request class is added to htmx-target elements. You can target this css selector to create loading state throbbers.
By default the target element will the self, but you can use the typical htmx [2] css selector to select which element will recieve the htmx-request class while the request is running.
The only way to override the name of the class is through config.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://htmx.org/attributes/hx-indicator/
[2]: /htmx/
[3]: /thoughts/
-
Prime concisely made sense of why htmx is so awesome compared to what has become modern reactive web dev in 2 minutes. I had never thought of it this way and it’s incredible.
One thing I have comepletely missed out on with my use of htmx is setting the disabled state while the server is working, what a genius move!
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /htmx/
[2]: /thoughts/
htmx ~ Examples ~ Updating Other Content
htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypert...
htmx.org [1]
Three ways to support updating other content. Fantastic article walking through the different ways to update other parts of the screen using htmx [2].
In htmx there is no 2 way data binding, the dom is your state, and if you have elements derived from the same data on the screen in different places you need to think about how to keep them in sync.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://htmx.org/examples/update-other-content/
[2]: /htmx/
[3]: /thoughts/
Bigger Applications - Multiple Files - FastAPI
FastAPI framework, high performance, easy to learn, fast to code, ready for production
fastapi.tiangolo.com [1]
Fastapi [2] lets you tag your APIRouter’s so that the swagger docs are grouped according to the router.
router = APIRouter(tags=['router'])
Now all routes in router will appear in the router group in the swagger docs.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://fastapi.tiangolo.com/tutorial/bigger-applications/#another-module-with-apirouter
[2]: /fastapi/
[3]: /thoughts/
Custom pages and templates - Datasette documentation
docs.datasette.io [1]
Datasette has its own static server that can host assets such as style sheets.
datasette -m metadata.json --static assets:static-files/
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://docs.datasette.io/en/stable/custom_templates.html#serving-static-files
[2]: /thoughts/
[1]
Tailwind css component library. There are many examples with copy and pastabily with the tailwind classes already setup.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /static/https://preline.co/docs/index.html
[2]: /thoughts/
Tailwind CSS Cheat Sheet
Cheat sheet to learn Tailwind CSS quickly. Browse and search all Tailwind utility classes or CSS properties on one page.
nerdcave.com [1]
A nice searchable cheatsheet for tailwindcss classes.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://nerdcave.com/tailwind-cheat-sheet
[2]: /thoughts/
cURL Command Without Using Cache | Baeldung on Linux
A quick and practical guide to using curl without cache.
Baeldung on Linux · baeldung.com [1]
Busting cache with curl. I’m not sure how much gets cached by curl, but I have ran into several cases where I am looking for new content and I want to ensure the content is new and no chance of being cached.
This article suggests 3 different techniques.
curl -H 'Cache-Control: no-cache, no-store' http://www.example.com
curl -H 'Pragma: no-cache' http://www.example.com
curl http://www.example.com/?xyzzyspoon
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.baeldung.com/linux/curl-without-cache#adding-the-pragma-http-header
[2]: /thoughts/
[1]
sqlite has 3 different tokenizers, porter, ascii, trigram.
These can be used with sqlite-utils.
sqlite-utils enable-fts --tokenize porter database.db post title message tags
And with the python api.
db = Database('database.db')
db["post"].enable_fts(
["title", "message", "tags"], create_triggers=True, tokenize="trigram"
)
posts = list(db["post"].search(search))
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /static/https://www.sqlite.org/fts5.html
[2]: /thoughts/
GitHub - sharkdp/bat: A cat(1) clone with wings.
A cat(1) clone with wings. Contribute to sharkdp/bat development by creating an account on GitHub.
GitHub · github.com [1]
Bat is my favorite pager, its the one for me that seems to just work more than the rest. colors, syntax highlighting, line numbers search, it just feels the most natural.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/sharkdp/bat
[2]: /thoughts/
sqlite_utils Python library - sqlite-utils
sqlite-utils.datasette.io [1]
sqlite-utils is primarily a cli tool for sqlite operations such as enabling full text search, and executing searches, but it also has a nice python api that is exposed and pretty straightforward to use.
from sqlite_utils import Database
db = Database("database.db")
db["post"].enable_fts(["title", "message", "tags])
db["post"].search("water")
This returns a generator object that you can iterate over the row objects with.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://sqlite-utils.datasette.io/en/stable/python-api.html#full-text-search
[2]: /thoughts/
External Link
levelup.gitconnected.com [1]
Use prettier to format all files in a directory. By default prettier does not write, it just echos out the format that it would do. Give it the --write and it will write the changes to the files.
prettier --write .
I just used this on my thoughts repo.
prettier --write templates
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://levelup.gitconnected.com/how-to-format-all-files-in-a-directory-with-prettier-5f0ff5f4ffb2
[2]: /thoughts/
GitHub - simonw/datasette-render-markdown: Datasette plugin for rendering Markdown
Datasette plugin for rendering Markdown. Contribute to simonw/datasette-render-markdown development by creating an account on GitHub.
GitHub · github.com [1]
datasette really does everything doesn’t it!
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/simonw/datasette-render-markdown
[2]: /thoughts/
GitHub - simonw/shot-scraper: A command-line utility for taking automated screenshots of websites
A command-line utility for taking automated screenshots of websites - simonw/shot-scraper
GitHub · github.com [1]
> A command-line utility for taking automated screenshots of websites
Daaaang, this is such an elegantly simple way to get web screenshots with a cli. I was literally up and running with two commands on my arch linux machine (which it warned was unsupported by playwright).
pip install shot-scraper
# Now install the browser it needs:
shot-scraper install
shot-scraper waylonwalker.com
shot-scraper https://datasette.io/
shot-scraper https://datasette.io/ -h 1280 -w 1920
shot-scraper https://datasette.io/ -h 480 -w 720
shot-scraper shot --selector '#posts' https://thoughts.waylonwalker.com/post/89
Note shot-scraper https://datasette.io/ is a full length screenshot of the entire page.
Oh and its pretty dang fast, let alone the setup time, this crushes on startup time in my attempts to use a headless browser in the past.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/si...
shot-scraper: automated screenshots for documentation, built on Playwright
shot-scraper is a new tool that I’ve built to help automate the process of keeping screenshots up-to-date in my documentation. It also doubles as a scraping tool—hence the name—which I …
Simon Willison’s Weblog · simonwillison.net [1]
An interesting way to build automatically annotaatd docs with arrows pointing to elements on a webpage.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://simonwillison.net/2022/Mar/10/shot-scraper/#a-complex-example
[2]: /thoughts/
-
I’d never given this much thought, but there are so many guides that are complete guides for beginner workflows, but once you get beyond beginner there is likely no manual for what you are trying to do in programming. There is no guide that will tell you the best way to get your companies salesforce data, alongside of the ERP data and present it to the users who need to know in a way that compels them to make the right decisions. You are going to have to build this out for yourself by piecing together knowledge about each subject.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/
HTML Over The Wire | Hotwire
Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire.
hotwired.dev [1]
An alternative approach to building modern web withhout heavy js and json, but instead html [2] over the wire, keeping the logic in the backend of rails.
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://hotwired.dev/
[2]: /html/
[3]: /thoughts/
How do I post form data using Curl?
ReqBin is the most popular online API testing tool for REST, SOAP and HTTP APIs.
ReqBin · reqbin.com [1]
How to pass form data with curl, give it the d.
curl -X POST https://reqbin.com/echo/post/form
-H "Content-Type: application/x-www-form-urlencoded"
-d "param1=value1¶m2=value2"
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://reqbin.com/req/c-sma2qrvp/curl-post-form-example
[2]: /thoughts/
Vue.js
Vue.js - The Progressive JavaScript Framework
vuejs.org [1]
A super handy reference to the vuejs lifecycle.
[2]
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://vuejs.org/guide/essentials/lifecycle.html#lifecycle-diagram
[2]: https://vuejs.org/assets/lifecycle.16e4c08e.png
[3]: /thoughts/
How to Use HTML to Open a Link in a New Tab
Tabs are great, aren't they? They allow the multitasker in all of us to juggle a bunch of online tasks at the same time. Tabs are so common now that, when you click on a link, it's likely it'll ope...
freeCodeCamp.org · freecodecamp.org [1]
Most of the time when creating links in html [2] you want to maintain the default behavior, as this is what users are going to expect, but sometimes your site behaves such that it does not fit, and it does something unexpected anyways. in this case you might want to make the default behavior to open the link in a new tab rather than relying on users to control click.
Use this with restraint as this can make your site feel janky and do things that do not feel natural to the web.
<p>Check out <a href="https://www.freecodecamp.org/" target="_blank" rel="noopener noreferrer">freeCodeCamp</a>.</p>
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.freecodecamp.org/news/how-to-use-html-to-open-link-in-new-tab/
[2]: /html/
[3]: /thoughts/
Create Models with a Many-to-Many Link - SQLModel
SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
sqlmodel.tiangolo.com [1]
Creating many to many relationships with sqlmodel requires a LinkTable Model. The link model will keep track of the linked id’s between each of the models.
[2]
from typing import List, Optional
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine
class HeroTeamLink(SQLModel, table=True):
team_id: Optional[int] = Field(
default=None, foreign_key="team.id", primary_key=True
)
hero_id: Optional[int] = Field(
default=None, foreign_key="hero.id", primary_key=True
)
class Team(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
headquarters: str
heroes: List["Hero"] = Relationship(back_populates="teams", link_model=HeroTeamLink)
class Hero(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
secret_name: str
age: Optional[int] = Field(default=None, index=True)
teams: List[Team] = Relationship(back_populates="heroes", link_model=HeroTeamLink)
Note
This post...
External Link
stackoverflow.com [1]
I went down the route of leveraging the json-enc extention in htmx [2], but later realized that this completely breaks browsers/users who do not wish to use javascript. While most of the web would feel quite broken with javascript disabled, I don’t want to contribute to that without good reason.
Taking a second look into this issue, rather than using json-enc, and using as_form to get form data into a model keeps the nice DX fo everything being a pydantic model, but the site still works without js. with js htmx kicks in, you get a spa like experience by loading partials onto the page, and without, you just get a full page reload.
the implementation # [3]
copied from https://stackoverflow.com/questions/60127234/how-to-use-a-pydantic-model-with-form-data-in-fastapi
import inspect
from typing import Type
from fastapi import Form
from pydantic import BaseModel
from pydantic.fields import ModelField
def as_form(cls: Type[BaseModel]):
new_parameters = []
for field_name, model_field in cls.__fields__.items():
model_field: ModelField # type: ignore
new_parameters.append(
inspect.Parameter(
model_field.alias,
inspect.Parameter.POSITION...
GitHub - chebykinn/sedmario: NES Super Mario Bros level 1 written in pure sed!
NES Super Mario Bros level 1 written in pure sed! Contribute to chebykinn/sedmario development by creating an account on GitHub.
GitHub · github.com [1]
🤯 NES Super Mario Bros level 1 written in pure sed, this is madmess.
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/chebykinn/sedmario
[2]: /thoughts/
Formatting on save
Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. - jose-elias-alvarez/null-ls.nvim
GitHub · github.com [1]
neovim stopped formatting on save for me awhile ago and I have just been dealing with it. looks like there may have been an api change, idk.
I had to make this update.4
- vim.lsp.buf.format()
+ vim.lsp.buf.format({async=false})
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Formatting-on-save#code
[2]: /thoughts/
[1]
How to enable debug mode in pywebview.
import webview
webview.create_window('Woah dude!', 'https://pywebview.flowrl.com/hello')
webview.start(debug=True)
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /static/https://pywebview.flowrl.com/guide/debugging.html
[2]: /thoughts/
`ValueError: Constraint must have a name` in alembic 1.10.0 · Issue #1195 · sqlalchemy/alembic
Describe the bug ValueError: Constraint must have a name in alembic 1.10.0. Expected behavior Migration succeeds. To Reproduce Please try to provide a Minimal, Complete, and Verifiable example, wit...
GitHub · github.com [1]
After a nasty time with alembic upgrades, thoughts is about to get a new users table. This may have came from incorrectly setting up alembic for sqlite from the start, but I was able to fix the issue with this GitHub issue.
alembic sqlite ValueError: Constraint must have a name
The change I needed to make to get my migration to run.
+ batch_op.create_foreign_key('fk_post_author_id_user', 'user', ['author_id'], ['id'])
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://github.com/sqlalchemy/alembic/issues/1195
[2]: /thoughts/
![[None]]
Since using alembic I have been just running out a new revision checking its content and deleting it if its empty, today I learned there is an alembic check command to check for operations that need to be created.
❯ alembic check
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
No new upgrade operations detected.
Note
This post is a thought [1]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: /thoughts/