Skip to content

Instantly share code, notes, and snippets.

View menslow's full-sized avatar

Michael Enslow menslow

View GitHub Profile
@menslow
menslow / namespace-pattern.js
Created June 27, 2014 18:24
JavaScript Namespace Pattern
var CS = (function() {
var $ = jQuery;
return {
init: function() {
this.setFoundation();
this.setJS();
this.setMenuEvents();
@menslow
menslow / middleman-config.rb
Created June 27, 2014 18:31
Middleman Configuration for Development and Production
# Turn on Livereload for development to reload your browser atomatically when you save changes to source files.
configure :development do
activate :livereload
end
# Turn on CSS and JavaScript minification for your production build files.
configure :build do
activate :minify_css
activate :minify_javascript
end
@menslow
menslow / middleman-partials.erb
Last active August 29, 2015 14:03
Using Middleman partials for organizing your pattern library.
<!--
Here's our Header "container" partial
_header.erb
-->
<header class="header">
<section class="tool-bar row">
<div class="large-12 columns">
<%= partial "shared/_logo" %>
<div class="connect">
@menslow
menslow / genesis-favicon-filter.php
Last active August 29, 2015 14:07
Genesis Filter for customizing favicons and Apple Touch icons
<?php
// Filter for Genesis Parent theme to Customize favicon and add Apple Touch Icons
add_filter( 'genesis_pre_load_favicon', 'my_pre_load_favicon');
function my_pre_load_favicon() {
echo '<link rel="shortcut icon" href="' . get_stylesheet_directory_uri() . '/lib/images/favicon.ico">'.PHP_EOL
.'<link rel="apple-touch-icon" href="touch-icon-iphone.png">'.PHP_EOL
.'<link rel="apple-touch-icon" sizes="76x76" href="' . get_stylesheet_directory_uri() . '/lib/images/logo-76.png">'.PHP_EOL
.'<link rel="apple-touch-icon" sizes="120x120" href="' . get_stylesheet_directory_uri() . '/lib/images/[email protected]">'.PHP_EOL
.'<link rel="apple-touch-icon" sizes="152x152" href="' . get_stylesheet_directory_uri() . '/lib/images/[email protected]">';
}
@menslow
menslow / lazyload-get-the-post-thumbnail.php
Last active November 13, 2017 13:10
Rewrite of the WordPress "get_the_post_thumbnail" for compatibility with jQuery LazyLoad plugin
<php
// Rewrite of "get_the_post_thumbnail" for compatibility with jQuery LazyLoad plugin
function my_get_the_post_lazyload_thumbnail( $post_id = false, $size = 'full' ) {
if ( $post_id ) {
// Get the id of the attachment
$attachment_id = get_post_thumbnail_id( $post_id );
if ( $attachment_id ) {
$src = wp_get_attachment_image_src( $attachment_id, $size );
if ($src) {
$img = get_the_post_thumbnail( $post_id, $size, array(