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 token = 'your-token-here'; // from https://erikberg.com/api for wildcard | |
var agent = 'Your/1.0 <user@agent>'; | |
var fetch = require('node-fetch'); | |
var hooks = {'https://hooks.slack.com/services/…': '#channel', | |
'https://hooks.slack.com/services/…': '#channel'}; | |
var team_table = { | |
"los-angeles-dodgers": ":dodgerslogo:", | |
"san-francisco-giants": ":giants:", |
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
import Foundation | |
struct Dice : SequenceType { | |
typealias Generator = GeneratorOf<Int> | |
let dice:[Int] | |
init (rolls:Int, sides:Int) { | |
dice = Array(count:rolls, repeatedValue:sides) | |
} | |
func roll() -> Int { | |
return dice.map { Int(arc4random_uniform(UInt32($0 - 1)) + 1) } |