Posts

Programmatically Clicking the “Convert to Blocks” Button in WordPress Gutenberg on the Edit Screen

In the beginning, I was one of the loud developers protesting WordPress Gutenberg. But, now that Gutenberg has been around for a while, I’ve grown to like it. I can’t tell if it’s because of Stockholm syndrome or if it has actually improved. Anyway. One of the looming problems users of WordPress will still face is the fact if you programmatically insert content into WordPress using wp_insert_post or however else you insert content (say from a CSV or API) you’ll find that WordPress will put it into a Classic Editor block. You will then be prompted to “Convert to blocks” in the editor.

Waiting for an Element to Exist With JavaScript

There are many different ways to solve this use case. You want to wait for an element to exist on the page and run a callback function when it does. It seems simple enough, but what’s the easiest way? By using an async function and a while loop, we can wrap setTimeout in a promise, then await it, and then resolve the promise when the timeout completes. As you can see, it will continue the loop until we reach the timeout passed into the function (or the element is found).

Stop Forcing People Back Into the Office

Remote work (also known as WFH) is a hot topic in 2022. As pandemic-era mandates and restrictions come to an end, there has been a new battle forming. In the left corner, we have companies that want their employees to come back into the office, and in the right-hand corner, we have employees who have been allowed to work remotely for the last two years being asked to come back into the office.

Passing Environment Variables Into Your Code With Webpack

In some use cases, it can be beneficial to pass environment variables into your code. In my case, at build time I pass an environment variable to Webpack in the form of --env production and so forth. I wanted to get this in my code so I could load different configuration files depending on the built environment. I have three environments I build for: Production Staging Development While there are code solutions you can implement such as checking the URL, I wanted something handled in the build itself.

Rate Rise Calculator

As a homeowner with a mortgage, interest rate rises have become an area of interest for my wife and me. As the Reserve Bank of Australia (and the rest of the world) sees continued rate hikes, it’s important to know how much extra money you’ll need to cough up. I wanted a simple tool that wasn’t trying to get me to provide my contact details and sell my information to banks. A simple calculator that gives me an approximation of what my monthly repayments will be with rate increases.

Fixing WiFi issues with the Neural DSP Quad Cortex

For some Quad Cortex users, you will encounter an issue with the WiFi not working. While your first thought might be yoy have a defective unit, the issue might be more simple than you think. The Quad Cortex only operates on the 2.4GHz band of WiFi. This band offers slower speeds than 5GHz WiFi, but is more reliable and can penetrate obstacles better. Chances are your WiFi isn’t setup to work with the 2.4GHz band and you could be transmitting on 5 instead.

How to Extend the Window Object in TypeScript

In many cases when you’re working with TypeScript, there are type definitions available for almost every package out there. However, in some circumstances, you might find yourself working with a third party that adds a property to the window object. Think a script tag like how Google Analytics works by adding in the ga property to the window. It doesn’t matter if you are using Angular, React, Vue, Svelte, Aurelia, or any other framework or library, this approach works for all TypeScript projects.

Build Aurelia 2 Plugins and Bundling With Only TypeScript

The Aurelia 2 makes command ships with the option to scaffold applications and plugins. However, the plugin scaffold uses Webpack and a bunch of dependencies for building plugins. There are reasons that the plugin skeleton uses Webpack. Firstly, HTML imports need to be inlined in bundled code or you’ll encounter issues with HTML files not being supported by Aurelia conventions when you consume them in your plugins. The same thing applies to CSS styles, you’ll want to inline those as strings too.

Moving All My Aurelia Plugins Into a Monorepo

Over the last few years, I have created a few plugins for Aurelia, mostly for Aurelia 1. However, with Aurelia 2 on the horizon (possibly released if you’re reading this in the future), I have decided to clean house and adopt a new strategy. My approach has always been to put my plugins into separate repositories. In my mind, separating issues/pull requests and code made it easier. In reality, having a lot of repositories is a maintenance nightmare.

The Weird Saga of the Optus Cybersecurity Breach

In case you weren’t aware, recently one of Australia’s large telecommunication companies Optus suffered one of the largest cybersecurity breaches to date. While the extent of the data breach has yet to be revealed, Optus has 9.7 million subscribers and the data taken allegedly could go back to 2017 and involves former customers. Allegedly, the data could contain data on over 11 million current and former Optus customers. In any other part of the world, this would have resulted in very large fines. In Australia, no such legislation exists to hold any company accountable for a breach like this.