Skip to content

Instantly share code, notes, and snippets.

@iso100
iso100 / block-x-ray-nocompass.scss
Created November 4, 2012 20:37
Conditionally shades block level elements (No Compass)
$show-blocks: true; // Show Block Shading
// Shades all block level elements if show-blocks is true
@if $show-blocks == true {
address, article, aside, blockquote,
center, dd, details, dir, div, dl,
dt, fieldset, figcaption, figure,
footer, form, frameset, h1, h2, h3,
h4, h5, h6, header, hgroup, hr,
isindex, menu, nav, noframes,
@iso100
iso100 / XHR-Mega-Menu.html
Created November 8, 2012 18:27
XHR-loaded megamenu content
HTML Markup:
<ul id="primary-nav" role="navigation">
<li id="nav_home" class="current"><a href="homepage.html">Home</a></li>
<li id="nav_products" class="hasMenu"><a href="overview.html">Products</a><div class="megamenu get-remote-content" data-remote-url="/nav_products.html" style="display:none"></div></li>
<li id="nav_shop"><a href="#">Shop</a></li>
</ul>
Script (requires jQuery):
{exp:ce_img:pair
src="{block_image}"
width="{if '{block_image_size}'=='large'}293{if:elseif '{block_image_size}'=='small'}137{if:else}215{/if}"
max_width="{if '{block_image_size}'=='large'}293{if:elseif '{block_image_size}'=='small'}137{if:else}215{/if}"
quality="72"
}
<img src="{made}" width="{width}" height="{height}">
{/exp:ce_img:pair}
@iso100
iso100 / PillResize.html
Created November 13, 2012 13:47
Sizing Images based on P&T Pill Settings
{exp:stash:set name="blocks" parse="inward"}
{ov_blocks}
<div class="block{switch="| even"} size-{block_image_size}" id="block-{row_count}">
<div class="img">{exp:ce_img:single src="{block_image}" width="{block_image_size}" max_width="{block_image_size}" quality="72" alt="size:{block_image_size}"}</div>
{if block_headline}<h2>{block_headline}</h2>{/if}
{if block_content}{block_content}{/if}
</div>
{/ov_blocks}
{/exp:stash:set}
@iso100
iso100 / ga-link-tracking.js
Created November 16, 2012 19:49
Track outbound links as events in GA
@iso100
iso100 / statamic13
Created November 21, 2012 00:38
Statamic 1.3 changes
# On branch official-1.3
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: public_html/_add-ons/redactor/css/redactor.css
# modified: public_html/_add-ons/redactor/ft.redactor.php
# modified: public_html/_add-ons/redactor/hooks.redactor.php
# modified: public_html/_add-ons/redactor/js/fullscreen.js
# modified: public_html/_add-ons/redactor/js/redactor.min.js
@iso100
iso100 / pi.list_linker.php
Created December 11, 2012 16:44
Plugin to create href links from delimited text
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* List Linker Plugin
*
* @package ExpressionEngine
* @subpackage Addons
* @category Plugin
* @author Adam Wiggall
* @link http://turnandface.com
@iso100
iso100 / GAOutboundTracking
Created January 10, 2013 17:46
Outbound link tracking with Google Analytics with special support for opening new tabs
// Track outbound links in GA via events
$("a").on('click',function(e){
var url = $(this).attr("href");
var target = $(this).attr("target");
if (e.currentTarget.host !== window.location.host) {
var newtab;
try {
_gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
} catch(err) {}
if (target || e.metaKey || e.ctrlKey) { // If there's a target specified or if the user is holding down a new tab key
@iso100
iso100 / Statamic Gallery
Created February 24, 2013 15:40
Sample code for Gareth that I'm using to size images used in a gallery.
@iso100
iso100 / wygwam_styles.js
Created March 18, 2013 20:15
Example Editor Styles for Wygwam
CKEDITOR.stylesSet.add( 'editor_styles',
[
// Block Styles
//{ name: 'Blue Title', element: 'h2', styles: { 'color': 'Blue' } },
{ name: 'Legal Text', element: 'p', attributes: { 'class': 'legal' } },
{ name: 'CTA Button', element: 'a', attributes: { 'class': 'ctabutton' } },
{ name: 'Citation', element: 'span', attributes: { 'class': 'cite' } },