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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Object.observer() demo3</title> | |
<style> | |
table, td, th { | |
border: 2px #000000 solid; | |
} | |
</style> |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Object.observer() demo2</title> | |
<style> | |
table, td, th { | |
border: 2px #000000 solid; | |
} | |
</style> |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Object.observer() demo1</title> | |
<style> | |
table, td, th { | |
border: 2px #000000 solid; | |
} | |
</style> |
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 fs = require('fs'); | |
var http = require('http'); | |
var util = require('util'); | |
var file = './1G.file'; | |
var stat = fs.statSync(file); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'octet-stream/binary', | |
'Content-Length': stat.size | |
}); | |
var rStream = fs.createReadStream(file); |
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 http = require('http'); | |
server = http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
server.close(); | |
}); | |
server.listen(8080, 0, function () { | |
console.log('Server running at http://localhost:8080/'); | |
}); |
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
function Animal() {} | |
function Ferret() {} | |
Ferret.prototype.eat = true; | |
Ferret.prototype.__proto__ = Animal.prototype; | |
Ferret.prototype.bark = false; | |
var ferret = new Ferret(); | |
console.log(ferret.eat, ferret.bark); |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <stddef.h> | |
#include <assert.h> | |
#include "uv.h" | |
#define MAX_CONSUMERS 16 | |
#define MAX_LOOPS 100 |
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
// domain.bind with closure | |
var domain = require('domain'); | |
var d = domain.create(); | |
var f = (function() { | |
var i = 0; | |
return function () { | |
return i++; | |
}; | |
}()); |
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
// domain stack sample | |
var fs = require('fs'), domain = require('domain'); | |
// >> ClassA | |
function ClassA() { | |
} | |
ClassA.prototype.fnA = function(cb) { | |
setTimeout(cb, 300); | |
throw new Error('fnA'); |
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
// domain stack sample #3 | |
var domain = require('domain'); | |
var d1 = domain.create(); | |
var d2 = domain.create(); | |
var d3 = domain.create(); | |
d1.on('error', function(err) { | |
console.log('d1:', err.message); | |
}); | |
d2.on('error', function(err) { |