Today I Learned
How to conditionally include code in Rust debug builds
Posted on:December 12, 2024Today I learned that in Rust, you can use the `#[cfg(debug_assertions)]` attribute to conditionally include a field in a struct only during debug builds, allowing for development-specific features without affecting release builds.
BlueSky API With Rust
Posted on:November 22, 2024Today I wrote an example of how to create a post using the Atrium bksy-sdk in Rust and contributed it as a pull request on GitHub.
Binary Search in Rust Vectors
Posted on:November 22, 2024Today I learned that Rust provides a binary search API on Vectors.
Mono Repos with pnpm
Posted on:October 31, 2024Today I learned that pnpm is generally a better choice than npm for managing dependencies in a monorepo due to its efficient local linking, automatic version management, and enhanced support for monorepo setups.
Using Cargo metadata query information about the project
Posted on:October 24, 2024Today I learned how to extract a package's version from a Rust project using cargo metadata.
Fetch Calls in Astro With Relative Routes
Posted on:October 21, 2024Today I learned that when writing a fetch call without `useEffect` hooks, it executes during the initial server-side render requiring a fully qualified route, whereas wrapping it in a hook confines the fetch to the client-side, allowing the use of a relative route.
Rust's Orphan Rule
Posted on:October 16, 2024Today I learned about the orphan rule in Rust, which restricts implementing a trait for a type unless either the trait or the type is defined in your crate, ensuring consistency and preventing conflicting implementations across different crates.
Rust Infers Closure Types on First Call
Posted on:October 15, 2024Today I learned that in Rust, if you define a closure without specifying concrete types, Rust will infer the types upon the first use, and any subsequent use with different types will result in a compilation error.
Kubernetes Cron Jobs Concurrency-Policy
Posted on:October 9, 2024Today I learned that by using the `concurrency-policy` in a CronJob specification, you can control whether jobs are allowed to run concurrently, ensuring that subsequent jobs do not start before the previous ones are completed.
Use ECR as a Pull Through Cache
Posted on:October 8, 2024Today I learned that the ECR Registry can function as a pull-through cache for Docker images or any OCI-compatible artifact, requiring a valid GitHub username/token with package READ access for configuration.