Skip to content

Instantly share code, notes, and snippets.

View NathanPJF's full-sized avatar

Nathan Ferguson NathanPJF

View GitHub Profile
@NathanPJF
NathanPJF / Multipe Other Shippers.md
Created July 14, 2015 13:25
If you ever wanted to use multiple unsupported tracking companies in email templates, you can set it up using this gist. It requires a little manual work on the merchants end, but is easy and yields infinite trackers.

    {% if fulfillment.tracking_company and fulfillment.tracking_company != 'Other' %}
       {{ fulfillment.tracking_urls }}
    {% else %}
        {% assign custom_tracking =  fulfillment.tracking_numbers | split: '-' %}
        
        {% if custom_tracking[0] contains "XX" %}
             CUSTOM_TRACKING_URL={{ custom_tracking[1] }}
 {% elsif custom_tracking[0] contains "YY" %}
@NathanPJF
NathanPJF / gist:251d85aee0a917e12bba
Last active January 2, 2018 11:01
[Collection loop] Check odd/even
{% for product in collection.products %}
{% comment %}
{% capture remainder %}{{forloop.index | modulo: 2}}{% endcapture %}
{% if remainder == '0' %}
{% assign is_even = true %}
{% else %}
{% assign is_even = false %}
{% endif %}
@NathanPJF
NathanPJF / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console