Skip to content

Instantly share code, notes, and snippets.

View JamieS's full-sized avatar

Jamie Sutton JamieS

View GitHub Profile
/*
* 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
*/
<?php
/**
* Application Controller
*
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
@JamieS
JamieS / Shopify Blog Display a Collection in a Blog
Created August 25, 2010 11:51
Shopify Blog Display a collection in a blog
<div class="article">
<h2 class="article-title">{{ article.title }}</h2>
<p class="article-details">posted <span class="article-time">{{ article.published_at | date: "%Y %h" }}</span> by <span class="article-author">{{ article.author }}</span></p>
<div class="article-body textile">
{{ article.content }}
{% if article.title == 'Our New merchandise' %}
<ul>
{% for product in collections.new-merchandise.products limit:3 %}
<li>
<div class="feature-product">
require 'rubygems'
require 'mechanize'
BASE = 'http://manure.myshopify.com/admin'
LOGIN = '/auth/login'
USER = 'paddy@cow.com'
PWD = 'moo-moo'
agent = Mechanize.new
page = agent.get(BASE+LOGIN)
form = page.forms.first
form.login = USER
# put this in 'serve_file'
if File.exists?("#{template_path}/#{filename}.liquid")
filepath = "#{template_path}/#{filename}.liquid"
else
filepath = "#{template_path}/#{filename}"
end
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*\"")