Today I Learned

Short TIL posts

1852 posts latest post 2026-05-13
Publishing rhythm
Apr 2026 | 23 posts
Today I am working on fokais.com, trying to get to a point where I can launch by workig through stripe integrations. This is my first time using stripe, so there has been quite a bit to learn, and I am probably building in more than I need to before launching, but I am learning, and not in a rush to launch. I am building the fokais backent in python primarilyt with fastapi [1] and sqlmodel on sqlite. My billing integration is going to be all Stripe. Stripe Subscription Cancellations Docs # [2] Here is a link to the stripe docs for your refrence, especially if you want to see how to cancel subscriptions in other languages. They include code samples for many popular languages. [3] User Model # [4] This is the part of the user model that includes the cancel and reactivate methods. It pretty much follows the stripe guide. class UserBase(SQLModel, table=False): # type: ignore[call-arg] username: str = Field(unique=True) full_name: str email: str email_verified: bool = False disabled: bool = False signup_date: Optional[datetime] = Field(default_factory=datetime.utcnow) stripe_customer_id: Optional[str] def cancel_subscription(self): for subscription in self.active_sub...
External Link stripe.com [1] You can find your customers next billing date through the stripe api by using Invoice. and passing in customer, customer_details, subscription, or schedule. import stripe stripe.api_key = "sk_test_51ODvHtB26msLKqCAPBAo1qkBBuIfT5tQBX6YFWCLMsPixIExxITCRVa9tNCIqkdQS8olhR79NYXsFWBPKsM3LbGO00zEcNQfNI" invoice = stripe.Invoice.upcoming(customer="cus_NeZwdNtLEOXuvB") Within the invoice, you can find the next_payment_attempt as a epoch. date = datetime.fromtimestamp(invoice.next_payment_attempt) amount = invoice.amount_due currency = invoice.currency 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://stripe.com/docs/api/invoices/upcoming [2]: /thoughts/
Search Use the search APIs to look up and retrieve objects in your Stripe data. Using search is a faster alternative to paginating through all resources. stripe.com [1] Stripe has it’s own query language for querying data. I’m just getting into using it and it seems pretty good so far. I needed to lookup the price for products. I was able to find prices for my product using the python api as shown below. stripe.Price.search(query="active: 'true' and product: 'prod_P8SfwtxJ45cWE2'") 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://stripe.com/docs/search#search-query-language [2]: /thoughts/
stripe-keys-and-ids.tsv [1] tsv Prefix Description Notes ac_ Platform Client ID Identifier for an auth code/client id. acct_ Account ID Identifier for an Account object. aliacc_ Alipay Account ID Identifier for an Alipay account. ba_ Bank Account ID Identifier for a Bank Account object. btok_ Bank Token ID Identifier for a Bank Token object. card_ Card ID Identifier for a Card object. cbtxn_ Customer Balance Transaction ID Identifier for a Customer Balance Transaction object. ch_ Charge ID Identifier for a Charge object. cn_ Credit Note ID Identifier for a Credit Note object. cs_live_ Live Checkout Session ID Identifier for a checkout Session object in live mode. cs_test_ Test Checkout Session ID Identifier for a checkout Session object in test mode. cus_ Customer ID Identifier for a Customer object. dp_ Dispute ID Identifier for a Dispute object. evt_ Event ID Identifier for an Event object. fee_ Application Fee ID Identifier for an Application Fee object. file_ File ID Identifier for a File object. fr_ Application Fee Refund ID Identifier for an Application Fee Refund object. iauth_ Issuing Authorization ID Identifier for an Issuing Authorization object. ic_ Issuing Card ID ...
- Dang this is such a good message. I can’t exactly relate to being forced into the overworking situation that PirateSofware is talking about. I can relate to being conditioned to feeling a certain way and changing that is very difficult. I can also relate to not feeling like I am getting enough done in the day. Sometimes a bit of separation is good. 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/
[1] I’ve been using tailwind for a few months now and I can still say I’m loving it. I’ve been using it to create some rapid prototypes that may or may not ever become something, a document that is likely to go to print (a resume), and some quick dashboards. I started using Tailwind a few month back # [2] A few months back in september of 2023 I made a case for tailwindcss [3]. And have been using it on quite a few projects since. - values are well thought out - it’s really easy to use - classes that make sense - tree shakable fokais.com # [4] I started working on fokais.com only a few weeks ago, It’s going to be a SAS to make blogging easier. I’ve started hosting some tools for this blog that I really like that I think I can turn into a service. It’s been fantastic to quickly pump out new pages with tailwind. [5] HTMX # [7] tailwind and htmx are a match made in heaven. They both really lean on Location of Behavior over Separation of concerns. They do really well at making small components that you can throw on and endpoint and stack into any page. With tailwind I just configure it to look at all my templates, and I can guarantee that the styles will be in app.css, ...
External Link stackoverflow.com [1] Get those print colors exact body{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; } 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://stackoverflow.com/questions/3893986/css-media-print-issues-with-background-color#answer-14784655 [2]: /thoughts/
page-break-after CSS property - CSS | MDN The page-break-after CSS property adjusts page breaks after the current element. MDN Web Docs Ā· developer.mozilla.org [1] I’m working on something that might go to print, so I want the page breaks to happen somewhat in my control as the content author. As I do my writing I break my content up in to many short sections using h2, sometimes an h3. These are generally short sections that go together, should stay together, and typically are not too lengthy to cause a large white space in print. I found a way in css to only allow page breaks to happen on h2 and h3, and it turned out perfect, suck it WSIWIG editors * { page-break-before: avoid; } h2, h3 { page-break-before: auto; } 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://developer.mozilla.org/en-US/docs/Web/CSS/page-break-after [2]: /thoughts/
Go by Example gobyexample.com [1] Fantastic resource for learning go. You work through small examples quickly, learning single concepts along the 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://gobyexample.com/ [2]: /thoughts/
How to Build a Website or App - Syntax #696 This podcast episode covers a wide range of topics related to building a website or web application from start to finish. syntax.fm [1] Great tips in this one. They discuss everything from front end to backend, databases and ORMS, here are a few of my favorite points. - Use good data or good fake data - make it have some variation like long and short text - Don’t use a database if you need one, static content is eaiser to manage - end to end test, (does the site load page x) - You DONT NEED all this complexity, you can deploy a site with HTML [2] and CSS. 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://syntax.fm/show/696/how-to-build-a-website-or-app [2]: /html/ [3]: /thoughts/
- Nice take by @t3dotgg [1]. Some of the old patterns that go deep into webdev, MVC, separation of concerns, REST, are things we are told to believe on day one, thrown so many things, no mental bandwidth, or experience to form our own opinions we must take them as fact. Rarely do we take these facts and revisit them with our new understandings years later. 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/t3dotgg [2]: /thoughts/
External Link X (formerly Twitter) Ā· twitter.com [1] Today I learned the meaning of abhorrent abhorrent ăb-hĆ“r′ənt, -hŏr′- adjective Disgusting, loathsome, or repellent. Feeling repugnance or loathing. 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/pypeaday/status/1727156823185113304 [2]: /thoughts/
I’m really excited about sqlmodel [1], an amazing project by fastapi [2]. It’s worth exploring! SQL databases in Python, designed for simplicity, compatibility, and robustness. References: [1]: https://github.com/fastapi/sqlmodel [2]: https://github.com/fastapi
If you’re into interesting projects, don’t miss out on draw-a-ui [1], created by SawyerHood [2]. Draw a mockup and generate html [3] for it References: [1]: https://github.com/SawyerHood/draw-a-ui [2]: https://github.com/SawyerHood [3]: /html/
Heroicons Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS. Heroicons Ā· heroicons.com [1] heroicons is a really nice set of many of the basic icons that you will need for building nice ui’s. They have a really nice copy as svg or jsx button, so that you can just yank it and paste it on your page without any extra packages or installation. 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://heroicons.com/ [2]: /thoughts/
Uptime Kuma A self-hosted monitoring tool uptime.kuma.pet [1] Uptime kuma is a fantastic self hosted [2] monitoring tool. One docker run command and you are up and running. Once you are in you have full control over checking status of urls, frequency, allowed timeouts, and a HUGE list of notification providers docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1 I deployed it in my homelab [3] today. [4] Note This post is a thought [5]. It’s a short note that I make about someone else’s content online #thoughts References: [1]: https://uptime.kuma.pet/ [2]: /self-host/ [3]: /homelab/ [4]: https://twitter.com/_WaylonWalker/status/1723077941649707468 [5]: /thoughts/
I came across uptime-kuma [1] from louislam [2], and it’s packed with great features and ideas. A fancy self-hosted [3] monitoring tool References: [1]: https://github.com/louislam/uptime-kuma [2]: https://github.com/louislam [3]: /self-host/
kv - Command | Vault | HashiCorp Developer The "kv" command groups subcommands for interacting with Vault's key/value secret engine. kv - Command | Vault | HashiCorp Developer Ā· developer.hashicorp.com [1] hashi vault lets you manage secrets right from your cli. # set your vault url export VAULT_ADDR=https://myvault.mydomain vault login # get a secret vault kv get secret/hvac # put a secret vault kv put -mount=secret creds passcode=my-long-passcode # get it vault kv get secret/creds # == Secret Path == # secret/data/creds # # ======= Metadata ======= # Key Value # --- ----- # created_time 2023-11-05T02:53:40.978120001Z # custom_metadata <nil> # deletion_time n/a # destroyed false # version 3 # # ====== Data ====== # Key Value # --- ----- # bar baz # passcode my-long-passcode # get one field vault kv get -field=passcode secret/creds # my-long-passcode vault kv put -mount=secret creds bar=baz # set more keys vault kv put -mount=secret creds passcode=my-long-passcode bar=baz # # == Secret Path == # secret/data/creds # # ======= Metadata ======= # Key Value # --- ----- # created_time 2023-11-05T03:24:14.65958906Z # custom_metadata <nil> # deletion_time n/a # destroyed fa...