Skip to content

Instantly share code, notes, and snippets.

Julian Shapiro julianshapiro

Block or report user

Report or block julianshapiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@julianshapiro
julianshapiro / IE.js
Last active Aug 2, 2017
Future-Proof IE Version Detection Without User Agent Sniffing
View IE.js
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@julianshapiro
julianshapiro / RAF.js
Last active Apr 19, 2017
requestAnimationFrame Polyfill
View RAF.js
var requestAnimationFrame = window.requestAnimationFrame || (function() {
var timeLast = 0;
return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
var timeCurrent = (new Date()).getTime(),
timeDelta;
/* Dynamically set the delay on a per-tick basis to more closely match 60fps. */
/* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671. */
timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
You can’t perform that action at this time.