Skip to content

Instantly share code, notes, and snippets.

View rmccue's full-sized avatar

Ryan McCue rmccue

View GitHub Profile
<a href="blackbox://🔒">lock</a>
<a href="blackbox://🔓">unlock</a>
<a href="blackbox://🔐">key</a>
<?php
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' ) );
}

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").

Motivation

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

@rmccue
rmccue / gist:ec6a7d79349ea7e9b206
Last active March 28, 2017 21:22
WordPress test server - front controller for testing WP. *****NEVER USE THIS ON PRODUCTION******
<?php
/**
* 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
@rmccue
rmccue / gist:7280217
Created November 2, 2013 15:42
Using custom QItemView item widgets with Qt 5
class SidebarItemsDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, parent=None):
super(SidebarItemsDelegate, self).__init__(parent)
self.items = {}
def itemForIndex(self, index):
try:
widget = self.items[index.row()]
except KeyError:
/* ----------------------------------------------------------------------------
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.
@rmccue
rmccue / _utilities.scss
Created August 5, 2013 05:01
Conversion of parts of MP6 to SCSS for http://core.trac.wordpress.org/ticket/22862
@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
rmccue / gist:5850339
Created June 24, 2013 14:12
New PHP.net CSS
body {
margin-top: 51px;
}
#beta-warning {
padding: 15px 0;
text-align: center;
}
@rmccue
rmccue / gist:5843903
Created June 23, 2013 05:30
My public key for SSH and such
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAjfsIKHbsuoDWNVyMTMUacQP/TsHnfnAhm0KNjYm07tJEjfzkddSIvm1tZR7qWcwSoCQzqDUb44P7OOYzYKmUDem0ewTXlHj7B1am8MIflPMXRDn87AwRUpmRFF4xKXTwGdPMgdeEuF9B8pbMstCJ5lfQ/dbeO1DyI3qb/V8TddM= me+2013@ryanmccue.info
@rmccue
rmccue / gist:5745916
Created June 10, 2013 00:54
Example of state management via Puppet for WooCommerce
<?php
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' );
woocommerce_create_pages();
update_option('skip_install_woocommerce_pages', 1);