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
| #!/usr/bin/env ruby | |
| $: << File.join(File.dirname(__FILE__), '../lib') | |
| require 'goliath' | |
| require 'em-mongo' | |
| require 'em-http' | |
| require 'em-synchrony/em-http' | |
| require 'yajl/json_gem' | |
| require 'goliath/synchrony/mongo_receiver' # has the aroundware logic for talking to mongodb | |
| require File.join(File.dirname(__FILE__), 'auth_receiver') |
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
| class Barrier < EM::Synchrony::Multi | |
| attr_accessor :env, :status, :headers, :body | |
| def initialize env | |
| super() | |
| @env = env | |
| @acb = env['async.callback'] | |
| env['async.callback'] = self | |
| callback 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
| require 'goliath' | |
| require 'http_router' | |
| # https://github.com/joshbuddy/http_router | |
| HttpRouter::Rack.override_rack_builder! | |
| class RackRoutes < Goliath::API | |
| map('/get/:id') do |env| | |
| [200, {'Content-type' => 'text/plain'}, ["My id is #{env['router.params'][:id]}\n"]] | |
| 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
| # Add this to more_web_steps.rb | |
| # Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today! | |
| When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text| | |
| alert = page.driver.browser.switch_to.alert | |
| alert.text.should eq(text) | |
| alert.send(action) | |
| 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
| BEGIN { | |
| require 'net/http' | |
| Net::HTTP.module_eval do | |
| alias_method '__initialize__', 'initialize' | |
| def initialize(*args,&block) | |
| __initialize__(*args, &block) |
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 self.cached_method(meth) | |
| eval <<-CODE | |
| def #{meth}_with_cache | |
| return @#{meth} if @#{meth} | |
| result = #{meth}_without_cache | |
| @#{meth} ||= result | |
| end | |
| CODE | |
| alias_method_chain meth, :cache | |
| 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
| #!/usr/bin/env sh | |
| # subgit | |
| # | |
| # A tiny wrapper around git to help you manage | |
| # Git sub-projects easily, safely, and simply. | |
| # | |
| # Created by Rusty Klophaus (@rklophaus) | |
| # | |
| # See http://rklophaus.com/subgit for usage. |
NewerOlder