Skip to content

Instantly share code, notes, and snippets.

View craigrodway's full-sized avatar

Craig A Rodway craigrodway

View GitHub Profile
@craigrodway
craigrodway / gist:673871
Created November 12, 2010 08:34
Reports page with printer location (main page)
<?php
/*
Copyright (C) 2010 Craig A Rodway.
This file is part of Print Master.
Print Master is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@craigrodway
craigrodway / gist:673874
Created November 12, 2010 08:39
Reports page with printer location (view file)
<?php
if(isset($printer)){
$tpl->set('title', 'Consumable installation reports for ' . $printer->getName());
} else {
$tpl->set('title', 'Consumable installation reports');
}
$tpl->place('header');
$colour = '<span style="color:#%s;">&bull;</span>';
?>
@craigrodway
craigrodway / printmaster-logo.php
Created January 14, 2011 08:35
Adding a logo to PrintMaster - line ~73.
<?php
/*
Copyright (C) 2010 Craig A Rodway.
This file is part of Print Master.
Print Master is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@craigrodway
craigrodway / gist:792382
Created January 23, 2011 19:57
Crops an image square.
<?php
function _process_image($data){
if($data['is_image'] == TRUE){
// It's definitely an image...
// Work out essential dimensions
@craigrodway
craigrodway / function.gmaps.php
Created April 10, 2011 22:25
Updated version of the gmaps plugin for CMS Made Simple. Static map for fallback. Code cleanup.
<?php
/*
CMS - CMS Made Simple
(c)2004-2007 by Ted Kulp (ted@cmsmadesimple.org)
This project's homepage is: http://cmsmadesimple.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@craigrodway
craigrodway / gist:928940
Created April 19, 2011 17:28
CMS Made Simple user-defined tag to show latest tweets. Includes caching. Original source listed in comments.
/**
* TWITTER FEED PARSER
*
* @version 1.1.2
* @author Jonathan Nicol
* @link http://f6design.com/journal/2010/10/07/display-recent-twitter-tweets-using-php/
*
* Notes:
* We employ caching because Twitter only allows their RSS feeds to be accesssed 150
* times an hour per user client.
@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"/>
@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 / 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 / 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