Rick Osborne

I write code, fiction, and educational material. Enhanced with autism superpowers.

Photos I post are mine, and copyright by me. They may be reused under the CC-BY-NC-SA license, but not in any kind of machine learning.

My avatar is a 4-color animation-style rendering of me making a goofy hand gesture, in front of a pride flag for demisexuality. My background header is a photo of an electric truck parked off the road, overlooking a cloudy sky above a rocky coastline obscured by mist.

Rick Osbornerick@ricko.social
2025-01-06

As much as I love the structural type system of #TypeScript , I really could do without the baggage of the JS it's built on.

The whole CommonJS/ESM thing is just embarrassing. Every time I think I've scraped the bottom of that particular barrel, I find another rotted plank beneath it.

I see now how people end up jumping ship for Rust or Go or whatever. I have no clue whether those ecosystems are less broken, but some days I understand the decision to just choose literally anything else.

Rick Osbornerick@ricko.social
2025-01-04

@kagan But, practically, how often are you looking at a random package.json where you don't know the name? How did you get to that package.json without knowing where you were going?

Rick Osbornerick@ricko.social
2025-01-04

I will forever have "prettier" on my 💩-list because of output like this. But everyone and their 🐶 loves prettier except me, so 🤷 .

And JSON arrays. "If there are fewer than 4 items, and they would all fit on one line within 80 characters, keep them on one line. Otherwise, add line breaks."

/but-why-meme

Ugh.

Rick Osbornerick@ricko.social
2025-01-04

I have the same cognitive dissonance with linters/formatters which have conditional rules.

Like JS arrow parens. The "as-needed" rule for this is "if you only have exactly one param, omit them, otherwise keep them.

So you go from:

```js
const whatever = (param) => {};
```

To:

```js
const whatever = param => {};
```

Unless you add a second param, at which point the parens return:

```js
const whatever = (param, options) => {};
```

But ... why? Why do that on purpose?

People are weird.

Rick Osbornerick@ricko.social
2025-01-04

TIL some people prefer their package.json to be sorted in "well known" order, instead of lex/alpha.

I truly did not ever suspect that was a thing. I just figured the non-alpha-sorted package.json files I ran into were like that because someone didn't have their editor set up to sort-on-save.

But no. It is, apparently, intentional. Like, someone maintains `sort-package-json` to do it that way on purpose.

Human brains are so weird.

#JavaScript #Nodejs

Rick Osbornerick@ricko.social
2024-12-31

@aesthr That was, as you said, surprisingly tricky. Without looking at your solution, I whipped up `colRowFromRef` correct on the first try. But the reverse took several iterations to get right.

Thanks for the amusing challenge!

Screenshot of console output from the tests provided above.  Eight lines each follow the same format: a green checkmark emoji, a spreadsheet-style reference like "A1" and "BA124", a pair of column and row index numbers, and the reference repeated again.  The values are joined by arrows to imply that each value was derived from the one before it.Screenshot of Javascript code showing some constant values and a single function named "col row from ref".  The function accepts a reference as text, then iterates through each character in that text.  If the character is between "0" and "9", it accumulates the row value using base-10 math.  If the character is between "A" and "Z" it does the same for the column value using base-26 math.A screenshot of some Javascript code, showing a single function named "ref from col row".  The function takes a pair of column and row indices and returns the text-formatted reference.  The bulk of the function is some slightly-tricky base-26 math, showing several places it would be easy to be off by one.
Rick Osbornerick@ricko.social
2024-12-25
A graphic treatment of the phrase "Fol lol the doh, fold the day".  The phrase is a line from Clannad's theme from "Harry's Game".  The layout evokes the classic "RUN DMC" graphic, with thick white letters between red bars.
Rick Osbornerick@ricko.social
2024-12-19

@tjcrowdertech But, also, I acknowledge my own hypocrisy. I'm relying on an intentionally undocumented behavior (Object keys being in insertion order) so that I can get more deterministic JSON.

The inciting problem here is that my linter was complaining that a JSON file's keys were not in lex order. The file was from a vendor, and that vendor used integer keys in a few places.

So I could have solved it by disabling the linter rules for those files, by not relying on JSON.stringify, etc. 🤷

Rick Osbornerick@ricko.social
2024-12-19

@tjcrowdertech The ES6-era discussions on how it came to be are like watching a slow-motion train wreck.

esdiscuss.org/topic/iteration-

This kills me:

>> It's good enough to preserve order for non-numeric keys only

