Thursday, April 29, 2021

when reviewing code, don't be walter monheit, the movie publicist's friend

 I've adopted not being judgmental and always giving the benefit as kind of a life style, which means sometimes I have trouble doing thorough enough code review. Sometimes I feel like Walter MonheitTM, the Movie Publicist's Friend, in the much lamented Spy magazine: 

I do understand that's not the best stance to have while reviewing code, but it's tough to second guess other developers and assume I know more about the problem (or was more observant) than they were...

Wednesday, April 21, 2021

mac bias and the joy of giant screens

I have few illusions that I have huge masses waiting with bated breath for my next dev blog post, but I feel bad when a month only has a few sparse posts. My excuse is, my sweetie and I have been moving into a new condo! 

I haven't been doing much work on my current freetime project, the splash-o-matic 2600, but today I picked it up again. 

One feature I threw in: a mode where left mouse button draws and the right mouse button erases. I've seen that in other homebrew Atari editors, but it seemed kind of corny to me. But I've come around: for a system so based on boolean values for pixels, it makes sense, and I can see that it was my "but Macs only have one mouse button!" bias that influenced my thinking - even though I've been using a 2 button mouse ever since I rearranged my desktop and put my laptop on a stand. 

One problem was in chrome etc, right clicking would pull up a context menu - this stackoverflow had a pretty clean solution: (specific to p5, which adds a "p5Canvas" class to its canvases) 

function setup() {
  for (let element of document.getElementsByClassName("p5Canvas")) {
    element.addEventListener("contextmenu", (e) => e.preventDefault());

Speaking of rearranging desktops - early on in COVID quarantine I got an extra monitor to use in vertical/portrait mode, along with a large-ish 28" Samsung monitor. But in the interest of a less cluttered desktop and few wires (and arguably less blatant geek "virtual signaling") I've replaced those two with a single 32" LG monitor - one in a close to "normal" ratio, not those Cinemascope-esque wide wide things. 

It's great - especially when combined with SizeUp that lets me use keyboard commands to throw windows to half or quarter the screen - it's like having 2 side-by-side portrait mode monitors. (I remember how proud I was of my "massive' geek-sized" CRT in college... must've been 19" - and each "half monitor" is a bit larger than that now. And it's really elegant looking, not quite as amazing in design as those new iMacs - like it's less colorful, but has the same tilt up pivot, and is larger and cheaper! 

Friday, April 16, 2021

Wednesday, April 7, 2021

old school mac command line search and replace

 Aargh! I was digging "Prettier" as a plugin for VS Code, but it has an irreconcilable difference opinion from my team on bullets in markdown  -- namely if - or * should start an unordered list item. Apparently this is an issue of some holywar, opinionated tool crap and I have already wasted enough time for it, so here is an old school command line thing that seems to fix it for me:

find . -name "*.mdx" -exec sed -i '' 's/^\- /\* /g' {} \;

That says, find every markdown file (*.mdx) and run the old sed command ... -i with '' says don't make a backup file, the regex is beginning of line and a dash and a space replaced with a star and a space, globally. 

Kind of sucks but easier than wrestling with Prettier config or eslint plugins right now., adieu

 For two and a half decades, looked like this:

Such a nice little slice of online life, near the dawn of the popular web.

Alas that page has now been shuttled off to and presumably modern stuff about the new movie will fill the root of it.

It reminds me of webolution of web design that imagines a simple NASA page reimagined in the dominant web styles of the day (you can flip through eras via the slider at the bottom.)

Thursday, April 1, 2021


I'm still toiling on the Atari 2600 graphics editor (with import) I mentioned the other day - the splash-o-matic One small bug (or at least poor UX) was that a dark imported image might come in as all black pixels, and so look like the process had failed. So besides adding a "loading" bit of text, I made a heuristic that tried 5 different contrast levels and then picked the one that had the closest to even split of black and white pixels. Works pretty well, and now an image is at least discernable, even if the user will still probably want to play with the contrast slider some more.

Now that I think about, maybe a better algorithm would have been to see what contrast settings had the most detail... maybe by counting "how many pixels are touching a pixel of a different color". Hmmm.