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
| # Variation on Hashrocket's script for managing the git process | |
| # as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html | |
| # Create shell scripts out of each of these, put them in your path (~/bin for example) | |
| # chmod 755 them and use like this: | |
| # | |
| # This version of hack is totally different than Hackrockets. I feel that hack implies | |
| # that you are getting started, not finishing up. sink is Hashrockets hack. | |
| # | |
| # $ hack branch_name | |
| # Test and Implement until done |
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
| module Rack | |
| class ChromeFrame | |
| def initialize(app, options={}) | |
| @app = app | |
| end | |
| def call(env) | |
| status, headers, response = @app.call(env) | |
| if env['HTTP_USER_AGENT'] =~ /MSIE/ && response.content_type == 'text/html' |
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 'net/http' | |
| class ServerProxy | |
| def self.call(env) | |
| if env["PATH_INFO"] =~ /^\/server_proxy/ | |
| request = Rack::Request.new(env) | |
| params = request.params | |
| Net::HTTP.start(params["service_url"]) {|http| | |
| req = Net::HTTP::Get.new(params["service_path"]) |
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 Rack::ResponseTimeInjector | |
| def initialize(app, options = {}) | |
| @app = app | |
| @format = options[:format] || "%f" | |
| end | |
| def call(env) | |
| t0 = Time.now | |
| returning @app.call(env) do |response| | |
| response.last.body.gsub! /\$responsetime(?:\((.+)\))?/ 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
| module Rack | |
| class ZombieShotgun | |
| ZOMBIE_AGENTS = [ | |
| /FrontPage/, | |
| /Microsoft Office Protocol Discovery/, | |
| /Microsoft Data Access Internet Publishing Provider/ | |
| ].freeze | |
| ZOMBIE_DIRS = ['_vti_bin','MSOffice','verify-VCNstrict','notified-VCNstrict'].to_set.freeze |
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
| # Temporary middleware for your APIs to immediately support a /v1/some/path.json prefix to | |
| # all route calls. | |
| # | |
| # When you decide to freeze a current API and provide a /v2/ route then | |
| # you will cease using this middleware and implement /v1/ and /v2/ routing as appropriate | |
| # to your app. | |
| # | |
| # This middleware provides a placeholder until then so users can be told to use /v1/some/path routes | |
| # immediately. | |
| # |
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 "net/http" | |
| # Example Usage: | |
| # | |
| # use Rack::Proxy do |req| | |
| # if req.path =~ %r{^/remote/service.php$} | |
| # URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}") | |
| # end | |
| # 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
| module Rack | |
| class NoIE | |
| def initialize(app, options = {}) | |
| @app = app | |
| @options = options | |
| @options[:redirect] ||= 'http://www.microsoft.com/windows/internet-explorer/default.aspx' | |
| @options[:minimum] ||= 7.0 | |
| end | |
| def call(env) |
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
| module Rack | |
| class GoogleAnalytics | |
| TRACKING_CODE = <<-EOCODE | |
| <script type="text/javascript"> | |
| var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
| document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
| </script> | |
| <script type="text/javascript"> | |
| try { | |
| var pageTracker = _gat._getTracker("{{ID}}"); |
OlderNewer