This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.paths.unshift 'express/lib' | |
require 'express' | |
http: require 'express/http' | |
get '/', -> | |
this.contentType 'html' | |
this.respond 200, ''' | |
<html> | |
<head><title>NodeJs Example</title></head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By Klaus Wuestefeld | |
1) Torne-se excelente. | |
Seja realmente bom em alguma coisa. Não fique só choramingando ou | |
querendo progredir às custas dos outros. Não pense q pq vc sentou 4 | |
anos numa faculdade ouvindo um professor falar sobre software q vc | |
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo | |
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo | |
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INFO | |
# Provides: OSX BandWidth Limitator | |
# Author: Emerson Macedo - http://github.com/emerleite - http://codificando.com | |
# Description: Limit bandwidth to test player in slow situations. Tested on OSX | |
### END INFO | |
usuage() { | |
echo "Usuage: sudo ./limit-bandwidth.sh <action> [width] | |
action {add|remove} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Parser string differences: http://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format | |
var EODateParser = (function(Date,undefined) { | |
var pad = function(s) { | |
return (s.toString().length === 1) ? "0" + s: s; | |
}; | |
var checkerValue = function(target, func, value) { | |
if (typeof value !== "undefined") { | |
target[func](value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if did_filetype() " filetype already set.. | |
finish " ..don't do these checks | |
endif | |
if getline(1) =~ '^#!.*node' | |
setfiletype javascript | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.route('/forums', function(){ | |
app.get('/', function(){ | |
}); | |
app.route('/:id', function(){ | |
app.get('/', function(){ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the TCP Library | |
net = require('net'); | |
// Keep track of the chat clients | |
var clients = []; | |
// Start a TCP Server | |
net.createServer(function (socket) { | |
// Identify this client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http") | |
, util = require("sys") // 0.3.x: require("util") | |
, fs = require("fs") | |
, client = http.createClient(80, "example.com") | |
, request = client.request("POST", "/", {"host":"example.com"}) | |
// send body chunks | |
request.write("hello, world") | |
// pump a file through |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// database.js | |
sys = require('sys'); | |
var mongo = require('./lib/node-mongodb-native/lib/mongodb'), | |
Connection = mongo.Connection, | |
Server = mongo.Server, | |
BSON = mongo.BSONNative; | |
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost'; | |
var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
n = 1_000_000 | |
Benchmark.bmbm do |x| | |
x.report("Double quotes") do | |
n.times do | |
str = "A simple string" | |
end | |
end | |
x.report("Single quotes") do |