Digital Dreamer

Writing

Engineering, product, abstract and random thoughts.

Generating Native PDFs from the Browser’s Resolved Layout

The browser has already laid out the page. We can read that result and rebuild it as native PDF text, paths, form fields and SVGs.

Using Bitmasks for Role-Based Permissions: Stop Querying Your Database

In Part 1, we learned how bitmasks work. Now let's build a real permission system.

Bitmask Operations: The Math You Skipped (And Why It Matters)

Your computer can check a boolean flag in a single CPU instruction. You're probably doing three memory lookups and a comparison.

Session Tokens vs JWTs: The False Dichotomy

I've been building auth systems for a while now, and there's this debate that keeps coming up: JWTs or sessions? Every tutorial forces you to pick one, then spends 2000 words explaining why the other one is terrible.

10 Hard-Earned Lessons (Plus One Bonus!) From Launching My First Startup

Looking Back: Building GoRemote Africa - The Maximum Viable Product Disaster. What started as a simple 'jobs go here' idea turned into a proper mess of features, four complete rewrites, and honestly, a masterclass in what not to do when you're building a product.

From Svelte 4 to Svelte 5: Understanding Slots (default and named)

There are a lot of changes that might be confusing in Svelte 5, which is why I'm trying to document my learning process from Svelte 4 to Svelte 5. One of them is using slots in Svelte 5.

A short guide to Async Components in Svelte 5

I couldn't find any working solution for this online, so I thought to share it when I got it to work. The {#await} block in Svelte lets you handle promises right in your template. Pair that with dynamic import() for lazy-loading.

Make EditorJS work in Svelte(kit) SSR

If you're here, you've probably been having issues using EditorJs in Sveltekit (like me). Since SSR isn't supported in EditorJs, you might encounter errors like 'Element is not defined'. Here's how to solve it.

Running a Function When an #await Block resolves in Svelte(Kit)

The #await block in svelte is very handy for handling asynchronous data. But let's say I want a certain function to run when the promise has been resolved or rejected (like a toast).

How to Compare (diff) two Objects

Object comparison in JavaScript is deceptively complex. While comparing primitive values like numbers and strings is straightforward, comparing objects can lead to unexpected results. Let's explore different approaches.

Calling a SvelteKit form action (or submitting a form) from a component

Submitting a form from a SvelteKit component can be tricky. Here's how to handle form submissions and bind form responses correctly within your components.

Fix for EPERM: operation not permitted (...$types.d.ts)

I had an issue running my sveltekit dev server. I kept getting this issue: EPERM: operation not permitted (...$types.d.ts). Here's how to fix it.

Change your Sveltekit (or any vite-powered) dev server localhost port

My dev server runs on 5173 by default. Let's say I wanted to change it to 5199. Here's how to do it in your vite.config.js.

Run your Sveltekit (or any vite) localhost server with HTTPS

A simple no-nonsense guide to running your vite-powered localhost server with HTTPS using MkCert.

Prisma db push or pull stuck?

Fix for Prisma connection stuck when working with Supabase. Switch from pooled connection to direct connection.

Prisma migration stuck?

I was trying to npx prisma migrate dev --name init to a supabase Postgre db. It was stuck. Here's how to fix it.

Prisma + Supabase Error P1001

I kept getting Error P1001 (Can't reach database server) when using Supabase with Prisma. Here's how to troubleshoot and fix it.

VSCode selection automagically toggles multicursor :(

I woke up one day to find that my trusty code editor was misbehaving. It was creating multiple cursors, messing with my code while I'm not looking. Here's how to fix it.

State Of CSS, May 2023 : Newest Additions

CSS has come a long way in recent years, and the state of CSS in 2023 is more exciting than ever before. Let's explore the most pertinent and innovative additions to CSS in 2023.

The State of JS

The JavaScript landscape is continuously evolving, with new frameworks, libraries, and tools emerging every year. Let's explore the most popular frameworks and emerging technologies in 2023.