Skip to content

{ Author Archives }

Using tagged template literals, revisted

I thought I had a clever way of using tagged template literals with Array.prototype.reduce, but it turns out that String.raw does this already. So my template function should be: function template(strings, ...keys) { return (data) => String.raw( {raw: strings, ...keys.map (key => data[key]) ); } Which is much simpler

HTTPS!

I've finally joined the 21st century, and gone to serving the site on https. On NearlyFreeSpeech, it should be easy: just run tls-setup.sh from an SSH terminal. That sets everything up to use Let's Encrypt, but that was failing because I use the Apache httpd RewriteEngine to host kavanot.name, with that domain redirecting to a […]

Using tagged template literals

This seems obvious in retrospect, but I got this from Olivier Wietrich's tag-reduce. Tagged Literal Templates are useful syntactic sugar. I fill out a lot of school physical forms (each school has its own form), so I need strings like `Weight: ${data.wt_lb} pounds (${data.wt_kg} kg), ${data.wt_pct} percentile`. That works fine if I am evaluating the […]

Updated bililiteRange

It seems like a long time ago that I started updating bililiteRange but it was only 3 months ago. And I think I'm done (though projects are never done!). bililiteRange 3.2 is released, and requires history.js, toolbar.js, jquery.status.js and jquery.keymap.js for all the functionality, though really the core only requires history.js. The documentation is at […]

Classic Editor

Well, that was easy. The Classic Editor plugin restores the old editor, with all my custom buttons. And installing it with the command line interface was just wp plugin install classic-editor

Updating WordPress with the command line

Nearlyfreespeech.net has been great, but their security settings make it hard to update WordPress automatically. I just discovered that WP now has a command line interface that works fine over SSH. wp core update wp core update-dp And done!. You can do wp db export to back up the database first. And updating plugins (for […]

Prism on a CDN

This is something I didn't know about: Prism, the syntax highlighter I use, is available from a few free CDN's, so I don't have to host it. Cool!

A programmable color scheme

I'm not a designer, and I've never been happy with the color scheme for kavanot.name, so I decided to try something new. I use scssphp with scssphp server (and yes, you need both) to generate the CSS, and it allows variables, so I can do: $hue = 250; $saturation = '40%'; $textcolor: hsl($hue, $saturation, 10%); […]

Implementing the History interface

The way browser history is implemented, with the History interface, is useful for other things than site navigation. The same idea, basically an extended stack that allows going back and forward, is the same algorithm used for undo/redo, and command line history. It would be nice to be able to do const h = new […]

Moving bililiteRange into the modern age.

I haven't updated bililiteRange for years, but it's time to drop support for Internet Explorer and use modern constructs like Promise and input events. It should make things more simple. From here on in, I will only support Chrome, Firefox and Edge (the chromium-based one; I don't have Edge Legacy. I'm also working on moving […]