Latest Updates

2023-03-13

🔗

Today I added a nav bar to the svelte-maplibre demo site, so you don't have to hit the back button all the time to go between examples.

Otherwise, I've mostly been heads down on the book. It's a bit over 7,000 words right now and coming along well. Still lots more to go!

2023-03-08

🔗

As procrastination for writing my book, I wrote a Neovim plugin to generate word counts per section in a document.

Neovim lets you use an extmark on a position to add virtual text. So the idea was to set an extmark on each header line with the word count, but I didn't quite figure out how the extmark actually moves around with the text. It feels somewhat unintuitive, but there are probably some subtleties that I haven't figured out yet.

Instead of dealing with that, instead I set up my plugin as a "decoration provider." This lets you just set an ephemeral extmark which only lasts for the draw cycle, and then next time a line is redrawn you just create it again (or not). This ended up being a bit more code, but much simpler since I now only have to track the word count and where the headers are, and not worry about if an extmark is still on the right line or not.

Overall Lua feels nice, if rather barebones. I'm definitely missing the functional programming idioms afforded by most modern languages. But the Neovim APIs are very easy to use.

If you're interested in using this, you can get it on Github.

2023-03-07

🔗

Today I encountered an issue using Vite with the Rush monorepo software. Rush keeps its lockfile in an unusual place, and so Vite could not automatically check the lockfile to know when to clear its cache. But it turns out to be pretty easy to code your own logic here.

// vite.config.js
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';

const dirname = path.dirname(fileURLToPath(import.meta.url));

function lockfileNeedsRebuild() {
  const lockFilePath = path.resolve(
    dirname,
    '../../common/config/rush/pnpm-lock.yaml'
  );
  const lockFileDatePath = path.resolve(dirname, '.last-lockfile-date');

  let lockFileSavedDate = '';
  try {
    lockFileSavedDate = fs.readFileSync(lockFileDatePath).toString();
  } catch (e) {
    // It's fine if there is no existing file.
  }

  const lockFileDate = fs.statSync(lockFilePath).mtime.valueOf().toString();

  if (lockFileSavedDate.trim() !== lockFileDate) {
    fs.writeFileSync(lockFileDatePath, lockFileDate);
    return true;
  }

  return false;
}

/** @type {import('vite').UserConfig} */
const config = {
  optimizeDeps: {
    force: lockfileNeedsRebuild(),
  },
  // ... and other config
};
export default config;

See more daily updates...

If you like what you've read here, please consider subscribing to my weekly-ish newsletter, where I announce new articles and share other interesting things I've found.

You can check out a recent issue, or enter your email below to subscribe.

About Me

Work

I'm a co-founder of Carevoyance (acquired by H1 Insights), a sales acceleration tool that analyzes healthcare data and enables healthcare sellers to zero in on their best prospects and generate custom reports and insights with just a few clicks.

I spend most of my time there creating new data analyses, working on the backend API and database systems, and developing tooling to research data anomalies and automate repetitive tasks. Recently I've been active on the front-end too, and have been enjoying the Svelte framework.

In the past I worked almost exclusively in C++ and various assembly languages. Now that I'm more in the web ecosystem, I'm mostly writing Javascript for work, but I'm using Rust more and more as well.

Before starting my own venture, I interfaced with advanced network switching chips at Arista Networks and worked on JTAG hardware debuggers and embedded operating systems at Green Hills Software. Running a small startup feels very different from working at these companies, and it has its ups and downs, but I love it.

Life

I usually have some sort of side project going on, and my most recent obsession is Ergo, a low-code workflow orchestrator that is still in early stages, but coming along well.

Sometimes I wish I could code all day and night, but when not hacking on something or spending time with my family, I enjoy good coffee, nature photography, reading nonfiction and sci-fi, and improving my nascent design and UX skills. I'm also active in my church and run the sound board there every few weeks.

Where to find me

Twitter is probably the best way to contact me, and I'm trying out Mastodon as well. You can also email me at daniel at this domain or find me on Github.

About this site

The website is written using SvelteKit, Tailwind, and hosted on Vercel. Icons sourced from the Refactoring UI icon set and iconmonstr.

The prose content on this site is licensed under a Creative Commons Attribution 4.0 International License. The code can be viewed on Github. The underlying code as well as all code examples are licensed under the MIT license.