Skip to content

Instantly share code, notes, and snippets.

View mre's full-sized avatar
πŸͺ΄
I like plants

Matthias Endler mre

πŸͺ΄
I like plants
View GitHub Profile
// This is an algorithm, which creates an ID for a podcast episode.
// It is based on the the podcast's title, episode's title, the episode number,
// the date of the episode and the episode's mp3 file name.
//
// All fields can change over time, but the ID should remain the same.
// Think of it more like a user agent string than a unique ID: it is "unique
// enough" for identifying episodes in most cases.
//
// It's used to identify episodes in the database.
@mre
mre / types_crate.md
Created May 16, 2025 23:08
Are Type Crates an Antipattern?

Why you think it's an anti-pattern to have a "types" crate?

Discussion at: https://fosstodon.org/@ianthetechie/114517520321760826

That's a fair question. What I found is that "types" is a bit of a scapegoat for things that have a proper place yet, similar to "utils", "shared." The types crate tends to become a dumping ground for types that don't have a fixed place yet. Code in those crates is not really "discoverable" as in: I would have to look into the crate to see what's in there and how it relates to the rest of the codebase.

For example, the standard library has a bunch of primitive types, but they all live in their own module in the core crate. The rest lives close to the supporting code, e.g. see the structs in std::process (https://doc.rust-lang.org/std/process/index.html#structs). If these structs were all in the types crate, it would make the code and the documentation a lot harder to navigate in my opinion.

@mre
mre / stats.txt
Created March 5, 2026 16:16
Created with `lychee '**/*.md' '**/*.html' --host-stats`
πŸ” 7336 Total (in 3m 26s) βœ… 4956 OK 🚫 767 Errors πŸ‘» 336 Excluded ⏳ 24 Timeouts πŸ”€ 1253 Redirects
πŸ“Š Per-host Statistics
────────────────────────────────────────────────────────────
github.com β”‚ 1052 reqs β”‚ 98.9% success β”‚ 593ms median β”‚ 19.5% cached
en.wikipedia.org β”‚ 673 reqs β”‚ 100.0% success β”‚ 67ms median β”‚ 18.1% cached
ru.wikipedia.org β”‚ 411 reqs β”‚ 100.0% success β”‚ 74ms median β”‚ 12.2% cached
img.youtube.com β”‚ 232 reqs β”‚ 100.0% success β”‚ 56ms median β”‚ 3.9% cached
amzn.to β”‚ 189 reqs β”‚ 100.0% success β”‚ 480ms median β”‚ 26.5% cached