Skip to content

Instantly share code, notes, and snippets.

View stevegrunwell's full-sized avatar

Steve Grunwell stevegrunwell

View GitHub Profile
@stevegrunwell
stevegrunwell / gist:2140268
Created March 20, 2012 19:32
Create a URL-safe slug from a string, useful for creating permalinks
<?php
/**
* Create a URL slug from a string
*
* @param string $str String to create slug from (str)
* @param mixed $limit Limit the number of characters returned (optional)
* @return string
* @author Steve Grunwell
*/
function create_slug($str, $limit=64){
@stevegrunwell
stevegrunwell / gist:2140325
Created March 20, 2012 19:35
Example usage of conditional comments with wp_enqueue_script() (WordPress)
<?php
wp_enqueue_style('ie7-fixes', get_bloginfo('template_url') . '/css/ie7.css', false, '', 'screen');
global $wp_styles;
$wp_styles->add_data('ie7-fixes', 'conditional', 'lte IE 7');
?>
@stevegrunwell
stevegrunwell / gist:2897997
Created June 8, 2012 20:29
Remove Contact Form 7 scripts and styles through the WordPress action hook API
/**
* Remove Contact Form 7's scripts and styles without having to add anything to wp-config.php (as described
* in the CF7 docs) by using the wpcf7_enqueue_styles and wpcf7_enqueue_scripts actions that Takayuki was
* nice enough to include in includes/controller.php
* @link http://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
*/
add_action( 'wpcf7_enqueue_styles', function() { wp_deregister_style( 'contact-form-7' ); } );
add_action( 'wpcf7_enqueue_scripts', function() { wp_deregister_script( 'jquery-form' ); } );
@stevegrunwell
stevegrunwell / .htaccess
Created June 12, 2012 14:49
Load production WordPress uploads in a local version of the site by putting this in a new Htaccess file in /wp-content/uploads/
# Attempt to load files from production if they're not in our local version (replace {SITE URL} with your production server)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://{SITE URL}/wp-content/uploads/$1
</IfModule>
@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
@stevegrunwell
stevegrunwell / hooked-on-wordpress-actions-and-filters.md
Created July 14, 2012 14:18
Hooked on WordPress Actions and Filters - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / using-git-for-version-control.md
Created July 14, 2012 14:57
Using Git for Version Control - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / creating-a-plugin-workshop.md
Created July 14, 2012 18:15
Creating a Plugin Workshop - WordCamp Columbus 2012

Creating a Plugin Workshop

July 14, 2012

Instructor: Nowell VanHoesen (@NowellVanHoesen)

Requirements

Location

@stevegrunwell
stevegrunwell / theme-development-essentials.md
Created July 14, 2012 18:56
Theme Development Essentials - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / responsible-responsiveness.md
Created July 14, 2012 19:33
Responsible Responsiveness - WordCamp Columbus 2012

Responsible Responsiveness

July 14, 2012

Instructor: John Hartley (@johnbhartley)

Slides: http://forknightdev.com/responsive/#1

"Responsive design is not some magical tool. You can't just pop it in and 'done, it works'." Responsive design requires planning.