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
kadamwhite /
Last active Mar 13, 2018 — forked from ramiabraham/
The Parbs Scale

The Parbs Scale: a Unit of Measurement for the Modern World

A Practical Means of Measuring Human-scale Physical Objects

Author: Rami Abraham
August 30, 2015



register_meta and the REST API

In the year since 4.8, confusion about how to properly expose meta information through the REST API has been one of the most prevalend issues we've seen in support posts and tickets.

Most developers try to use register_meta with show_in_rest => true; unfortunately register_meta works on object types, not subtypes, so you cannot pass a custom post type name into register_meta like you can with register_rest_field. Worse, if you register meta for the type 'post', then that meta key is registered not just for core posts, but for every single custom post type. Meta almost never applies across all post types, so this behavior forces developers to use register_rest_field for REST API data modeling instead of taking advantage of the API's built-in meta handling.

there is no way to and this behavior makes it impossible for a developer to register meta that is specific to their single post type. and requires any REST API data modeling to use register_rest_field

kadamwhite / run-in-console.js
Last active Aug 1, 2017
"guess" at author mappings when importing WordPress WXR file
View run-in-console.js
[...document.getElementById('authors').querySelectorAll('li')].forEach(li => {
const author = li.querySelector('strong').innerText;
const select = li.querySelector('select');
const options = ['option')].map(node => ({
value: node.value,
name: node.text,
const match = options.reduce((match, option) => {
if (match) {
return match;
kadamwhite /
Last active Jun 15, 2017
WCEU 2017 Contributor Day REST API architecture and request API lifecycle overview

REST API Contributor Day

Plan for the day

  • Improve documentation
    • Something we explain very poorly in the REST API handbook; hoping to explain it today to de-mystify
    • Handbook is what was on -- some stuff in there is very good and some that is out of date
    • We have some guides but they are not organized
    • We want to come up with a coherent content architecture
  • Expand the endpoints presented by the API
kadamwhite /
Last active May 8, 2019
Visual Studio Code Preferences

From Joe M, "you can get your current extensions list by typing code --list-extensions in CLI" His list:

kadamwhite / tile-and-recompose.js
Last active Sep 12, 2016
Take an input image, break it into tiles, then recompose the tiles into a new image (requires "convert" from image magick)
View tile-and-recompose.js
var spawn = require( 'child_process' ).spawn;
var exec = require( 'child_process' ).exec;
var path = require( 'path' );
var fs = require( 'fs' );
* Get the list of files in a directory, either as a list of file and subdir
* names or a list of absolute file system paths
* @private
kadamwhite / movieify.js
Last active Sep 1, 2016
Take a directory of images output by and convert them to a mp4
View movieify.js
ffmpeg and libvpx with Homebrew
ffmpeg docs
"Supported A/V formats include M4a, MP4, OGG, WebM, FLV, WMV, MP3, WAV and WMA files."
View oauth-node-oauth.js
'use strict';
var opn = require( 'opn' );
var prompt = require('prompt');
var OAuth = require( 'oauth' );
var oauth = new OAuth.OAuth(
// reqURL
// accessURL
kadamwhite / GAME_MASTER_POKEMON_v0_2.tsv
Created Jul 17, 2016 — forked from anonymous/GAME_MASTER_POKEMON_v0_2.tsv
Pokemon from GAME_MASTER protobuf file v0.2 in a .tsv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 27 columns, instead of 12. in line 2.
PkMn BaseStamina BaseAttack BaseDefense Type1 Type2 BaseCaptureRate BaseFleeRate CollisionRadiusM CollisionHeightM CollisionHeadRadiusM MovementType MovementTimerS JumpTimeS AttackTimerS QuickMoves CinematicMoves AnimTime Evolution EvolutionPips PokemonClass PokedexHeightM PokedexWeightKg HeightStdDev WeightStdDev FamilyId CandyToEvolve
1 90 126 126 HoloPokemonType.POKEMON_TYPE_GRASS HoloPokemonType.POKEMON_TYPE_POISON 0.1599999964237213 0.10000000149011612 0.3815000057220459 0.6539999842643738 0.27250000834465027 HoloPokemonMovementType.POKEMON_ENC_MOVEMENT_JUMP 10.0 1.149999976158142 29.0 d601dd01 5a3b76 6d56d53fdaac2a3f6d56d53f93a9ea3f0000000036ab0a403333b33fbfbbbb3f 02 HoloPokemonClass.POKEMON_CLASS_NORMAL 1 0.699999988079071 6.900000095367432 0.08749999850988388 0.862500011920929 HoloPokemonFamilyId.V0001_FAMILY_BULBASAUR 25
2 120 156 158 HoloPokemonType.POKEMON_TYPE_GRASS HoloPokemonType.POKEMON_TYPE_POISON 0.07999999821186066 0.07000000029802322 0.3187499940395355 0.637499988079071 0.2549999952316284 H
kadamwhite / index.html
Last active Jul 12, 2016
A performance test of different method invocation techniques, and the use or non-use of arguments
View index.html
<!doctype html>
<meta charset="utf-8"/>
var seeded = false;
var lcg = (function() {
var m = 4294967296,a = 1664525,c = 1013904223,seed, z;
You can’t perform that action at this time.