Skip to content

Instantly share code, notes, and snippets.


Nick Williams nilliams

  • Leicestershire, UK
View GitHub Profile
nilliams / particles.c
Last active Dec 29, 2015
Simple particles example using the OpenVG Testbed
View particles.c
// particles.c - Simple particles example using the OpenVG Testbed
// Installing & Running:
// 1. Download the OpenVG Testbed (
// $ git clone
// $ cd openvg/client
// 2. Place a copy of this file (particles.c) in that directory
// 3. Add the following to the Makefile:
nilliams / onClick.js
Last active Dec 27, 2015
A relatively sane onClick helper (Webkit only), for e.g. Node-Webkit work. Add additional prefixed versions of `matchesSelector` for further browser compat.
View onClick.js
function onClick(selector, fn) {
document.addEventListener('click', function(e) {
if ( _matchesSelector(, selector) ) fn(e);
}, false);
function _matchesSelector(el, selector) {
var doc = document.documentElement;
var fn = doc.matchesSelector || doc.webkitMatchesSelector;
nilliams / node-openvg-particles.js
Created Oct 29, 2013
Simple particles example on the Raspberry Pi using node-openvg-canvas. Original demo code from
View node-openvg-particles.js
// Original Source
// Modified to work with `node-openvg-canvas` on the Raspberry Pi
// - use RequestAnimationFrame instead of setInterval
// - correct the number of arguments in call to `ctx.arc()`
// Usage:
// - install Node.JS
// (refer to Installing Node section here:
nilliams /
Last active Jan 24, 2020
Add client-side syntax highlighting to static sites (such as Jekyll w/ Pygments disabled), with Google-Code-Prettify.

Note: One alternative is to use this Prism.js Jekyll Plugin, the advantage of using google-code-prettify is that it can be used with standard markdown (indented code blocks) rather than using liquid tags like {% prism %}. Prettify will guess which language your code blocks contain and highlight appropriately.

Grab the google-code-prettify sources and include them in the <head> of your page template, for Jekyll you will want to edit layouts/default.html (tailor paths to directory structure):

<link rel="stylesheet" href="/css/google-code-prettify/prettify.css">
<script src="/js/google-code-prettify/prettify.js"></script>

This JS snippet adds the prettyprint class to <pre> tags and runs prettify: