Programming Leftovers
-
Buttondown LLC ☛ Why Not Comments
Code is written in a structured machine language, comments are written in an expressive human language. The "human language" bit makes comments more expressive and communicative than code. Code has a limited amount of something like human language contained in identifiers. "Comment the why, not the what" means to push as much information as possible into identifiers. Not all "what" can be embedded like this, but a lot can.
-
Daniel Lemire ☛ Replace strings by views when you can
C++ programmers tend to represent strings using the std::string class. Though the implementation might vary, each instance of an std::string might use 32 bytes. Though it is not a large amount of memory, it can add up.
-
Martin Hähne ☛ A Limitation Of Laravel's Seeders - And Why It is There
Laravel has pretty cool tools to work with databases and fill them with seeded data. This is useful in many contexts, but mostly if you want to test things.
Seeders are cool, because they can make use of model factories - or factories for short - to create some test data the conforms to what we consider valid data.
-
Chris ☛ Types as Interfaces
For the past few days, I have been toying with an idea for a board game. To test it out, I wanted to write a simple implementation of it. Here’s an example of a type we might need in a critical phase of the game.
-
Karl Seguin ☛ Closures in Zig
Zig doesn't have a simple way to create closures because closures require allocation, and Zig has a "no hidden allocation" policy. The values that you want to capture need to live somewhere (i.e. the heap), but there's no way for Zig (the language) to create the necessary heap memory. However, outside of the language, either in the standard library, or our own code, we can write code that takes an allocator and can thus create a closure.
-
Leon Mika ☛ Rubber-ducking: Of Config And Databases
It’s been a while since my last rubber-ducking session. Not that I’m in the habit of seeking them out: I mainly haven’t been in a situation when I needed to do one. Well that chance came by yesterday, when I was wondering whether to put queue configuration either in the database as data, or in the environment as configuration.
This one’s relatively short, as I was leaning towards one method of the other before I started. But doubts remained, so having the session was still useful.
-
Rlang ☛ Introduction to Interpretable Machine Learning in R
Title: Introduction to Interpretable Machine Learning in R
Date: Thursday, October 10th, 18:00 – 20:00 CEST (Rome, Berlin, Paris timezone)
-
Chris ☛ Types as Interfaces
-
Medevel ☛ TailwindFlex: The Best Free and Open-Source Code Snippets for Tailwind Designs
TailwindFlex is an open-source library that offers a wide array of ready-to-use UI components and code snippets, all built with Tailwind CSS.
-
Dirk Eddelbuettel ☛ RcppSpdlog 0.0.18 on CRAN: Updates
Version 0.0.18 of RcppSpdlog arrived on CRAN today and has been uploaded to Debian. RcppSpdlog bundles spdlog, a wonderful header-only C++ logging library with all the bells and whistles you would want that was written by Gabi Melman, and also includes fmt by Victor Zverovich. You can learn more at the nice package documentation site.
This releases updates the code to the version 1.14.1 of spdlog which was released as an incremental fix to 1.14.0, and adds the ability to set log levels via the environment variable SPDLOG_LEVEL.
-
Avoiding environment conflicts with Kamal and Dotenv
We often use Dotenv in Rails for managing environment variables in development. But both Kamal and Dotenv works with .env files by default. Let’s see how to solve this conflict.
[...]
Kamal works with the
.env
file by default but also supports other environments called destinations. Destinations are essentially all production environments, but might still require different variables.Destinations have their own config and env file. A production could have an associated
config/deploy.production.yml
config file and.env.production
environment file.Kamal merges this environment file with
.env
together to produce the final set of variables for a destination.