Skip to content

Instantly share code, notes, and snippets.

@thomaspuppe
thomaspuppe / gist:4000626
Created November 2, 2012 11:49
Track Navigation Timing data from the Browser in Google Analytics
var NAMESPACE = NAMESPACE || {};
NAMESPACE.gaSpeedTrackingJsLoadStart = (new Date()).getTime();
/* All JS ... */
/* Encapsulate "use strict" to this part of the code, while others can still be unstrict. */
(function () {
"use strict";
/* Track JS Parsing time (start was set at the Beginning of the JS) */
@thomaspuppe
thomaspuppe / gist:3163220
Created July 23, 2012 11:48 — forked from madrobby/gist:3161015
detect retina support
function isRetina(){
return (('devicePixelRatio' in window && devicePixelRatio > 1) ||
('matchMedia' in window && matchMedia("(-moz-device-pixel-ratio:1.0)").matches))
}