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
| YUI.add "card", (Y) -> | |
| Card = Y.Base.create "card", Y.Widget, [Y.WidgetChild], | |
| BOUNDING_TEMPLATE: "<li></li>" | |
| CONTENT_TEMPLATE: "<div></div>" | |
| renderUI: -> | |
| @_renderCard() |
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
| gem install s3 |
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
| gem install magic |
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
| namespace :patch do | |
| desc "Applies patches to Rails frozen in vendor" | |
| task :rails do | |
| rails_dir = Rails.root.join("vendor", "rails") | |
| Rails.root.join("patch", "rails").children.each do |patch| | |
| patch(patch, rails_dir) | |
| end | |
| end | |
| desc "Applies patches to gems frozen in vendor" |
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
| sudo apt-get install ruby rubygems libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev curl | |
| sudo gem install rvm | |
| /var/lib/gems/1.8/bin/rvm-install |
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 UserNotifier < ActionMailer::Base | |
| # sample message | |
| def some_message(user) | |
| from %Q{"Internal Messaging System"} | |
| recipients user.email | |
| subject "This is internal message" | |
| body :user => user | |
| end | |
| # sample message notification |
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 "json" | |
| class JavaScriptI18n | |
| def self.call(env) | |
| locale = env["PATH_INFO"][1..-4] | |
| if translations.key?(locale) | |
| [200, {"Content-Type" => "text/javascript"}, new(translations[locale])] | |
| else | |
| [404, {}, "Not found"] | |
| 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
| use Rack::Static, :urls => [""]; run nil |
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
| Devise::ALL.dup.each do |name| | |
| class_name = name.to_s.classify | |
| to_class = WebsiteAccount | |
| to_instance = :website_account | |
| class_eval <<-METHODS, __FILE__, __LINE__ + 1 | |
| module Devise::Models::Delegated#{class_name} | |
| extend ActiveSupport::Concern | |
| included 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
| def read_body # Net::HTTPResponse#read_body | |
| yield "foo"; yield "bar"; yield "baz" | |
| end | |
| class R # A Rack Streaming response | |
| def initialize | |
| @l = lambda do |block| | |
| read_body do |chunk| # Net::HTTPResponse#read_body | |
| sleep(0.5) | |
| block.call(chunk) |