Skip to content

Instantly share code, notes, and snippets.

View paulomcnally's full-sized avatar
:octocat:
JS

Paulo McNally paulomcnally

:octocat:
JS
View GitHub Profile
@ry
ry / fib.js
Created March 12, 2012 00:17
a proper fibonacci server in node. it will light up all your cores.
var http = require('http')
var fork = require('child_process').fork;
function fib(n) {
if (n < 2) {
return 1;
} else {
return fib(n - 2) + fib(n - 1);
}
}
@diegok
diegok / mercadopago.rb
Created January 8, 2012 19:34
Small ruby object to interact with MercadoPago API
class MercadoPago
require 'rubygems'
require 'json/add/core'
require 'uri'
require 'net/https'
attr_accessor :client, :secret, :currency
def initialize(options={})
@client = options[:client_id]
@arpit
arpit / Android TimeZone Ids
Created June 20, 2011 13:26
List of all Android TimeZone ids
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
var http = require('http');
exports.query = function(cb) {
var cbCalled = false;
http.get({ host: 'jsonip.com' }, function(res) {
var buffer = '';
res.setEncoding('utf8');
res.on('data', function(d) {
buffer += d;
// Answer to http://github.com/ry/http-parser/issues/#issue/1
// UNTESTED
struct line {
char *field;
size_t field_len;
char *value;
size_t value_len;
};