Skip to content

Instantly share code, notes, and snippets.

View jamesmusgrave's full-sized avatar

James Musgrave jamesmusgrave

View GitHub Profile
html,
body,
#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
-webkit-overflow-scrolling:touch;
overflow-y: scroll;
<html>
<head>
<title>Dithering Test</title>
</head>
<body>
<canvas></canvas>
<script>
var canvas = document.getElementsByTagName("canvas")[0];
@jamesmusgrave
jamesmusgrave / cachedjson.js
Last active December 27, 2015 11:59 — forked from kpuputti/gist:1040118
Cached JSON via jQuery
var getCachedJSON = function (url) {
var deferred = new $.Deferred();
var cachedData = window.localStorage[url];
if (cachedData) {
log('Data already cached, returning from cache:', url);
deferred.resolve(JSON.parse(cachedData));
} else {
$.getJSON(url, function(data) {
log('Fetched data, saving to cache:', url);
window.localStorage[url] = JSON.stringify(data);