Skip to content

Instantly share code, notes, and snippets.

View schell's full-sized avatar
🥑
hacking on renderling

Schell Carl Scivally schell

🥑
hacking on renderling
View GitHub Profile
/**
* Creates and populates a server with listeners.
*
* @param request http.ServerRequest
* @param response http.ServerResponse
* @author Schell Scivally
* @since Sat Mar 6 18:20:46 PST 2010
*/
var server = http.createServer(function (request, response) {
// put the response in an envelope
@schell
schell / prettyxml.js
Created March 24, 2010 17:31
Pretty prints xml
/**
* Pretty prints xml
*
* @param String ugly xml
* @return String prettier xml
* @author Schell Scivally
* @since Sun Mar 14 16:16:50 PDT 2010
*/
var formatXml = this.formatXml = function (xml) {
var reg = /(>)(<)(\/*)/g;
@schell
schell / public private javascript
Created March 4, 2010 01:03
Javascript closures providing private methods and variables.
var object = function() {
var _privateVariable = 0;
function _privateFunction() {
alert('i am in a closure');
}
function _privateFunctionTwo() {
alert('nothing outside the object created by this function can reach me.');
_privateFunction();
/**
* Lists the (at least enumerable) properties of an object.
*
* @param Object the object to list
* @param Number the level to print at (num tabs)
* @param Boolean whether or not to print function code
* @author Schell Scivally
* @since Wed Feb 24 11:10:24 PST 2010
*/
this.dump = function(obj, lvl, pf) {