Skip to content

Instantly share code, notes, and snippets.

@thotbox
thotbox / ExpressionEngine: Grid Images.html
Created May 6, 2015 18:55
ExpressionEngine: Grid Images
<div class="wygwam">
{exp:grid_images}{page_text}{/exp:grid_images}
</div>
{page_images}
{if page_images:image_size == '1/2 Left'}
<meta class="grid_images" id="grid_source_{page_images:count}" data-src="{page_images:image}" data-float="left" data-width="half">
{if:elseif page_images:image_size == '1/2 Right'}
<meta class="grid_images" id="grid_source_{page_images:count}" data-src="{page_images:image}" data-float="right" data-width="half">
{if:else}
@thotbox
thotbox / ExpressionEngine: Grid Images (CE).html
Created May 6, 2015 18:54
ExpressionEngine: Grid Images (CE)
<div class="wygwam">
{exp:grid_images}{page_text}{/exp:grid_images}
</div>
{page_images}
{if page_images:image_size == '1/2 Left'}
{exp:ce_img:pair src="{page_images:image}" width="640" allow_scale_larger="no" crop="no" quality="70"}<meta class="grid_images" id="grid_source_{page_images:count}" data-src="{made}" data-float="left" data-width="half">{/exp:ce_img:pair}
{if:elseif page_images:image_size == '1/2 Right'}
{exp:ce_img:pair src="{page_images:image}" width="640" allow_scale_larger="no" crop="no" quality="70"}<meta class="grid_images" id="grid_source_{page_images:count}" data-src="{made}" data-float="right" data-width="half">{/exp:ce_img:pair}
{if:else}
@thotbox
thotbox / HTML: Foundation Template.html
Last active August 29, 2015 14:20
HTML: Foundation Template
<!doctype html>
{if '{exp:browser_detect:browser}' == 'IE8'}
<html class="no-js lt-ie9" lang="en">
{if:elseif '{exp:browser_detect:browser}' == 'IE9'}
<html class="no-js lt-ie10" lang="en">
{if:else}
<html class="no-js" lang="en">
{/if}
<head>
@thotbox
thotbox / CSS: Default Media Queries.css
Created April 16, 2015 14:03
CSS: Default Media Queries
/* Non-Small screens */
@media only screen and (min-width: 641px) {
}
/* Large screens */
@media only screen and (min-width: 1025px) {
@thotbox
thotbox / JavaScript Browser Class.js
Last active August 29, 2015 14:18
JavaScript Browser Class
// Browser Class
$(document).ready(function() {
var agent = navigator.userAgent;
var browser;
if ( /Trident\/7.0/i.test(agent) ) {
browser = 'ie11';
}
@thotbox
thotbox / ExpressionEngine Switchee Meta Template.html
Last active August 29, 2015 14:18
ExpressionEngine Switchee Meta Template
{exp:switchee variable="{segment_1}" parse="inward"}
{!-- French --}
{case value="fr"}
{switchee variable="{segment_2}" parse="inward"}
{case value="services-famille"}
@thotbox
thotbox / PHP: Database FTP Backup.php
Last active August 10, 2022 23:45
PHP: Database FTP Backup
<?
$dbhost = 'localhost';
$dbuser = 'db_user';
$dbpass = 'db_pass';
$dbname = 'db_name';
$ftphost = 'ftp_host';
$ftpuser = 'ftp_user';
$ftppass = 'ftp_pass';
@thotbox
thotbox / Mobile Phone Store Selector.js
Created February 24, 2015 14:57
Mobile Phone Store Selector
$(document).ready(function() {
if($('#bonus').length ) {
if ( /Android/i.test(navigator.userAgent) ) {
$('.store-ios').css('opacity', '.25');
$('.store-bb').css('opacity', '.25');
}
if ( /BlackBerry/i.test(navigator.userAgent) ) {
$('.store-ios').css('opacity', '.25');
$('.store-android').css('opacity', '.25');
}
@thotbox
thotbox / Placeholder Focus Kill.js
Created February 18, 2015 14:42
Placeholder Focus Kill
// Placeholder Focus Kill
$('.has-placeholder').on('focus', function() {
var $field = $(this);
$field.attr({placeholderinactive : $field.attr('placeholder')}).removeAttr('placeholder');
});
$('.has-placeholder').on('blur', function() {
var $field = $(this);
$field.attr({placeholder : $field.attr('placeholderinactive')}).removeAttr('placeholderinactive');
@thotbox
thotbox / JavaScript: Placeholder Label Fallback.js
Last active August 29, 2015 14:15
JavaScript: Placeholder Label Fallback
// JS
if (!Modernizr.input.placeholder) {
$('.placeholder-fallback').addClass('fallback');
$('.has-placeholder').keyup(function() {
var fieldValue = $(this).val();
var fieldname = $(this).attr('name');
if (fieldValue === '') {