This file contains 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
Prefix Verb URI Pattern Controller#Action | |
events_summary GET /events/summary(.:format) events#summary | |
event_attendees GET /events/:event_id/attendees(.:format) attendees#index | |
POST /events/:event_id/attendees(.:format) attendees#create | |
new_event_attendee GET /events/:event_id/attendees/new(.:format) attendees#new | |
edit_event_attendee GET /events/:event_id/attendees/:id/edit(.:format) attendees#edit | |
event_attendee GET /events/:event_id/attendees/:id(.:format) attendees#show | |
PATCH /events/:event_id/attendees/:id(.:format) attendees#update | |
PUT /events/:event_id/attendees/:id(.:format) attendees#update | |
DELETE /events/:event_id/attendees/:id(.:format) attendees#destroy |
This file contains 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
2.0.0p247 :001 > rake nagging_email:send | |
ArgumentError: no method name given | |
from (irb):1 | |
from /Users/Simon/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start' | |
from /Users/Simon/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start' | |
from /Users/Simon/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>' | |
from bin/rails:4:in `require' | |
from bin/rails:4:in `<main>' |
This file contains 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
# app/models/user.rb | |
class User | |
attr_reader :payment_gateway | |
def initialize | |
@payment_gateway = PaymentGateway::Braintree.new | |
end | |
def charge_for_subscription |
This file contains 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
Before: | |
def create | |
@transaction = current_order.build_transaction(transaction_params) | |
@transaction.update(:order_id => current_order.id) | |
if @transaction.save | |
@transaction.pay! | |
if current_user | |
current_order.update(:user_id => current_user.id, :status => "paid") | |
else | |
current_order.update(:status => "paid") |
This file contains 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
#user nobody; | |
worker_processes 1; | |
error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
This file contains 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 Fizzbuzz < Struct.new(:max) | |
MUTATIONS = { | |
'fizzbuzz' => ->(i) {i % 3 == 0 && i % 5 == 0}, | |
'fizz' => ->(i) {i % 3 == 0}, | |
'buzz' => ->(i) {i % 5 == 0} | |
} | |
def fizzle | |
1.upto(max).map do |i| | |
mutations.find(-> {[i]}) do |k, v| |
This file contains 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
"1001" + "11" ---> "1100" | |
"1" + "1" ---> "10" | |
def add(number_one, number_two) | |
# "1011" | |
# "1111" | |
# 1110" | |
ones_digit = number_one[-1] | |
result = "" |
This file contains 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
title: Filters | |
output: basic.html | |
controls: true | |
-- | |
# Filters | |
## Controllers | |
-- |
This file contains 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
desc 'Benchmark funds_raised methods' | |
ITERATIONS = 100_000 | |
task benchmark_sql: :environment do | |
GC.disable | |
campaign = Campaign.last | |
Benchmark.bm do |bm| | |
bm.report('sql') do |
This file contains 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
desc 'Benchmark funds_raised methods' | |
ITERATIONS = 1000 | |
task benchmark_sql: :environment do | |
campaign = Campaign.last | |
Benchmark.bm do |bm| | |
bm.report('sql') do | |
ITERATIONS.times do |
OlderNewer