This is a pretty incredible use of css grid to overlay items overtop of each other without needing to resort to position: absolute and the side effects that it brings.
Posts tagged: webdev
All posts with the tag "webdev"
Some sick looking icons no attribution needed.
A slug is the part of the url that comes after the domain. Commonly matches the file name of a markdown file many blogging systems. These are typically human readable, unique identifiers for pages within the site.
today I learned that there is an accessibility feature in chrome that allows you to place a text cursor anywhere on the page. I had accidentally done this and it drove me mad that it was there.
You can explicitly make a script render blocking, nothing will be rendered until this js is ready.
Very interesting approach to htmx 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.
Very interesting approach to htmx 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.
fastapi 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
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 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.
Two inspirational people in one podcast, its cool to see how adam thinks about code, css, webdev, and building businesses.
I've added htmx to my blog
I’ve added htmx 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.
markata pre-release 0.8.1.dev10 has been released with support for feed partials on pypi.
...
svgbackgrounds is a really awesome resource for svg things recently featured on https://shoptalkshow.com/618/
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{.hoverlink} clone or more realistically I could make it into a template for blog pages and this could become og images.
...
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.
...
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.
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.
A full list of standard Accept types.
This is a handy reference.
This page shows how to customize your fastapi 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...
html 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.