Category: Programming
-
Adding support for MHTML in Chrome’s Apple Script “save” action
MHTML is a handy format for archiving pages. In Chrome, you can get it by selecting “Save Page As…” and choosing “Webpage, single file” as the output format. In a Chrome extension, you can get it via chrome.pageCapture.saveAsMHTML, which is what I use in the gg_download extension I’ve been hacking on. In the project I’m…
-
Comparing nodes
I thought I wanted to compare the DOM trees for a couple of nodes. I ended up putting this together: How would you have done it? (I’d be unsurprised if this has some bugs.) After writing this though, I realized that comparing the HTML from n1.getHTML() vs n2.getHTML() was better for my purposes. (I don’t…
-
white-space: pre-line converts lines into spaces in Safari when pasting into a textarea
In a site I’m helping with, we encountered this weird behavior: users pasting multiline text into a textarea in Safari (but *not* in Chrome) found their newlines replaced with spaces. This was a problem because lines are used to separate items to be processed. Dropping the lines garbled the meaning of the input. My first…
-
Regex in C++
I’ve missed out on a few things. It was fun to learn (or be reminded?) today that regular expressions have been part of the C++ std library for a while: https://en.cppreference.com/w/cpp/regex
-
Wayback Machine rescues pytest posts
I’ve been curious about how pytest‘s assertion rewriting works. (As someone used to Abseil’s testing framework, the usage of bare asserts was a shock.) I was happy to come across a Reddit post: “How does pytest work?”. Unfortunately, the site it points to, pythoninsight.com, seems to be mostly dead. Luckily, the wonderful Wayback Machine has…
-
Snooping on Internet Archive’s Wayback Machine bot
I’m reading Jon Duckett’s “PHP & MYSQL” and got up to a section where he discusses $_SERVER, which contains info on HTTP headers, etc. I thought it might be fun to see what Internet Archive’s Wayback Machine bot looks like in terms of this. So, here’s my take on dumping parts of $_SERVER: https://github.com/fadend/server-vars-php/blob/main/server_vars.php. Hopefully…
-
Wolfram’s Cellular Automata
I’ve had fun reviving another old PHP project — code to draw the evolution of 1D cellular automata using the codes described by Stephen Wolfram in his book “A New Kind of Science”. See https://github.com/fadend/wolfram-ca-php. One thing I added over my 2004 version is the ability to easily start with just a single point turned…
-
Clifford Pickover “million-point” structures in PHP
Back in 2004, I wrote some PHP to render the “million-point” structures Clifford Pickover described in his book “Computers and the Imagination”. I’ve got a project coming up that may require PHP so I decided to give it another look. Code is here: https://github.com/fadend/pickover-dots-php/blob/main/pickover_dots.php You can play with it here: https://revfad.com/cgi-bin/pickover_dots.php. A couple references I…
-
Static photo album creator
I’ve published a utility for creating a static photo album (no server-side stuff, just HTML + photos) given a folder of photos: https://github.com/fadend/go-photos. I was inspired to do this because in looking for costs to cut, I decided to stop paying for Photobucket. Whatever you used to find under https://s114.photobucket.com/user/dfaden (broken link), you can now…
-

Mandelbrot Set in Autoplot
My older brother Jeremy was the first person to help me with programming. (And I’ve never stopped asking him for programming advice since then!) My first computer was a Commodore 128 that my mom picked up at a garage sale (it turns out from one of Jeremy’s high school friends); it was quite ancient even…