Skip to content

Instantly share code, notes, and snippets.


Ryan McCue rmccue

View GitHub Profile
View gist:722769379f4fc4148b1f

Integrating WP API into Core

Plan for integrating WP API into core

This document describes the process of integrating the WordPress JSON REST API ("API project") into the WordPress core codebase ("core").


Accessing data remotely is a common goal for many WordPress users and developers. The ability to access and update data remotely is used by desktop publishing software, mobile applications, and in-browser applications. These

View gist:daf72eaffe984f988a0a

Commit Guidelines

Commit messages are one of the most important parts of using version control. Badly written messages make it much harder to see at a glance what's changed in the project.

Commit Content

Keep your commits as small and atomic as possible. The best way to consider this is to think about reverting your commit. That is, if something is wrong in a commit, what are the logically separate parts that could be undone?

rmccue / gist:ec6a7d79349ea7e9b206
Last active Mar 28, 2017
WordPress test server - front controller for testing WP. *****NEVER USE THIS ON PRODUCTION******
View gist:ec6a7d79349ea7e9b206
* WordPress Test Server
* This serves up a full WordPress site via the PHP test server (`php -S`), and
* is intended purely for serving WP for UI testing. Please do not ever use this
* in production.
// Path to WP install
View gist:8156953
class YourAwesomeAuthenticationTokenHandler {
protected $correct_null_user = false;
public function __construct() {
add_filter( 'auth_cookie_malformed', array( $this, 'check_authentication_token' ) );
add_filter( 'set_current_user', array( $this, 'correct_null_user' ) );
rmccue / gist:7280217
Created Nov 2, 2013
Using custom QItemView item widgets with Qt 5
View gist:7280217
class SidebarItemsDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, parent=None):
super(SidebarItemsDelegate, self).__init__(parent)
self.items = {}
def itemForIndex(self, index):
widget = self.items[index.row()]
except KeyError:
View buttons.css
/* ----------------------------------------------------------------------------
Last merged revision: 22948
WordPress-style Buttons
Create a button by adding the `.button` class to an element. For backwards
compatibility, we support several other classes (such as `.button-secondary`),
but these will *not* work with the stackable classes described below.
View _utilities.scss
@mixin background-gradient($start-color, $end-color) {
background: $start-color;
@include background-image(linear-gradient(top, $start-color 0%, $end-color 100%));
@include ie-filter($start-color, $end-color);
@mixin ie-filter($start-color, $end-color) {
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{$start-color}', endColorstr='#{$end-color}', GradientType=0 );
rmccue / gist:5850339
Created Jun 24, 2013
View gist:5850339
body {
margin-top: 51px;
#beta-warning {
padding: 15px 0;
text-align: center;
rmccue / gist:5843903
Created Jun 23, 2013
My public key for SSH and such
View gist:5843903
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAjfsIKHbsuoDWNVyMTMUacQP/TsHnfnAhm0KNjYm07tJEjfzkddSIvm1tZR7qWcwSoCQzqDUb44P7OOYzYKmUDem0ewTXlHj7B1am8MIflPMXRDn87AwRUpmRFF4xKXTwGdPMgdeEuF9B8pbMstCJ5lfQ/dbeO1DyI3qb/V8TddM=
rmccue / gist:5745916
Created Jun 10, 2013
Example of state management via Puppet for WooCommerce
View gist:5745916
class Tyuratam_CLI_WooCommerce extends WP_CLI_Command {
* Installs the default WooCommerce pages
public function install_pages() {
if ( ! get_option( 'skip_install_woocommerce_pages', 0 ) ) {
require_once( $GLOBALS['woocommerce']->plugin_path() . '/admin/woocommerce-admin-install.php' );
update_option('skip_install_woocommerce_pages', 1);