Posts

Quora's Slow Descent Into Nothingness

A few short years ago, Quora was the darling of the tech world. A place where you could ask questions and get answers from people at the top in their chosen field. CEO’s, leaders, heavy hitters. The fun part of Quora was how accessible skilled experts were, who would otherwise not be easy to reach. You could ask pilots questions about flying. You could ask police officers about their job. I mean, even astronauts were answering questions on Quora.

Is the Nintendo Switch OLED Worth It?

Despite having had my Switch since 2017, I am still in love with the console. After a busy life and kids made my Playstation 4 obsolete because it was constantly downloading some massive patch, the instant-on nature of the Nintendo Switch appealed to me. Sure, the Switch is a little rough around the edges, and the screen isn’t the prettiest thing to look at, but it still looks good and performs well.

How to Deploy a Site via SSH Using GitHub Actions

I love GitHub Actions. They are so simple and powerful, allowing you to have your code deployment and source code in one location. I manage and deploy all of my sites using SSH (because it’s more secure), and over the years, I’ve adopted numerous deployment strategies. I adopted a Git strategy not too long ago where my server would pull down changes from Git, but it’s a flawed approach. Here is an actual GitHub Actions build file I use for a project. It’s a mixture of Node.js and WordPress. If your needs are not as complicated, your file will resemble a fraction of this.

How to Parse Dates With Different Timezones in PHP (and convert them)

Recently I was tasked with processing some content from an API, the published dates and times were coming through with timezone values in the string. My dates looked like this: 2021-09-29T04:24:39Z If you parse these using strtotime like I was and importing them into WordPress, even if your server timezone is configured correctly, the timezone will be wrong. In my situation, the dates and times were showing all hours of the morning.

How to Get Authentication Working Using the Node WPApi Package

If you are working with WordPress version 5 and up, you might be using the REST API. I love the in-built REST API WordPress provides, especially for creating applications on top of WordPress. The Node WPApi package makes this a breeze, especially when it comes to authentication based actions. My first test with this package was creating a new post, and I got this error message: Sorry, you are not allowed to create posts as this user. I was confused at first because I entered the correct username and password for my WordPress installation. Well, as you will discover, WordPress won’t just allow you to perform authentication-based requests using your standard credentials.

How to Remove WordPress Menu Items (Including Those Created by Plugins)

WordPress comes with a lot of stuff out of the box. Throw in some plugins, and it gets even noisier. Next minute, your menu sidebar in admin looks like that drawer in the kitchen you shove everything into (known in Australia as a crap draw). Now, you’ll want to hide some menu items for particular roles or even users (whatever floats your boat). The first hurdle can be knowing what each item is registered as (the slug matters). The core menu items like plugins and tools are easy enough, but custom menu items like “Custom Fields” and “Elite Video Player” — you need to know the slugs these were registered using.

A List of WordPress Gutenberg Core Blocks

Believe it or not, finding this information in the official WordPress documentation was a nightmare. I had to go through the WordPress codebase itself to find these values. In a site I am working on, I wanted only to enable specific WordPress Gutenberg blocks. By default, my client will never use a lot of junk, like buttons and page separators that I wanted to disable. I am using the allowed_block_types hook to create an inclusion list where I specify what blocks I want to enable. You can also add your custom blocks to this list.

How to Copy Files Using the Copy Webpack Plugin (without copying the entire folder structure)

Despite the fact that I’ve been doing this whole front-end development thing for over a decade now, I still get caught up on silly things. Mostly build-related things trip me up. In a project using Webpack for the bundler, I needed to copy a folder from a node_modules directory and include the files in my bundle (don’t ask). The first thing I did was this: new CopyWebpackPlugin({ patterns: [ { from: 'node\_modules/@ia/qce/dist', to: 'content/qce' }, ]}), Now, the problem here is that the copy-webpack-plugin will copy the entire path to the file. So, inside of my content/qce directory I had node_modules/@ia/qce/dist folders (the entire path). It will recreate the entire folder structure from the from value instead of just taking the contents (like we want).

What happened to Deno?

The ever-changing landscape of web development can be both cruel and kind. In May 2009, Ryan Dahl introduced Node.js to the world, and it didn’t take long before developers flocked to it like ants on a large pile of sugar. Ryan left the Node project in 2012. Node continued to increase in popularity and, front-end tooling started to build on Node.js, further propelling the popularity even further. To this day, most front-end tooling is built on Node, and Npm underpins the package ecosystem for both browser-based packages and Node.js packages.

Working With the Children Decorator in Aurelia 2

In Aurelia 1, we had the children decorator which allows you to query HTML elements inside of a component and then access them. In Aurelia 2, we have a children decorator, but it works differently. We are going to assume for this article that we have a bunch of custom elements being rendered called product-block which represent detail blocks for products in our custom element view In Aurelia 1 @children('product-block') productBlocks; Simple and effective.