Skip to content

Instantly share code, notes, and snippets.

@stephenharris
stephenharris / description.md
Last active August 29, 2015 14:03
Automated generation of 'colour schemed' stylesheets from less files.

Description of problem

You have a directory (colour-scheme/) containing .less (each defining a different colour scheme). For each of those files (call it scheme-x.less), compile it with the "core" .less file(s) (stored elsewhere) to create style-x.css.

Preferably, by adding a .less file to colour-scheme/ directory and running a grunt task, the appropriate style-?.css should be created. That is, no editing of Gruntfile.js is required.

Directory layout is below.

@stephenharris
stephenharris / date-venue-group.php
Last active August 29, 2015 14:05
An untested proof of concept solution to grouping events by day and ordering them by venue (upstairs & downstairs )
<?php
/**
* An untested proof of concept solution to grouping events by day and ordering them by venue
* (upstairs & downstairs )
* @see http://wp-event-organiser.com/forums/topic/returning-2-events-for-a-single-date-based-on-venue/
* @todo Change first three lines as appropriate
*/
$upstairs_id = 1; //Set to venue ID of upstairs venue
$downstairs_id = 2; //Set to venue ID of downstairs venue
@stephenharris
stephenharris / eo-custom-admin-columns.php
Last active August 29, 2015 14:05
A snippet which adds a custom column, and removes an existing column from the Events admin table
<?php
/**
* A snippet which adds a custom column, and removes an existing column from the Events admin table
*
* Specifically, this snippet removes the existing 'Reoccurrence' column and replaces it with another column.
* This new column does exactly the same thing, but you can change it's behaviour as desired.
*
* @see http://wp-event-organiser.com/forums/topic/better-reoccurrence-display-in-admin-panel/
*/
@stephenharris
stephenharris / insert-columns-in-order.php
Last active August 29, 2015 14:05
Insert columns in a WordPress admin table in specific order (example).
<?php
function set_custom_CPT_columns( $columns ) {
//Insert 'Until' before 'date'
$index = array_search( "date", array_keys( $columns ) );
if( $index !== false ){
$before = array_slice( $columns, 0, $index );
$after = array_splice( $columns, $index, count( $columns ) );
@stephenharris
stephenharris / attach-ical-to-booking-confirmation.php
Last active August 29, 2015 14:05
Attach an iCal 'invite' to booking confirmation. Please note this snippet is for when you are selling tickets by **series** or you only have non-recurring events.
<?php
/**
* Please note this snippet is for when you are selling tickets by **series** or you only have non-recurring events.
* This is because the attached iCal file will detail all dates of the event booked for.
*
* If you are selling tickets by date, then you should change the get_ical() method so that it returns an iCal feed, which details
* only the event (date) that has been booked
*
*
@stephenharris
stephenharris / event-organiser-calendar-event-booked.php
Last active August 29, 2015 14:09
This plug-in marks events which are fully booked as red in the fullCalendar and removes the link to the event.
<?php
/*
* Plugin Name: Event Organiser Calendar Booked Event Highlight
* Version: 1.0
* License: GNU General Public License, v2 (or newer)
* License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
/**
* This plug-in marks events which are fully booked as red in the fullCalendar
@stephenharris
stephenharris / eu-vat-rates.json
Last active August 29, 2015 14:11
Current VAT rates
{
"hash": "22d93225dbac78bd5f9634a39782c71d9a45b746a77a68eee2415f1a7b7f7fe2",
"version": "1.3.1",
"last_updated": "05\/02\/2014",
"rates": {
"AT": {
"id": "AT",
"name": "Austria",
"national": {
"standard": {
@stephenharris
stephenharris / git-branchdes
Last active August 29, 2015 14:11
Creates a Git command to list all branches and their descriptions.
#!/bin/bash
# Adapted from https://github.com/bahmutov/git-branches/
# License: MIT
# Place in executable path. Name the file git-branchdes
# Execute with the command git branchdes
# @see https://gist.github.com/stephenharris/611fabdb584745e6ad9b
# Store an array of merged branches
readarray -t merged <<< "$(git branch --merged)"
@stephenharris
stephenharris / shortcode-event-list.php
Created December 23, 2014 15:06
An edited shortcode event list template, grouping events by date
<?php
/**
* Add this to your theme for it to take affect.
*/
global $eo_event_loop,$eo_event_loop_args;
//Date % Time format for events
$date_format = get_option('date_format');
$time_format = get_option('time_format');
@stephenharris
stephenharris / event-organiser-ical-feed-workaround.php
Created January 6, 2015 13:55
Implements a work around for feeds wth invalid DTSTART/DTEND properties.
<?php
/*
* Plugin Name: Event Organiser iCal feed work around
* Version: 1.0
* License: GNU General Public License, v2 (or newer)
* License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Description: Implements a work around for feeds with invalid DTSTART/DTEND properties.
*/
/**