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
(1..100).each do |i| | |
s = "#{'Fizz' if (i%3).zero?}#{'Buzz' if (i%5).zero?}" | |
puts s.empty? ? i : s | |
end |
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
var multimethod = require('multimethod'); | |
var _ = require('underscore'); | |
// expected message format: {from: String, text: String} | |
var Bot = function() { | |
this.regexps = {}; | |
this.dispatcher = multimethod().dispatch(function(message) { | |
var regexp = _.find(this.regexps, function(regexp, key) { |
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
function (input) { | |
return Math.max.apply(Math, input.split('').map(Number).map(function(num, index, arr) { | |
return arr.slice(index, index+5).reduce(function(memo, num) { | |
return memo * num; | |
}, 1); | |
}, 0)); | |
} |