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
# This version works in Rails 3.2 | |
require 'redcarpet' | |
class ActionView::Template | |
class Redcarpet | |
def call( template ) | |
renderer.render( template.source ).inspect | |
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
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 | |
# --------------------------------------------------------------------------- |