This is an example of code highlighting
class Ruby
def blah
end
end| require "rubygems" | |
| require 'rails/all' | |
| class MyApp < Rails::Application | |
| config.active_support.deprecation = :log | |
| end | |
| class MyView | |
| include ActionView::Helpers::TagHelper | |
| end |
| source 'https://rubygems.org' | |
| gem 'apartment' | |
| gem 'sidekiq' | |
| gem 'rails' | |
| gem 'pg' |
| require 'eventmachine' | |
| require 'em-synchrony' | |
| require "em-synchrony/em-http" | |
| require 'net/http' | |
| require 'benchmark' | |
| def em_http | |
| EM.synchrony do | |
| multi = EventMachine::Synchrony::Multi.new | |
| multi.add :page1, EventMachine::HttpRequest.new("http://localhost:3000/page1").aget |
| # Install with: | |
| # bash < <(curl -L https://raw.github.com/gist/1333785) | |
| # | |
| # Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
| echo "Installing ruby-debug with ruby-1.9.3-p125 ..." | |
| curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
| curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |
This is an example of code highlighting
class Ruby
def blah
end
end| class Deal < AR | |
| attr_reader :minimum_order, :board_lot_size, :unit_value, :allocation_value | |
| end | |
| # last level allocation rate | |
| # planned allocations | |
| # deal | |
| class DealAllocation < AR | |
| belongs_to :deal |
| # Say you have different types of pet classes. It appears that using method_missing is preferable | |
| # over using DelegateClass as we can decide our target at runtime. Is there a way to accomplish | |
| # this type of behaviour using DelegateClass ? | |
| def PetDecorator | |
| def initialize(target) | |
| @target = target | |
| end | |
| def talk |
| def configure(token) | |
| user = User.find_by_token(token) | |
| user.update_attributes(:confirmed => true) if user | |
| user | |
| end |
| # we can name each result set eg. top_male_times_this_season | |
| result | |
| | name | | |
| # it's unlikely that we're going to reuse results, so we should scope them by the result they belong to | |
| results | |
| | age | time | gender | result_id | | |
| | 23 | 55:11 | M | 1 | | |
| | 49 | 1:27:51 | F | 2 | |