Skip to content

Instantly share code, notes, and snippets.

View jeromecoupe's full-sized avatar
💭
coding away

Jérôme Coupé jeromecoupe

💭
coding away
View GitHub Profile
@jeromecoupe
jeromecoupe / stash caching and escape enmbed
Last active August 29, 2015 14:00
Cache an entire page but escape an embed used for relationships (in case one of the related entry changes or some are removed / added)
{!-- Stash page caching https://github.com/croxton/Stash/wiki/Caching --}
{exp:stash:cache bundle="news"}
{!-- layout used --}
{stash:embed name="layouts:page"}
{exp:channel:entries
channel="news"
status="open"
disable="member_data|pagination"
@jeromecoupe
jeromecoupe / gist:cbac5f271fea0939fa88
Last active August 29, 2015 14:05
Trouble figuring out stash caching / parse order
{!--
I have a complex template, fully cached.
The only thing I don't want to cache is a list of random testimonials
that has to change every time the page is loaded.
***
Some things I would like to understand, pretty please
@jeromecoupe
jeromecoupe / clearingfloats.css
Created February 26, 2012 11:05
Float Clearing Styles
/* =Clearing floats without markup
To be combined with a Paul Irish approach of ie specific styles
<http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/>
---------------------------------*/
.group:after {
content: ".";
display: block;
height: 0;
clear: both;
@jeromecoupe
jeromecoupe / gist:2567707
Created May 1, 2012 12:37 — forked from croxton/gist:1505601
User friendly modal windows for touch devices using Colorbox and Modernizr
$(document).ready(function(){
// colorbox
if ($('#modal').length > 0) {
var modalConfig = {
inline : true,
href : "#modal",
opacity : .75,
onLoad:function(){
$('#modal').css('display','block');
@jeromecoupe
jeromecoupe / use switch to open and close divs
Last active October 5, 2015 20:08
ExpressionEngine: Insert a <div> every x rows within a loop without PHP
{exp:channel:entries channel="news"}
{if '{switch="one|two|three"}' == "one"}<div class="row">{/if}
... something ...
{if '{switch="one|two|three"}' == "three" || count == total_results}</div>{/if}
{/exp:channel:entries}
@jeromecoupe
jeromecoupe / gist:3426115
Last active October 9, 2015 02:47
Sublime Text 2 User Config
{
"theme": "Soda Dark.sublime-theme",
"bold_folder_labels": true,
"highlight_modified_tabs": true,
"soda_classic_tabs": true,
"highlight_modified_tabs": true,
"color_scheme": "Packages/User/themes/Monokai.tmTheme",
"font_face": "Inconsolata",
"font_size": 17,
@jeromecoupe
jeromecoupe / gist:3436758
Created August 23, 2012 13:47
exp:ifelse and playa conditionals
<!--
Using this code in an embed, passing the father entry_id as {embed:myentryid}
This works natively but as soon as I add ifelse, it breaks
Could stash value of playa conditionals but rather avoid it if possible
Have tried multiple ways of quoting things
{if "{exp:playa:total_children entry_id='{embed:myentryid}' channel='projects|news|pressreleases|documents' status='open'}" != "0"}
{if {exp:playa:total_children entry_id="{embed:myentryid}" channel="projects|news|pressreleases|documents" status="open"}}
@jeromecoupe
jeromecoupe / gist:3880163
Created October 12, 2012 16:40
Custom pagination with {exp:stash:get_list} and filtering
{!-- Wrapper template --}
{embed="wrappers/page_full_width"}
{!-- Meta data --}
{exp:stash:set name="meta_title"}Our projects{/exp:stash:set}
{exp:stash:set name="meta_description"}Projects of the International Polar Foundation{/exp:stash:set}
{!-- Navigation --}
{exp:stash:set name="nav_current"}projects{/exp:stash:set}
@jeromecoupe
jeromecoupe / eecms safecracker
Created December 20, 2012 20:51
safecrachker and .htacess interactions
1. don't use these rules in your .htaccess if using the exclude method, they prevent safecracker forms from submitting properly. Sorry I forgot about thios.
# Add a trailing slash to paths without an extension
# -------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
OR add a rule not to add a trailing slash for POST requests
// ---
// Sass (v3.2.9)
// ---
@mixin respond-to($queries...) {
$length: length($queries);
@for $i from 1 through $length{
@if $i % 2 == 1 {
@media screen and (min-width: nth($queries, $i)) {