Skip to content

Instantly share code, notes, and snippets.

<fieldset>
<legend>Site Title</legend>
<table>
<tr>
<th><label for="title_width">Title Size</label></th>
<td>
<select name="title_width" id="title_width">
<option value="normal" selected="selected">Normal (147 x 167 px)</option>
<option value="wide">Wide (294 x 167 px)</option>
</select>
@carolineschnapp
carolineschnapp / gist:993663
Created May 26, 2011 18:04
Holy Grail for buy section in product.liquid
{% if product.available %}
<form method="post" action="/cart/add">
{% if product.variants.size > 1 %}
<!-- START LISTING VARIANTS -->
<select name="id" id="product-select">
{% for variant in product.variants %}
{% if variant.available %}
<option value="{{ variant.id }}">{{ variant.title }} ({{ variant.price | money }})</option>
@carolineschnapp
carolineschnapp / gist:994755
Created May 27, 2011 06:31
Product images path
var path = "{{ 'products/retarded.jpg' | product_img_url: "original" | remove: 'products/retarded.jpg' | replace: '?', ' ' | truncatewords: 1, '' }}";
@carolineschnapp
carolineschnapp / gist:1795220
Created February 11, 2012 01:54
The Big Loop
<ul>
{% for collection in collections %}
{% unless collection.products_count == 0 %}
<li>
{{ collection.title | link_to: collection.url }}
{% if collection.all_tags.size > 0 %}
<ul>
{% for tag in collection.all_tags %}
{% capture url %}{{ collection.url }}/{{ tag | handle }}{% endcapture %}
<li>{{ tag | link_to: url }}</li>
@carolineschnapp
carolineschnapp / gist:1904659
Created February 24, 2012 23:46
Client-side sorting for collections
<div id="reorder-drop-down" style="margin-top:10px; background-color:#e8e8e8; padding:10px; overflow:hidden">
<label style="display:inline; color: #777; font-size: 12px; font-weight: normal">Reorder this collection</label>
<select id="reorder-options" name="reorder-options">
<option value="alpha-asc"{% if collection.handle contains 'alpha-asc' %} selected="selected"{% endif %}>Alphabetically: A-Z</option>
<option value="alpha-desc"{% if collection.handle contains 'alpha-desc' %} selected="selected"{% endif %}>Alphabetically: Z-A</option>
<option value="best-selling"{% if collection.handle contains 'best-selling' %} selected="selected"{% endif %}>By Best Selling</option>
<option value="created-desc"{% if collection.handle contains 'created-desc' %} selected="selected"{% endif %}>By Created Date: Newest to Oldest</option>
<option value="created-asc"{% if collection.handle contains 'created-asc' %} selected="selected"{% endif %}>By Created Date: Oldest to Newest</option>
<optio
@ryanb
ryanb / railscasts_episodes.rb
Created June 4, 2012 06:01
Download source code for all RailsCasts episodes. You may want to cd into an empty directory first.
require "rubygems"
require "octokit" # gem install octokit
1.upto(5) do |page|
Octokit.repositories("railscasts", page: page, per_page: 100).each do |repo|
system "git clone git://github.com/railscasts/#{repo.name}"
end
end
@carolineschnapp
carolineschnapp / gist:3351324
Created August 14, 2012 18:05
Lots of filters
<!-- Step 1: Add your filters -->
<!-- The collection filter is entirely optional -->
<!-- You can have as many as 3 of the product tags filters -->
<ul class="clearfix">
<li class="clearfix filter">
<p>Shop by category</p>
<select class="coll-picker">
<option value="all">All</option>
{% for c in collections %}
@carolineschnapp
carolineschnapp / gist:3452112
Created August 24, 2012 15:41
swatches.liquid
<style>
/* Hiding the drop-downs. */
#product-variants, .selector-wrapper { display:none; }
/* Style the swatches */
#swatches { margin:20px 0 0; }
.swatch { margin:15px 0; }
.swatch ul { list-style-type:none; margin:0; padding:0; }
.swatch li {
<!--[if IE 8]>
<style>
/* CSS here that you apply to mobile devices */
</style>
<![endif]-->
@AWeg
AWeg / CopyAsanaTasks.php
Last active May 28, 2025 00:17 — forked from mhdhejazi/CopyAsanaTasks.php
main changes: - Asana has own SSL cert -> had to add to lines of code - copies subtasks and up to 11 subtasks of subtasks - copies tags -> only tagnames not followers/descriptions
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);