Skip to content

Instantly share code, notes, and snippets.

K Adam White kadamwhite

View GitHub Profile
dd32 / fatal-error-handler.php
Last active Jan 21, 2019
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 Apr 18, 2019
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"
ashfurrow / Fresh macOS
Last active Mar 28, 2019
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 2
  • Airmail 3
  • iA Writer
marcysutton /
Last active Apr 10, 2019
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:

kosamari /
Last active Apr 24, 2019
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.


Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

kucrut / bridge-walker-nav-menu.php
Last active Mar 7, 2019
WordPress Nav Menu walker that returns menu items as multidimensional array (items will children)
View bridge-walker-nav-menu.php
* Nav menu walker
class Bridge_Walker_Nav_Menu extends Walker_Nav_Menu {
* Prepare item
You can’t perform that action at this time.