KevinRuffe.com

Husband, Father, Vermonter, Developer

Chin Up

I'm hearing a lot of pessimism coming from friends, family and neighbors lately about the future. And I'm talking about people with a variety of political positions here. They don't agree on what the problems are, let alone how to fix them, but they all seem to agree that something is wrong.

I tend to see things a little differently. I don't deny there are things happening in this country that I don't agree with, but on balance I tend to think the world is becoming a better place, and for every thing we can quibble about with our country's direction there's a couple other metrics we can point to where things are improving.

Good to get some validation then in The Interpreter column in The New York Times this morning. In it, Max Fisher writes pretty persuasively that while democratic erosion in the States and elsewhere is a big concern, there are so many other trends worth celebrating right now. Cheers to that. 🍻


Brave Little State

My wife Katie and I are big fans of the Brave Little State podcast from Vermont Public (formerly Vermont Public Radio). It's a great show where listeners get to vote on listener-submitted questions that they'd like answered by Vermont Public's reporters. Given our love for the show, you can imagine our delight when a question of Katie's got selected, albeit through the backdoor. Who needs votes? One of the show producers selected it as a wildcard pick! 😁

The episode just landed this week. Katie's question was: Whose job is it to come up with the punny messages on the highway traffic alert signs throughout Vermont? Hilarious!


Keep your Tabs to Yourself

Prettier is an amazing tool. I've used it for years and will continue to do so, but I find shit like this beyond eyeroll inducing. Because there's an accessibility angle now the vast majority of JS/TS devs might have tabs as the default? The point of a default is that it fits the default use case.

I've never bothered with a config file for Prettier before. Now I'll be dropping a .prettierrc like this at the root of all my projects:

{
  "useTabs": false
}

I'm Listening

I've no love for either big party in federal US politics. I have points of agreement with both, I've voted for candidates from both, but I have little respect for both. I suspect one reason I don't see many candidates I can quickly support from either is a need for them to go to the extremes in order to secure their base.

I don't necessarily see what NJ Congressman Tom Malinowski presents in this piece as offering a silver bullet for our national polarlization. (I have other ideas as to what might mitigate that.) I do, however, think he's on to something with regard to how we can mitigate political animosity and vote in folks who could get things done in DC. And I suspect I'd be at least open to supporting a politician of either big party (grudgingly, no doubt) who also had the endorsement of some Moderate Party.


A New Version of My Site

What follows is an adapted version of the README from the code that generated this site.

New day, new code for my site! This time it's created via a bespoke static site generator written in TypeScript and served off of the Cloudflare CDN network.

Another version of your personal site?!

First, some context. Yes, this is another version of my personal site. Previous versions this of site have been made with raw HTML, a custom PHP framework, Laravel, and Next.js. The previous versions were just fine. In the case of the last two versions, they even had more "features" than this site -- things like tagging, search, contact forms, etc. The only problem is that I hardly ever posted to those sites.

In the case of the first two, I was writing in HTML, and that always feels awkward to me. In the case of the last two, I was writing into a CMS (a custom one and Contentful, respectively), and while that is better, there's just a lot more of a "process" to writing a post that way than I liked. I came to realize that what I really wanted was to just write some Markdown in vim and push to version control to trigger publishing. And so here we are, at version 5 of this site.

The tech employed in making this.

I considered a few options early on, including static site generators like Eleventy and Gatsby (or even leveraging Next.js again -- it is a great framework), but ultimately I knew that isolating myself from framework maintenance was a goal for this project. If my personal site starts to feel like work it's not something I'll make heavy use of. Instead, I wrote my own static site generator that builds my website via a TS script and the build output can be deployed on any CDN network.

As it stands right now, I have 4 small dependencies (not counting dev-dependencies, which are also nearly all for convenience's sake):

Any of these would be replaceable with a little work, but they're great libraries and should be very ease to keep up to date.

How to try it.

If you'd like to give it a trial spin simply clone the repo:

git clone https://github.com/kevinjruffe/kevinruffe.com.git

Then install dependencies:

cd kevinruffe.com_v2 && npm i && npm run compile

...and finally create a starter Markdown file with:

npm run newPost

Once you've completed writing your Markdown file all that's needed is running npm run build and your blog site will be generated. Viewing it locally is then possible by running npm run serve. That's it.

Of course, everything is set up with my own use case in mind. If you'd like to fork this repo to make your own static site you'll need to do some small customization. Namely, you'll want to update the images in the blog directory, rm -rf blog/built and update the style.css file to add your own look. Then you would run through the process of starting a first post as already described.

The infrastructure the site is served with.

In the past for static sites I've used AWS or Vercel, and that would have been a great choice for this site too. In fact, for a static site like this any CDN service should work just fine, but for the sake of trying something new I went with Cloudflare's Pages offering.

Setup couldn't be simpler. You do some initial configuration that dictates how Cloudflare gets triggered (in my case, through pushes to my GitHub repository), then you do a small bit of configuration telling Cloudflare how to respond to that trigger:

  1. Choose the framework you're using so Cloudflare knows what to expect. For me, there is no framework, so we choose "None".
  2. Any command your framework or script needs to build the site. Here that is npm run build, which compiles TypeScript and then triggers the blog generation script. (Yes, I could have just done the later -- my npm run generate command -- but I wanted to have Cloudflare respond to any code changes subsequently made to the script code.
  3. The output directory your built files live in. In this case, those files live at /blog/built.

That done you have a site deployed around the world at "the edge". You'll likely want to hook up a custom domain and perhaps leverage some of Cloudflare's other services, but that's really all that is necessary to get going.

What's Next?

Hopefully more frequest posts! I've drastically reduced the barriers to writing new posts and expect that going forward I'll be updating this site pretty frequently. With features too.

One such at the forefront of my mind is adding a login link for family/friends. The idea here would be that family and friends could login to the site and that would unlock additional private posts, like posts about, or pictures of, my kid. The current idea for this is to leverage Auth0 to handle authorization and Cloudflare Pages Functions to simply strip the private posts for the non-authorized and serve all others as normal. (The latter are middleware-like serverless functions that run at the CDN layer -- a.k.a. "the edge" -- and can manipulate HTML on a per-request basis.)

That feature may be some time away. I head back to work from paternity leave on July 18th. I feel like I have no free time now, but when work starts back up? 😅

<<<>>>