Skip to content

Instantly share code, notes, and snippets.

View JamieS's full-sized avatar

Jamie Sutton JamieS

View GitHub Profile
def zip(theme, location)
begin
FileUtils.mkdir_p(File.dirname(location))
FileUtils.rm(location) if File.exists?(location)
if RUBY_PLATFORM =~ /darwin/
Dir.chdir(THEMES) do
system("zip -r \"#{location}\" #{theme}/ -x \"*.svn*\" -x \"*.git*\"")
# put this in 'serve_file'
if File.exists?("#{template_path}/#{filename}.liquid")
filepath = "#{template_path}/#{filename}.liquid"
else
filepath = "#{template_path}/#{filename}"
end
require 'rubygems'
require 'mechanize'
BASE = 'http://manure.myshopify.com/admin'
LOGIN = '/auth/login'
USER = '[email protected]'
PWD = 'moo-moo'
agent = Mechanize.new
page = agent.get(BASE+LOGIN)
form = page.forms.first
form.login = USER
<?php
/**
* Application Controller
*
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
/*
* mediaquery function - test whether a CSS media type or query applies
* author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* Developed as a feature of the EnhanceJS Framework (enhancejs.googlecode.com)
* thx to:
- phpied.com/dynamic-script-and-style-elements-in-ie for inner css text trick
- @paul_irish for fakeBody trick
*/
/*
* mediaquery function - test whether a CSS media type or query applies
* author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* Developed as a feature of the EnhanceJS Framework (enhancejs.googlecode.com)
* thx to:
- phpied.com/dynamic-script-and-style-elements-in-ie for inner css text trick
- @paul_irish for fakeBody trick
*/
{% if template == 'product' %}
{% assign mf = product.metafields.meta_description %}
{% unless mf == empty %}
{% for mf in product.metafields.meta_description %}
<meta name="Fubar2 Ronnie James Dio" content="{{mf.last}}" />
{% endfor %}
{% endunless %}
{% endif %}
// ---------------------------------------------------------
// 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)) {
@JamieS
JamieS / altered-superfish.js
Created April 13, 2011 12:24 — forked from kswedberg/altered-superfish.js
Superfish onclick
/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
@JamieS
JamieS / gist:1083549
Created July 14, 2011 21:49 — forked from carolineschnapp/gist:1083007
Linked options helper methods for Shopify. See this: http://wiki.shopify.com/Linked_Options
<script>
// (c) Copyright 2011 Caroline Schnapp. All Rights Reserved. Contact: [email protected]
// See http://wiki.shopify.com/Linked_Options
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
var key = jQuery('.single-option-selector:eq(0)').val();
if (selectorIndex === 2) {
key += ' / ' + jQuery('.single-option-selector:eq(1)').val();
}
var selector = jQuery('.single-option-selector:eq(' + selectorIndex + ')');