Skip to content

Instantly share code, notes, and snippets.

View tralamazza's full-sized avatar

Daniel Tralamazza tralamazza

View GitHub Profile
@tralamazza
tralamazza / gist:3265246
Created August 5, 2012 14:59
tsw - The Big Terrible Picture
PATH OF THESUN - RLATES NOT JUST TO THESOLAR BODY, BUT THE TRAVEL OF THEHUMAN BODY - BIRTH TO BEYOND.
EIGHT FLAMES - EIGHT STATIONS ON THEPATH OF LIFE? ALTHOUGH THEORDER IS NOT WHAT SEEMED INITIALLY OBVIOUS
1# 1
ovegu - gur oevrsrfg oynmr
BIRTH - THE BRIEFEST BLAZE
2# 5
puvyqubbq - bayl gehyl snqrf nsgre byq ntr
CHILDHOOD - ONLY TRULY FADES AFTER OLD AGE
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
@tralamazza
tralamazza / .vimrc
Created October 1, 2012 18:21
vim config
set nocompatible " be iMproved
filetype off " required!
set encoding=utf-8
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
@tralamazza
tralamazza / hashstream.js
Created October 2, 2012 00:49
stupid nodejs stream example
var crypto = require('crypto');
var through = require('through');
exports.createHashStream = function(algorithm, input_encoding, output_encoding) {
input_encoding = input_encoding || 'utf8';
output_encoding = output_encoding || 'hex';
var hashsum = crypto.createHash(algorithm || 'sha1');
return through(function write(data) {
hashsum.update(data, input_encoding);
@tralamazza
tralamazza / gist:3899198
Created October 16, 2012 13:13
htmlparser2 script block parsing
<html>
  <body>
    <script type="text/javascript">
      if (foo<=bar)
        console.log('oh noes');
    </script>
  </body>
</html>
@tralamazza
tralamazza / gist:3949592
Created October 24, 2012 23:29
thoughts on nodejs
I must apologize beforehand, as my English might give you ebola-like symptoms in the coming paragraphs.
Hi, I'm Daniel and I've been working with node among other things.
I started fiddling with node pretty much as soon as it was made public, back then I was doing research in dependable systems and going crazy over async I/O (boost asio, libevent, libev, linux/freebsd async io implementation ...).
Ok intro done, here is what I meant with that tweet (https://twitter.com/tralamazza/status/261175563392270339)
It was not just this post http://www.mikealrogers.com/posts/coffee-perspective.html that made me tweet that. I was at the LXJS 2012 conference, a great venue and organization btw. The closing talk, given by Mikeal, was a bit disturbing. At some point during the talk, I stepped back to look at the crowd, a surreal experience.
I get that people love a good show, and more importantly that most people need and seek a leader. Mikeal's speech sounded like a call to arms, one that a king in the battlefield woul
var url = require('url');
var PROTOCOLS = {
'http:': { agent: require('http'), port: 80 },
'https:': { agent: require('https'), port: 443 }
};
/*
* @param {String} method HTTP method ('GET', 'POST' ...)
* @param {String} uri URI (defaults protocol to HTTP)
@tralamazza
tralamazza / gist:4032395
Created November 7, 2012 15:50
installing phpunit on fedora 17
sudo yum install php-pear
pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
sudo pear install --alldeps phpunit/DbUnit
sudo yum install php-domxml-php4-php5
sudo pear install --alldeps phpunit/PHPUnit_Selenium
@tralamazza
tralamazza / gist:4047368
Created November 9, 2012 18:28
quickstart cube
npm install -g forever
git clone git://github.com/square/cube.git
cd cube
forever start bin/collector.js
forever start bin/evaluator.js
// foo.js
module.exports = function(exp) {
return typeof _ !== 'undefined' && exp === _;
};
// start repl (node)
> 1
1
> require('./foo')(1)