Skip to content

Instantly share code, notes, and snippets.

View LightSpeedC's full-sized avatar

Kazuaki Nishizawa LightSpeedC

View GitHub Profile
@LightSpeedC
LightSpeedC / debug.html
Last active September 5, 2015 08:22
Mithril.js 試してみた(3) console.logの様に画面に表示してみる ref: http://qiita.com/LightSpeedC/items/23dcecfa22b89dc7c165
<!DOCTYPE html>
<meta charset="UTF-8">
<title>debug - Mithril.js</title>
<script src="mithril.min.js"></script>
<!--[if IE]><script src="es5-shim.min.js"></script><![endif]-->
<body>
<div id="$debugElement"></div>
</body>
@LightSpeedC
LightSpeedC / links.html
Last active September 5, 2015 08:23
Mithril.js 試してみた(2) サーバーからデータを取得する m.request() ref: http://qiita.com/LightSpeedC/items/f533f048e01ac19a06ec
@LightSpeedC
LightSpeedC / counter-min.html
Last active December 18, 2015 05:12
Mithril.js 試してみた(1) todo アプリを作り始める所まで ref: http://qiita.com/LightSpeedC/items/a2c967928f9cc13e0ebc
<!DOCTYPE html>
<meta charset="UTF-8">
<title>counter minimum - Mithril.js</title>
<script src="mithril.min.js"></script>
<!--[if IE]><script src="es5-shim.min.js"></script><![endif]-->
<body></body>
<script>
var target;
target: for (;;) switch (target) {
case undefined:
console.log('init');
case 'start':
console.log('start');
@LightSpeedC
LightSpeedC / aa-chan1.js
Last active October 26, 2017 22:14
[JavaScript] 非同期処理のコールバック地獄から抜け出す方法 ref: http://qiita.com/LightSpeedC/items/7980a6e790d6cb2d6dad
'use strict';
var aa = require('aa');
var Channel = aa.Channel;
var get = require('./get');
aa(function*() {
var ch = Channel();
get('a.txt', ch);
@LightSpeedC
LightSpeedC / http-proxy-plus-stealth-mode.js
Last active May 11, 2019 12:30
Node.js で https をサポートする http proxy サーバを 80行で書いた ref: https://qiita.com/LightSpeedC/items/5c1edc2c974206c743f4
if ('proxy-connection' in cliReq.headers) {
cliReq.headers['connection'] = cliReq.headers['proxy-connection'];
delete cliReq.headers['proxy-connection'];
delete cliReq.headers['cache-control'];
}
@LightSpeedC
LightSpeedC / http-proxy-server-in-10-lines.js
Last active December 14, 2018 23:47
Node.jsによる必要最小限のhttpサーバとhttpsサーバとhttp proxyサーバ ref: https://qiita.com/LightSpeedC/items/3cae342fd7e79a21869f
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);