This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();stats.domElement.style.cssText='position:fixed;left:0;top:0;z-index:10000';document.body.appendChild(stats.domElement);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//rawgit.com/mrdoob/stats.js/master/build/stats.min.js';document.head.appendChild(script);})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* rem.js | |
* v0.1.1 | |
* fixed 2015-3-12 | |
*/ | |
(function (win){ | |
var doc = win.document, | |
html = doc.documentElement, | |
option = html.getAttribute('data-use-rem'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(){ | |
var formatParams = function(data) {//格式化参数 | |
var arr = []; | |
for (var name in data) { | |
arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name])); | |
} | |
return arr.join('&'); | |
} | |
var jsonp = function(options) { | |
options = options || {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from seajs | |
function isType(type) { | |
return function(obj) { | |
return {}.toString.call(obj) == "[object " + type + "]" | |
} | |
} | |
var isObject = isType("Object") | |
var isString = isType("String") | |
var isArray = Array.isArray || isType("Array") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//延长xss生命周期 | |
//文章:http://drops.wooyun.org/web/5049 | |
var XssGhost = function() { | |
function module(id, payload, winList, first) { | |
var window = this; | |
// debug | |
window.addEventListener('error', function(e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
匹配单纯的tag: /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.extend = jQuery.fn.extend = function() { | |
var options, name, src, copy, copyIsArray, clone, | |
target = arguments[ 0 ] || {}, | |
i = 1, | |
length = arguments.length, | |
deep = false; | |
// Handle a deep copy situation | |
if ( typeof target === "boolean" ) { | |
deep = target; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*代理模式*/ | |
var mult = function(){ | |
var a = 1; | |
for(var i = 0, l = arguments.length; i < l; i++) { | |
a = a * arguments[i]; | |
} | |
return a; | |
} | |
var proxyMulti = (function(){ | |
var cache = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
参考链接 http://www.ruanyifeng.com/blog/2015/05/thunk.html | |
js中 thunk 的概念及函数式编程中所说的柯里化 | |
JavaScript 语言是传值调用,它的 Thunk 函数含义有所不同。在 JavaScript 语言中,Thunk 函数替换的不是表达式,而是多参数函数,将其替换成单参数的版本,且只接受回调函数作为参数 | |
*/ | |
/*例子一*/ | |
// 正常版本的readFile(多参数版本) | |
fs.readFile(fileName, callback); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var readFile = function (fileName){ | |
return new Promise(function (resolve, reject){ | |
fs.readFile(fileName, function(error, data){ | |
if (error) reject(error); | |
resolve(data); | |
}); | |
}); | |
}; |