📝

Week 23 2024

Another good week. My niece came to visit for the weekend, I did the parkrun (two thirds of it anyway), got on with my food, got on with my work…

It's been reasonably sunny, but we've also had this June cold snap, which is a thing apparently.

I've been watching One Punch Man, listening to A Canticle for Liebowitz, dipping into a slim volume on Stoicism, and messing around loads with my RG35XX+, as well as plenty of tinkering on my website.

Feeling busy and productive and, though I'd always like more solitude and space to do my own thing, I'm not absolutely run ragged.

Which is nice.

Keto week 2

Admittedly I'm only 2 weeks into this keto thing, but I'm enjoying it a lot.

It's definitely a journey, and I've been through some phases of irritability and moodswings, but things seem to be stabilising now, and overall I'd say my mood is improved. No sugar, no alcohol, healthy food, plenty of fluids, and periods of fasting between 18 and 24 hours.

Positives for me:

Stand-out meals have been:

Peppery cauliflower, which is awesome anyway, but to which I added prawns.

Cauliflower mash with chicken and red onion (and also salmon and asparagus!).

Fried shredded cabbage with chorizo which I ate for 4 meals straight I was so into it. Eats like a bowl of spicy noodles.

4 meals from above 4 meals from above

Dev: Some actual code

I'm really enjoying my dev stuff at the moment. There was a bunch of stuff at work about getting my project migrated to the component library, and last minute goalpost moving when we decided it was decided that we weren't going to release it, but that's OK. I got to delete a bunch of stuff and I got to reimplement a component as a freemarker template instead of in Vue, so I was happy.

The latter half of the week was spent working with actual javascript! Can you imagine?!

I had to get form date properties submitting in Unix time, which was fine, just write a new helper function. The first problem was where to apply it, because there's only one form template for the whole CMS plugin, so all the logic for all the forms is in there and it's just this maze of jquery. I got there in the end.

Next problem was that although the date was Unixed, it was still being sent as a string, when the DB expected an integer. This was harder to solve than it seemed on the surface because there's this complex, established workflow that the data goes through on its way to being formulated as the final payload, and it was getting stringified in multiple places. So it didn't matter if it was a number when it came out of my convertToUnix function, or when it was added to the form data object, because it was going to get transformed again downstream, and by the time it got to the last stringify call it was just a key:value pair with no metadata to let me cherry pick.

So I ended up, for this one form-type that's going to the typed DB, adding a replacer function to the stringify method to try and coerce every property to a number on the way through. If it came back as NaN the original string value went in and if not it went into the payload as a number. The only scenario I can think of where this might be a problem is if someone out there has a name that consists entirely of numerals, or something like that. We can cross that bridge when we come to it.

Since I was in a JS state of mind, I finally got around to progressively enhancing the darkmode on my site so that it persists across pages and sessions. I'm really happy with the way that turned out — it's small and clean and integrates well with the way my CSS custom variables work to flip modes without JS. It might even be the first progressive enhancement I've applied to something of my own, just because.

END