Casey Primozic’s Notes

Misc. notes, code, and other content I want to post publicly that don’t warrant a full blog post

By Casey Primozic

Subscribe to RSS

Fixing Svelte VS Code e.children.findLastIndex Is Not a Function

The Problem

I recently created a new SvelteKit project using the Svelte 5 preview and kept getting an error at the beginning of every Svelte component:

A screenshot of VS Code showing an error at the first character of a Svelte file, marked with a red squiggly line.  The error message reads “e.children.findLastIndex is not a function svelte”

The error was e.children.findLastIndex is not a function (svelte). It was showing up even on the basic SvelteKit skeleton starter project as soon as I added a <style></style> block.

Read more →

Investigating Bogus Plausible Analytics Traffic

I run self-hosted Plausible analytics to keep track of how many people are visiting my various websites and web apps. I’m largely very happy with it - it gives me all of the info I need with only a miniscule JS payload, no cookies or other invasive tracking, and full control over the data.

However, recently I’ve been running into an issue with fake/bogus traffic getting submitted for my personal homepage. Usually, I’m more than happy to see a bump in traffic to one of my sites, but something was off about it this time.

Read more →

Trying Out sea-orm

For a new project at my dayjob, I’ve had the opportunity to try out sea-orm for the database layer. In the past, I’ve tried out other Rust SQL solutions including diesel and sqlx, so I have some context to compare this one to.

At a high level, sea-orm provides a fully-featured solution for managing your database setup in Rust. It provides a framework and CLI for setting up and maintaining migrations, code-gen’ing entities and relations, and writing + running queries. Like most other Rust DB options, it is fully typed and integration into Rust’s type system.

Read more →

Handling Gamma Correction for Three.JS pmndrs postprocessing Effects

I recently received a bug report on a library I built - three-good-godrays - which implements screen-space raymarched godrays for Three.JS as a pass for the pmndrs postprocessing library. One of the problems pointed out was that colors seemed washed out/desaturated when my pass was used, even when the pass wasn’t rendering any godrays.

Here’s how things look by default without the effect (and are supposed to look with it on):

Screenshot of a scene rendered with Three.JS.  There’s a red plane with a red cube floating above it, casting a shadow on the plane.  The red color is quite bright and cherry/tomato colored.

Read more →

Changing Linux Select to Paste Menu fcitx Keyboard Shortcut

For a long time - at least a couple of years - I’ve been cursed with an issue on my KDE Plasma Linux desktop where my PgUp key doesn’t work. Instead of scrolling up in my terminal or editor, it pops open a menu with the title “Select to paste” and a listing of my most recent clipboard entries:

A screenshot of the fcitx menu with the title “select to paste” and a listing of my six most recent clipboard entries

Read more →

PIXI.JS Optimizations

I was recently working on speeding up a MIDI editor UI written in PIXI.JS which is part of my web synth project. The UI is fairly simple itself, but it needs to be efficient in order to render potentially thousands+ notes on the screen at once.

Here’s what the MIDI editor UI looks like:

Screenshot of a MIDI editor web UI.  There are a few dozen rows of notes with a labeled piano keyboard on the left.  There are green notes arrayed along the composition.  There is a toolbar with a variety of buttons with icons for controlling the MIDI editor on the top.

Read more →

Fixing Svelte Seo Cannot find module './transformers/"application/ld+json">${'

The Problem

After upgrading svelte-seo to the latest version (1.5.4 at the time of writing this), I encountered this error when trying to run my SvelteKit dev server:

Error while preprocessing /home/casey/dream/node_modules/svelte-seo/index.svelte - Cannot find module './transformers/"application/ld+json">${'
Require stack:
- /home/casey/dream/node_modules/svelte-preprocess/dist/autoProcess.js
- /home/casey/dream/node_modules/svelte-preprocess/dist/index.js
Error while preprocessing /home/casey/dream/node_modules/svelte-seo/index.svelte - Cannot find module './transformers/"application/ld+json">${'
Require stack:
- /home/casey/dream/node_modules/svelte-preprocess/dist/autoProcess.js
- /home/casey/dream/node_modules/svelte-preprocess/dist/index.js

The Fix

The issue turned out to be that my svelte version was too old.

Read more →

Building a Realistic Raindrop-Covered Window Pane Material in Three.JS

Screenshot of a rain-covered window rendered with Three.JS. There appears to be many water drops covering the back surface which refract the light from the background. The background is blurry and gray with indistinct high-rise buildings visible in the distance and a gray concrete platform just outside the window. The corner of a table and a table leg are visible in the bottom left corner.

Recently, I’ve been working on a rainy scene in Three.JS. One of the most important parts of this scene is a greenhouse with big glass windows.

I decided to take a stab at making some realistic raindrop-covered window panes for them using Three.JS’s built-in transmission shader. The result turned out pretty well if I do say so myself, so I thought I’d write up my process for building it from start to finish.

Read more →

Fixing Anker USB Hub Not Connecting to M1 Mac

I have an Anker USB hub that I use with my work laptop - an M1 Mac Pro. I use it to plug in two USB-A peripherals (mouse and keyboard) as well as to plug in a HDMI monitor. The hub itself connects to my laptop via USB-C. In addition to the hub, I also have a second HDMI monitor, a USB-C internet adapter, wired headphones, and my charging cable connected to the laptop.

Read more →

Investigating Fidget Spinner Bot

While watching some logs for my webserver recently, I’ve noticed a significant amount of requests coming from a bot I didn’t recognize with the user agent of fidget-spinner-bot. It seems to be pretty aggressively crawling my personal network of sites that I maintain, following links and downloading page contents. Some requests are also coming from user agents including my-tiny-bot, thesis-research-bot, test-bot which seems to be the same or related. I usually recognize most of the user agents of bots making significant amounts of requests to my server, so these stood out to me.

Read more →