Skip to content

Instantly share code, notes, and snippets.

View dominictarr's full-sized avatar

Dominic Tarr dominictarr

View GitHub Profile
@dominictarr
dominictarr / client.js
Created June 28, 2011 00:16
events over Dnode
var dnode = require('dnode')
, EventEmitter = require('eventemitter2').EventEmitter2
, log = console.log
, port = 1337
, greetings = ['hello','houdy', "g'day", 'kiora', 'bonjour']
, greet = greetings [Math.round(Math.random() * greetings.length)]
var dnode = require('dnode');
@dominictarr
dominictarr / notes.txt
Created July 2, 2011 06:20
nodejitsu deploy problem
//app seems to deploy correctly.
jitsu deploy
Nodejitsu ok.
//does not start
curl http://helloworld-fullstacktest.nodejitsu.com
An error has occurred: {"stack":"Error: ECONNREFUSED, Connection refused\n at Socket._onConnect (net.js:601:18)\n at IOWatcher.onWritable [as callback] (net.js:186:12)","message":"ECONNREFUSED, Connection refused","errno":111,"code":"ECONNREFUSED","syscall":"connect"}
@dominictarr
dominictarr / example.sh
Created July 11, 2011 11:34
setup git deploy
ssh user@remote
mkdir prod
cd prod
git init
git config receive.denyCurrentBranch false
echo 'cd ~/prod ; git reset --hard' > .git/hooks/post-receive
#maybe also add a command to .git/hooks/post-receive to restart your server?
#forever restart 0
@dominictarr
dominictarr / test-methods.js
Created July 17, 2011 12:51 — forked from stagas/test-methods.js
node-http-proxy methods not working
var http = require('http')
, httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
//
// Put your custom server logic here
//
proxy.proxyRequest(req, res, {
host: 'localhost',
port: 9000
//npm install http-proxy socket.io@0.6.17
var server = require("http").createServer(function(req, res) {
res.writeHead(200, {"content-type": "text/html"});
res.end("<html><body><script src='/socket.io/socket.io.js'></script>\
<script>\
var socket = new io.Socket(null, {transports: ['xhr-multipart']});\
socket.connect();\
</script></body></html>");
})
@dominictarr
dominictarr / proposal.markdown
Created July 18, 2011 06:05
middleware system for node-http-proxy

#middleware system for node-http-proxy

##feature requests:

  • 69: easy url proxying. forward x.com/whatever to y.com
  • 66: monitor requests. (use connect middleware - once http-proxy supports it)
  • 60: spin up nodes on request (seems like a bad idea, incoming middleware)
  • 18: gzip responses (would need response middleware)
  • 58: modify responses (would need response middleware)
@dominictarr
dominictarr / client.js
Created July 29, 2011 08:18 — forked from fjakobs/index.html
node-http-proxy bug #70
var http = require('http')
function log (str) {
console.log('' + str)
}
http.get({host: 'localhost', port:6666, path: '/xhr'}, function (res) {
res.on('data', log)
res.on('end', log)
@dominictarr
dominictarr / concurrent-proxy.js
Created August 2, 2011 04:15
script to check level of concurrency through proxy
var util = require('util'),
colors = require('colors'),
http = require('http'),
httpProxy = require('./../lib/node-http-proxy');
//
// Basic Http Proxy Server
//
httpProxy.createServer(9000, 'localhost').listen(8000);
@dominictarr
dominictarr / output
Created August 5, 2011 07:21
failing tests
Running tests in test/resources/snapshot/snapshot-api-test.js
· ·✗ ·✗·✗ ···· ······ ✗✗·· ··
When using the master server a POST request to /apps/marak/test/snapshots using application/octet-stream
✗ should respond with the snapshot
» expected '0.0.0-1',
got '0.0.0-3' (==) // snapshot-api-test.js:56
When using the master server a POST request to /apps/marak/chat/snapshots using application/json
✗ should respond with the snapshot
#install via ssh without having to stay logged in.
IP=$1 #host to install node on
#save the ssh command
toNew="ssh root@$IP -o StrictHostKeyChecking=no"
#will need this to save the logs.
quiet=" 2>> log >> log << /dev/null"