Notes on Tech

Documenting my ideas and insights on tech.

[Solution] Husky pre-commit hook error in GitHub Desktop

How to resolve the Husky pre-commit hook error in GitHub Desktop.

How to install Google APIs Client Library for PHP using Composer

These are the steps I followed to install the Google APIs Client Library for PHP using Composer.

Installing PHP dependencies in production using Composer

How I install the PHP dependencies on the production server using Composer.

Loading a config file in Bash

How to include and read variables from another Bash file in a Bash script.

How to get the last modified date of a file in Bash

Use Bash to get the last modified date of a file.

How to install/update nvm, Node.js, and npm

These are the steps I followed to install and update nvm, Node.js, and npm on Windows.

 — Updated

JavaScript: Number field sanitization

A JavaScript method for allowing only valid characters in a number field.

How to install Git and Git Bash on Windows

These are the steps I followed to install Git and Git Bash on Windows.

Calculating the number of days between two dates in PHP

Learn how to calculate the number of days between two dates in PHP.

How to change date format in PHP

Learn how to convert a date to a different format (e.g. “dd/mm/yyyy” to “yyyy-mm-dd”) in PHP.

How to fix the mysql_connect fatal error in WP-CLI

How to fix the “Call to undefined function mysql_connect()” error in WP-CLI.

[Solution] Composer: openssl and curl extensions errors

How to resolve openssl and curl errors when installing a package in Composer.

JavaScript: How to pass multiple parameters (and the event object) to an event handler

How to pass multiple parameters, along with the event object, from an event listener to an event handler.

JavaScript: Waiting for a function to finish before continuing

Different methods in JavaScript (promises, async await) to wait for a function to finish before continuing the code.

Cloudflare Rules: Fields description

How to find out what each field in Cloudflare rules means and what kind of value it returns.

How to flush permalinks in WordPress

Refreshing WordPress permalinks is very simple to do and can solve various problems with custom post types like 404 errors.

[Solution] Cannot add more than one item to a list block in WordPress 6.1

Learn how to fix the issue where you can’t add more than one item to a list block after updating to WordPress 6.1.

Allow a PHP script to run only through CLI

How to restrict the execution of a PHP script to CLI (Command Line Interface) only (so it doesn’t run through the browser).

How to run a PHP file on a remote server (SSH) via a Bash script

Learn how to execute a PHP file remotely (using SSH) via a Bash script.

How to automatically scroll to an element on a page

Different ways to automatically scroll to a particular HTML element on a page.