Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@dd32
dd32 / fatal-error-handler.php
Last active January 13, 2023 00:52
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 …
<?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 October 17, 2018 22:14
Helpers I use for local WordPress development.

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 March 18, 2019 19:39
wpapi lightweight testbed
/* 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 December 19, 2017 13:07
PHPCS just with security rules
<?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 April 14, 2024 05:40
axios mocking via interceptors
import axios from 'axios'
let mockingEnabled = false
const mocks = {}
export function addMock(url, data) {
mocks[url] = data
}
@adamsilverstein
adamsilverstein / blocksinpost.json
Last active September 8, 2017 17:57
Blocks in post
// 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 June 7, 2017 19:43
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
yaroslav / guetzli-all
Created March 25, 2017 20:53
A script to run guetzli recursively for all JPEG files in current directory and lower
#!/bin/bash
find . -name '*.jp*' -print0 | xargs -0 -I{} -t guetzli --quality 90 {} {}
@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active April 4, 2024 17:29
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
@marcysutton
marcysutton / chrome-a11y-experiment-instructions.md
Last active January 31, 2023 22:07
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: 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: