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
$ ruby test.rb | |
Run options: --seed 42213 | |
# Running: | |
running setup | |
925762681343 | |
running setup | |
691270111299 | |
.running setup |
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
session = {} | |
# see https://github.com/mperham/dalli | |
def common_cache | |
@common_cache ||= Dalli::Client.new('localhost:11211', { :namespace => "all_apps", :compress => true }) | |
end | |
def session.[] (arg) | |
if arg.to_s == 'access_token' | |
@access_token ||= common_cache.get("sessions/#{self[:user_id]}") |
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 Signup | |
include Virtus | |
extend ActiveModel::Naming | |
include ActiveModel::Conversion | |
include ActiveModel::Validations | |
attr_reader :user | |
attr_reader :company |
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 Proxy | |
def initialize(object) | |
@object = object | |
end | |
def method_missing method, *args, &block | |
if @object.respond_to? method | |
@object.send(method, *args, &block).to_s | |
else |
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/bash | |
function rvmrc-production { | |
export WTGW_ENV_CHOICE='production' # for use in database.yml for example | |
rvm use jruby-1.7.12 --create | |
export JRUBY_OPTS=--2.0 | |
} | |
function rvmrc-development { | |
export WTGW_ENV_CHOICE='development' # for use in database.yml for example |
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 'celluloid/io' | |
require 'http' | |
class Client | |
include Celluloid::IO | |
def transmit | |
HTTP.get('http://127.0.0.1:1337', socket_class: Celluloid::IO::TCPSocket) | |
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
/home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:177:in `read': U+0416 from UTF-8 to ASCII-8BIT (Encoding::UndefinedConversionError) | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:177:in `load_rb' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:166:in `load_file' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:15:in `block in load_translations' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:15:in `each' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/base.rb:15:in `load_translations' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/simple.rb:57:in `init_translations' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0.6.9/lib/i18n/backend/simple.rb:71:in `lookup' | |
from /home/bbozo/.rvm/gems/ruby-1.9.3-p484/gems/i18n-0 |
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
Connecting to database specified by database.yml | |
Cache write: test | |
Dalli::Server#connect 127.0.0.1:11211 | |
Cache read: test | |
.... removed a bunch of boot-up ActiveRecord spam ... | |
Cache read: http://domain_a.somewhere.com/? | |
127.0.0.1:11211 failed (count: 0) RuntimeError: Cannot share client between multiple processes | |
Cache read: http://domain_b.somewhere.com/? |
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 Foo1 | |
FOO = 3 | |
end | |
class Foo2 | |
def self.foo | |
3 | |
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
RuntimeError (can't modify frozen String): | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:51:in `force_encoding' | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:51:in `encode_params' | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:63:in `block in encode_params' | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:56:in `each' | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:56:in `encode_params' | |
actionpack (3.2.16) lib/action_dispatch/http/parameters.rb:12:in `parameters' | |
actionpack (3.2.16) lib/action_dispatch/http/filter_parameters.rb:31:in `filtered_parameters' | |
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:21:in `process_action' | |
actionpack (3.2.16) lib/action_controller/metal/params_wrapper.rb:207:in `process_action' |