Skip to content

Instantly share code, notes, and snippets.

View tanepiper's full-sized avatar

Tane Piper tanepiper

View GitHub Profile
server.use(require('browserify')({
mount : '/browserify.js',
require : [ 'traverse' ],
preProcess: function(file, output) {
output += uglifyJs(file)
}
}));
@tanepiper
tanepiper / gist:823717
Created February 12, 2011 12:03
xml2json
var sys = require('sys'), fs = require('fs'), libxml = require('./libxmljs');
var stack = [];
var parser = new libxml.SaxPushParser(function(cb) {
cb.onStartDocument(function() {
sys.log('Starting to parse ...');
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
var obj = {};
obj['@'] = {};
var DNodeClient = DNode({
}).connect(function(remote, connection) {
// Connection stuff in here
});
DNodeClient.on('disconnect', function() {
// Disconnect logic
module.exports = new (require('winston').Logger)
transports: [
new (require('winston').transports.Console)(),
new (require('winston').transports.File)({ filename: '/tmp/camayak-web.log' })
]
levels:
debug: 0
info: 1
notice: 2
warning: 3
Foo Bar
GIF89a����2��������������������������������������������������������]��P��r�����������w��������j��������k��Z��!� NETSCAPE2.0!�Created with ajaxload.info!�
,�@�pH �b�$Ĩtx@$�W@e��8>S���-k�\�'<\0�f4�`���
/yXg{w Q
o �X
h�
Dd� a�eTy�vkyBVevCp�y��CyFp�QpGpP�CpHp�ͫpIp��pJ�����e��
֝X��ϧ���e���p�X����%䀪ia6�Ž�'_S$�jt�EY�<��M��zh����*AY ���I8�ظq���J6c����N8/��f�s�� !�
,�@�pH �P Ĩtx@$�W��8L�
��'��p�0g� �B h�ew�����f! Q
mx[
require.extensions[".json"] = function (module, filename) {
module.exports = JSON.parse(require("fs").readFileSync(filename, "utf8"))
}
loadSpecs = (paths...) ->
# expand all spec paths to full cache busted file paths
paths = for path in paths
"spec/#{path}_spec.js?#{new Date().getTime()}"
# Load the specs with head.js, and start a spec run 1 second after they load.
head.js paths..., ->
setTimeout ->
jasmine.getEnv().addReporter(new jasmine.TrivialReporter())
jasmine.getEnv().execute()
@tanepiper
tanepiper / express_app.coffee
Created March 31, 2011 19:55
CoffeeScript version of the default expressjs application generated by express
# Module Dependencies
express = require 'express'
app = module.exports = express.createServer();
# Configuration
app.configure () ->
app.set 'views', "#{__dirname}/views"
app.set 'view engine', 'jade'
// Target API:
//
// var s = require('net').createStream(25, 'smtp.example.com');
// s.on('connect', function() {
// require('starttls')(s, options, function() {
// if (!s.authorized) {
// s.destroy();
// return;
// }
//