This file contains hidden or 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
/** | |
* 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 |
This file contains hidden or 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
/** | |
* 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 |
This file contains hidden or 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
.DS_Store | |
*.log | |
tmp/ |
This file contains hidden or 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
node_modules | |
secrets.js |
This file contains hidden or 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 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)); |
This file contains hidden or 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.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? | |
}); | |
}); |
This file contains hidden or 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
#!/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 | |
# |
This file contains hidden or 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 | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
clear | |
declare -A snowflakes | |
declare -A lastflakes |
This file contains hidden or 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
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); |
This file contains hidden or 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'); | |
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); |