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
<div class=".payment-errors"></div> | |
<form action="REPLACE WITH AN ACTUAL URL HELPER" method="post" id="stripe-form"> | |
<div class="formset"> | |
<label>Card Number</label> | |
<input type="text" size="20" autocomplete="off" class="credit-number" /> | |
</div> | |
<div class="formset"> | |
<label>Security Code/CVC</label> |
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
Stripe.setPublishableKey('PUBLISHABLE KEY'); |
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
function stripeResponseHandler(status, response) { | |
if (response.error) { | |
$(".payment-errors").text(response.error.message); | |
} | |
else { | |
var form$ = $("#stripe-form"); | |
var token = response['id']; | |
form$.append("<input type='hidden' name='stripeToken' value='" + token + "'/>"); | |
form$.get(0).submit(); |
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
token = params[:stripeToken] | |
customer = Stripe::Customer.create( | |
:card => token, | |
:plan => "medium", | |
:email => "customeremail@example.com" | |
) |
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
<% ps = Post.where(:author => "Dhaivat Pandya", :blog => "Something", | |
:language => "English", :market => "developers")[0] %> | |
<% if ps.time_posted.nil? %> | |
Oops, using old system please revert. | |
<% end %> | |
<div id="times"> | |
<span class="age"><%= Date.today - ps.time_posted %></span> | |
<span class="age_edited"><%= Date.today - ps.time_edited %></span> |
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 User < ActiveRecord::Base | |
... | |
def self.find_logins_at_time(time) | |
#method implementation | |
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
<% if no_time_included %> | |
Oops, using old system please revert. | |
<% end %> | |
<div id="times"> | |
<span class="age"><%= @age %></span> | |
<span class="age_edited"><%= @age_edited %></span> | |
</div> | |
<div id="post-<%= @id %>" data-id="<%= @p_id %>"> |
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
forward 1 | |
fire | |
backward 2 | |
fire | |
right 16 | |
fire | |
backward 2 | |
fire | |
left 2 |
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
forward 1 | |
left 16 | |
forward 5 | |
right 6 | |
backward 3 |
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 Robot | |
def forward | |
puts "forward" | |
end | |
def backward | |
puts "backward" | |
end | |
def right |