today's howtos
-
Day 56: Container queries
You can use media queries to style elements based on features of the browser viewport, for example, min-width, max-height, or orientation. With container queries, you can now do the same but with any parent element. Instead of the viewport, you can now listen to properties and features of a containing element.
-
Kill Process Running on a Specific Port in Linux
Killing a process in Linux usually involves using the process ID with the kill command. You can also use the process name with killall command.
-
Snowflake IDs in Mastodon (and Unique IDs in the Fediverse more generally)
This becomes a problem at scale. If you have millions of users on hundreds of different shards of a database, eventually you'll get a clash of IDs. To that end, Twitter invented Snowflake IDs.
Snowflakes are pretty clever. They are a 64 bit ID. The first part of the ID is a timestamp, and the second part is some information about the server which generated the ID. This means that IDs can be sorted by time, and will globally unique.