> This is an abysmal compromise, with the worst traits of each alternative.

And yet, that's what the spec now says. /sadtrombone

On the upside, I guess, it's now a great example of how design-by-committee often leads to the worst of all possible solutions where no one is happy.

Rick Osbornerick@ricko.social
2024-12-19

For clarity: without this code, regardless of the insertion order, we were seeing:

```json
{
"2": 2,
"10": 10
}
```

When we should have been seeing:

```json
{
"10": 10,
"2": 2
}
```

I'm sure some sociopath thinks it's perfectly reasonable to "sort keys numerically when all the keys are number-like", for some justification I simply cannot fathom.

Rick Osbornerick@ricko.social
2024-12-19

I present to you, the most subtly heinous #TypeScript I've had to write this week.

It's just an object deep sorter, used when saving JSON files, so we always get deterministic output.

Except ... it's more tricky than just using `localeCompare` because modern versions of node will ignore key insertion order and return keys in number-sorted order if the keys are all number-like.

Cue: "Thanks, I hate it" or "This is why we can't have nice things".

#JustWebDeveloperThings

Screenshot of some syntax-highlighted TypeScript code.  It shows a function called "deep sort" which does what it sounds like it does.  Most of the logic is pretty easy to follow and linear.  But then there's a big, out-of-place comment toward the bottom which says:

This looks goofy, but ...In modern versions of node, the default implementation will try to numeric-sort keys for you.  Because we want string-sorting only, we have to proxy the call to return the correct order.
Rick Osbornerick@ricko.social
2024-12-17

Random realization:

"Rump Shaker", by Wreckx-N-Effect, is actually fairly gender-neutral song. At least the first two verses, anyway.

I will not be taking any questions about why this occurred to me.

Rick Osbornerick@ricko.social
2024-12-12

On my mind are all the times I was presented with an ideal. Ideals toward which I was supposed to strive, because each was "right". Ideals with simple, achievable, innocuous names.

Christian.
Masculine.
Capitalist.
Straight.
Normal.
Productive.

In every case, those ideals have been lies. Lies with the ultimate purpose of keeping me in a place someone else wanted me.

Pacifist?

I dunno. Pacifism doesn't seem to be serving me or my loved ones inasmuch as it is the systems I don't support.

Rick Osbornerick@ricko.social
2024-12-12

This excellent Dasia Sade video talks about Capitalistic Nihilism. The endless series of carrots of consumption put before us.

youtu.be/LBUHBfFSa4I

And I can't help but juxtapose this with the current narrative around vigilantism vs "civilized society".

(Rhetorical) What is the difference between respectability politics and "we don't celebrate murder"?

(Rhetorical) Is "democracy", not the abstract concept but the current reality, just another carrot?

>>> None of this exists in a vacuum.

Rick Osbornerick@ricko.social
2024-12-11

@gwenthekween Yeah, the phrase "we recognize that many users will prefer a Copilot experience, and are considering it" was spoken at our all-hands yesterday.

And, look, as an antisocial :infinity_autistic: , I get it. But WE MAKE A MEDICAL DEVICE. Can we just f'n not?

Rick Osbornerick@ricko.social
2024-12-09

(And yes, I do enjoy Bandcamp. Most of my music is now on Bandcamp. I will be sad when Bandcamp eventually implodes. But not everything is on Bandcamp.)

Rick Osbornerick@ricko.social
2024-12-09

(Brought to you by the absolutely ridiculous gymnastics I had to go through to find, buy, and download Michael Giacchino's deluxe edition soundtrack for the 2009 "Star Trek".)

Rick Osbornerick@ricko.social
2024-12-09

Today I am nostalgic for the Good Old Days of circa 2010 when you could buy and download an MP3 album.

Not stream it. Not shuffle it. Not build a playlist inspired by it.

Just buy the damned album and download it.

Rick Osbornerick@ricko.social
2024-12-08

Hmm. Random idea: I wonder if using inter-frame deltas might help with text extraction?

That is, since text is basically static, I wonder if you could do something like:

Given frame A, and frame B after it. Make a diff, D, of the two frames. Make a new frame C by erasing/masking-out anything from B which has changed from A. (Logically: C = B & A.) Then use C for text extraction.

(Someone with a PhD in Computer Vision enters the chat: "that's so 1982".)

Rick Osbornerick@ricko.social
2024-12-08

(But I've also had a persistent migraine for the last 3 days ... so it's entirely possible the code is absolute 💩 and would just take a day to clean up.)

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst