v. 3.0.0
- created, ignoring all previous incarnations of the rules, from draft of an email
v 3.0.1
- Clarifications
| ActiveRecord::Base.class_eval do | |
| public :callback | |
| def self.define_background_callback(callback_name) | |
| class_eval <<-RUBY | |
| define_callbacks :background_#{callback_name} # define_callbacks :background_after_create | |
| # | |
| #{callback_name} do |object| # after_create do |object| | |
| object.queue_background_callbacks(:#{callback_name}) # object.queue_background_callbacks(:after_create) | |
| end # end |
| # Use local clones if possible. | |
| # If you want to use your local copy, just symlink it to vendor. | |
| def custom_gem(name, options = Hash.new) | |
| local_path = File.expand_path("../vendor/#{name}", __FILE__) | |
| if File.exist?(local_path) | |
| gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) } | |
| else | |
| gem name, options | |
| end | |
| end |
| # CANDY Extension | |
| PROMPT_PREFIX="%{$fg[blue]%}[%{$reset_color%}" | |
| PROMPT_SUFFIX="$fg[blue]%}]%{$reset_color%}" | |
| HOST_PROMPT="%{$fg_bold[green]%}%n@%m" | |
| DATE_PROMPT="$PROMPT_PREFIX%{$fg[red]%}%D{%I:%M:%S}$PROMPT_SUFFIX" | |
| PWD_PROMPT="$PROMPT_PREFIX%{$fg[white]%}%~$PROMPT_SUFFIX" | |
| LEADER_PROMPT="%{$fg_bold[blue]%}\$%{$reset_color%}" | |
| # Get the current ruby version in use with RVM: |
| # app/models/user_extensions/admin.rb | |
| module UserExtensions | |
| module Admin | |
| extend ActiveSupport::Concern | |
| ADMIN = 'admin' | |
| module ClassMethods |
| require 'rubygems' | |
| require 'test/unit' | |
| require 'watir-webdriver' | |
| class LoginTest < Test::Unit::TestCase | |
| def setup | |
| @browser = Watir::Browser.new :ff | |
| end |
| module EventMachine | |
| module WebSocket | |
| class MaskedString < String | |
| def read_mask | |
| raise "Too short" if bytesize < 4 # TODO - change | |
| @masking_key = String.new(self[0..3]) | |
| end |
| <% autoescape do %> | |
| <div> | |
| <%= content_helper_gets_escaped %> | |
| </div> | |
| <% end %> |
| class Server | |
| def start | |
| EM.run { | |
| EM.start_server @host, @port, Client::Socket, :app => self do |players| | |
| @players << player | |
| player.send_data("READY\r\n") | |
| end |
| EM.run { | |
| # our fantastic eventmachine code | |
| } |