Skip to content

Instantly share code, notes, and snippets.

View garethredfern's full-sized avatar
🔥

Gareth garethredfern

🔥
View GitHub Profile
@garethredfern
garethredfern / copy-data.js
Created June 21, 2012 14:59
Copy Billing Info To Shipping Info
<script>
//on page load
$(document).ready( function () {
//when the checkbox is checked or unchecked
$('#copyaddress').click(function() {
// If checked
if($('#copyaddress').is(':checked')) {
@garethredfern
garethredfern / children.html
Created June 30, 2012 05:26
Selecting in jQuery
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<style>
li { color: black; }
.emphasis > li { color: red; } <!-- Only the direct children -->
</style>
</head>
@garethredfern
garethredfern / prependTo.html
Created July 3, 2012 07:36
Using prependTo to remove content from the DOM.
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Appending Content</title>
<style>
article {
width: 600px;
margin: auto;
}
@garethredfern
garethredfern / alfred-ext.txt
Created August 11, 2012 16:51
Alfred Extension Creates HTML Bolilerplate
cd ~/Desktop && mkdir {query} && cd {query}
#Begin with my templates
cp -R ~/Dropbox/Templates/html/ .
#Pull in jQuery
curl http://code.jquery.com/jquery.js > assets/js/libs/jquery.js
#Pull in Modernizr
curl https://raw.github.com/Modernizr/Modernizr/master/modernizr.js > assets/js/libs/modernizr.js
@garethredfern
garethredfern / slider.html
Created August 12, 2012 19:51
Simple Image Slider
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Simple Image Slider</title>
<style>
.gallery { position: relative; width: 400px; height: 200px; }
.gallery figure {
top: 0;
left: 0;
@garethredfern
garethredfern / back.js
Created August 24, 2012 15:33
Back Button Using jQuery
(function() {
$('.back').on('click', function(e) {
history.back()
e.preventDefault();
});
@garethredfern
garethredfern / hcard.html
Created August 30, 2012 13:19
hcard with icons
<ul class="vcard">
<li class="fn">Gareth Redfern</li>
<li class="email">
<span aria-hidden="true" data-icon="&#x29;" class="icon-alone"></span>
<span class="screen-reader-text">Email</span>
<span>your@email.com</span>
</li>
<li class="tel">
<span aria-hidden="true" data-icon="&#x28;" class="icon-alone"></span>
<span class="type screen-reader-text">work</span>
@garethredfern
garethredfern / ee-stash-cats.html
Created September 27, 2012 09:34
Stash Example Displaying Categories
{!-- THIS PULLS IN THE VIEW TEMPLATE (ALL THE HTML STRUCTURE) --}
{embed="_views/_two_col"}
{!-- USE STASH TO SET THE BANNER CONTENT --}
{exp:stash:set name="banner" parse_tags="yes"}
{exp:channel:entries channel="banners" url_title="events-banner" dynamic="no"}
{mx_banner_images}
{exp:ce_img:pair src="{mx_image}" width="920" height="435" crop="yes"}
<img src="{made}" width="{width}" height="{height}" alt="" title="{mx_caption}">
{/exp:ce_img:pair}
@garethredfern
garethredfern / jquery-selecting.html
Created October 9, 2012 06:41
Selecting with jQuery
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Selecting jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
@garethredfern
garethredfern / prepend-content.html
Created October 10, 2012 05:52
Using jQuery to append & prepend existing content to somewhere else in the DOM
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Adding Content To The DOM</title>
<style>
article { width: 600px; margin: 0 auto; }
blockquote {
width: 30%;
float: right;