Skip to content

Instantly share code, notes, and snippets.

View andy-williams's full-sized avatar

Andrew Williams andy-williams

View GitHub Profile
@andy-williams
andy-williams / prettifyRun.js
Created March 24, 2014 17:44
add prettyprint class dynamically - to be used in conjunction with https://code.google.com/p/google-code-prettify/
;(function() {
var pres = document.getElementsByTagName("pre");
for(var i=0; i < pres.length; i++) {
if(pres[i].getElementsByTagName('code').length > 0)
{
pres[i].className += "prettyprint";
}
}
@andy-williams
andy-williams / fadeLink.js
Created March 18, 2014 00:19
Slow colour fade on hover - Requires modernizr and jquery.color https://github.com/jquery/jquery-color
@andy-williams
andy-williams / gist:9589990
Last active August 29, 2015 13:57
Poet - get post page
poet.helpers.getPostPage = function(title) {
var postsPerPage = poet.options.postsPerPage;
var pageCount = poet.helpers.getPageCount();
for(var i=1; i < pageCount; i++) {
var from = (i-1) * postsPerPage;
var to = from + postsPerPage;
var posts = poet.helpers.getPosts(from, to);
if(title in posts) {
return i;
}
@andy-williams
andy-williams / build.xml
Created March 10, 2014 11:23
Example phing build.xml - seems to be more or less the same as Ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="ProjectName" default="dist">
<property name="builddir" value="./build" />
<!-- ============================================ -->
<!-- Target: prepare -->
<!-- ============================================ -->
<target name="prepare">
<echo msg="Making directory ${builddir}" />