Skip to content

Instantly share code, notes, and snippets.

View geetfun's full-sized avatar

Simon Chiu geetfun

View GitHub Profile
@geetfun
geetfun / storage.yml
Created April 26, 2018 18:18
Example mirror storage yaml for ActiveStorage configuration
production:
service: Mirror
primary: amazon1
mirrors:
- amazon2
<style type="text/css">
.ajaxcart__product-meta,
.cart__product-property {
display: none;
}
</style>
<script type="text/javascript">
var cssClasses = [".ajaxcart__product-meta", ".cart__product-property"];
setInterval(function() {
jQuery.each(cssClasses, function(index, cssClass) {
@geetfun
geetfun / uploadcare_signature.rb
Created January 15, 2017 06:54
Uploadcare Signature generation
secret = ENV['UPLOADCARE_SECRET_KEY']
expiry = (DateTime.now + 30.minutes).to_i
@uploadcare_secure_signature = Digest::MD5.hexdigest("#{secret}#{expiry}")
@uploadcare_expiry = expiry
<script type="text/javascript">
var calculateCartTotal = function() {
var total = 0;
$('[data-checkend-total-price]').each(function(index, element) {
var string = $(element).html();
console.log(string);
string = string.trim();
string = string.replace(",", "")
total += parseFloat(string.replace(/[^0-9]/, ''));
});
<!-- Checkend Recurring Billing -->
{% assign row_loop_index = forloop.index %}
{% for p in item.properties %}
{% if p.first == "Subscription" %}
<script>
$.getJSON('https://subscriptionorder.com/product_lookup/{{ item.product.id }}/variants/{{ item.variant.id }}', function(response) {
var discountPercentage = response.discount_percentage;
var discount = Number(discountPercentage) / 100;
var unitPrice = $("#checkend-cart-row-{{row_loop_index}}").find("[data-checkend-unit-price]").data("checkend-unit-price");
var discountUnitPrice = (unitPrice * (1-discount));
@geetfun
geetfun / tabify_code.html
Created August 10, 2016 02:11
Sample Code
<h4>Tab #1</h4>
<p>This is the description under Tab #1.</p>
<p>You precede it with a "Heading" tag. In this case, it's a Heading 4 tag (<h4> in HTML code).</p>
<p>You can add links here, images, and even videos. Pretty much anything that you can add from within the Shopify product editor.</p>
<h4>Tab #2</h4>
<p>This is the description under Tab #2</p>
/*!
* JavaScript Cookie v2.1.0
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
(function (factory) {
var _OldGrowCookies = window.GrowCookies;
var api = window.GrowCookies = factory();
@geetfun
geetfun / checkend-subscription-order.liquid
Created March 22, 2016 17:38
Subscription Order Snippet
<script type="text/javascript">
$(document).on('checkend.subscriptionOptionsRendered', function() {
// Code goes here
});
</script>
@geetfun
geetfun / gist:fe433bb63ff5bf1ebc22
Created March 13, 2016 21:31
Checkend Subscription Order Snippet
<!-- CheckendApps::SubscrtiptionOrder::[email protected] -->
{% assign property_size = item.properties | size %}
{% if property_size > 0 %}
{% for p in item.properties %}
{% unless p.last == blank %}
<br>
<small>
<span style="color: #999999;">
{{ p.first }}
{% if p.first == "Subscription" %}
@geetfun
geetfun / wale_postgres_recovery.md
Created November 19, 2015 08:11 — forked from elithrar/wale_postgres_recovery.md
WAL-E + Postgres 9.x (single server + DB) Setup and Recovery

A quick "how to" on what you need to do to both setup AND recover a single-server PostgreSQL database using WAL-E

  • WAL-E: https://github.com/wal-e/wal-e
  • Assuming Ubuntu 12.04 LTS ("Precise")
  • We'll be using S3. Make sure you have an IAM in a group with GetObject, ListBucket and PutObject on the bucket you want to use (and that it's not public).

Setup:

  1. These packages: