This file contains 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
# demo of brain functionality (persisting data) | |
# https://github.com/github/hubot/blob/master/docs/scripting.md#persistence | |
# counts every time somebody says "up" | |
# prints out the count when somebody says "are we up?" | |
# /STUFF/ means match things between the slashes. the stuff between the slashes = | |
# regular expression. | |
# \b is a word boundary, and basically putting it on each side of a phrase ensures | |
# we are matching against the word "up" instead of a partial text match such as in "sup" | |
robot.hear /\bup\b/, (msg) -> | |
# note that this variable is *GLOBAL TO ALL SCRIPTS* so choose a unique name |
This file contains 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
# Description: | |
# A script to translate laughter to Argentina's native language | |
# | |
# Notes: | |
# :) | |
# | |
# Author: | |
# Michi Kono | |
module.exports = (robot) -> |
This file contains 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
# Description: | |
# Decides between two or more options at random. Now Spanish compatible! | |
# | |
# Commands: | |
# decide|choose|pick( between)(:) <option 1> and|or <option 2> (and|or <option #> ...) | |
# escoger|elegir|seleccionar|decidir( entre)(:) <opción 1> y|o <opción 2> (y|o <opción #> ...) | |
# | |
# Author: | |
# Michi Kono | |
This file contains 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
module.exports = function (app, config, passport, express) { | |
var kue = require("kue"); | |
var auth = express.basicAuth(function(user, pass, callback) { | |
var result = (user === 'username' && pass === 'password'); | |
callback(null /* error */, result); | |
}); | |
// any kue related settings can go here | |
kue.app.set('title', 'Jobs'); | |
// create a wrapper to add auth on since without it we can't globally wrap kue's paths | |
var subApp = express() |
This file contains 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
get_time = function() { | |
var date_part, local_time, now, time_part; | |
local_time = new Date(); | |
now = new Date(local_time.getTime() + (local_time.getTimezoneOffset() * 60000)); | |
date_part = "" + (this.zero_pad(now.getFullYear(), 2)) + "-" + (this.zero_pad(now.getMonth() + 1, 2)) + "-" + (this.zero_pad(now.getDate(), 2)); | |
time_part = "" + (this.zero_pad(now.getHours(), 2)) + ":" + (this.zero_pad(now.getMinutes(), 2)) + ":" + (this.zero_pad(now.getSeconds(), 2)); | |
return "" + date_part + " " + time_part; | |
} | |
zero_pad = function(number, length) { | |
var str; |
This file contains 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
// taken from http://daveymorris.co.uk/web-development/bump-jquery-plugin-bounce | |
// improved with additional options | |
(function($){ | |
$.bump = function(el, options){ | |
// Some object and DOM instansiation to make traversing the DOM less expensive | |
var base = this; | |
base.$el = $(el); | |
base.el = el; |
This file contains 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
# centralized global_dispatcher object added to all Backbone Collection, Model, View, and Router classes | |
(-> | |
return if this.isExtended | |
# attaching the Events object to the dispatcher variable | |
dispatcher = _.extend({}, Backbone.Events, cid: "dispatcher") | |
_.each [ Backbone.Collection::, Backbone.Model::, Backbone.View::, Backbone.Router:: ], (proto) -> | |
# attaching a global dispatcher instance | |
_.extend proto, global_dispatcher: dispatcher | |
)() |