Skip to content

Instantly share code, notes, and snippets.

@coderarity
coderarity / gist:3965464
Created October 27, 2012 17:38 — forked from hackable/gist:3965462
Proxt
var httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
var buffer = httpProxy.buffer(req);
middleware(res, function() {
console.log("The request was proxied");
});
proxy.on('proxyError', function () {
@coderarity
coderarity / gist:3773010
Created September 23, 2012 20:51 — forked from anonymous/gist:3772985
NodeJS Socket.IO simple server
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
var users = {};
app.listen(80);
app.get('/', function handler (req, res) {
@coderarity
coderarity / proxy.js
Created April 14, 2012 20:05 — forked from RobSpectre/proxy.js
Proxy with buffering
var http = require('http'),
https = require('https'),
httpProxy = require('./lib/node-http-proxy');
var server = httpProxy.createServer({
target: { host: 'graph.facebook.com', port: 443, https: true },
changeOrigin: true },
function (req, res, proxy) {
console.log("Received request.");
server.proxy.response_buffer = '';
@coderarity
coderarity / run-test.js
Created April 6, 2012 18:02
this is very broken and i'm not sure why
#!/usr/bin/env node
var path = require('path'),
spawn = require('child_process').spawn,
http = require('http');
var PORT = 8080;
var PROXY_PORT = 8090;
var test = process.argv[2];
~/projects/test -bash$ node testserver.js
-------------- This is testing in curl
{ act: 'get' }
pushing get request
{ act: 'get' }
pushing get request
{ act: 'send' }
Writing data.....
Writing data.....
------------- This is testing with Chrome
var https = require('https'),
http = require('http'),
util = require('util'),
colors = require('colors'),
httpProxy = require('../node-http-proxy/lib/node-http-proxy'),
helpers = require('../node-http-proxy/test/helpers');
//just uses readFileSync to load keys
var opts = helpers.loadHttps();
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
int main( int argc, char* argv[] ) {
int a;
struct timeval starttv, endtv;
time_t totalsec, totalusec, startsec, startusec;
double pps, totaltime;
var path = require('path');
var union = require('union');
var ecstatic = require('ecstatic');
//super simple static file server
union.createServer({ before: [
ecstatic(path.join(__dirname, 'public'))
]}).listen(8080);
console.log('Server started!');
@coderarity
coderarity / combatcompendium.md
Created January 6, 2012 21:12
Combat Compendium

Combat Compendium

Table of Contents

  • Introduction
    • Goals
    • Level Flow
    • Versions
  • Stats
  • Breakpoints