Skip to content

Instantly share code, notes, and snippets.


How to run phpcs on WordPress-Develop files without installing PHP

I've been running all my dev projects via Docker to avoid the pitfalls of installing server software on my computer. This also lets me jump between macheines very easily since everything I need is wrapped up in dockerfiles, docker-compose files or package.json scripts.

WordPress development doesn't work like that. The default development environment expects PHP to be installed and will try to run PHPCS validation checks from a local instance of PHP.

Use Composer's Docker image

The official Composer Docker image is extremely versatile. It can run arbitrary shell commands if the passed argument isn't a Composer keyword.

joemaller /
Last active September 29, 2023 02:41
How WordPress includes minimized script snippets for blocks in use.

WordPress v6.3.1 inlines styles for used blocks via the wp_head hook. However there is an additional wrinkle. If the SCRIPT_DEBUG constant is set and truthy, then a minimized copy of the styles will be inlined. The minimized copy is pre-generated and included with WordPress.

Code for choosing to use the min variant is in wp-includes/blocks.php:

// Check whether styles should have a ".min" suffix or not.
$suffix = SCRIPT_DEBUG ? '' : '.min';
if ( $is_core_block ) {
    $style_path = ( 'editorStyle' === $field_name ) ? "editor{$suffix}.css" : "style{$suffix}.css";
joemaller / wsl-port-proxy.json
Created March 3, 2023 20:08
script and config file for configuring WSL 2 portproxy rules
View wsl-port-proxy.json
"ports": [3000, 5173, 8000]
joemaller / conversion.js
Created November 15, 2022 15:48
Question about preferred code conversion
View conversion.js
// Starting with an API returned data structure like this:
const Parameters = [
Name: "PASS",
Type: "SecureString",
Value: "cGFzc3dvcmQ=",
Version: 3,
LastModifiedDate: "2022-11-14T15:13:08.263Z",
ARN: "arn:aws:ssm:us-east-1:678000000000:parameter/PASS",
joemaller / curl-format.txt
Created November 8, 2022 20:13
Template for reporting connection times from curl connections. More here:
View curl-format.txt
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
time_total: %{time_total}\n
joemaller / harrassment-training-bot.js
Created October 6, 2022 14:56
bot for helping test online training. Kind of garbage, but maybe useful in the future.
View harrassment-training-bot.js
* For ADP's 2022 sexual harrassment training
cr = () => {
const next = $('')
if (next.length) {;
joemaller /
Created September 23, 2022 20:30
Case Conversion examples

Input: my name is bond

Name Sample
🐪 Camel case myNameIsBond
👨‍🏫 Pascal case MyNameIsBond
🐍 Snake case my_name_is_bond
👩‍🏫 Ada case My_Name_Is_Bond
Ⓜ️ Macro case MY_NAME_IS_BOND
🥙 Kebab case my-name-is-bond
joemaller / index.html
Last active September 9, 2022 16:28 — forked from d3noob/index.html
Add multiple markers in leaflet.js
View index.html
<!DOCTYPE html>
<title>Simple Leaflet Map</title>
<meta charset="utf-8" />
joemaller /
Last active October 21, 2023 16:40
Helper script for installing apps on a new Mac
#!/usr/bin/env bash
# Download this file then run:
# % chmod a+x
# % ./
# Or run directly from this Gist:
# % curl | bash
# Install Homebrew first
set -u
joemaller /
Last active February 6, 2022 17:15
Out of deference to Prettier, I'm switching to filling empty attributes

Previously, for "cleaner HTML" I tended to prefer something like this:

$classes = ['cat', 'dog'];
$classAtt = empty($classes) ? "" : " class='" . implode($classes, ' ') . '"'; 
<div<$= $classAtt ?>>Text</div>

That string concatenation is just gross, but the HTML is "nicer"; the opening tag will either be or.