news
Programming Leftovers
-
Rlang ☛ Mock Them All: Simulate to Better Test with testthat
Unit testing in R. You know, those small functions that ensure your code works flawlessly—even when you’re on vacation or writing new modules at 2 a.m. But let’s be honest: when it comes to testing user interactions or external resources, things can quickly turn into a headache. What do you do when your code requires a file selection dialog or a connection to an API that takes forever to respond? No way you want to block everything just for a test!
In those cases, it’s time to get clever. The idea isn’t to give up on testing, but to cleverly bypass what’s problematic. That’s where a well-known technique comes in: mocking.
-
Alex Ewerlöf ☛ When a team is too big
There’s a story for several years back that keeps back to my mind. What makes it interesting is the fact that there was no master plan. Yet with a few cultural elements, the story took such an interesting trajectory that it shaped my leadership model. Ever since, I have been an advocate of continuous improvement by preparing the environment instead of being the wise-ass who has the ultimate solution to all problems.
-
Lee Yingtong Li ☛ htmlcc: Statically compiled HTML templates for C
Web applications are not commonly written in C; one notable counterexample is cgit, a web frontend for git repositories. HTML output in cgit is implemented from scratch, using bespoke helper functions and hundreds of individual printf-esque calls. A representative example of HTML-related code in cgit looks like: [...]
-
Python
-
Ned Batchelder ☛ PyCon summer camp
PyCon can be the same way, either with people or projects. Not a romance, but the exciting feeling that you want to keep doing the project you started at PyCon, or be a member of some community you hung out with for those days. You want to keep talking about that exciting thing with that person. These are great feelings, but it’s easy to emotionally over-commit to those efforts and then have it fade away once PyCon is over.
-