Skip to content

Instantly share code, notes, and snippets.


Ryan McCue rmccue

View GitHub Profile
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:61b683b61011b96149bb
Created Jun 11, 2014
Experiments in skipping the main WP query
View gist:61b683b61011b96149bb
add_action( 'setup_theme', function () {
global $wp;
class RM_FakeWP extends WP {
public $skip_query = false;
function main($query_args = '') {
View gist:4a0dadc68aa4e75c851f
namespace HM\Hotfix;
add_action( 'deleted_option', __NAMESPACE__ . '\\workaround_28701' );
* Workaround cache deletion issue
* Ensures that the singular
rmccue /
Created Nov 4, 2014
Commit message syntax highlighting in Vim with submodules

Ever tried committing inside a git submodule, only to find that Vim doesn't syntax highlight your commit message? Worry no more!

Simply save the following file as ~/.vim/filetype.vim

rmccue / gist:99df1e545bd8bf45c9b8
Last active Aug 29, 2015
Demo code from WC talk - Requires v2 of the REST API
View gist:99df1e545bd8bf45c9b8
* Grab latest post title by an author!
* @param array $data Options for the function.
* @return string|null Post title for the latest,
 * or null if none.
function my_awesome_func( $data ) {
$posts = get_posts( array(
View proxy
From 253278458860aadf0d25b11351357bcf90c6db7a Mon Sep 17 00:00:00 2001
From: Ryan McCue <>
Date: Tue, 29 Sep 2009 19:41:53 +1000
Subject: [PATCH] Add proxy support. Closes #19
--- | 78 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 60 insertions(+), 18 deletions(-)
diff --git a/ b/
rmccue / gist:248095
Created Dec 3, 2009
A quick demo of how to get comments for a Blogger post with SimplePie.
View gist:248095
$sp = new SimplePie('', './cache');
foreach($sp->get_items() as $item) {
echo '<h2>' . $item->get_title() . '</h2>';
$link = $item->get_link(0, 'replies');
if($link) {
$comments = new SimplePie($link);
foreach($comments->get_posts() as $comment) {
echo 'Comment: ' . $comment->get_content();
rmccue / gist:250682
Created Dec 7, 2009
Normalise SimplePie items to put into a database
View gist:250682
$feed = new SimplePie('');
foreach($feed->get_items() as $item) {
$new_item = (object) array(
'hash' => $item->get_id(true),
'timestamp' => $item->get_date('U'),
'title' => $item->get_title(),
'content' => $item->get_content(),
rmccue / gist:250195
Created Dec 6, 2009
Read SimplePie cache without opening SimplePie
View gist:250195
$cache = SimplePie_Cache::create($cache_location, md5($url), 'spc');
// Load data
$data = $cache->load(); // returns instance of SimplePie
// Get timestamp
$time = $cache->mtime(); // returns integer
rmccue / blackout.php
Created Dec 21, 2009
A plugin for the Great Australian Internet Blackout
View blackout.php
Plugin Name: Blackout your Blog
Description: From Monday, January 25th to Friday, January 29th, Aussie websites will turn their lights out — "black out" — to inform Australians about the threat of imposed Internet censorship. Pledge your support, and install this plugin!
Version: 1.0
Author: Ryan McCue
function blackout_js() {