Toby's Log

Project: Website theme switcher

I finally made a theme switcher for my website. Ever since I saw the CSS Zen Garden, I loved the idea of using the same markup with completely different appearances. This led to a desire to have multiple themes and an ability to switch them on my own site. Early on I didn’t have the ability, and later I didn’t, have the energy or time, or decide on the way I wanted to do it. There are performance and complexity considerations, as well as needing to make decent themes other than the default one. My eventual desire to have a static-friendly site complicated the performance aspect as well.

Some browsers have a built in way to change to alternate stylesheets, but they stupidly download all of them even when they’re not being used. I’m not doing that. So JS or a server-side cookie solution are needed, and the latter won’t work for static sites. I try to minimize the JS on my site and didn’t want something heavy or complex, especially if it were loading before page render.

Recently, I had the energy and decided on a simple, lightweight JS way to do it. I decided to start it even without real alternative themes.

Continue reading post "Project: Website theme switcher"

I don’t use npm often. When I do, I tend to be reminded of annoyances in using it. One such annoyance is that it doesn’t take into account the node version in use when installing new packages, as I posted about four years ago. It just goes with the latest if no version is specified, regardless of its ability to run in the available environment. So I have to manually step back versions until I find one that works. The alternative package manager yarn at least has the good grace to error out for incompatible versions, so I used that and just decremented the version of each package until it stopped erroring.

Some of us like to let our OS package manager manage our OS-wide software for security, stability, and simplicity, and that isn’t always the latest and greatest.


Dunc got skunked

My brother’s dog, Duncan, got skunked recently while I was walking him. They were very close quarters between, in a ditch / drainage pipe, so I don’t think I got any on me. It was dark, and around a bush from me, so I didn’t even see the critter, and didn’t know it was a skunk until after I had pulled him away and noticed the smell. But it was quite some work to get him cleaned up.

Continue reading post "Dunc got skunked"

Symfony templates for WordPress pages

I’ve been using Symfony for all of my site pages except the blog, which is run with WordPress. Originally I was using a standard WordPress theme that made my blog look different than the rest of my site. I had looked into ways to pull WordPress through a controller action and stuff like that, but ran into difficulties. I ended up using a solution where WordPress functions as normal for the subpath that it is in, but code in a custom theme boots the kernel from the Symfony part of my site and uses the twig service to render the template. Output buffering is used to capture the normal output of the site to pass to twig.

My theme code does some other things, but I will try to present a stripped down version that could work with a Symfony Standard Edition site for the purposes of this post to hopefully help others do the same.

Continue reading post "Symfony templates for WordPress pages"

Updated to Symfony 6.4

Since updating my server earlier in the year, and thus moving to PHP 8, I would’ve been able to update to Symfony 6. I didn’t get around to it until today, though. I’ve been fixing deprecations in my code mostly as they appear (in profiler, console, logs, or automated tests) so I didn’t have a lot to do this time. I changed ^5.4 to ^6.4 in my composer.json and then had to adjust a few minor things in config. Some of those took longer than they should’ve though.

Continue reading post "Updated to Symfony 6.4"

Ghosts.js

A few years back, to make my site more festive for Hallowe’en, I made a script to have ghosts move around my web-page. I based it on my snow script for winter / Christmas, using the basic structure, reducing the number of moving objects, and changing their movement to look better for ghosts. I meant to post about it. This year I decided to break it out into its own Github repo, which led to me refining it and cleaning it up somewhat. See the ghosts.js repo and the ghosts.js demo.

Continue reading post "Ghosts.js"

vim.tiny and vimrc

I tried installing my dotfiles on an unmodified Ubuntu install. My vimrc threw many errors. Ubuntu and other Debian based distros install the tiny build of vim by default, which has a lot of features disabled, including eval, but still loads the user vimrc. That means that many things that might be in there, including function and even let, do not exist in tiny. :help no-eval-feature provides a solution: Wrap everything that should only work in +eval capable versions of vim in if 1 … endif.

Continue reading post "vim.tiny and vimrc"

</toby>