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 server, ip = "127.0.0.1", | |
port = 1337, | |
http = require('http'), | |
url = require('url'); | |
server = http.createServer(function (req, res) { | |
console.log(req.url); | |
res.writeHead(200, { | |
'Content-Type': 'text/plain' | |
}); | |
res.end('hello world\n'); |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-TW" lang="zh-TW"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>node.js index html file</title> | |
</head> | |
<body> | |
<h1>node.js index html file</h1> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="author" content=""> | |
<meta name="created" content="2012-02-23"> | |
<meta name="modified" content="Thu Feb 23 02:44:31 2012"> | |
<title> Form serialize - Prototype by Caesar Chi</title> | |
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> |
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
/** | |
* @overview | |
* | |
* @author Caesar Chi | |
* @blog clonn.blogspot.com | |
* @version 2012/02/26 | |
*/ | |
// create server. | |
var app = require('express').createServer(), |
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
/** | |
* @overview | |
* | |
* @author Caesar Chi | |
* @blog clonn.blogspot.com | |
* @version 2012/02/27 |
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 format(format) { | |
if (!FB.String.format._formatRE) { | |
FB.String.format._formatRE = /(\{[^\}^\{]+\})/g; | |
} | |
var values = arguments; | |
return format.replace( | |
FB.String.format._formatRE, | |
function(str, m) { |
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 fs = require('fs'); | |
var fullpath = '/home/clonn/test.html'; | |
fs.watchFile(fullpath, function (curr, prev) { | |
if (curr.mtime.getTime() !== prev.mtime.getTime()) | |
console.log('file update'); | |
}); |
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 mongo = require('mongodb'); | |
var mongostr = 'mongodb://[user]:[pwd]@alex.mongohq.com:10046/[dbname]'; | |
mongo.connect(mongostr, {}, function(error, db) { | |
if ( ! error) | |
console.log("connected, db: " + db); | |
}); |
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 connect = require('connect'); | |
var uid = connect.utils.uid(20); | |
console.log('origin uid: ' + uid); | |
var crypto = require('crypto'); | |
var sha1 = crypto.createHash('sha1'); | |
var d = sha1.update(uid).digest('hex'); | |
console.log('encrypt uid(sha1): ' + d); |
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
<!DOCTYPE html> | |
<html lang="zh"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bootstrap, from Twitter</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<!-- Le styles --> |
OlderNewer