Skip to content

Instantly share code, notes, and snippets.

View craigrodway's full-sized avatar

Craig A Rodway craigrodway

View GitHub Profile
@craigrodway
craigrodway / cols_periods.php
Created May 27, 2019 11:33
classroombookings: 24hr time format
<!-- application/views/bookings/table/cols_periods.php -->
<td align="center" width="<?php echo $width ?>">
<strong><?php echo html_escape($name) ?></strong><br />
<span style="font-size:90%">
<?php echo date('H:i', strtotime($time_start)).'-'.date('H:i', strtotime($time_end)) ?>
</span>
</td>
@craigrodway
craigrodway / Bookings.php
Last active March 21, 2019 22:40
classroombookings duplicate fix
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Bookings extends MY_Controller
{
public function __construct()
{
parent::__construct();
@craigrodway
craigrodway / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@craigrodway
craigrodway / Gravatar.module
Last active February 22, 2017 15:38
ProcessWire gravatar
<?php
/**
* Basic shell of a module for generating Gravatar URLs for ProcessWire users.
*
* Mostly based on official implementation guidance here:
* https://en.gravatar.com/site/implement/images/php/
*
*
* Use it like this:
#!/bin/bash
#
# ProcessWire upgrade script
#
# Upgrades ProcessWire ./wire directory.
# Use either master of dev branch.
#
#
@craigrodway
craigrodway / FieldtypeForms.module
Created November 17, 2013 17:11
Very simple Fieldtype that lists FormBuilder forms in a select box on editing pages.
<?php
/**
* ProcessWire Form Fieldtype.
* Stores reference to a single FormBuilder Form to allow easy selection on pages.
*
* ProcessWire 2.x
* Copyright (C) 2012 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@craigrodway
craigrodway / jsq.js
Created November 25, 2011 14:07
Javascript function queue
/**
* In the <head>
*/
var jsq = (function(){
var q = []; // internal queue of functions that are added
var fs = {}; // public exportable functions
// Add a function to the queue
@craigrodway
craigrodway / collection.php
Created November 14, 2011 11:57
GoCart 'Local collection' shipping method
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class collection
{
var $CI;
function __construct()
{
$this->CI =& get_instance();
$this->CI->load->model('Settings_model');
@craigrodway
craigrodway / cbtristate.js
Created October 1, 2011 23:33
jQuery tristate checkbox plugin
$.fn.cbtristate = function(settings) {
var config = {
yes: { img: "img/ico/check-yes.png", val: "1" },
no: { img: "img/ico/check-no.png", val: "0" },
empty: { img: "img/ico/check-empty.png", val: "" }
};
if (settings) $.extend(config, settings);
@craigrodway
craigrodway / gist:1141732
Created August 12, 2011 08:56
Javascript loading
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<base href="http://spennymoortownband.org/" />
<title>Spennymoor Town Band - Latest News | Spennymoor Town Band | Spennymoor in County Durham, North East England</title>
<link rel="stylesheet" type="text/css" href="http://spennymoortownband.org/tmp/cache/stylesheet_50_1303132365.css" media="projection,screen"/>
<link rel="stylesheet" type="text/css" href="http://spennymoortownband.org/tmp/cache/stylesheet_51_1309989026.css" media="projection,screen"/>