Skip to content

Instantly share code, notes, and snippets.

@fivetanley
fivetanley / twss.coffee
Created January 25, 2012 18:34
That's What She Said Hubot script
#Requires twss.js by Daniel Rapp. npm install -g twss
twss = require('twss')
module.exports = (robot) ->
robot.respond /twss\s*(.*)?$/i, (msg)->
query = msg.message.text.split(" ")
shesaid = ""
for said in query
if said not in query[0..1]
shesaid += said + " "
@fivetanley
fivetanley / example.js
Created March 6, 2012 03:34
RequireJS and this
/** Example AMD Module definition in RequireJS */
define(function(){
this.prototype.fnSuper = function(){
//do stuff
};
});
@fivetanley
fivetanley / LinkedList.cpp
Created March 7, 2012 23:00
Recursive function to find last node before end of LinkedList
Node* LinkedList::getBeforeTail(Node* h)
{
if (!h.next)
{
return 0;
}
if (getBeforeTail(h) == 0)
{
return h;
}
@fivetanley
fivetanley / f.cpp
Created March 7, 2012 23:25
Fuuuuuuuuuuck.cpp
Node* LinkedList::removeAtHead()
{
if (!head)
{
return 0;
}
Node* firstNode = head;
//Advance to the second position in the linked list because
//the first one will be popped off and (hopefully) deleted by the process
//requesting it..
@fivetanley
fivetanley / something.mustache
Created March 12, 2012 20:15
Mustache example
<h1>{{Obj.title}}</h1>
<table>
{{Collection.each}}
<tr><td>{{each.data}}</tr></td>
{{/Collection.each}}
@fivetanley
fivetanley / Queue.js
Created March 12, 2012 23:47
Queue and (this)
function Queue(delay){
this._lastExecutionTime = new Date();
this._delay = delay;
}
Queue.prototype.dequeue = function(){
//return first function in the list
};
@fivetanley
fivetanley / jshint.json
Created March 14, 2012 01:37
JSHint configuration
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : false,
@fivetanley
fivetanley / gist:2481581
Created April 24, 2012 17:10 — forked from iammerrick/gist:2481564
RequireJS Coffeescript
(function() {
require.config({
paths: {
'jquery': 'vendor/jquery-1.7.2',
'backbone': 'vendor/backbone',
'underscore': 'vendor/underscore',
'handlebars': 'vendor/handlebars-1.0.0.beta.6',
'text': 'vendor/require.text',
'i18n': 'vendor/i18n',
require.config
paths:
'jquery': 'vendor/jquery-1.7.2'
'backbone': 'vendor/backbone'
'underscore': 'vendor/underscore'
'handlebars': 'vendor/handlebars-1.0.0.beta.6'
'text': 'vendor/require.text'
'i18n': 'vendor/i18n'
'use': 'vendor/use'
use: