View gist:4385cf7e70ec7a03e1fe2a0314f52f2a
64 bytes from 216.58.217.142: icmp_seq=9 ttl=53 time=338.567 ms
64 bytes from 216.58.217.142: icmp_seq=10 ttl=53 time=322.274 ms
64 bytes from 216.58.217.142: icmp_seq=11 ttl=53 time=126.302 ms
64 bytes from 216.58.217.142: icmp_seq=12 ttl=53 time=168.253 ms
64 bytes from 216.58.217.142: icmp_seq=13 ttl=53 time=35.626 ms
64 bytes from 216.58.217.142: icmp_seq=14 ttl=53 time=84.729 ms
64 bytes from 216.58.217.142: icmp_seq=15 ttl=53 time=409.794 ms
64 bytes from 216.58.217.142: icmp_seq=16 ttl=53 time=175.656 ms
64 bytes from 216.58.217.142: icmp_seq=17 ttl=53 time=58.228 ms
64 bytes from 216.58.217.142: icmp_seq=18 ttl=53 time=72.543 ms
View bin-setup
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
View highlight.sh
highlight -O rtf 03.with_multiple_orms.rb --font-size 24 --font Inconsolata --style zenburn -W -J 80 -j 3 --src-lang ruby | pbcopy
View gist:0b9f6c477812817725741da212f571a0
Devise.setup do |config|
config.mailer_sender = ENV['EMAIL_FROM']
require 'devise/orm/active_record'
config.case_insensitive_keys = [:email]
config.strip_whitespace_keys = [:email]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 11
config.pepper = ENV['PASSWORD_PEPPER']
View null_seller.rb
# Only the sysadmin will have this type of {Seller}
class NullSeller < Seller
def active?
true
end
def activated?(key)
true
end
View null_object.rb
class Seller
belongs_to :user
def can_add_products?
products.count < seller.products_limit
end
def seller
if is_sysadmin?
NullSeller.new
View check_payments.rb
class PaymentGateway::MangoGateway < PaymentGateway
# Checks for payments
def check_payments
begin
payments = Mango::Charges.list(secret_api_key)
if payments.any?
logger.info "payments: #{payments.inspect}"
logger.info "[Mango] Payment Found! "
# ...
end
View talk.rb
class Animal
attr_accessible :kind
def talk
fail "I don't know how to talk! "
end
end
class Cat < Animal
def talk
View start.sh
#!/bin/bash
bundle check || bundle install
bundle exec rake db:migrate
bundle exec rails server
View setup.rb
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
chdir APP_ROOT do
# This script is a starting point to setup your application.