When running phpcs with the –ignore option (because I don’t want to scan the /vendor nor /node_modules directories), I kept getting the error “zsh: no matches found: –ignore=/vendor/*,/node_modules/*”.
Programming
Don’t Do It Now, Open an Issue Instead
When working on an issue, it is easy to get sidetracked by other unrelated changes that need to be made. I’ve found that instead of addressing other issues as I spot them, taking a moment to open an issue and then ignoring them allows me to stay focused on the task at hand.
WordPress View Block Attributes
When developing a WordPress plugin that creates a Gutenberg block, it is invaluable to be able to view the attributes on the block. Here are some tricks I use to view this information.
Automatically Switch Node Version in Zsh from package.json
Add this code to $HOME/.zshrc to automatically set the node version to match the version in package.json.
Getting Started with LuaSnip
This article assumes you are using Neovim (version 0.8.0 or higher) and packer.nvim to manage your plugins. Adding the following loads the LuaSnip plugin, creates a snippet for “func”, and maps “Ctrl + p” to expand the snippet and jump through the fields.
vim.keymap.set() coc to confirm completion with lua
I’m currently rewriting my Neovim configuration using lua rather than using vimscript. I’m using the coc.nvim plugin and want to map return (
trailingslashit() vs untrailingslashit()
WordPress has two functions that can be helpful when dealing with the final character of a URL, trailingslashit() and untrailingslashit(). I find it preferable to use untrailingslashit() for two reasons: 1. It does not break empty checks and 2. It makes my sprintf() statements more readable.
How to Disable beforeunload Event Listeners
I was doing some troubleshooting and wanted to disable the “beforeunload” event listeners on a page. This is how I accomplished it with the Chrome browser.
Always Bring Your Pull Requests Up to Date
A Pull Request (PR) should always be up to date with the branch into which it is being merged. Another way of saying this is you should be able to merge your PR as a fast-forward merge (even if you decide not to do a fast-forward merge). In this post we’ll look at how a safe looking PR that is out of date can be catastrophic to merge.
JavaScript Unix Timestamp from String in Time Zone
Given a string like “2022-01-01 13:00:00”, which represents a time in the “Europe/Paris” timezone, how can we get the corresponding Unix Timestamp in JavaScript? This problem is sufficiently complex that in my opinion leveraging a third-party library is the best solution.