This file contains hidden or 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
| require 'rubygems' | |
| require 'amqp' | |
| require 'mq' | |
| EM.error_handler {|e| | |
| p [:exception, e] | |
| } | |
| EM.run do |
This file contains hidden or 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
| chain | |
| (addCustomHeaders) | |
| (errorHandler) | |
| (deflate) | |
| (route | |
| ("/foo", chain(fooApp)()) // the () ends the chain | |
| (/^\/blog\/(.*)/, chain(funkyBlogApp)()) // the () ends the chain | |
| (/^\/static\//, chain | |
| (farFutureExpiresHeader) | |
| (route |
This file contains hidden or 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(){ | |
| var original_ajax = jQuery.ajax; | |
| jQuery.ajax = function(opts){ | |
| var self = this; | |
| return setTimeout(function(){ | |
| original_ajax.call(self, opts); | |
| }, 2000); | |
| }; | |
| })(); |
This file contains hidden or 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
| # encoding: utf-8 | |
| require 'methopara' | |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'dm-core' | |
| require 'dm-types' | |
| require 'dm-serializer' | |
| require 'dm-validations' | |
| require 'dm-migrations' |
This file contains hidden or 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
| # spec helper | |
| Spec::Runner.configure do |config| | |
| # snip | |
| config.include(Rack::Test::Methods) | |
| end |
This file contains hidden or 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
| def on_time_value | |
| attendances.inject(0){|sum, a| a.late? ? sum : sum + 5} | |
| end |
This file contains hidden or 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
| def f(ra,n) | |
| ra.inject(0) { |r,x| r += 1 if x.include? n; r } | |
| end |
This file contains hidden or 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
| def f(ra,n) | |
| ra.inject(0) { |r,x| r += 1 if x.include? n; r } | |
| end |
This file contains hidden or 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
| def f(ra,n) | |
| ra.inject(0) { |r,x| r += 1 if x.include? n; r } | |
| end |
This file contains hidden or 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
| def f(ra,n) | |
| ra.inject(0){ |c, x| x.include? n ? c + 1 : c } | |
| end |