Skip to content

Instantly share code, notes, and snippets.

🙌
Happy working!

lenville lenville

🙌
Happy working!
Block or report user

Report or block lenville

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
@lenville
lenville / rAF.js
Last active Aug 5, 2016 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
View rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@lenville
lenville / gist:4e3acccfbf629f9735ae
Last active Dec 25, 2015
Javascript Send Request
View gist:4e3acccfbf629f9735ae
function sendXMLHTTPRequest (successCallback, errorCallback) {
var request = new XMLHttpRequest(),
url = "",
type;
request.open("GET", url);
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status === 200) {
successCallback(request.responseText); // 不判断格式直接回调
} else {
errorCallback("error"); // 出错回调
You can’t perform that action at this time.