Posts tagged: dev

All posts with the tag "dev"

297 posts latest post 2026-05-23
Publishing rhythm
May 2026 | 13 posts
FastHX - FastHX volfpeter.github.io [1] Very interesting approach to htmx [2] and fast api. It uses separate decorators for returning template partials and json that can be stacked to include both options on a single route. The templates are explicitly set in the decorator. Separate decorators are used for full page and partial pages. I don’t see an example of full and partial pages being combined. I think the demo app must be behaving in a spa like fashion where it does not get all of the data when it calls index and index will ask for user-list. Definitely going to keep my eye on this project and ponder on it. from fastapi import FastAPI from fastapi.templating import Jinja2Templates from fasthx import Jinja from pydantic import BaseModel # Pydantic model of the data the example API is using. class User(BaseModel): first_name: str last_name: str # Create the app. app = FastAPI() # Create a FastAPI Jinja2Templates instance and use it to create a # FastHX Jinja instance that will serve as your decorator. jinja = Jinja(Jinja2Templates("templates")) @app.get("/") @jinja.page("index.html") def index() -> None: ... @app.get("/user-list") @jinja.hx("user-list.html") async...
Background Tasks - FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi.tiangolo.com [1] fastapi [2] comes with a concept of background tasks which are functions that can be ran in the background after a function has been ran. This is handy for longer running functions that may take some time and you want to have fast response times. Here is an example from the docs from fastapi import BackgroundTasks, FastAPI app = FastAPI() def write_notification(email: str, message=""): with open("log.txt", mode="w") as email_file: content = f"notification for {email}: {message}" email_file.write(content) @app.post("/send-notification/{email}") async def send_notification(email: str, background_tasks: BackgroundTasks): background_tasks.add_task(write_notification, email, message="some notification") return {"message": "Notification sent in the background"} 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/background-tasks/ [2]: /fastapi/ [3]: /thoughts/
[1] Damn, supply chain vector attacks are wild. Random guy in Primes stream was getting $40k offers to buy their open source project while in university and they have never made anything from it. What a social engineering attack this is. It would be so easy to make it look like a good deal and that the package was going to a good new owner who has real resources to maintain 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]: /static/https://www.youtube.com/watch?si=6NK4iCu1b1rCDo7a&t=555&v=mmlHQyMOK7Y&feature=youtu.be [2]: /thoughts/
- Supply chain attacks are so big these days engineers definitely need to take these into consideration. It’s wild that such a simple attack vector hit some really big applications. This particular vector is so easy to avoid. You are already hosting web content, just curl the file and self host [1] the script, then you own it. That eliminates this attack vector all together, but doesn’t completely remove supply chain attacks, the js file can still hit external apis internally. What I see has happened in this case is that the owner of the domain polyfill.io changed. so anyone who directly linked to them got a malware injected script used. I can only imagine the number of applicatons that are not even being maintained anymore getting hit by this. TLDR, if you are taking something to production, where you are goind to deploy it and let it run, host the js yourself. these cdns are great for prototyping, but tread with caution. Note This post is a thought [2]. It’s a short note that I make about someone else’s content online #thoughts References: [1]: /self-host/ [2]: /thoughts/

I've added htmx to my blog

