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 sleep = function(t){ | |
//console.log(+new Date()); | |
var t1 = +new Date(); | |
while(+new Date() - t1 < t){ | |
} | |
//console.log(+new Date()); | |
} | |
var f = function(x){ | |
sleep(Math.random() * 1000); |
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
.s-btn { | |
display: inline-block; | |
zoom: 1; | |
-moz-border-radius: 2px; | |
-webkit-border-radius: 2px; | |
border-radius: 2px; | |
-moz-box-shadow: 0 1px 1px #e4e4e4; | |
-webkit-box-shadow: 0 1px 1px #E4E4E4; | |
box-shadow: 0 1px 1px #E4E4E4; | |
border: 1px solid #C1C8D1; |
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 classObj= | |
{ | |
ToUnicode:function(str) | |
{ | |
return escape(str).replace(/%/g,"\\").toLowerCase(); | |
}, | |
UnUnicode:function(str) | |
{ | |
return unescape(str.replace(/\\/g, "%")); |
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
假设你fork的项目原始地址是http://github.com/abc/rep.git, 你自己的是http://github.com/you/rep.git | |
$ git remote add upstream http://github.com/abc/rep.git # 你本地的origin应该跟了自己的remote,前且假设当前本地branch是master。 | |
$ git fetch upstream | |
$ git merge upstream/master # merge可能会有冲突,手工解决掉并commit | |
$ git push origin/master # push到你自己的fork上 | |
然后向原始项目提交一个pull request。 |
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
echo "deb http://opensource.wandisco.com/ubuntu lucid svn17" | sudo tee /etc/apt/sources.list.d/svn.list | |
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get dist-upgrade |
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
Example install: | |
sudo apt-get install python-software-properties | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs npm | |
It installs current stable Node on the current stable ubuntu. | |
If you want to compile Node C++ modules: |
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
UglifyJS是基于 NodeJS 的Javascript语法解析/压缩/格式化工具,它支持任何CommonJS模块系统的Javascript平台(实现自己的CommonJS平台也非难事)。 | |
UglifyJS通过解析重新生成JS代码的语法树,你可以通过AST以了解更多代码情况,或者自己来做一个不同的实现。UglifyJS解析器是在 parse-js.js 中实现的,它是非常优秀的 parse-js Common Lisp Library 的一部分。 | |
(如果你正在查找UglifyJS的Common Lisp版本,点击 这里 ) | |
UglifyJS的另一个重要部分是在 process.js 实现的,它用于检查并实现解析生成的AST: | |
通过AST进行Javascript代码的重新生成 :如果你想格式化已经被压缩过的代码,可以选择缩进参数。你也可以打印出无空白(whitespace)的AST,以达到压缩的目的。 | |
缩短变量名 :UglifyJS通过分析代码并生成新的变量名称,依赖于作用域,这些名称通常被简化为单一字符,并能足够智能的处理全局变量,或者eval()调用及with{}块。换句话说,如果在某个作用域内使用了eval()或with{},那么该作用域的所有变量及其父作用域的变量都不会被重新命名,并且所有指向这类变量的引用也不会被改变。 |
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
filter:alpha(opacity=50); /* IE */ | |
-moz-opacity:0.5; /* Moz + FF */ | |
opacity: 0.5; /* 支持CSS3的浏览器(FF 1.5也支持)*/ |
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
.box { | |
/*非IE的主流浏览器识别的垂直居中的方法*/ | |
display: table-cell; | |
vertical-align:middle; | |
/*设置水平居中*/ | |
text-align:center; | |
/* 针对IE的Hack */ | |
*display: block; |
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
/** | |
* js 对象序列化 | |
* @param obj | |
* @return {String} | |
*/ | |
function serialize(obj){ | |
switch(obj.constructor){ | |
case Object: | |
var str = "{"; | |
for(var o in obj){ |
OlderNewer