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
if ('proxy-connection' in cliReq.headers) { | |
cliReq.headers['connection'] = cliReq.headers['proxy-connection']; | |
delete cliReq.headers['proxy-connection']; | |
delete cliReq.headers['cache-control']; | |
} |
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
平成29/2017年2月 | |
日 月 火 水 木 金 土 | |
1 2 3 4 | |
5 6 7 8 9 10 11 | |
12 13 14 15 16 17 18 | |
19 20 21 22 23 24 25 | |
26 27 28 |
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
const http = require('http'), url = require('url'); | |
http.createServer((cliReq, cliRes) => { | |
const x = url.parse(cliReq.url); | |
const opt = {host: x.hostname, port: x.port || 80, path: x.path, | |
method: cliReq.method, headers: cliReq.headers}; | |
const svrReq = http.request(opt, svrRes => { | |
cliRes.writeHead(svrRes.statusCode, svrRes.headers); | |
svrRes.pipe(cliRes); }); | |
cliReq.pipe(svrReq); | |
}).listen(8080); |
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 target; | |
target: for (;;) switch (target) { | |
case undefined: | |
console.log('init'); | |
case 'start': | |
console.log('start'); |
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
'use strict'; | |
require('express')() | |
.use(require('express').static('.')) | |
.use(require('serve-index')('.', {icons: true})) | |
.listen(process.env.PORT || 3000); |
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
'use strict'; | |
var aa = require('aa'); | |
var Channel = aa.Channel; | |
var get = require('./get'); | |
aa(function*() { | |
var ch = Channel(); | |
get('a.txt', 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
'use strict'; | |
require('babel-polyfill'); // おまじない | |
//require('regenerator').runtime(); | |
console.log('main: start'); | |
main().then(function (val) { | |
console.log('main: finish:', val); | |
}); |
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
'use strict'; | |
// tarai(x: number, y: number, z: number): number; | |
const tarai = (x, y, z) => x <= y ? y : | |
tarai(tarai(x - 1, y, z), | |
tarai(y - 1, z, x), | |
tarai(z - 1, x, y)); | |
bench('takeuchi tarai', tarai, 10, 5, 0); | |
bench('takeuchi tarai', tarai, 12, 6, 0); |
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 -v | |
v6.x.x | |
$ npm -v | |
v3.x.x |
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
Object.setPrototypeOf(arguments, Array.prototype); | |
// または | |
arguments.__proto__ = Array.prototype; |
NewerOlder