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
var RES_MAX = 10; | |
var count = 0; | |
function foo () { | |
if (count > RES_MAX) { | |
//出让cpu,等待并发任务完成 | |
return process.nextTick(foo); | |
} | |
//do the real work here | |
count ++; |
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
var http = require('http'); | |
var options = { | |
host: 'www.baidu.com', | |
port: 80, | |
path: '/s?wd=gfw' | |
}; | |
var Iconv = require('iconv').Iconv; |
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
var async = require('async'); | |
var http = require('http'); | |
function getPage(callback) { | |
http.get('http://www.baidu.com', function(res) { | |
var buffers = []; | |
var size = 0; | |
res.on('data', function(buffer) { | |
buffers.push(buffer); | |
size += buffer.length; |
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://www.mongodb.org/display/DOCS/dbshell+%28mongo%29+Reference |
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
sudo /Developer/Library/uninstall-devtools --mode=all |
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
//定义 | |
SEL class_func; | |
//赋值 | |
@interface foo | |
-(int)add:int val; | |
@end | |
class_func = @selector(add:int); | |
//执行 |
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
hdiutil convert -format UDRW -o <output-file> <input-iso-file> | |
diskutil list /dev/disk | |
diskutil unmountDisk /dev/diskN | |
dd if=<dmg-file> of=/dev/rdisk1 |
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
1. 系统安装 | |
2. 网络链接 | |
3. 显卡驱动安装 | |
4. git安装 | |
5. vim安装 | |
6. 中文/输入法安装 |
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
(reduce conj '() [1 2 3 4]) |
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
private final static int clamp(int x, int low, int high) { | |
return (x < low) ? low : ((x > high) ? high : x); | |
} |
OlderNewer