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
// the competitor is the atomic entity of a tournament | |
var Competitor = Backbone.Model.extend({ | |
defaults: { | |
firstname: "Bye", | |
lastname: "", | |
team: "None", | |
id: Math.floor(Math.random() * 10000) | |
} | |
}) |
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
{name:'griff'} |
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
// string input is assumed, punctuation is ignored, and the earliest word wins a tie | |
function getLongestWord (sentance) { | |
var words = sentance.split(/[\s-]+/); | |
words = words.map( function(word) {return word.match(/[\w\d]+/)[0] || '';} ); | |
return words.reduce( function(a,b) {return (a.length >= b.length)? a:b;} ); | |
} |