Skip to content

Instantly share code, notes, and snippets.

View stewartknapman's full-sized avatar
🤘

Stewart Knapman stewartknapman

🤘
View GitHub Profile
@sskylar
sskylar / harmony.export.tpl
Last active December 30, 2015 01:59
WXR dump for Harmony CMS
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<title>{{ blog.title }}</title>
<link>{{ blog.url }}</link>
@kyleaparker
kyleaparker / gist:8851659
Created February 6, 2014 20:09
Shopify: Map all collection tags (avoid 50 product limit)
{% assign collection_tags = collection | map: 'tags' %}
{% for tag in collection_tags %}
<a href="/collections/{% if collection.handle != blank %}{{ collection.handle }}{% else %}all{% endif %}/{{ tag | handleize }}" title="{{ tag | escape }}">{{ tag }}</a>
{% endfor %}
@resistorsoftware
resistorsoftware / gist:1487854
Created December 16, 2011 20:35
Update Fulfillment with Order ID
f = ShopifyAPI::Fulfillment.find(:first, :params => {:order_id => order_id})
if f.nil?
fulfillment = ShopifyAPI::Fulfillment.new({:order_id => order_id, :notify_customer => true, :tracking_number => "123456"})
fulfillment.save
else
f.tracking_number = '123456'
f.notify_customer = true
f.save
end
@stewartknapman
stewartknapman / lib.js
Last active March 14, 2019 01:21
Commonly reused functions in JS
module.exports = {
/*
Array Functions
*/
// For each item in Array
each: function (arr, callback, ctx) {
var r;
for (var i = 0; i < arr.length; i++) {
ctx = ctx || arr[i];
r = callback.apply(ctx, [arr[i], i]);
@kyamaguchi
kyamaguchi / oneline_detailed_logging.rb
Created December 7, 2012 05:55 — forked from troy/oneline_detailed_logging.rb
One-line detailed logging for Rails 3 (ActiveSupport::Notifications) and later
# Outputs this at warn log level:
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]}
#
# Save as config/initializers/oneline_detailed_logging.rb. Consider
# decreasing the log level from "info" to "warn" (in production.rb) so
# the one-line log message replaces the standard request logs.
# override process_action to add 2 things to the payload:
# - remote IP
@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).