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 mongoose = require('./node_modules/mongoose'); | |
mongoose.connect('mongodb://localhost/test'); | |
var schema = mongoose.Schema({ | |
_id : Number, | |
title : String, | |
date : { type: Date }, | |
parts : [{ | |
name : String, | |
posx : { type: Number }, |
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
#include <afxwin.h> | |
#include "SplitterWindow.h" | |
#include <afxext.h> | |
/********** 這裡是CDocument類別 **********/ | |
class DocBoxy : public CDocument | |
{ | |
//在此撰寫Document內容 | |
DECLARE_DYNCREATE(DocBoxy); | |
}; |
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 crypto = require('crypto'); | |
//md5 | |
var md5_password = crypto.createHash('md5').update('admin').digest('hex'); | |
console.log(md5_password.length + ', ' + md5_password); | |
//md5(base64) | |
var md5_base64_password = crypto.createHash('md5').update('admin').digest('base64'); | |
console.log(md5_base64_password.length + ', ' + md5_base64_password); |
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 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-TW" xml:lang="zh-TW"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Typing Delay</title> | |
</head> | |
<body> | |
<textarea id="inputcode" cols=50 rows=10></textarea><br /> | |
<textarea id="outputcode" cols=50 rows=10></textarea> | |
<script type="text/javascript"> |
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
<?php | |
header('content-type: application/json; charset=utf-8'); | |
function curl($url,$params = array(),$is_coockie_set = false) { | |
if(!$is_coockie_set) { | |
$ckfile = tempnam ("/tmp", "CURLCOOKIE"); | |
$ch = curl_init ($url); | |
curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); | |
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); | |
$output = curl_exec ($ch); | |
} |
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 express = require('./node_modules/express'); | |
var app = express(); | |
var port = 1337; | |
var server = app.listen(port); | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser('_(:3_<)_...QQBoxy')); | |
app.use(express.session({secret : '_(:3_<)_...QQBoxy'})); |
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
#include <node.h> | |
using namespace v8; | |
Handle<Value> parseJson(Handle<Value> jsonString) { | |
HandleScope scope; | |
Handle<Context> context = Context::GetCurrent(); | |
Handle<Object> global = context->Global(); |
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
/* | |
Connect 3.0 的 connect.multipart() 將被移除, | |
可使用 multiparty 解決向下相容,方法如下: | |
1. 安裝multiparty | |
npm install multiparty | |
2. 安裝connect-multiparty | |
npm install connect-multiparty |
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
//node main.js | |
var hello = require('./hello.js'); | |
var foo = new hello.foo(); | |
foo.say(); | |
//hello.js | |
var foo = function() { | |
console.log("foo"); | |
}; | |
foo.prototype.say = 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
var http = require('http'); | |
var express = require('./node_modules/express'); | |
var multiparty = require('./node_modules/multiparty'); | |
var multipart = require('./node_modules/connect-multiparty'); | |
var app = express(); | |
var server = http.Server(app); | |
var port = 1337; | |
var middle = multipart(); | |
app.use(express.json()); |
OlderNewer