Skip to content

Instantly share code, notes, and snippets.

View rickydazla's full-sized avatar

Rick Davies rickydazla

View GitHub Profile
@ridem
ridem / Download-Shopify-CDN-Assets.md
Last active October 28, 2023 12:15
Download all Shopify CDN assets from a store

Instructions

  1. Go to your Shopify admin/settings/files page
  2. Open your browser Dev tools, go to the console

Then, depending on the option you choose:

Option 1 - Download all the files directly (might crash you browser)

  1. Make sure your browser is set to download files automatically and doesn't ask for the download location every time
@AllThingsSmitty
AllThingsSmitty / flexslider.htm
Created February 1, 2015 03:45
Lazy loading images for FlexSlider
<section class="slider">
<div class="flexslider">
<ul class="slides">
<li><img src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
</ul>
</div>
@freakdesign
freakdesign / edit-button-min.js
Last active August 26, 2016 14:42 — forked from carolineschnapp/new_gist_file.liquid
Add edit button to Shopify page
(function(){if(document.getElementById("admin_bar_iframe")){var d=function(a){"undefined"===typeof a&&(a="Sorry, that can not be run here...");console.warn(a);return!1},e=function(a,c){var b=new XMLHttpRequest;b.open("GET",a,!1);b.onreadystatechange=function(){if(4==b.readyState&&200==b.status&&"function"===typeof c){var a;a:{try{JSON.parse(b.responseText)}catch(e){a=!1;break a}a=!0}if(!a)return d("That does not look like json...");a=JSON.parse(b.responseText);c(a,Object.keys(a)[0])}};b.send()},c=
document.createElement("button");c.id="admin_bar_iframe";c.style="position: fixed;top: 70px;right: 1em;background-color: rgb(16, 206, 223);padding: .75em 1em;color: #FFF;cursor: pointer;border:none;z-index:99999";c.innerHTML="Edit This";c.addEventListener("click",function(a){a.target.blur();if("/"===location.pathname)return d();if("blogs"===location.pathname.split("/")[1])return"undefined"!==typeof __st&&__st.s?(location.href=[location.protocol,"//",location.host,"/admin/articles/",__st.s.split("-")[1]].join(""),
!1
@gefangenimnetz
gefangenimnetz / materialDesignShadowHelper.less
Last active December 17, 2022 17:21
Less css box-shadow helper for cards & modals according to Googles Material Design spec.
/**
* A mixin which helps you to add depth to elements according to the Google Material Design spec:
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality
*
* Please note that the values given in the specification cannot be used as is. To create the same visual experience
* the blur parameter has to be doubled.
*
* Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp)
*
* Example usage:
@willbroderick
willbroderick / jquery.shopifyproductfill.js
Last active December 7, 2016 17:29
Fill an HTML template with an arbitrary Shopify product, with AJAX
/*
Fill an HTML template with a Shopify product
MIT license.
Example use:
<span class="prev" data-fill-with-product="{{ collection.previous_product | split: '/' | last }}">
<script type="text/template">
<a href="{{ collection.previous_product }}" title="[encode:title]">
<span class="title">[title]</span>
<img src="[img:600x]" />
@carolineschnapp
carolineschnapp / gist:f014bf78daf2684185d7
Created May 7, 2014 15:11
JavaScript tag to place at the bottom of collection.liquid to handle both the .sort-by select and the .coll-filter selects.
<script>
Shopify.queryParams = {};
if (location.search.length) {
for (var aKeyValue, i = 0, aCouples = location.search.substr(1).split('&'); i < aCouples.length; i++) {
aKeyValue = aCouples[i].split('=');
if (aKeyValue.length > 1) {
Shopify.queryParams[decodeURIComponent(aKeyValue[0])] = decodeURIComponent(aKeyValue[1]);
}
}
}
<div>
<label for="sort-by">Sort by</label>
<select id="sort-by">
<option value="manual">Featured</option>
<option value="price-ascending">Price: Low to High</option>
<option value="price-descending">Price: High to Low</option>
<option value="title-ascending">A-Z</option>
<option value="title-descending">Z-A</option>
<option value="created-ascending">Oldest to Newest</option>
<option value="created-descending">Newest to Oldest</option>
@jacrook
jacrook / font_variables.scss
Last active June 16, 2024 18:15
Sass Css Font Stack Variables
//////////////////////////////////////////////////////////////
// Font Variables (http://cssfontstack.com/)
//////////////////////////////////////////////////////////////
//
// Serif font-stacks
//
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default;
@willbroderick
willbroderick / split_images_from_content.liquid
Last active December 31, 2015 22:29
Liquid code to separate X number of images from html content - for displaying these in separate areas.
{% comment %}
Use:
{% include 'split_images_from_content' with collection.description %}
<div class="header">{{ split_images }}</div>
<div class="description">{{ split_content }}</div>
{% endcomment %}
{% assign num_to_split = 1 %}
{% assign split_content = split_images_from_content %}
{% assign split_images = '' %}
@darryn
darryn / Shopify tag filter groups
Last active August 23, 2023 03:51
Create tag filter groups in Shopify. This snippet is designed to group and separate out collection tags. It requires the tags to share a common value prepended to the tag with an underscore. E.g. to create a separate tag filter group for 'brands', each product will need to be tagged with 'brand_Nike' or 'brand_Reebok'. Some of this is probably l…
{% if template contains 'collection' and collection.all_tags.size > 1 %}
<!-- A recursive loop to catch and filter out the different tag categories -->
{% assign c = 0 %}
{% for t in collection.all_tags %}
{% capture cat %}{{ cat }}{% capture temp_cat %}{% if t contains '_' %}{% assign cat_grp = t | split: '_' %}{{ cat_grp.first }}{% endif %}{% endcapture %}{% unless cat contains temp_cat %}{% if t contains '_' %}{% assign new_cat_grp = t | split: '_' %}{{ new_cat_grp.first }}{% endif %}{% unless forloop.last %}+{% endunless %}{% assign c = c | plus: 1 %}{% endunless %}{% endcapture %}
{% endfor %}
<!-- create array of tag categories -->
{% assign cat_array = cat | split: '+' %}