Skip to content

Instantly share code, notes, and snippets.

joemaller /
Created Sep 23, 2022
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 Sep 9, 2022 — 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 Feb 6, 2022
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.

joemaller / resize safari.applescript
Last active Jan 18, 2022
AppleScript snippet to resize the front-most Safari window to a given size
View resize safari.applescript
tell application "Safari" to set the bounds of the front window to {0, 0, 1600, 1080}

Three package-lock.json files generated by node v14.16.0 and npm v6.14.11 on macOS, Ubuntu and Windows. Windows and macOS generated an identical file, Ubuntu omitted two optional packages, bindings and file-uri-to-path.

As expected, npm ci installs an exact snapshot from package-lock.json, so installing from the ubuntu-generated lockfile on mac or windows will not install those packages. Doing the opposite and installing from the mac/windows lockfiles on Ubuntu causes no issues since the optional packages are not needed.

Source project is ideasonpurpose/docker-build, docker-based build tools primarily for developing WordPress sites.


WordPress Admin Menu Indexes

WordPress Admin menus are populated from a global $menu variable which is only generated in admin contexts. Items can be added or re-ordered from the admin_menu action.

This is the default order:

  1. Dashboard
  2. wp-menu-separator
  3. Posts
joemaller / crontab.txt
Created Dec 9, 2020
Example cron task for auto-removing old downloads on macOS Big Sur and Catalina
View crontab.txt
# Cron on macOS 10.14+ requires Full Disk Access permissions in
# System Preferences->Security & Privacy.
# More here:
# Removes downloads older than 14 days. Runs every 6 hours
45 */6 * * * find ~/Downloads -maxdepth 1 -mtime +14 -exec rm -rf {} \; >> /tmp/cron.log 2>&1
joemaller / WufooEndpoint.php
Last active Dec 1, 2020
A class for creating a WordPress rewrite rule to serve a stylesheet from a persistent top-level url
View WufooEndpoint.php
namespace IdeasOnPurpose;
* This class created a nice little persistent endpoint for an
* externally referenced stylesheet. This was necessary because
* our themes are versioned with each release living in a different-
* named directory. All assets are also generated by Webpack and
* have hashed filenames.
joemaller /
Last active Oct 10, 2020
Script for logging IP address changes. Checked with shfmt: `docker run --rm -it -v "$PWD":/src peterdavehello/shfmt shfmt -i 2 -w /src/`
#! /usr/bin/env bash
# Stop on errors, unset vars and broken pipes
set -o errexit
set -o nounset
set -o pipefail
if [ -z "$LOG_FILE" ]; then
echo "Please provide a logfile as the first argument"
joemaller / inotifywait
Created Aug 28, 2020
inotifywait docker command
View inotifywait
docker run -it -v $PWD:/app alpine sh -c 'apk --no-cache add inotify-tools; inotifywait -m --format "%e %f" /app'