Skip to content

Instantly share code, notes, and snippets.

View leewillis77's full-sized avatar

Lee Willis leewillis77

View GitHub Profile
@leewillis77
leewillis77 / gist:18a04eef8f6305711ca4
Last active August 29, 2015 14:08
Hook/Filter arg best practice
<?php
// Consider the following hook
do_action( 'my_swanky_hook', $a, $b, $c );
/*
* I would traditionally attach as follows:
*/
function my_swanky_hook_handler( $a, $b, $c ) {
@leewillis77
leewillis77 / ansi-colors.css
Created April 23, 2015 15:23
Replacement build log stylesheet for PHPCI
.ansi_color_fg_black { color: black }
.ansi_color_bg_black { background-color: black }
.ansi_color_fg_red { color: orangered; font-weight: bold }
.ansi_color_bg_red { background-color: red }
.ansi_color_fg_green { color: lawngreen; }
.ansi_color_bg_green { background-color: green }
.ansi_color_fg_yellow { color: yellow; }
.ansi_color_bg_yellow { background-color: yellow }
.ansi_color_fg_blue { color: blue; }
.ansi_color_bg_blue { background-color: blue }
$ git diff
diff --git a/jigoshop.php b/jigoshop.php
index 9874228..5d04ff9 100644
--- a/jigoshop.php
+++ b/jigoshop.php
@@ -631,7 +631,7 @@ function jigoshop_price( $price, $args = array() ) {
$return = $currency_symbol . $price . $currency_code;
break;
case 'symbol_code_space' :
- $return = $currency_code . ' ' . $price . ' ' . $currency_code;
@leewillis77
leewillis77 / drush-6.x-2.x.patch
Created February 24, 2012 17:07
Allow per-project working-file checkouts in drush makefiles (6.x-2.x)
diff --git a/drush_make.download.inc b/drush_make.download.inc
index 92c68f9..106269f 100644
--- a/drush_make.download.inc
+++ b/drush_make.download.inc
@@ -12,7 +12,12 @@ function drush_make_download_factory($name, $download, $download_location) {
function drush_make_download_cvs($name, $download, $download_location) {
if (!empty($download['module'])) {
- if (drush_get_option('working-copy')) {
+ if ( isset ( $download['working-copy'] ) ) {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Pie Examples</title>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="flot/jquery.flot.pie.js"></script>
<?php $percentage = rand(1,100); ?>
@leewillis77
leewillis77 / sp.diff
Created June 25, 2012 19:02
Patch to resolve image swap issues with SP themes and Simple Product Options plugin
--- old/theme.js 2012-06-25 20:00:45.389783955 +0100
+++ new/theme.js 2012-06-25 19:59:43.805786530 +0100
@@ -667,7 +667,7 @@
var i = 0; //counter
// loops through all selections and check if all has been selected to proceed (also captures all variation ids)
- jQuery("select", parent_form).each(function() {
+ jQuery("select.wpsc_select_variation_ajax", parent_form).each(function() {
if (jQuery("option:selected",this).val() == 0) {
allSelected = false;
@leewillis77
leewillis77 / filelistingwpsymlink.txt
Created July 19, 2012 19:00
File listing demonstrating problems with WP and symlinks - http://core.trac.wordpress.org/ticket/16953
@leewillis77
leewillis77 / patches.txt
Created July 23, 2012 21:21
Changes to WFX theme framework
--- wf-display-functions.php.orig 2012-07-23 22:13:49.026990879 +0100
+++ wf-display-functions.php 2012-07-23 22:17:44.358981036 +0100
@@ -1848,20 +1848,22 @@
// Backpat - depreciated function get_current_theme() in WordPress 3.4
$theme_name = preg_replace('/[^a-zA-Z0-9]/','_', ( WF_WORDPRESS_VERSION < 3.4 ) ? get_current_theme() : wp_get_theme()->Name);
+ /* Risk of the transient key ooverflowing the allowed size - WordPress has a bug where key's > 32 chars
+ * will appear to have been set, but won't be retrievable */
$transient_key = empty($transient_key) ? $theme_name.'_cache_'.$part : $transient_key;
@leewillis77
leewillis77 / Wonderfluxperformance.patch
Created July 25, 2012 20:47
Wonderflux performance patch
--- wf-display-functions.php.orig 2012-07-25 21:43:07.050252166 +0100
+++ wf-display-functions.php 2012-07-25 21:47:03.102242294 +0100
@@ -8,12 +8,26 @@
class wflux_display_code extends wflux_data {
protected $xml_namespaces;
+ private $cache_theme_name = null;
function __construct() {
parent::__construct();
Mixed indentation examples:
foreach ( $foo as $bar ) {
$foo = array ( "this" => "that",
"them" => "three" );
$sql = "SELECT *
FROM foo
WHERE y = z";