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
I started at Shopify on Tuesday, September 3rd, 2013. |
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
self.per_page = 15 |
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
gem 'stripe' |
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
rails g controller charges |
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 new | |
end | |
def create | |
# Amount in cents | |
@amount = 500 | |
customer = Stripe::Customer.create( | |
:email => params[:stripeEmail], | |
:source => params[:stripeToken] |
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
bin/rails generate migration NameOfMigration |
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 NameOfMigration < ActiveRecord::Migration[5.0] | |
def change | |
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
<!-- rare.io subscription form --> | |
<style type="text/css"> | |
.rare-signup-form{background:#fff;clear:left;font:14px Helvetica,Arial,sans-serif;color: #545454;} | |
.rare-signup-form label,.rare-signup-form input{display:block;margin-top:10px} | |
.rare-signup-form label{font-weight:700} | |
.rare-signup-form input[type="text"]{width:100%;padding:8px 16px;font-size:16px;height:auto;border-width:2px;width:100%;height:34px;padding:6px 12px;border:1px solid #ccc;border-radius:4px;line-height:1.42857143;color:#555} | |
.rare-signup-form input[type="submit"]{background:#19A0CF;color:#fff;display:inline-block;border:0;-webkit-border-radius:5px;border-radius:5px;text-decoration:none;font-size:15px;font-weight:400;line-height:1em;padding:12px 25px} | |
</style> | |
<div class="rare-signup-form"> | |
<form method="POST" action="https://api4.rarelogic.com/shop/rarelogic/subscribe"> |
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
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.tags.include?('MyTag') | |
line_item.change_line_price(line_item.line_price - Money.new(cents: 500), message: "$5 Off") | |
end | |
Output.cart = Input.cart |
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
PAID_ITEM_COUNT = 1 | |
DISCOUNTED_ITEM_COUNT = 1 | |
# Returns the integer amount of items that must be discounted next | |
# given the amount of items seen | |
# | |
def discounted_items_to_find(total_items_seen, discounted_items_seen) | |
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen | |
end |
OlderNewer