Skip to content

Instantly share code, notes, and snippets.

View eykd's full-sized avatar

David Eyk eykd

View GitHub Profile
@eykd
eykd / hubot-markov.coffee
Created May 15, 2012 19:17
Markov plugin for Hubot
base_url = 'http://nymkit.com/generators/chatterbots/gort/'
module.exports = (robot) ->
robot.catchAll (msg) ->
if msg.message.text.match(/\bgort\b/i) or msg.message.text.match(/\n/)
# When addressed, I'll pull something out of my... sock
# drawer. Or, if it's a multi-line message, I'll add my
# two cents.
json_params =
name: 'gort'
var setTextMeasure = function (contentElement, targetMeasure, maxSize, minSize) {
if (!contentElement) contentElement = document.createElement('p');
if (!targetMeasure) targetMeasure = 66;
if (!maxSize) maxSize = 16;
if (!minSize) minSize = 9;
var sizer = contentElement.cloneNode();
sizer.style.cssText = 'margin: 0; padding: 0; color: transparent; background-color: transparent; position: absolute;';