Skip to content

Instantly share code, notes, and snippets.

View Chrisedmo's full-sized avatar

Chris Mousdale Chrisedmo

View GitHub Profile
@Chrisedmo
Chrisedmo / nav-dropdown.liquid
Created July 31, 2012 11:19
Shopify: 2 Level Dropdown Menu
<ul>
{% for link in linklists.main-menu.links %}
<li class="{% if forloop.first %}first{% elsif forloop.last %}last{%endif%}">
{% assign child_list_handle = link.title | handle %}
{% if linklists[child_list_handle].links != blank %}
<div class="has-dropdown">
<a href="{{ link.url }}" class="clearfix">
<span class="nav-label">{{ link.title }}</span>
<span class="nav-arrow"></span>
</a>
@Chrisedmo
Chrisedmo / latest-blog-posts.css
Created July 31, 2012 11:29
Shopify: Latest Blog Posts
.widget .latest-blog-posts-list {
margin: 0;
list-style: none;
}
.widget .latest-blog-posts-list li {
margin: 0 0 10px 0;
padding: 0 0 10px 0;
border-bottom: dotted 1px #CCC;
background: none;
word-wrap: break-word;
@Chrisedmo
Chrisedmo / eager-loading.twig
Created December 11, 2016 22:13
#CraftCMS: Eager-Load Nested Sets of Elements
{#
According to docs (https://craftcms.com/docs/templating/eager-loading-elements),
this is how you Eager-Load Nested Sets of Elements
#}
{% set entries = craft.entries({
section: 'news',
with: [
'entriesField.assetsField'
]
@Chrisedmo
Chrisedmo / filter-vendor.liquid
Created July 31, 2012 11:14
Shopify: Filter by Vendor
<!-- add the vendor as product tag to product then use this code in collection.liquid -->
<!-- if we are on a collection page that is either custom or smart -->
{% if collection.url != blank %}
<h4>Shop by vendor:</h4>
<ul>
{% for product_vendor in collection.all_vendors %}
<li>
{% if current_tags contains product_vendor %}
<a class="active" href="{{ collection.url }}">{{ product_vendor }}</a>
{% else %}
@Chrisedmo
Chrisedmo / Mountain Lion tweaks
Created July 30, 2012 14:30
Mountain Lion tweaks (under the hood)
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
@Chrisedmo
Chrisedmo / snippet-fb-open-graph-tags.liquid
Created August 21, 2012 11:12
Shopify: Facebook OG Tags
{% comment %}
This is for widgets that share content on Facebook.
See the Facebook Linter: http://developers.facebook.com/tools/debug
{% endcomment %}
{% if template contains 'product' %}
<meta property="og:url" content="{{ shop.url }}{{ product.url }}" />
<meta property="og:title" content="{{ product.title }}" />
<meta property="og:description" content="{{ product.description | strip_html | truncatewords: 100, '' | escape }}" />
<meta property="og:image" content="{{ product.featured_image | product_img_url: 'medium' }}" />
@Chrisedmo
Chrisedmo / Gulpfile.js
Last active January 8, 2019 11:09 — forked from AugustMiller/Gulpfile.js
Craft + Gulp Setup
var gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
coffeeify = require('gulp-coffeeify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
test = require('gulp-if'),
del = require('del'),
rename = require('gulp-rename'),
@Chrisedmo
Chrisedmo / SHOPIFY: Percentage Discount Saved
Created May 2, 2013 19:00
SHOPIFY: How To Show Percentage Discount Saved
{% comment %}How To Show Percentage Discount Saved{% endcomment %}
{% if product.compare_at_price_max > product.price %}You save {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: ‘.0′}}%{% endif %}
@Chrisedmo
Chrisedmo / Craft3ValetDriver.php
Created February 1, 2017 10:29
Craft 3 Composer Install Valet Driver
<?php
class Craft3ValetDriver extends ValetDriver
/* https://github.com/laravel/valet/blob/master/cli/drivers/CraftValetDriver.php */
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
@Chrisedmo
Chrisedmo / debug.css
Created April 17, 2018 08:50 — forked from zaydek-old/bookmark.min.js
A simple CSS debugger
*:not(path) {
color: hsla(210, 100%, 100%, 0.9) !important;
background: hsla(210, 100%, 50%, 0.5) !important;
outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important;
box-shadow: none !important;
}