Triggering multiple api calls in HTMX

I am a big fan of htmx and use it in a lot of my projects. I recently had a use case where I needed to trigger multiple api calls in a single htmx request. I was able to do this by using the hx-trigger attribute. <html> <head> <script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script> </head> <body> <input id="input-box" type="text" placeholder="Enter your input and press Enter" name="name"> <div hx-get="/api/call1" hx-trigger="keyup delay:200ms from:#input-box"> </div> <div hx-get="/api/call2" hx-trigger="keyup delay:200ms from:#input-box"> </div> <div hx-get="/api/call3" hx-trigger="keyup delay:200ms from:#input-box"> </div> </body> </html> The idea is to listen to the keyup event on the input box and trigger the api calls after a delay of 200ms....

May 29, 2023 · 1 min

Migrating out of PostHaven

My blog was hosted on PostHaven for about 12 years now. It’s a pretty good platform and has served me well. But I wanted to move my blog to a MarkDown powered static site. Unfortunately, posthaven doesn’t provide an export option, probably because it not in their financial interest. Oh well, I’ll scrape my own blog and extract the posts. My first attempt was to use the requests and BeautifulSoup to fetch the urls from the archives page....

May 19, 2023 · 2 min

Opportunities

I am setting the table for breakfast. I announce loudly “Breakfast is ready”. Vian sits down at the table and notices that I had left two forks next to his plate of cantaloupe slices. Vian: Who put two forks? Me: Oh, I didn’t realize I left two forks. My mistake. Vian: No, it’s ok. Then proceeds to use both his forks to pick up two slices of cantaloupes and starts shoving them in his mouth....

October 4, 2022 · 1 min

Opposite of a Crater

The kids are having Pizza. One of the pizza slices had a trapped air bubble and looked engorged. Yoshi: Looks like there is a crater in your pizza. (from her angle she could only see the gaping hole). Sempi: (from his side he can only see the bulge) No it is the opposite of a crater. It is a meteor. TIL the opposite of a crater is a meteor. 

August 31, 2022 · 1 min

Egg Skin

We are at the breakfast table. Vian is having cereal and I am having hard boiled eggs for breakfast. I offered one of my eggs to Vian. Vian: I don’t like the yolk. Me: I can take it out for you. Vian: Yeah, if you can take out the yolk, I will eat just the skin. 

August 26, 2022 · 1 min