Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
/**
* Geocoder
*
* You pass it an address and it returns a geocoded response. You will need
* a Geocodio API Key.
*
* @param {string} api_key Your geocodio API Key
* @param {string} address An address.
*
* curl--data 'api_key=XXXXX&address=123 Maple Lane, Everywhere USA' http://hook.io/desmondmorris/geocoder
/**
* Geocoder
*
* You pass it an address and it returns a geocoded response. You will need
* a Geocodio API Key.
*
* @param {string} api_key Your geocodio API Key
* @param {string} address An address.
*
* curl--data 'api_key=XXXXX&address=123 Maple Lane, Everywhere USA' http://hook.io/desmondmorris/geocoder
.DS_Store
*.log
tmp/
node_modules
secrets.js
@Marak
Marak / client.js
Created May 15, 2012 01:06
connecting to a dnode socket.io server from node
var io = require('socket.io-client');
var sock = io.connect('http://localhost:8080');
var dnode = require('dnode');
var Stream = require('stream');
var stream = new Stream;
stream.writable = true;
stream.readable = true;
stream.write = function (buf) {
sock.emit('message', String(buf));
app.router.get('/:slug', function (slug) {
var that = this;
Shortlink.find( {slug: slug} , function (err, shortlink) {
if (err) { throw new(Error)(err) }
console.log( that.req ); // This returns "undefined" and I think I understand why.
// How do I access request and response objects from within
// an anon callback like this one?
});
});
@Marak
Marak / hack.sh
Created March 31, 2012 22:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@Marak
Marak / gist:1505534
Created December 21, 2011 10:27 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
clear
declare -A snowflakes
declare -A lastflakes
@Marak
Marak / gist:1431484
Created December 4, 2011 22:22 — forked from joshsmith/gist:1431472
How should I be doing the callback?
user.save().on('success', handler).on('failure', handler)
function handler (result) {
if(result.err) { // or something like this
return callback(err);
}
return callback(null, result);
@Marak
Marak / bbs.js
Created October 27, 2011 05:15
curl bbs
var http = require('http');
var buf0 = new Buffer([0]);
var server = http.createServer(function (req, res) {
res.setHeader('content-type', 'multipart/octet-stream');
res.write('Welcome to the Fun House\r\n');
res.write('> ');
req.on('data', function (buf) {
res.write(buf);