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
| #!/bin/sh | |
| # Install the dependencies | |
| sudo apt-get -y remove ffmpeg x264 libx264-dev | |
| sudo apt-get -y update | |
| sudo apt-get -y install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev | |
| # Install x264 | |
| cd | |
| git clone git://git.videolan.org/x264.git |
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 'erb' | |
| # DynamicAccessors source file found here: http://gist.github.com/215257 | |
| require File.dirname(__FILE__) + '/dynamic_accessors' | |
| module Sprout # :nodoc | |
| # Rake task that makes it stupid-easy to render ERB templates | |
| # to disk. Just add parameters to the yielded object, and | |
| # they will be available to your Template. |
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
| ; Copyright (c) Rich Hickey. All rights reserved. | |
| ; The use and distribution terms for this software are covered by the | |
| ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
| ; which can be found in the file epl-v10.html at the root of this distribution. | |
| ; By using this software in any fashion, you are agreeing to be bound by | |
| ; the terms of this license. | |
| ; You must not remove this notice, or any other, from this software. | |
| (set! *warn-on-reflection* true) |
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 Remote < ActiveRecord::Base | |
| @abstract_class = true | |
| def self.db_context(db_name, &block) | |
| if block_given? | |
| block.call remote_class(db_name) | |
| else | |
| return remote_class(db_name) | |
| 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
| class Remote < ActiveRecord::Base | |
| @abstract_class = true | |
| def self.db_context(db_name, &block) | |
| if block_given? | |
| block.call remote_class(db_name) | |
| else | |
| return remote_class(db_name) | |
| 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
| # If you'd like this packaged up as a gem, send me a note. You can get | |
| # in touch with me at http://www.techiferous.com/about | |
| require 'nokogiri' | |
| require 'ispell' | |
| module Rack | |
| class SpellCheck | |
| def initialize(app, options = {}) |
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
| # See also http://github.com/simonjefford/rack_firebug_logger | |
| # for this middleware + tests + a rails plugin | |
| class FirebugLogger | |
| def initialize(app, options = {}) | |
| @app = app | |
| @options = options | |
| end | |
| def call(env) | |
| dup._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
| require 'geoip' | |
| module Rack | |
| # Rack::GeoIPCountry uses the geoip gem and the GeoIP database to lookup the country of a request by its IP address | |
| # The database can be downloaded from: | |
| # http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | |
| # | |
| # Usage: | |
| # use Rack::GeoIPCountry, :db => "path/to/GeoIP.dat" | |
| # |
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
| class ApplicationController < ActionController::Base | |
| private | |
| # To write subdomains on the url helpers: | |
| # root_url(nil, {:subdomain => "subdomain"}) | |
| def url_for(options = nil) | |
| case options | |
| when Hash | |
| if subdomain = options.delete(:subdomain) |