Skip to content

Instantly share code, notes, and snippets.

View haroldao's full-sized avatar
🎯
Design + Dev

Harold AO haroldao

🎯
Design + Dev
View GitHub Profile
@carolineschnapp
carolineschnapp / related-products.liquid
Last active December 22, 2022 21:29
Related Products — to add to product.liquid
@jconnoll
jconnoll / Linklist-with-first-image.liquid
Created September 6, 2011 16:37
Shopify Snippet - Linklist with Images (ala Category Display)
@resistorsoftware
resistorsoftware / Google Shopping Snippet
Last active March 22, 2021 17:01
Enhanced Meta Tagger snippet
{% comment %}
- add this snippet to any product.liquid template, at the top of the file, and you can access the extra data provided by
the new version of Meta Tagger that supports Google Shopping.
{% endcomment %}
{% if template contains 'product' %}
{% if product.metafields.global %}
{% for mf in product.metafields.global %}
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active July 25, 2024 03:38
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@rsheldiii
rsheldiii / chess.py
Created June 26, 2012 04:07
chess program for python
"""CONVENTIONS:
positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples
"""
import itertools
WHITE = "white"
BLACK = "black"
@ozh
ozh / new empty git branch.md
Last active May 29, 2024 00:00
Create a new empty branch in Git
$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.

@garystorey
garystorey / pxtorem.scss
Last active July 3, 2024 01:25
Sass to convert px to rem
/**
* Convert font-size from px to rem with px fallback
*
* @param $size - the value in pixel you want to convert
*
* e.g. p {@include fontSize(12px);}
*
*/
@use "sass:math";
@kyleaparker
kyleaparker / gist:5949872
Created July 8, 2013 15:32
Shopify - Show total savings on cart page
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% capture saving %}{{ item.variant.compare_at_price | minus: item.variant.price }}{% endcapture %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
...rest of cart code within for loop
{% endfor %}
Display saving:
@zakhardage
zakhardage / Much much simpler option selector for Shopify
Last active July 13, 2024 21:36
Much simpler version of Shopify's option_selection.js for separating product options into their own dropdown menus.
<form action="/cart/add" method="post">
{% if product.variants.size > 1 %}
{% if product.options[0] %}
{% assign used = '' %}
<label for="select-one">{{ product.options[0] }}</label>
<select id='select-one' onchange="letsDoThis()">
{% for variant in product.variants %}
{% unless used contains variant.option1 %}
<option value="{{ variant.option1 }}">{{ variant.option1 }}</option>
{% capture used %}{{ used }} {{ variant.option1 }}{% endcapture %}
@adamblank
adamblank / webkit.scrollbar.css
Created December 10, 2013 19:36
webkit styled minimalist gray scrollbar
::-webkit-scrollbar{
width: 10px;
}
::-webkit-scrollbar-track-piece{
background-color: #FFF;
}
::-webkit-scrollbar-thumb{
background-color: #CBCBCB;