Skip to content

Instantly share code, notes, and snippets.

View rognoni's full-sized avatar

Rognoni rognoni

View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@hatched
hatched / server.js
Created February 27, 2012 01:12
fromanegg.com - How to make a Node.js static file server - Part 1
var http = require('http'),
path = require('path'),
fs = require('fs'),
util = require('util');
http.createServer(_handler).listen(3000);
console.log('Server running at http://127.0.0.1:3000/');
function _handler(req, res) {