Skip to content

Instantly share code, notes, and snippets.

View rmccue's full-sized avatar

Ryan McCue rmccue

View GitHub Profile

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
rmccue / gist:61b683b61011b96149bb
Created June 11, 2014 07:52
Experiments in skipping the main WP query
<?php
add_action( 'setup_theme', function () {
global $wp;
class RM_FakeWP extends WP {
public $skip_query = false;
function main($query_args = '') {
$this->init();
<?php
namespace HM\Hotfix;
add_action( 'deleted_option', __NAMESPACE__ . '\\workaround_28701' );
/**
* Workaround cache deletion issue
*
* Ensures that the singular
@rmccue
rmccue / README.md
Created November 4, 2014 05:55
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
rmccue / gist:99df1e545bd8bf45c9b8
Last active August 29, 2015 14:22
Demo code from WC talk - Requires v2 of the REST API
<?php
/**
* 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(
@rmccue
rmccue / proxy
Created September 30, 2009 07:36
From 253278458860aadf0d25b11351357bcf90c6db7a Mon Sep 17 00:00:00 2001
From: Ryan McCue <me+gist197903@ryanmccue.info>
Date: Tue, 29 Sep 2009 19:41:53 +1000
Subject: [PATCH] Add proxy support. Closes #19
---
simplepie.inc | 78 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 60 insertions(+), 18 deletions(-)
diff --git a/simplepie.inc b/simplepie.inc
@rmccue
rmccue / gist:248095
Created December 3, 2009 11:59
A quick demo of how to get comments for a Blogger post with SimplePie.
<?php
$sp = new SimplePie('http://example.com', './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
rmccue / gist:250195
Created December 6, 2009 12:16
Read SimplePie cache without opening SimplePie
<?php
require('simplepie.inc');
$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
rmccue / blackout.php
Created December 21, 2009 16:19
A plugin for the Great Australian Internet 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() {
?>
@rmccue
rmccue / webapp.ini
Created December 24, 2009 09:52
Code to make Hahlo work properly in a Prism app
[Parameters]
id=hahlo@prism.app
name=Hahlo
uri=http://hahlo.com/
icon=webapp
status=false
location=false
sidebar=false
navigation=false
trayicon=false