Skip to content

Instantly share code, notes, and snippets.


James Musgrave jamesmusgrave

View GitHub Profile
View iOS-iFrame fix
#doc {
height: 100%; // Passes through the height of the parent iframe element
#doc {
// Magic to prevent iOS growing the iFrame to fit the content.
// This container will mimic the behavior of the iframe on a desktop browser
overflow-y: scroll;
View FloydSteinberg.html
<title>Dithering Test</title>
var canvas = document.getElementsByTagName("canvas")[0];
jamesmusgrave / cachedjson.js
Last active Dec 27, 2015 — forked from kpuputti/gist:1040118
Cached JSON via jQuery
View cachedjson.js
var getCachedJSON = function (url) {
var deferred = new $.Deferred();
var cachedData = window.localStorage[url];
if (cachedData) {
log('Data already cached, returning from cache:', url);
} else {
$.getJSON(url, function(data) {
log('Fetched data, saving to cache:', url);
window.localStorage[url] = JSON.stringify(data);