Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
.DS_Store
*.log
tmp/
@Marak
Marak / imageResize.js
Last active August 29, 2015 14:08
Resize a remote image
var gm = require('gm');
module['exports'] = function resizeImage (hook, callback) {
hook.debug('Opening image stream');
var readStream = hook.open(hook.params.image);
hook.debug('Sending image/png header');
hook.res.writeHead(200, { 'Content-Type': 'image/png' });
@Marak
Marak / pipeHook.js
Last active August 29, 2015 14:08
Pipe Hooks into each other
module['exports'] = function pipeHook (hook) {
hook.debug('Opening echo hook with some data');
var hook2 = hook.open('http://hook.io/Marak/echo?foo=bar');
hook2.write('hello!');
hook2.pipe(hook.res);
};
@Marak
Marak / mergeHooks.js
Last active August 29, 2015 14:08
Merge multiple Hooks into a single Hook
var http = require('http');
module['exports'] = function recieveHttp (hook) {
var hook2 = hook.open('http://hook.io/Marak/echo?foo=bar');
var hook3 = hook.open('http://hook.io/Marak/echo');
var hooks = 2;
function complete() {
/**
* 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
@Marak
Marak / gist:39bb1d9dfb84d8b1074e
Created November 5, 2014 00:25
cat image to hook.io, rotate, pipe to new file locally
cat cat.jpg | curl --header "content-type: application/octet-stream" --data-binary @- http://hook.io/Marak/image/rotate > upsidedowncat.jpg
@Marak
Marak / simpleHook.js
Last active August 29, 2015 14:08
setting an Theme View for a hook.io hook
module['exports'] = function simpleHook (hook) {
hook.res.end('Request ended');
};
module['exports'].theme = "http://hook.io/themes/simple/index.html";
/**
* 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