Skip to content

Instantly share code, notes, and snippets.

Cam Gould Cam

Block or report user

Report or block Cam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Cam
Cam / readme.md
Created Feb 6, 2019 — forked from solderjs/readme.md
How to publish packages to NPM
View readme.md

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser
View gist:7d2a314b3f153033ef3caf1fbc9f5e6f
<div class="container center">
<h3>Want more?</h3>
<p>Add a exclusive VIP pack</p>
<div class="row no-margin">
<div class="column l4 m4 s12">
<a href="/collections/music">
<img src="https://cdn.shopify.com/s/files/1/0911/1228/files/BannerDeluxeBundle_02.jpg?17536667668312517801">
<br>
<h4>Bundle title</h4>
<h5>$100</h5>
@Cam
Cam / share.liquid
Last active Sep 17, 2018
Handy ‘lite’ Shopify sharing code
View share.liquid
<!-- Sharing is caring, with love from Cam -->
{% if template contains 'product' %}
<ul class="social-sharing inline-list">
<li title="Share on Twitter"><a target="_blank" href="https://twitter.com/intent/tweet?text={{ product.title | truncate: 30 }}&url=http%3A%2F%2F{{ shop.domain }}{{ product.url | replace: '/', '%2F' }}&via=YOURTWITTERNAME">Share on Twitter</a></li>
<li title="Share on Facebook"><a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=http://{{ shop.domain }}{{ product.url }}">Share on Facebook</a></li>
<li title="Share on Google+"><a target="_blank" href="https://plus.google.com/share?url=http://{{ shop.domain }}{{ product.url }}">Share on Google+</a></li>
<li title="Share on LinkedIn"><a target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=http://{{ shop.domain }}{{ product.url }}&title={{ product.title | truncate: 30 }}&summary={{ product.description | strip_html | truncate: 240 }}&source=http://{{ shop.domain }}{{ product.url }}">Share
@Cam
Cam / country_codes.json
Created Sep 8, 2018 — forked from orenitamar/country_codes.json
Two letter country code mapping, grouped by continent/region
View country_codes.json
{
"europe": {
"va": "vatican city",
"ch": "switzerland",
"ad": "andorra",
"ee": "estonia",
"is": "iceland",
"am": "armenia",
"al": "albania",
"cz": "czech republic",
@Cam
Cam / .htaccess
Created Sep 8, 2018 — forked from louy/.htaccess
Apache .htaccess geographical redirect based on CloudFlare's geo-ip headers
View .htaccess
# add as many as you need...
SetEnvIf CF-IPCountry SY RedirectSubdomain=syria
SetEnvIf CF-IPCountry AE RedirectSubdomain=uae
SetEnvIf CF-IPCountry EG RedirectSubdomain=egypt
# Only redirect if Host is not a subdomain
SetEnvIfNoCase Host ^.+\.example\.com$ !RedirectSubdomain
# Only redirect if cookie "noredirect" doesn't exist
SetEnvIfNoCase ^Cookie$ noredirect=true !RedirectSubdomain
@Cam
Cam / order-status-product.liquid
Created Jun 20, 2018 — forked from shopifypartners/order-status-product.liquid
Script to load specific content for a particular product, on the order status page
View order-status-product.liquid
<script>
{% for line in checkout.line_items %}
<!-- DEBUG looking at {{ line.title }} -->
{% if line.title == 'Red Sports Tee' %}
Shopify.Checkout.OrderStatus.addContentBox(
'<h2>Thanks for your order</h2>',
'<p>Have a 10% discount on us! Use AWESOME18 with your next purchase</p>'
)
{% endif %}
{% endfor %}
@Cam
Cam / config
Created Dec 7, 2017
Sample SSH config file
View config
# GitHub
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
# Bitbucket
Host bitbucket.org
HostName bitbucket.org
User [YOUR_BITBUCKET_USERNAME]
@Cam
Cam / README.md
Created Sep 25, 2017 — forked from leonderijke/README.md
Front Export: Little export script for exporting all conversations in a Front App inbox
View README.md

Front export

Little export script for exporting all conversations in a Front inbox, using the Front API.

When using the awesome Front App, you want to export all conversations in an inbox. For example, for backup purposes.

Three environment variables are needed:

@Cam
Cam / cart.liquid
Last active May 10, 2018
Shopify automatic discounts in cart without Plus sample code
View cart.liquid
<script>if (typeof Shopify === "undefined") var Shopify = {}; Shopify.cart = {{ cart | json }};</script>
{% assign all_items_count = 0 %}
{% assign discount_line_total = 0 %}
{% if cart.item_count > 0 %}
{% for item in cart.items %}
{{ item.title }}
@Cam
Cam / bulk import shipping rates
Created Jun 19, 2017 — forked from leobossmann/bulk import shipping rates
Bulk create/delete shipping rates in the Shopify backend. Go to Settings/Shipping and paste it into Javascript console. WARNING: This is a proof of concept, use with extreme caution and only if you know what you're doing, you will have to customize this to fit your needs. Again, just a proof of concept, worked for me, might not work for you. Ong…
View bulk import shipping rates
function make_shipping_rates(id, low, mid, high) {
$.post('/admin/price_based_shipping_rates.json', {
price_based_shipping_rate: {
country_id: id,
min_order_subtotal: "0",
max_order_subtotal: "500",
name: "DHL Premiumversand",
offsets: [],
price: low
}
You can’t perform that action at this time.