This file contains 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
// RegExp for English & Chinese usual sentence, which is reuseable | |
[\s\w\。\,\、\`\:\~\`\!\@\#\$\%\^\&\*\(\)\-\_\+\=\{\}\[\]\|\;\:\"\'\<\>\,\.\/\?]*?\n | |
// Whole RegExp for change my fucking annotation style, which is: | |
// /** | |
// * balabala | |
// * foo | |
// **/ | |
// search via it and replace with $1$3 **twice**, and than there is a new annotation style: |
This file contains 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
// For V8: | |
// Define global variable `__stack__` and `__line` | |
// for current stack and line | |
(function(global){ | |
Object.defineProperty(global, '__stack__', { | |
get: function(){ | |
var orig = Error.prepareStackTrace; | |
Error.prepareStackTrace = function(_, stack){ return stack; }; | |
var err = new Error; | |
Error.captureStackTrace(err, arguments.callee); |
This file contains 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 evaluate(){ | |
var ifr = document.querySelector('#iframeautoheight'), | |
ifrDoc = ifr.contentDocument, | |
selects = ifrDoc.querySelector('#DataGrid1').querySelectorAll('.select'), | |
i, l, | |
options, | |
submitBtn = ifrDoc.querySelector('#Button2'); | |
if( submitBtn.value.search(/提\s*交/) === -1 ){ | |
for(i = 0, l = selects.length; i < l; ++i){ |
This file contains 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
.wrapper { | |
width:90%; | |
margin: auto; | |
overflow: hidden; | |
zoom: 1; | |
background: beige; | |
} | |
.nav { | |
float: left; |
This file contains 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
body { | |
width: 600px; | |
font:normal 14px/1.62 arial, sans-serif; | |
} | |
.mod { | |
margin-bottom:100px; | |
background-color:#efc; | |
} | |
.pic { | |
margin-right: 20px; |
This file contains 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 shuffle (source) { | |
return source.slice().sort(function (a, b) { | |
return Math.random() < 0.5 ? -1 : 1; | |
}); | |
} | |
var arr = Array.apply(null, new Array(3 * 54)) | |
.map(function (val, i) { return i; }); | |
console.log( shuffle(arr) ); |
This file contains 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
.box{ | |
float:left; | |
position:relative; | |
left:50%; | |
} | |
p{ | |
float:left; | |
position:relative; | |
right:50%; | |
} |
This file contains 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 sendLog (urlWithLog) { | |
var img = new Image(), no, caches; | |
if (sendLog.count >= Number.MAX_VALUE) sendLog.count = 0; | |
no = 'no' + sendLog.count++; | |
caches = sendLog.caches; | |
// hold on reference, otherwise image object may be GCed and abort request that has not been send | |
caches[no] = img; | |
// delete reference | |
img.onload = img.onerror = img.onabort = function () { |
This file contains 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
> Object.prototype.toString.call({foo: 'foo'}) | |
"[object Object]" | |
> Object.prototype.toString.call('fff') | |
"[object String]" | |
> Object.prototype.toString.call([]) | |
"[object Array]" | |
> Object.prototype.toString.call(function () {}) | |
"[object Function]" | |
> Object.toString.call(function () {}) | |
"function () {}" |
This file contains 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 mul (a) { | |
return a * a; | |
} | |
console.log( mul.toString() ); | |
/* | |
output: | |
function mul(a) { | |
return a * a; | |
} |