jesseleite has done a fantastic job with macroni.nvim. Highly recommend taking a look.
Save your macros for future use 🤌
Short TIL posts
jesseleite has done a fantastic job with macroni.nvim. Highly recommend taking a look.
Save your macros for future use 🤌
ikalnytskyi has done a fantastic job with httpie-auth-store. Highly recommend taking a look.
Credential store plugin for HTTPie, attaches auth to ongoing request.
Authentication from cli tools can be a bit of a bear, and I have to look it up every time. This is my reference guide for future me to remember how to easily do it.
I set up a fastapi server running on port 8000, it uses a basic auth with waylonwalker as the username and asdf as the password. The server follows along with what comes out of the docs. I have it setup to take basic auth, form username and password, or a bearer token for authentication.
The og of command line url tools.
# basic auth curl -u 'waylonwalker:asdf' -X POST localhost:8000/token # basic auth with password prompt curl -u 'waylonwalker' -X POST localhost:8000/token # token curl -H 'Authorization: bearer...
...
After struggling to get dependencies inside of middleware I learned that you can make global dependencies at the app level. I used this to set the user on every single route of the application without needing Depend on getting the user on each route.
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.
Setting an additional log handler to the uvicorn logger for access logs in fastapi was not straightforward, but This post was very helpful.
Setting tags in your fastapi endpoints will group them in the docs. You can also set some metadata around the tags to get nice descriptions.
Here is a full example from the post.
Most bloggers on my twitter blog right into a file that goes on git. I kinda expected to have more database folk. I have my blog in markdown on git and the editing experience is top notch. I can just find files edit them in MY EDITOR, push them and I got a post. I am running thoughts in a sqlite database with a fastapi backend, and holy crap the instant nature of posting feels so much better. Both sides have good points.
I often want to reach for non existing list comprehensions in jinja 2, Here are a few nice equivalents.
I fixed my missing macro recording indicator that I lost and was never quite sure why. (because I forgot that I set cmdheight=0).
I am working on fokais.com’s signup page, and I want to hide the form input during an htmx request. I was seeing some issues where I was able to prevent spamming the submit button, but was still able to get one extra hit on it.
It also felt like nothing was happening while sending the email to the user for verification. Now I get the form to disappear and a spinner to show during the request.
Let’s start off with the form. It uses htmx to submit a post request to the post_request route. Note that there is a spinner in the post_request with the htmx-indicator class.
The intent is to hide the spinner until the request is running, and hide all of the form input during the request.
...
DataDog ddqa is building out a textual app and deploying it with pyapp. They have CI setup to fully build and cross compile their textual tui into github releases that you can just download from their releases page. This is something I am looking at for markata. This would be pretty sweet to be able to make it just work on places like windows. It would also be interesting to try to build a full desktop app with pyapp.
I like cross-rs’s project cross.
“Zero setup” cross compilation and “cross testing” of Rust crates
Full list of imagemagick color names.
I’m going to give this trick a shot on my sites, and see how I like it.
* { min-width: 0 }
Down in the comments @adamwathan goes on to say.
Basically every layout overflow bug ever boils down to some flex or grid child needing min-width: 0 😄
Oh and @ryanflorence also says in the comments.
...
Nice message by @tusharsadhwani.
Write it down.
You had to dig deeper than face value at something.
Write it down.
...
Excluding routes from fastapi docs, can be done from the route configuration using `include_in_schema`. This is handy for routes that are not really api based or duplicates.
from fastapi import FastAPI app = FastAPI() @app.get("/items/", include_in_schema=False) async def read_items(): return [{"item_id": "Foo"}] I’ve had better luck just routing both naked and trailing slash routes in fastapi. I’ve had api’s deployed as a subroute to a site rather than a subdomain, and the automatic redirect betweens them tended to always get messed up. This is pretty easy fix for the pain is causes just give vim a yyp, and if you don’t want deuplicates in your docs, ignore one.
...
You can protect your fastapi docs behind auth so that not only can certain roles not run certain routes, but they cannot even see the docs at all. This way no one that shouldn’t be poking around can even discover routes they shouldn’t be using.
Here is the soluteion provided by @kennylajara