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
app.get '/riders', (req, res) -> | |
redis.smembers 'riders', ( err, replies ) -> | |
pool = new RequestPool ( rider, callback ) -> redis.hgetall rider, callback | |
pool.push rider for rider in replies | |
pool.go -> alert 'Done!' |
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 User < Struct.new(:name, :phone, :email) | |
end | |
# --------------------------------------------------------------------------- | |
# Extend on demand | |
# + no dependency on User class, could be reusable | |
# + composable | |
# - cannot unextend user object once extended, but this object could be short | |
# lived | |
# --------------------------------------------------------------------------- |
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
#!/usr/bin/env ruby -wKU | |
require "yaml" | |
=begin | |
TODO this could all use a little DRYing up | |
=end | |
class Event | |
TYPE_PATTERN = /public\s+static\s+(?:const|var)\s+([A-Z_]+)\s+:\s+String\s+=\s+(.*?);/ | |
CLASS_PATTERN = /public\s+class\s+(\w+)\s+extends\s+Event/ |
NewerOlder