I’ve added htmx [1] to my blog. It’s extra bloatware that I long avoided, but it’s so damn convenient. Ok so it’s not bloatware, but it’s not the theme I was going for. I wanted my site to be as lightweight as possible. I had at one point gone too far and had Mb’s of react that did not provide any value for the end user. can it be done with jinja # [2] {% with feed = markata.feeds.recent_thoughts %} {% include 'feed_sm_partial.html [3]' %} {% endwith %} Feed Partials # [4] markata [5] pre-release 0.8.1.dev10 has been released with support for feed partials on pypi [6]. It’s now part of my blog # [7] Commit aa233 [8] added support for recent posts on each page to be loaded off of this partial. References: [1]: /htmx/ [2]: #can-it-be-done-with-jinja [3]: /html/ [4]: #feed-partials [5]: /markata/ [6]: https://pypi.org/project/markata/0.8.1.dev10/ [7]: #its-now-part-of-my-blog [8]: https://github.com/WaylonWalker/waylonwalker.com/commit/aa23361e8606b62f7e4ca1a9305e6975fcdbc088
SVG Backgrounds, icons, and other website graphics 👉 Copy-and-paste backgrounds, patterns, icons, and other website graphics directly into projects. All customizable, tiny in file size, and licensed for multi-use. SVG Backgrounds · svgbackgrounds.com [1] svgbackgrounds is a really awesome resource for svg things recently featured on https://shoptalkshow.com/618/ 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.svgbackgrounds.com/ [2]: /thoughts/
Blogmarks that use markdown I needed to attach a correction to an older blogmark (my 20-year old name for short-form links with commentary on my blog) today - but the commentary field has always … Simon Willison’s Weblog · simonwillison.net [1] Oh I kinda like the name blogmark, as opposed to thoughts like I have chose for the same thing. Aparantly Simon beat me to the punch by 20 years on this one. 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/2024/Apr/25/blogmarks-that-use-markdown/ [2]: /thoughts/
A Link Blog in the Year 2024 Kellan Elliott-McCrea has started a new link blog: Like many people I’ve been dealing with the collapses of the various systems I relied on for information over the previous decades. … Simon Willison’s Weblog · simonwillison.net [1] THIS! is the same reasons that I built thoughts [2]{.hoverlink}. Simon has bee a big inspiration along the way. He defintely changed the format of my posts as I watched him build out his quote posts. Link blogging is a pleasantly low-pressure way of writing online. Found something interesting? Post a link to it, with a sentence or two about why it’s worth checking out. Ditto! just make a post. 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://simonwillison.net/2024/Jun/9/a-link-blog-in-the-year-2024/ [2]: https://thoughts.waylonwalker.com [3]: /thoughts/
[1] Kellan brings some interesting thoughts on where the internet is headed in 2024. Interestingly I see myself headed in a similar direction. Feeling like I know just enough to say fuck it and build my own platform for me to me me, from thoughts [2]{.hoverlink} where I link and make thoughts on posts like this, to reader [3]{.hoverlink} which is my rss reader replacement that I wanted in 2013 when it was killedbygoogle [4] And particular with the collapse of the social spaces many of us grew up with, I feel called back to earlier forms of the Internet, like blogs, and in particular, starting a link blog. Ai has really had quite the two sided effect since chatgpt launched and set the world ablaze. Suddenly you can get any answer you want as a custom fit blog post for free without effort, thus killing the traffic to any of these sites. Note This post is a thought [5]. It’s a short note that I make about someone else’s content online #thoughts References: [1]: /static/https://laughingmeme.org//2024/06/08/a-link-blog-in-2024.html [2]: https://thoughts.waylonwalker.com [3]: https://reader.waylonwalker.com [4]: https://killedbygoogle.com/ [5]: /thoughts/
Today I am playing around with tailwind, flexing the css muscle and learning how to build new and different layouts with it. I created a new post template that mimics a terminal look in css where I could inject the post title, description, and other frontmatter elements. I think this is a pretty cool layout, I could make a carbon.now.sh [1]{.hoverlink} clone or more realistically I could make it into a template for blog pages and this could become og [2] images. Still Loving Tailwind [3] References: [1]: https://carbon.now.sh [2]: /og/ [3]: /still-loving-tailwind/
How to Deliver Code Every Day I recently calculated that I merge 0.8 pull requests every day into my team repo. “How to Deliver Code Every 0.8 Days” didn’t sing, so let’s say I merge about one PR every day, delivering o... Jake Worth · jakeworth.com [1] Great set of tips here! No waiting. No “waiting until tomorrow” or “It’s Friday, let’s wait until Monday” to deploy. If your deploys are so slow that deploying an hour before the end of the day is a risk, that’s a separate problem. If you’re afraid of a Friday deploy, your system is too brittle, or you don’t have foolproof rollback procedures, or you don’t have people you trust on call to resolve it. Each of these is a problem that you can fix. This one I find interesting I think there are some industries where customers come in large waves over the weekend, and a weekend bug can not only ruin someones day off, take longer to fix, but also cost a lot of money. Not deploying on Friday is totally what that team should be doing. Most of us are not that team. Most of us work on small teams supporting some sort of product that Should be able to be tested and rolled back. I completely agree with Jake here, if your not willing to...
text-decoration-line - Typography Utilities for controlling the decoration of text. tailwindcss.com [1] Tailwind calls strikethrough line-through. This caught me off guard and took me a minute to find. Control how text is decorated with the underline, no-underline, and line-through utilities. 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://tailwindcss.com/docs/text-decoration [2]: /thoughts/
Fields Pydantic Docs · docs.pydantic.dev [1] exclude=True and repr=False is a good pydantic combination for secret attributes such as user passwords, or hashed passwords. exclude keeps it out of model_dumps, and repr keeps it out of the logs. from pydantic import BaseModel, Field class User(BaseModel): name: str = Field(repr=True) age: int = Field(repr=False) user = User(name='John', age=42) print(user) #> name='John' 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.pydantic.dev/2.7/concepts/fields/#field-representation [2]: /thoughts/
Media Types iana.org [1] A full list of standard Accept types. This is a handy reference. 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.iana.org/assignments/media-types/media-types.xhtml#text [2]: /thoughts/
Handling Errors - FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi.tiangolo.com [1] This page shows how to customize your fastapi [2] errors. I found this very useful to setup common templates so that I can return the same 404’s both programatically and by default, so it all looks the same to the end user. from fastapi import FastAPI, Request from fastapi.responses import JSONResponse class UnicornException(Exception): def __init__(self, name: str): self.name = name app = FastAPI() @app.exception_handler(UnicornException) async def unicorn_exception_handler(request: Request, exc: UnicornException): return JSONResponse( status_code=418, content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."}, ) @app.get("/unicorns/{name}") async def read_unicorn(name: str): if name == "yolo": raise UnicornException(name=name) return {"unicorn_name": name} --- This post sat in draft for months. I stumbled upon it again and found great success returning good error messages based on user preferences. the default remains json, but if a user requests text/html it will be an html [3] response, and text for ...
white-space CSS property - CSS | MDN The white-space CSS property sets how white space inside an element is handled. MDN Web Docs · developer.mozilla.org [1] html [2] can preserve newline \n characters by styling an element with white-space: pre-wrap; pre-wrap Sequences of white space are preserved. Lines are broken at newline characters, at , and as necessary to fill line boxes. 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://developer.mozilla.org/en-US/docs/Web/CSS/white-space [2]: /html/ [3]: /thoughts/
htmx ~ The htmx Response Targets Extension 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... htmx.org [1] The htmx [2] response-targets extension allows me to respond to errors from the backend and do normal htmx swaps. Note by default htmx will only swap on 200 and 300 responses Load the extension in head <script src="https://unpkg.com/[email protected]/dist/ext/response-targets.js"></script> Use the extension on an endpoint that might return a 400. <div hx-ext="response-targets"> <div id="response-div"></div> <button hx-post="/register" hx-target="#response-div" hx-target-5*="#serious-errors" hx-target-404="#not-found"> Register! </button> <div id="serious-errors"></div> <div id="not-found"></div> </div> 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/extensions/response-targets/ [2]: /htmx/ [3]: /thoughts/
MarkdownDown Convert any webpage to a clean markdown w/ images downloaded. MarkdownDown · markdowndown.vercel.app [1] Small web app to convert html [2] into markdown. Pretty cool idea. I actually want to look into this for reader and see how well it would work. Right now I am just pulling descriptions, but maybe I can pull full web pages, and keep the full intent of the first 200 words or so in the cards. 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://markdowndown.vercel.app/ [2]: /html/ [3]: /thoughts/