Skip to content

Instantly share code, notes, and snippets.


K Adam White kadamwhite

View GitHub Profile
dd32 / fatal-error-handler.php
Last active Jan 13, 2023
A quick WordPress 5.1 shutdown handler to disable the plugin/theme pausing features. Install as wp-content/fatal-error-handler.php. This is needed during development, and on sites which have sensitive plugins enabled which must never be deactivated. You should also consider adding a wp-content/php-error.php template. UPDATE: This is replaced by …
View fatal-error-handler.php
// UPDATE: This can be replaced by `define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );` in `wp-config.php`.
// See
* Shutdown handler to disable WordPress 5.1's plugin/theme pausing features.
class dd32_Fatal_Error_Handler extends WP_Fatal_Error_Handler {
// Do not store errors, this disables the ability for plugins/themes to be marked 'paused'.
kadamwhite / File
Last active Oct 17, 2018
Helpers I use for local WordPress development.
View File

Local WordPress Core Development Helpers

This is a collection of scripts, bash functions, and config files that help me do WordPress core development.

Folder Structure

  • /wp: parent folder
  • /wp/svn: SVN checkout
  • /wp/git: Git checkout
  • /wp/{ git | svn }/wp-test-config.php: see attached file
kadamwhite / api-testbed.js
Last active Mar 18, 2019
wpapi lightweight testbed
View api-testbed.js
/* eslint-disable no-console */
* A little module that adds a wpapi() method to the window object.
* wpapi() takes an API path (e.g. /wp/v2/posts), optionally containing string query parameters,
* or a query-less API path and a hash object of query param objects.
( context => {
const { root, nonce } = context.WP_API_Settings;
igmoweb / phpcs-security.xml
Created Dec 19, 2017
PHPCS just with security rules
View phpcs-security.xml
<?xml version="1.0"?>
<ruleset name="Ignacio">
<description>Security reviews with PHPCS.</description>
<!-- Exclude the Composer Vendor directory. -->
<!-- Exclude the Node Modules directory. -->
cowboy / mock-axios.js
Last active Jan 13, 2023
axios mocking via interceptors
View mock-axios.js
import axios from 'axios'
let mockingEnabled = false
const mocks = {}
export function addMock(url, data) {
mocks[url] = data
View blocksinpost.json
// 20170908135703
// http://developwordpress.localhost/wp-json/wp/v2/posts/40018
"content": {
"id": 40018,
"date": "2017-09-04T19:21:42",
"date_gmt": "2017-09-04T19:21:42",
"guid": {
"rendered": "http://developwordpress.localhost/?p=40018"
rtomayko /
Created Jun 7, 2017
10x SSH connection speedup w/ persistent control masters

SSH Persistent Control Master Config

Add to ~/.ssh/config:

Host *
  # Enable persistent connection multiplexing
  ControlMaster auto
  ControlPath ~/.ssh/-%r@%h:%p
 ControlPersist 600
yaroslav / guetzli-all
Created Mar 25, 2017
A script to run guetzli recursively for all JPEG files in current directory and lower
View guetzli-all
find . -name '*.jp*' -print0 | xargs -0 -I{} -t guetzli --quality 90 {} {}
ashfurrow / Fresh macOS
Last active Dec 15, 2022
All the stuff I do on a fresh macOS Installation
View Fresh macOS

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
marcysutton /
Last active Jan 31, 2023
Enable Chrome Accessibility Experiment

NOTE: This is no longer an experiment! You can use the accessibility inspector in Chrome Devtools now, including a fantastic color contrast inspection tool. Read more:

Just like any good element inspector helps you debug styles, accessibility inspection in the browser can help you debug HTML and ARIA exposed for assistive technologies such as screen readers. There's a similar tool in Safari (and reportedly one in Edge) but I like the Chrome one best.

As an internal Chrome experiment, this tool differs from the Accessibility Developer Tools extension in that it has privileged Accessibility API access and reports more information as a result. You can still use the audit feature in the Chrome Accessibility Developer Tools, or you could use the aXe Chrome extension. :)

To enable the accessibility inspector in Chrome stable: