Skip to content

Instantly share code, notes, and snippets.

@ijy
ijy / EE: Matrix: If no results on search
Last active December 18, 2015 20:49
Conditionally check whether a Matrix is empty when searching on a particular column. Can be used with a Playa relationship field.
@ijy
ijy / EE: Matrix: Row count not empty
Created June 22, 2013 22:46
Return the total number of rows in a Matrix where a specified column is not empty. the_matrix refers to the name of the Matrix field. my_col refers to the column to search on.
{the_matrix:total_rows search:my_col="not IS_EMPTY"}
@ijy
ijy / EE: Dynamic parameter values
Created June 22, 2013 22:41
How to pass in dynamic values to ExpressionEngine tag parameters. (How to use plugin tags inside EE tags). The two secret ingredients are parse="inward" to parse the dynamic inner tag first. The second is the 'random' keyword to ensure the dynamic parameter value is used instead of a placeholder string.
{exp:channel:entries parse="inward" parameter="{exp:plugin:method parameter='value' random}" }
@ijy
ijy / EE: Store: Hide modifier option if out of stock
Last active December 18, 2015 20:48
ExpressionEngine: How to conditionally hide modifier options depending on inventory count in Expresso Store 1.6+. {option_stock_level} can be used inside the {modifier_options} tag pair to output the current stock level for that modifier option. It can also be used (as in this example) to conditionally hide modifier options if out of stock.
{modifier_options}
{if option_stock_level > 0}
<option value="{option_id}">
{option_name} {if price_mod_val} ({price_mod}) {/if}
</option>
{/if}
{/modifier_options}
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcetour_l_current_presentation_images extends SectionDatasource{
public $dsParamROOTELEMENT = 'tour-l-current-presentation-images';
public $dsParamORDER = 'asc';
public $dsParamPAGINATERESULTS = 'yes';
public $dsParamLIMIT = '1';
@ijy
ijy / tutorial.md
Created October 4, 2012 12:26 — forked from liuwen-lvtu/tutorial.mkdn
A new Susy tutorial

Susy Tutorial

For this tutorial I'm assuming you are already comfortable with CSS, Sass (I'll use the SCSS syntax) and Compass. Please get set up with each one of those before attempting to use Susy. Sass and Compass both have their own setup instructions and tutorials that you can use.

There is also reference documentation in the works.

What Susy Does

CSS Systems

@ijy
ijy / 01-variable-respond-to-mixin.md
Created September 22, 2012 17:10 — forked from Snugug/01-variable-respond-to-mixin.md
Variable-driven respond-to mixin

What if controlling your media queries was as easy as adding on to a Sass list? What if I told you it now is?

This snippet comes from a modified version of mixins in the Aura Responsive Framework and came from me hijacking the respond-to mixin namespace but still wanting to use it for custom media queries. It's a little ugly and requires Sass 3.2+ (for now, (sudo) gem install sass --pre), but it works a charm.

There are two fairly mundane caveats to this method. First, every media query needs to be named. Second, every media query needs a size and assumes min-width and screen. If you want to change min-width, simply add your operator as another option, but if you want to change screen, you need to also include your operator even if you want it to be min-width.

Also, I haven't built in warnings yet for when you do bad things, so bear that in mind.

Without further adue, tada.

@ijy
ijy / susy-baseline.scss
Created September 22, 2012 16:48 — forked from mirisuzanne/susy-baseline.scss
Show susy grid and basline on the same element
@include show-susy-with-baseline($baseline: rhythm(1)) {
@include grid-background($total-columns, column(), gutter(), $baseline, 0%);
@include background-size(100% $baseline, auto);
@include background-origin(border-box, content-box);
@include background-clip(border-box, content-box);
}
@ijy
ijy / grunt-1.js
Created August 13, 2012 11:41
grunt.js file used purely for JS concatenation & minification with a watch to automate the process. Includes multiple build targets.
/* global module:false */
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Project metadata, used by some directives, helpers and tasks.
meta: {
project: '<Project Name>',
author: "<Author>",
url: '<URL>',
@ijy
ijy / osx_lion_rail_setup.md
Created July 11, 2012 11:59 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL