Skip to content

Instantly share code, notes, and snippets.

View thisislawatts's full-sized avatar

Luke Watts thisislawatts

View GitHub Profile
@thisislawatts
thisislawatts / console.js
Created November 9, 2015 09:22
Extract Shopify Shipping Rates as json
jQuery.get('/admin/countries.json', function(res) {
var str = '<script>var AC = window.AC || {};' + "\r";
str += 'AC.shipping = ' + JSON.stringify(res.countries) + '</script>';
document.body.innerHTML = '<code>' + str + '</code>';
});
@thisislawatts
thisislawatts / gist:efbdf8019a84eeb9d9c7
Created October 30, 2015 20:38
Sublime Text find and replace for stripping out compass mixins
# appearance|background-size|border-bottom-left-radius|border-top-left-radius|border-bottom-right-radius|border-top-right-radius|border-radius|box-shadow|box-sizing|columns|column-gap|column-count|column-width|filter|hyphens|opacity|rotate|text-shadow|transition|transition-property|transition-duration|transition-timing-function|word-break
@include (appearance|background-size|border-bottom-left-radius|border-top-left-radius|border-bottom-right-radius|border-top-right-radius|border-radius|box-shadow|box-sizing|columns|column-gap|column-count|column-width|filter|hyphens|opacity|rotate|text-shadow|transition|transition-property|transition-duration|transition-timing-function|transform|word-break)\((.*)(?=\))\);
@thisislawatts
thisislawatts / export.rb
Last active October 10, 2015 11:02
Shopify Pages Export & Import via CLI
# Connect to the store you're exporting from
include ShopifyAPI
File.write('pages.data', Page.all.to_json )
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2015-08-25T11:35:09.127Z",
@thisislawatts
thisislawatts / array_unique_deep.php
Created August 21, 2015 10:16
array_unique_deep
function array_unique_deep( $array ) {
$uniq = array();
foreach ($array as $key => $value) {
$str = json_encode( $value );
if ( in_array( $str, $uniq ) ){
unset( $array[$key] );
} else {
$uniq[] = $str;
@thisislawatts
thisislawatts / gist:b87792fcd06c92d9d7dd
Created July 30, 2015 12:00
Phishing link. *Don't Click*
https://googleappdocsm-reviewupdateall.rhcloud.com/news/vielogsi/
@thisislawatts
thisislawatts / utils.liquid
Last active August 29, 2015 14:24
Liquid Counter Loop
{% comment %}
I only want to echo out `Do something` six times on this page
But `something_we_cant_limit might` could contain 22 items or 2
{% endcomment %}
{% assign counter = 'i' %}
{% for item in something_we_cant_limit %}
{% capture counter %}{{ counter }}i{% endcounter %}
{% if capture.size < 6 %}
Do something
@thisislawatts
thisislawatts / utils-hide-images-in-content.liquid
Created July 2, 2015 15:23
Shopify. Remove images in wysiwyg content
{% if content contains "<img" %}
{{ content | replace: '<img ', '<meta ' }}
{% endif %}
@charset UTF-8;
100% {
stroke-dashoffset:480px;
margin-top:-20px;
width:50%;
left:100%;
opacity:1;
-webkit-transform:rotate(360deg);
transform:rotate(360deg);
@thisislawatts
thisislawatts / index.liquid
Created May 31, 2015 15:45
Shopify - Adding a slideshow to the homepage
{% if settings.homepage_slideshow %}
<section id="HomepageSlideshow" class="homepage--slideshow">
<ul class="slides">
{% if settings.homepage_slide_show_1 %}
<li data-id="1">
<img src="{{ 'homepage_slide_image_1.jpg' | asset_url }}" alt="{{ settings.homepage_slide_title_1 }}"/>
<a href="{{ settings.homepage_slide_title_1 }}" class="vac">
<h1>{{ settings.homepage_slide_title_1 }}</h1>
<h2>{{ settings.homepage_slide_text_1 }}</h2>
</a>