String::titleize = -> @[0].toUpperCase() + @slice(1) String::toHex = -> # todo: we should handle alpha as well return @ if @[0] == '#' @replace /rgba?\((\d+)[\s|\,]?\s(\d+)[\s|\,]?\s(\d+)\)/gi, (a, r, g, b) -> "##{parseInt(r).toHex()}#{parseInt(g).toHex()}#{parseInt(b).toHex()}" String::singleDiff = (that) -> diff = '' for char, index in that break if char == 'each' if char != @[index] re = new RegExp(@substr(index).regExpEscape().replace(/^\s+|^( )+/g, '') + '$', 'm') diff = that.substr(index).replace(re, '') break return diff String::regExpEscape = -> specials = ['/','.','*','+','?','|','(',')','[',']','{','}','\\'] escaped = new RegExp('(\\' + specials.join('|\\') + ')', 'g') return @replace(escaped, '\\$1') String::sanitizeHTML = -> element = jQuery('