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 PaypalExpressController < ApplicationController | |
# ... everything else was covered in the previous blog | |
def purchase | |
if params[:token].nil? or params[:payer_id].nil? | |
redirect_to home_url, :notice => "Sorry! Something went wrong with the Paypal purchase. Please try again later." | |
return | |
end | |
total_as_cents, purchase_params = get_purchase_params @cart, request, params |
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
get "paypal_express/review" |
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
get "paypal_express/purchase" |
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
module PaypalExpressHelper | |
# ... other methods were implemented in the previous blog posts | |
def get_totals(cart) | |
# implemented in the previous blog posts | |
end | |
def to_cents(total) | |
# implemented in the previous blog posts | |
end |
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
list = $('#answers') | |
first = $(list.children()[0]) | |
second = $(list.children()[1]) | |
top = first.offset().top | |
bottom = second.offset().top | |
offsetDiff = bottom - top | |
dragDistance = offsetDiff+1 | |
console.log dragDistance |
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
<% zombie = Zombie.first %> | |
<h1><%= zombie.name %></h1> | |
<p> | |
<%= truncate zombie.graveyard, :length => 10 %> | |
</p> |
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
<% zombie = Zombie.first %> | |
<p> | |
<%= link_to zombie.name, zombie, :class=>"bloody" %> | |
</p> |
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
<% zombies = Zombie.all %> | |
<ul> | |
<% zombies.each do |zombie| %> | |
<li> | |
<%= link_to zombie.name, edit_zombie_path(zombie) %> | |
</li> | |
<% end %> | |
</ul> |
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
def clock(&block) | |
(Time.now.hour % 12 + 1).times do | |
block.call | |
end | |
end |
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
require 'chronic' | |
class Scheduler | |
def self.process(params) | |
raise 'start_date must be supplied' if params[:start_date].nil? | |
raise 'end_date must be supplied' if params[:end_date].nil? | |
raise 'occurs_on must be supplied' if params[:occurs_on].nil? | |
start_date = DateTime.parse params[:start_date] | |
end_date = DateTime.parse params[:end_date] |