Skip to content

Instantly share code, notes, and snippets.

@joshuapaling
joshuapaling / gist:cb683d8ec6ecab077c19
Last active August 29, 2015 14:03
htaccess caching, gzip compression, and blocking bots / scrapers
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
@billerickson
billerickson / gist:1321001
Created October 27, 2011 21:56
Only show images marked as Include in Rotator
<?php
add_filter( 'be_gallery_metabox_args', 'be_gallery_custom_args' );
/**
* Only show images marked as Include in Rotator
* @author Bill Erickson
* @link http://www.wordpress.org/extend/plugins/gallery-metabox
* @since 1.0
*
* @param array query $args
<?php
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action( 'wp_head', 'wp_generator' );
@slevithan
slevithan / real-xregexp.js
Created April 4, 2012 14:28
Grammatical pattern for real numbers using XRegExp.build
// Creating a grammatical pattern for real numbers using XRegExp.build
/*
* Approach 1: Make all of the subpatterns reusable
*/
var lib = {
digit: /[0-9]/,
exponentIndicator: /[Ee]/,
digitSeparator: /[_,]/,
@johnbhartley
johnbhartley / kellum-method.css
Created April 19, 2012 04:29
Kellum Method Image Replacement
.hide-text {
height: ;
width: ;
display: block;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@stevegrunwell
stevegrunwell / brworkshop-cbus-2012.md
Created July 9, 2012 15:53
Build Responsively Workshop - July 9-10, 2012 - Columbus, OH

Build Responsively - July 9-10, 2012

Responsive Design 101

Semantic grid system: http://semantic.gs/

They'd love to see an analytics script to track how often people are resizing the browser

  • add resize listener to the window, send GA event
  • git://gist.github.com/3076998.git
@jzeltman
jzeltman / hash-navigation
Created July 10, 2012 14:54
#hash based navigation pattern
<!DOCTYPE html>
<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie7"> <![endif]-->
<!--[if IE 8 ]> <body class="ie8"> <![endif]-->
<!--[if IE 9 ]> <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" dir="ltr" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
@chrisdc
chrisdc / navigation.js
Last active June 16, 2016 15:39
An alternative navigation.js that makes dropdown menus keyboard accessible in _s.
/**
* navigation.js
*
* Handles toggling the navigation menu for small screens and enabling tab support for dropdown menus.
*/
( function() {
var container, button, menu, links;
container = document.getElementById( 'site-navigation' );
if ( ! container )
@brodkin
brodkin / magento-auth-customer-nopass
Last active May 3, 2017 15:48
Magento Force Customer Login Without Password
// Retrieve Customer by Email (or other method)
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email);
// Set as Logged In and Clear Session
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer)
->renewSession();
// Redirect or do something here :)
@jaygooby
jaygooby / strip_related_videos.php
Created November 4, 2011 13:51
Always put a rel=0 attribute on Youtube embedded videos so that related videos aren't shown at the end