Skip to content

Instantly share code, notes, and snippets.

View benqy's full-sized avatar
💭
(1)

刺蛇狗毒爆 benqy

💭
(1)
View GitHub Profile
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>console track</title>
</head>
<body>
console status: <span id="stat"></span>
<script>
function isConsoleOpen() {
@benqy
benqy / IE.js
Created October 19, 2015 03:56 — forked from julianshapiro/IE.js
Future-Proof IE Version Detection Without User Agent Sniffing
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) {
@benqy
benqy / RAF.js
Created October 19, 2015 06:46 — forked from julianshapiro/RAF.js
requestAnimationFrame Polyfill
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));