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
# Create a chai helper method | |
chai.use (_chai, utils) -> | |
# Backbone collection testing of a model for particular attributes. | |
# | |
# The first key in the hash must be the index number of the model in the | |
# collection. The value of the index are the properties you want | |
# to check. Example--- 1: {title:'Root'} | |
# | |
# @param properties [hash] index#:{key:'value'} |
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
class ClassName | |
constructor: (attr) -> | |
@attr = attr | |
# Private | |
privateVariable = null | |
privateMethod = () -> | |
# Class method | |
@classMethod : () -> |
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
// Via Jone Resig: http://ejohn.org/apps/learn/#90 | |
function addMethod(object, name, fn){ | |
// Save a reference to the old method | |
var old = object[ name ]; | |
// Overwrite the method with our new one | |
object[ name ] = function(){ | |
// Check the number of incoming arguments, | |
// compared to our overloaded function |
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
# Via Jone Resig: http://ejohn.org/apps/learn/#90 | |
addMethod (object, name, fn) -> | |
# Save a reference to the old method | |
old = object[ name ] | |
# Overwrite the method with our new one | |
object[ name ] = -> | |
# Check the number of incoming arguments, | |
# compared to our overloaded function |