Skip to content

Instantly share code, notes, and snippets.

View Marak's full-sized avatar

Marak

View GitHub Profile
@Marak
Marak / highfive.js
Last active August 29, 2015 14:27 — forked from kmoe/highfive.js
module['exports'] = function highFive(hook) {
// hook.io has a range of node modules available - see
// https://hook.io/modules.
// We use request (https://www.npmjs.com/package/request) for an easy way to
// make the HTTP request.
var request = require('request');
// The parameters passed in via the slash command POST request.
var params = hook.params;
@Marak
Marak / api.js
Created March 4, 2010 04:43 — forked from tim-smart/api.js
exports.someMethod = function (arg1, arg2, callback) {
// Do this for safety's sake, people might accidentally send us an extra arg
arg1 = arguments[0];
arg2 = arguments[1];
callback = arguments[arguments.length - 1];
callback(null, 'win!');
};
// Only instantiate once and append the calls in your loop
// Because XHR responses pop out of the stack, all of the
// requests will be linked and sent before the first can
// return.
// Also, when passing the settings object as a config,
// the callback is inside the object. The signatures for
// sexy methods are (url, callback) or (settings)
// Can configure globally for the Sexy instance
var F = function () {};
F.name // ''
F.name = "foo";
F.name // ''
function F(){}
var blah = new F();
var sys = require('sys');
var child_process = require('child_process');
var servers = ['host1', 'host2', 'host3'];
var i;
for ( i in servers ) {
var server = servers[i];
sys.puts('init: ' + server);
var http = require("http"),
querystring = require("querystring"),
sys = require("sys");
var channel = "http://chat.nodejitsu.com/chat",
speed = 5000,
spammers = 10;
for (var i = 0; i < spammers; i++ ) {
setTimeout(startSpamming, (speed / spammers) * i);
var fs = require("fs")
, path = require("path")
fs.tree = function (root, cb) {
fs.lstat(root, function (er, s) {
if (er) return cb(er)
s.name = root
// if it's a dir, then get the list of children.
if (!s.isDirectory()) return cb(null, s)
fs.readdir(root, function (er, children) {
//
// Recursively traverse a hierarchy, returning
// a list of all relevant .js files.
//
function paths(dir) {
var paths = [];
try { fs.statSync(dir) }
catch (e) { return [] }
input ! click {
delay: 1ms;
}
! fadeOut {
time: 100ms;
}
input#search ! tokenize {
input ! click {
delay: 1ms;
}
! fadeOut {
time: 100ms;
}
input#search ! tokenize {