Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / functions.php
Created September 5, 2016 21:05
Translate specific WP string.
<?php
// Untested, but should give you an idea.
add_filter( 'gettext', 'claire_rename_color_to_colour' );
/**
* Rename the exact WP string "Color" to "Colour".
*
* Doesn't affect non-exact strings.
*
@GaryJones
GaryJones / gist:0466df3bb9ca7a4d795c174d148a9059
Created August 20, 2016 17:17
en_GB for Title Capitalization plugin
#, fuzzy
msgid ""
msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Title Capitalization For WordPress\n"
"POT-Creation-Date: 2016-08-20 09:39-0700\n"
"PO-Revision-Date: 2016-08-20 18:30+0100\n"
"Last-Translator: Gary Jones\n"
"Language-Team: British English\n"
"MIME-Version: 1.0\n"
@GaryJones
GaryJones / xml-bom.php
Created August 18, 2016 14:11
WASDE XML BOM checker
<?php
/*
* = Instructions =
* Save locally as xml-bom.php
* Then in terminal, `cd` to the correct folder, and run:
* php xml-bom.php
*/
$xml = file_get_contents('http://www.usda.gov/oce/commodity/wasde/latest.xml');
define('BOM', "\xEF\xBB\xBF");
@GaryJones
GaryJones / PluginTest.php
Last active August 2, 2016 18:12
Test that plugin called `load_plugin_textdomain()` correctly.
<?php
namespace GAA\CorpManager;
use WP_UnitTestCase;
class PluginTest extends WP_UnitTestCase {
private $domain;
private $mofile;
@GaryJones
GaryJones / phpbrew-notes.md
Last active September 28, 2018 14:13
phpbrew - my config

These are my instructions for compiling a new version of PHP via Phpbrew on Mac High Sierra, with the latest versions of cURL and OpenSSL that Composer seems to need.

Homebrew config

/usr/local/bin must come before /usr/bin in the PATH when using Homebrew.

export PATH=/usr/local/bin:$PATH
@GaryJones
GaryJones / gist:daaa55c4c4b380ecfb70
Created January 22, 2016 10:08 — forked from srikat/gist:8350989
Conditional code for different days of a week
<?php
$dates = array("Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
@GaryJones
GaryJones / style.css
Created August 5, 2015 12:34
Klingon font (pIqad)
@font-face {
font-family:pIqad;
src:url('data:font/eot;base64,piAAAOAfAAABAAIAAAAAAAIABgMAAAAAAAABAPQBAAAAAExQAQAAAAAAABAAAAAAAAAAAAEAAAAAAAAAJJpHDQAAAAAAAAAAAAAAAAAAAAAAAAoAcABJAHEAYQBEAAAADABNAGUAZABpAHUAbQAAADQAVgBlAHIAcwBpAG8AbgAgADAAMAAxAC4AMAAwADAAIABCAHUAaQBsAGQAIAAxADAAMQAgAAAAGABwAEkAcQBhAEQAIABNAGUAZABpAHUAbQAAAAAAAAEAAAAOAIAAAwBgR0RFRgD5AMoAABeEAAAAWkdQT1NuacfnAAAX4AAAB95HU1VCbJF0jwAAH8AAAAAgT1MvMmv6eAMAAAFoAAAAVmNtYXDq+gR+AAACZAAAAWpnYXNw//8AAwAAF3wAAAAIZ2x5Zmml+jsAAAQkAAAO6GhlYWT1EmRrAAAA7AAAADZoaGVhFA4HiwAAASQAAAAkaG10eP5hBTgAAAHAAAAAomxvY2FKjU36AAAD0AAAAFRtYXhwAD0AbwAAAUgAAAAgbmFtZaBegQ4AABMMAAAC3XBvc3SeSYZwAAAV7AAAAY8AAQAAAAEAAA1HmiRfDzz1AAsIAAAAAAC/4MTYAAAAAM26Vur/mP17CMAGMQAAAAgAAgAAAAAAAAABAAAF1/3bBdwJof+Y/+YIwAABAAAAAAAAAAAAAAAAAAAAKAABAAAAKQA+AAIAAAAAAAIAEAAvAAEAAAAAAAAAAAAAAAEGbgH0AAUAAAXcBkAAAAPWBdwGQAAAAAAAZgISAAACAAYDAAAAAAAAAAAAARAAAAAAAAAAAAAAAFBmRWQAAAAA+P4HCP8IBdwHAwNRAAAAAQAAAAAAAAAAAAAE5QEAAqoAAAfQ/8wH/wAICHT/1QeOAC4F7AABB+//8gUVAEUGjABhB8UAOwa9//MFtgA+BzIAFwfj/6EGvwAABTwAfQP6
<?php
namespace GMJ\Foobar;
class Config extends \ArrayObject {}
@GaryJones
GaryJones / edd_mu_updater.php
Created July 10, 2015 11:03
EDD-VAT MU updater file
<?php
/**
*
* Version: 1.0.7
*
* This must-use plugin implements three things:
*
* 1) A class that will be used indirectly by a host plugin to
* check to see if this plugin already exists and, if not,
* will copy this file to the mu-plugins folder.
@GaryJones
GaryJones / functions.php
Created May 30, 2015 08:51
bookmarks.gj theme
<?php
/** Start the engine **/
require_once( TEMPLATEPATH . '/lib/init.php' );
require_once( CHILD_DIR . '/tag_list_widget.php' );
require_once( CHILD_DIR . '/tag_chain_widget.php' );
require_once( CHILD_DIR . '/tag_filter_widget.php' );
/** Add support for custom background **/
add_theme_support( 'custom-background' );