Skip to content

Instantly share code, notes, and snippets.

View quis's full-sized avatar

Chris Hill-Scott quis

View GitHub Profile
<?
// Post category listing with support for exclusion
// $separator is a string, $excluded is an array of category slugs to be excluded from the list
// Sample call:
// echo the_category_exclude(" &middot; ", array("hidden", "admin"));
function get_the_category_exclude($separator, $excluded = array("")) {
foreach (
// =============================================
//
// SCALE ELEMENTS TO FIT A FIXED CONTAINER SIZE
// ---------------------------------------------
//
// By Chris Hill-Scott 2009-10
//
// Code is public domain, reuse as desired
//
// Requires jQuery
<?
/*
Plugin Name: quis.cc inline images
Plugin URI: http://quis.cc
Description: Embed an image post inside a text post
Version: 0.1
Author: Chris Hill-Scott
Author URI: http://quis.cc
License: GPL2
(function preloadImages() {
for (i in arguments) {
(new Image()).src = arguments[i];
}
}("image1.png", "image2.png"));
// Campaign Monitor jQuery plugin
// Chris @ Anywhichway 2010
//
// usage $(form).campaignMonitor(), where form is the signup form that Campaign Monitor generates
jQuery.fn.campaignMonitorSignup = function(options) {
var defaults = {
callbacks: {
success: function(){},
@quis
quis / imageProxy.php
Created March 16, 2012 10:47
Wordpress responsive image proxy
<?php
class ImageProxy {
function __construct($request) {
$this->sourceFolder = "/wp-content/uploads/";
$this->path = dirname($request);
$this->partialFileName = str_replace($this->path."/", "", $request);
@quis
quis / smootherWindowResize.js
Created March 18, 2012 11:09
jQuery-based window resizing hook with rate limiting
/*
Usage: $.windowResize(yourFunction);
Intended as a replacement for $(window).resize(yourFunction)
yourFunction will only be called once the resize action has been completed, improving performance
Code is public domain
*/
@quis
quis / map.js
Last active August 29, 2015 14:04
/*
USAGE:
<div class="onMap" style="padding-top: 80%" data-route-to=""><img src="photo.jpg" /></div>
Where data-route-to is an encoded polyline that you can get from the Google Maps XML API, e.g.
https://maps.googleapis.com/maps/api/directions/xml?origin=marrakech%20airport&destination=merzouga
(look for the data inside <overview_polyline><points>
@quis
quis / gist:efbac0338930efece675
Created September 25, 2014 10:15
Prototype Gruntfile snippet
grunt.registerTask('production', [
'copy:govuk_template',
'copy:govuk_frontend_toolkit',
'copy:assets_js',
'copy:toolkit_js',
'bower',
'convert_template',
'copy:govuk_frontend_toolkit',
'replace',
'sass',
@quis
quis / 1-route.png
Last active August 29, 2015 14:07
Morocco planning
1-route.png