Skip to content

Instantly share code, notes, and snippets.

View Havvy's full-sized avatar

Ryan Scheel Havvy

  • Work is not programming related
  • Washington, USA
View GitHub Profile
@Havvy
Havvy / delayFns.js
Last active December 18, 2015 22:49
module.exports = function (delayedFn, period) {
var queue = [];
var queueEmpty = true;
var interval;
function consume () {
if (queue.length === 0) {
queueEmpty = true;
clearInterval(interval);
} else {
var config = require('./config/mibbit.json');
var Client = require('tennu').Client;
new Client(config).connect();
@Havvy
Havvy / id_rsa.pub
Created November 7, 2013 18:58 — forked from anonymous/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChecVDc+Ydwqnri7ikD5fPFgPsY0xuD/XLYD9piJqWLQKyogEhWZqMoQ/eZEfRPuRjaoHfZ+9vjl29LSQgqSApamgANSefw6jpJw/AvVFcAe/fBn44x8tHWSrV0iTR4MSjEPnupnIALa1qq/MTcbmcGnuLKSj8VvjVXHiw1THk7ErjHV5P5lXvurw+KFznxiwqgx2NsWZAPEEhFPb+C2v/w/W+fQ7jZTq7AqYG1AHp/wOpG7dHDmgXxx3x5T1t6xMG1eMlsfhwBwgULCFGElv7Mgwglx+SkMtGKuEjSK2MKML/9nPIV0UPMWoBfYbQTJK5rDfS0ib6MtCgkI+TOmHN [email protected]
@Havvy
Havvy / post.js
Created November 29, 2013 01:50
Do a POST request, redirecting the current page to the result.
function post(url, values) {
function add_input(name, value) {
var input = document.createElement("input");
input.name = name;
input.value = value;
form.appendChild(input);
}
var form = document.createElement("form");
var sinon = require('sinon');
var assert = require('better-assert');
var equal = require('deep-eql');
var inspect = require('util').inspect;
var format = require('util').format;
var debug = false;
var logfn = debug ? console.log.bind(console) : function () {};
var logger = {debug: logfn, info: logfn, notice: logfn, warn: logfn, error: logfn};
fez.js (*)
test-src/
test-bdd.sjs (*)
test/
node_modules/
fez/
fez-sweet.js/
plugin.js (*)
node_modules/
sweet.js/
function keysWhere (obj, predicate) {
return Object.keys(obj).reduce(function (acc, key) {
if (predicate(key, obj[key])) {
acc.push(key);
}
return acc;
}, []);
}
@Havvy
Havvy / server.sjs
Created January 19, 2014 08:11
Ah, the difference a year makes.
/*
var util = require('util');
var ServerModule = function () {
this.capabilities = {};
};
ServerModule.prototype.getModule = function () {
return {
macro m { rule { $v } => { $v } }
let it = macro {
rule { $name:lit { $body ... } } => {
it($name, function () {
$body ...
});
}
}
digraph{0 [shape=box,label="test-src/client.sjs"];1 [label="?"];2 [shape=box,label="test/client.js"];3 [shape=box,label="test-src/command-handler.sjs"];4 [label="?"];5 [shape=box,label="test/command-handler.js"];6 [shape=box,label="test-src/message-handler.sjs"];7 [label="?"];8 [shape=box,label="test/message-handler.js"];9 [shape=box,label="test-src/message.sjs"];10 [label="?"];11 [shape=box,label="test/message.js"];12 [shape=box,label="test-src/output-socket.sjs"];13 [label="?"];14 [shape=box,label="test/output-socket.js"];15 [shape=box,label="test-src/plugin-help.sjs"];16 [label="?"];17 [shape=box,label="test/plugin-help.js"];18 [shape=box,label="test-src/plugin-user.sjs"];19 [label="?"];20 [shape=box,label="test/plugin-user.js"];21 [shape=box,label="test-src/subscriber.sjs"];22 [label="?"];23 [shape=box,label="test/subscriber.js"];24 [shape=box,label="src/client.sjs"];25 [label="?"];26 [shape=box,label="lib/client.js"];27 [shape=box,label="plugin-src/server.sjs"];28 [label="?"];29 [shape=box,label="tennu_p