Skip to content

Instantly share code, notes, and snippets.

K Adam White kadamwhite

Block or report user

Report or block kadamwhite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dd32
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
<?php
// UPDATE: This can be replaced by `define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );` in `wp-config.php`.
// See https://core.trac.wordpress.org/changeset/44674
/**
* 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
kadamwhite / File Structure.md
Last active Oct 17, 2018
Helpers I use for local WordPress development.
View File Structure.md

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
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
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>
<file>.</file>
<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<!-- Exclude the Node Modules directory. -->
@cowboy
cowboy / mock-axios.js
Last active Jul 1, 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"
@rtomayko
rtomayko / ssh-persistent-control-master.md
Created Jun 7, 2017
10x SSH connection speedup w/ persistent control masters
View ssh-persistent-control-master.md

SSH Persistent Control Master Config

Add to ~/.ssh/config:

Host *
  # Enable persistent connection multiplexing
  ControlMaster auto
  ControlPath ~/.ssh/-%r@%h:%p
  ControlPersist 600
@yaroslav
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
#!/bin/bash
find . -name '*.jp*' -print0 | xargs -0 -I{} -t guetzli --quality 90 {} {}
@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active Jul 12, 2019
All the stuff I do on a fresh macOS Installation
View Fresh macOS Setup.md

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 2
  • Airmail 3
  • iA Writer
@marcysutton
marcysutton / chrome-a11y-experiment-instructions.md
Last active Jul 4, 2019
Enable Chrome Accessibility Experiment
View chrome-a11y-experiment-instructions.md

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: https://developers.google.com/web/updates/2018/01/devtools#a11y


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:

You can’t perform that action at this time.