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 numberOfDays(year, month) { | |
var d = new Date(year, month, 0); | |
return d.getDate(); | |
} |
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
http://10.129.157.3:88/s/2.3/projects/profile/styles/applist.css |
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
C:\Users\jinwei>npm install totoro | |
npm http GET https://registry.npmjs.org/totoro | |
npm http 304 https://registry.npmjs.org/totoro | |
npm http GET https://registry.npmjs.org/commander/1.2.0 | |
npm http GET https://registry.npmjs.org/express/3.1.0 | |
npm http GET https://registry.npmjs.org/colorful/2.1.0 | |
npm http GET https://registry.npmjs.org/tracer/0.5.1 | |
npm http GET https://registry.npmjs.org/request/2.21.0 | |
npm http GET https://registry.npmjs.org/socket.io-client/0.9.11 |
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
//http://stackoverflow.com/questions/3898130/how-to-check-if-a-user-has-scrolled-to-the-bottom/10795797#10795797 | |
function isAtBottom () { | |
var getDocHeight = function() { | |
var D = document; | |
return Math.max( | |
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), | |
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), | |
Math.max(D.body.clientHeight, D.documentElement.clientHeight) | |
); | |
} |
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
.transition { | |
-webkit-transition: background-color 500ms ease-out 1s; | |
-moz-transition: background-color 500ms ease-out 1s; | |
-o-transition: background-color 500ms ease-out 1s; | |
transition: background-color 500ms ease-out 1s; | |
} |
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 getOffset (ele) { | |
var box = ele.getBoundingClientRect(); | |
return { | |
top: box.top + (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), | |
left: box.left + (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0) | |
}; | |
}; |
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
/** | |
referrence:http://leeiio.me/text-overflow-ellipsis/ | |
*/ | |
.overflow { | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
-o-text-overflow: ellipsis; |
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
//Fuck ie6!!!! | |
//url length >= 2084 returns error code 0x7a | |
(function(length) { | |
var url = "http://zhushou.sogou.com/data/data.html?", | |
len = url.length, | |
str = new Array(length+1-len).join("u"), | |
img = new Image(); | |
img.src = url+str; |
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
//ie8及以下浏览器 | |
if (window.attachEvent && !window.addEventListener) { | |
// "bad" IE | |
} | |
//ie7及以下浏览器 | |
if (window.attachEvent && !document.querySelector) { | |
// "bad" IE | |
} |
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
/** | |
https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L214 | |
*/ | |
function clone(obj) { | |
if (typeof obj == "function" || Object(obj) !== obj) { | |
return obj; |