Skip to content

Instantly share code, notes, and snippets.

View sta1r's full-sized avatar

Alastair Mucklow sta1r

  • Dotdigital
  • Winchester
View GitHub Profile
@sta1r
sta1r / caman-hover
Created November 5, 2013 15:44
Caman hover states
var imgArray = $('.projects-cluster img');
var size = imgArray.length;
var canvasArray = [];
// loop through images, render them to canvas on document ready (user won't notice)
imgArray.each( function(index, value) {
Caman(this, function () {
this.render( function() {
// once all images are rendered to canvas, fire the doCaman() function
if (index == size - 1) {
// Showtime JSON loader
if ($('.showtime-json').length){
// with a lightbox use-case, Magnific is a dependency. The .lightbox call further down shouldn't fire, since the Showtime lightbox only functions inside the getJSON.
jQuery.getScript('http://d27lwoqz7s24cy.cloudfront.net/assets/js/magnific-lightbox.js', function() {
var outputNode = $('.showtime-json');
jQuery.each(outputNode, function(i) {
/*
University of the Arts London
Universal print stylesheet
Author: Alastair Mucklow
Date: May 2008
Thanks to 24ways.org for print styling techniques: http://24ways.org/2007/back-to-the-future-of-print
*/
/* Reset to pt styles for print and increase line-height */
@sta1r
sta1r / eventtrack.js
Last active April 3, 2017 09:32
Add click event tracking to RoyalSlider
$(document).ready(function() {
$('.rsArrowRight').click(function () {
_gaq.push(['_trackEvent', 'RoyalSlider', 'Slider Arrow Right Click', 'Component ID: ' + $(this).closest('.slider-container').attr('id')]);
});
$('.rsArrowLeft').click(function () {
_gaq.push(['_trackEvent', 'RoyalSlider', 'Slider Arrow Left Click', 'Component ID: ' + $(this).closest('.slider-container').attr('id')]);
});
// <t4 type="navigation" id="49"/> = 'Current Section Name'
// if we could do this inline, you can substitute the content name from T4
@sta1r
sta1r / gist:9618817
Created March 18, 2014 12:08
UCAS event tracking code
You can apply online through the <a href="http://www.ucas.com/" onClick="_gaq.push(['_trackEvent', 'UCAS', 'Exit to ucas.com', 'UCAS link clicked',, false]);">Universities and Colleges Admissions Service</a> (UCAS).
@sta1r
sta1r / index.html
Created April 3, 2014 19:34
Ryu demo (not my own), optimised
<div id="my-div"></div>
@sta1r
sta1r / Custom WP page menu
Created April 4, 2014 11:13
Wordpress page menu that shows all top-level pages, and child pages when EITHER the current page has children, OR the current child page has siblings.
<?php
$all_pages = get_pages();
foreach ($all_pages as $page) {
if (!$page->post_parent) {
$incl .= $page->ID . ",";
} elseif ($page->post_parent == $post->ID ||
$page->post_parent == $post->post_parent) {
$incl .= $page->ID . ",";
} else {
@sta1r
sta1r / gist:10656526
Last active August 29, 2015 13:59
Panel open (light gray bg)
</div>
</div>
</div>
<div class="panel bg-gray-bg">
<div class="content-wrapper">
<div class="row">
<div class="content">
@sta1r
sta1r / Short course XML schema from Access PlanIT
Last active August 29, 2015 14:01
Courses XML schema for search
<?xml version="1.0" encoding="UTF-8"?>
<courses>
<course>
<tutor3id/>
<caf>903</caf>
<whoshouldattend/>
<subjectchildren2nd>Fashion Styling</subjectchildren2nd>
<dayofweek>Friday to Tuesday</dayofweek>
<sitemanagerpageurl>http://www.arts.ac.uk/fashion/courses/short-courses/browse-short-courses/middle-east/principles-of-fashion-styling-1/</sitemanagerpageurl>
<subjectchildren3rd/>
@sta1r
sta1r / UAL default form
Last active August 29, 2015 14:04
UAL default form
<form id="form" name="form" class="l-forms margin-top with-box-shadow">
<label>Label example</label>
<input type="text" name="default" id="default" />
<fieldset>
<label>Select box:</label>
<div class="js-select-box select-box">
<input type="hidden" value="option one" class="js-select-box-value">
<div class="select-box-heading">
<h3 class="select-box-title">Option one</h3>