Skip to content

Instantly share code, notes, and snippets.

View jakebresnehan's full-sized avatar
👋

Jake Bresnehan jakebresnehan

👋
View GitHub Profile
@jakebresnehan
jakebresnehan / Easy-Background-Grid.css
Created March 6, 2012 03:25 — forked from JeffreyWay/Easy Background Grid
This is an easy way to set a background grid for new websites.
.grid-overlay:before {
content: "";
position: fixed;
background-color: rgba(34,102,153,0.5);
background: -webkit-linear-gradient(skyblue 2px, transparent 2px), -webkit-linear-gradient(0, skyblue 2px, transparent 2px), -webkit-linear-gradient(skyblue 1px, transparent 1px), -webkit-linear-gradient(0, skyblue 1px, transparent 1px);
background: -moz-linear-gradient(skyblue 2px, transparent 2px), -moz-linear-gradient(0, skyblue 2px, transparent 2px), -moz-linear-gradient(skyblue 1px, transparent 1px), -moz-linear-gradient(0, skyblue 1px, transparent 1px);
background: -o-linear-gradient(skyblue 2px, transparent 2px), -o-linear-gradient(0, skyblue 2px, transparent 2px), -o-linear-gradient(skyblue 1px, transparent 1px), -o-linear-gradient(0, skyblue 1px, transparent 1px);
background: -ms-linear-gradient(skyblue 2px, transparent 2px), -ms-linear-gradient(0, skyblue 2px, transparent 2px), -ms-linear-gradient(skyblue 1px, transparent 1px), -ms-linear-gradient(0, skyblue 1px, transparent 1px);
background
@jakebresnehan
jakebresnehan / WDW-Email-Stripper.js
Created March 6, 2012 04:37
This little bit of jQuery strips out all the unwanted code from the Campaign Monitor email and enables me to quickly add the email as a blog post.
var output = '';
$('.contentblock').each(function(){
var heading = $(this).find('h2').text();
var article_heading_h3 = $(this).find('h3 a').text();
var article_heading_h3_link = $(this).find('h3 a').attr('href');
var article_heading_h4 = $(this).find('h4 p a').text();
@jakebresnehan
jakebresnehan / Simple-HTML5-Local-Storage.js
Created March 6, 2012 06:02
Simple HTML5 Local Storage example to hide a element
Need to include Modernizer (http://www.modernizr.com/) and jQuery (http://jquery.com/)
$(document).ready(function($){
if (Modernizr.localstorage) {
$('#hide-button').click(function(e){
localStorage.setItem('subscribed',true);
$('#sign-up-form,#hide-button').hide();
$('#hide-button').hide();
@jakebresnehan
jakebresnehan / typekit-asynchronously.js
Created March 7, 2012 04:01
Loading typekit asynchronously with yepnopejs
<script>
Modernizr.load([{
// Does the browser support @font-face?
test: Modernizr.fontface, // Should return a boolean
// Yep! Get the fonts
yep : 'http://use.typekit.com/rndmstr1ng.js',
complete: function() {
// Load complete! Tell Typekit to start up
try { Typekit.load(); } catch(e) {};
// Profit!
@jakebresnehan
jakebresnehan / form.html
Created March 29, 2012 04:02 — forked from davatron5000/form.html
How to freaking line up checkboxes n' stuff.
<h1>Contact</h1>
<form action="#" method="post">
<div>
<label for="name">Text Input:</label>
<input type="text" name="name" id="name" value="" tabindex="1" />
</div>
<div>
<h4>Radio Button Choice</h4>
@jakebresnehan
jakebresnehan / Class Contains
Created March 30, 2012 03:22
Finds text and wrap with element
//Finds the text 'pancakes' in .food and wraps it with a span which has the sauce class. YUMMY!
$('.food:contains(pancakes)').each(function(){
$(this).html(
$(this).html().replace('pancakes','<span class=\'sauce\'>pancakes</span>')
);
});
@jakebresnehan
jakebresnehan / contains-case-insensitive.js
Created April 3, 2012 00:41
Make jQuery :contains Case-Insensitive
//Code for overloading the :contains selector to be case insensitive:
//Without the overload on the :contains selector jquery would normaly only underline the second line
// New selector
jQuery.expr[':'].Contains = function(a, i, m) {
return jQuery(a).text().toUpperCase()
.indexOf(m[3].toUpperCase()) >= 0;
};
// Overwrites old selecor
@jakebresnehan
jakebresnehan / gist:2425153
Created April 20, 2012 01:16 — forked from efedorenko/gist:2028193
Function for alpha blending
// Alpha blending
@function blend($bg, $fg) {
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg));
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg));
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg));
@return rgb($r, $g, $b);
@jakebresnehan
jakebresnehan / add-custom-post-type-to-feed.php
Created May 4, 2012 01:24
Add custom post type to feed
<?php
function myfeed_request($qv) {
if (isset($qv['feed']) && !isset($qv['post_type']))
$qv['post_type'] = array('post', 'snippets');
return $qv;
}
add_filter('request', 'myfeed_request');
?>
@jakebresnehan
jakebresnehan / clean-wordpress-custom-menus.php
Created May 4, 2012 01:26
Remove class and ID’s from Custom Menus
<?php
add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($var) {
return is_array($var) ? array_intersect($var, array('current-menu-item')) : '';
}
?>
// http://wp-snippets.com/remove-class-and-ids-from-custom-menus/