Skip to content

Instantly share code, notes, and snippets.

View jdlich's full-sized avatar

Jacob Lichner jdlich

View GitHub Profile
@jdlich
jdlich / Rakefile.rb
Created January 13, 2012 22:03 — forked from garyt/g.compass.config
G Compass config
# COMPASS WATCH
desc "Watches and compiles sass to tomcat"
task :watch do
puts Paint["Watching sass", :cyan]
puts "Watching: " + SRC_SCSS
puts "Compile to: " + TOMCAT_SKIN + SCSS_CSS
puts "output-style: " + SCSS_OUTPUT
Dir.chdir(COMPASS) do
system "compass watch --sass-dir #{SRC_SCSS} --css-dir #{TOMCAT_SKIN} --output-style #{SCSS_OUTPUT}"
end
function getQueryParams(qs) {
qs = qs.replace(/\+/g, " ");
var params = {},
re = /[?&]?([^=]+)=([^&]*)/g,
tokens;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
}
// ---------------------------------------------------------
// POST to cart/update.js returns the cart in JSON.
// To clear a particular attribute, set its value to an empty string.
// Receives attributes as a hash or array. Look at comments below.
// ---------------------------------------------------------
Shopify.updateCartAttributes = function(attributes, callback) {
var data = '';
// If attributes is an array of the form:
// [ { key: 'my key', value: 'my value' }, ... ]
if (jQuery.isArray(attributes)) {
@jdlich
jdlich / enforce-http.liquid.js
Last active July 16, 2018 22:27 — forked from chrisjhoughton/enforce-http.liquid.js
How to build an ajax form on Shopify. See http://inside.sauce.ly/how-to-build-an-ajax-login-form-on-shopify/ for the full blog post.
/*
* Ensure the http protocol is always used on the myshopify.com domains.
* Uses liquid to input the correct URL.
*/
if (window.location.href.match(/https:\/\/.*.myshopify.com/) && top === self) {
window.location.href = window.location.href.replace(/https:\/\/.*.myshopify.com/, 'http://{{ shop.domain }}');
}