Posts

What Button Covers to Use on Your Quad Cortex?

The Quad Cortex is an amazing modeller, and since buying one in October 2021, I use it many times a week (the perks of having it on your desk). However, despite how incredible the modeller is, the rotary stomps can be a little small for non-desktop use. If you’re gigging or using it with your feet, the small stomps can be tricky, and you can accidentally press the wrong rotary button.

Reliably waiting for network responses in Playwright

Playwright makes what used to be complicated in end-to-testing almost too easily, especially waiting for network requests. However, in the case of single-page applications (SPA) where a click on a link or button maybe fire a request but not a page load, you can encounter a situation where Playwright encounters a race condition between clicking and waiting for a response. The issue is sometimes the waitForResponse in situations where the request might be faster than the click event finishing, it acts as if it never took place and times out. This issue is acknowledged in the Playwright documentation for page.waitForResponse.

How To Test Your Web Applications Using Playwright and Support 2fa Tokens

At work, I’ve been migrating us over from Cypress to Playwright for end-to-end tests. In that time, we’ve enabled two-factor authentication functionality in our application for security. These TOTP tokens are great for security but provide an additional challenge for testing. While Playwright supports saving state, our application tokens have a short expiry. I needed to log in to our application, enter a one-time password, and test. The logging-in part was easy. We created development environment credentials. But because 2fa is enabled in all environments, we still had the issue of needing a TOTP token.

How to debug the output from within WordPress filters

WordPress has a great actions and filters system allowing you to create injection points for modifying parts of your code (especially for plugin authors). However, you probably arrived here because you’re trying to echo or print_r something from within a filter and not seeing the output. Because WordPress operates on a post/redirect approach, it means you’re not seeing the output because the page has been reloaded. You need to kill the script from within your filter callback function to see the output.

How to Use Bootstrap JavaScript Components Inside of Shadow DOM Web Components

Despite doing this front-end thing for over a decade, I still encounter new problems thanks to the ever-evolving web specifications. One of the newer specifications is Web Components. Now, my situation was I wanted to see Bootstrap 5 Javascript components. Because of the closed-wall nature of Shadow DOM means, the global approach Bootstrap takes by default will not work for components. Fortunately, it is possible to use Bootstrap components with Shadow DOM, albeit programmatically.

I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification

After being deplatformed a little while ago, Donald Trump created his Twitter clone, Truth Social. As you can imagine, Truth Social launched to about as much fanfare as a fart in an elevator. Still, my curiosity got the better of me. For whatever reason, the site is currently restricted to Canada and the United States. And, it is worth pointing out that this restriction is Truth Social themselves restricting which countries can access the site. I am not sure what the reason is for restricting access. Seems ironic given it’s meant to be a Twitter-esque site for free speech.

Creating Site Meta Search In WordPress Multisite using Site Queries

WordPress is incredibly powerful, and every so often, a new feature gets added that goes under the radar that can dramatically change how you build sites. In WordPress 5.1, an addition of a new WP_Site_Query class was created. It allows you to query your network of sites but goes beyond just getting IDs and making you loop over them to use with switch_to_blog($id) Here is another super-specific use case I had with WordPress Multisite recently.

What is flex: 1 shorthand for?

If you have used Flexbox before in CSS, you might have used the shorthand property flex: 1. And if you’re like me, you might have been using it but forgotten or not even known what this is shorthand for. I know to use this shorthand when I have Flexbox items that I want to take up the rest of the space. It’s perfect for situations where you have an image on the left and a box of text on the right (product image and product name + price).

Programmatically Create New Sites In WordPress Multisite

In WordPress, creating new sites from the admin interface can be tedious, especially if you want to add custom metadata to sites/ACF option fields. I had a scenario where I needed to create 1800 sites from a spreadsheet. Doing it one-by-one was not going to cut it, so I needed a code solution where I could loop through these sites and create them without needing the UI. Like almost everything in WordPress, there is a function you can call. It’s called wpmu_create_blog — I have a Multisite subdomain install, so this code won’t work for directory-based multisites (it’s not hard to change, though). And I found the documentation to be quite poor. But, here is what I ended up doing.

Unpkgd Is Down (Again)

After an outage seven days ago, unpkgd.com, a widely used CDN for NPM packages, is again down. This time, the outage is more severe. At the time of writing, unpkgd.com has been down for hours. Even the official status page is down. With two outages in such a short period, I am starting to doubt whether I will continue to use unpkgd in the long term. It’s a free service, so I can’t complain really. But, it does highlight the fragility of relying on free services.