Skip to content

Instantly share code, notes, and snippets.

View iamtravjohnson's full-sized avatar

Travis Johnson iamtravjohnson

  • Austin, TX
View GitHub Profile
@zakhardage
zakhardage / Simple "Captcha" for Shopify
Created July 31, 2014 18:16
Simple "Captcha" for Shopify
// Goes in theme.liquid
{% if template contains 'contact' %}
{{ 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' | script_tag }}
<script type="text/javascript">
$(document).ready(function() {
var n1 = Math.round(Math.random() * 10 + 1);
var n2 = Math.round(Math.random() * 10 + 1);
$("#question").val(n1 + " + " + n2);
$(".contact-form").submit(function (e) {
if (eval($("#question").val()) != $("#answer").val()) {
@rickydazla
rickydazla / collections.liquid.html
Created December 17, 2011 05:42 — forked from davecap/collections.liquid.html
"Infinite" (non-auto) scrolling in Shopify collections
{% paginate collection.products by 20 %}
<ul class="collection-matrix">
{% for product in collection.products %}
<li id="product-{{ forloop.index | plus:paginate.current_offset }}">
{% include 'product' with product %}
</li>
{% endfor %}
<li class="top"><a href="#collectionpage">Back to Top</a> &uarr;</li>
{% if paginate.next %}
<li class="more">&darr; <a href="{{ paginate.next.url }}">More</a></li>