This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alias ST2's command line tool for a shorter (easier-to-remember) name | |
alias st="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl" | |
# Search for an open Sublime Text to a function definition | |
function fx() { | |
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st | |
} | |
# Example usage from the root of a WordPress repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_js() { | |
// jQuery | |
wp_deregister_script('jquery'); | |
wp_register_script( | |
'jquery', | |
includes_url( 'js/jquery/jquery.js' ), | |
array(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Internal Linking for Scheduled Posts | |
Description: Add scheudled posts to the internal linking dialog in the WordPress editor. | |
Version: 1.0 | |
Author: Evan Solomon | |
Author URI: http://evansolomon.me | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function unique_chars( $string ) { | |
$chars = array(); | |
foreach ( str_split( $string ) as $character ) | |
$chars[$character] = true; | |
return count( $chars ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin name: Capitalize category names on display | |
Description: Capitalize the first letter of a category name when it's displayed in the theme | |
*/ | |
function capitalize_category_names_on_display( $name ) { | |
return ucfirst( $name ); | |
} | |
add_filter( 'single_cat_title', 'capitalize_category_names_on_display' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_body_class( $new_classes ) { | |
// Turn the input into an array we can loop through | |
if ( !is_array( $new_classes ) ) | |
$new_classes = explode( ' ', $new_classes ); | |
add_filter( 'body_class', function( $classes ) use( $new_classes ) { | |
foreach( $new_classes as $new_class ) | |
$classes[] = $new_class; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$revision_regex = '/^r(\d+) /'; | |
exec( 'svn log | sed \'s/------------------------------------------------------------------------/NEWCHANGESET/g\' | sed -e \'/[^NEWCHANGESET]$/{N;s/\n//;}\' | sed -e \'/[^NEWCHANGESET]$/{N;s/\n//;}\' | sed -e \'s/NEWCHANGESET//\'', $commits ); | |
foreach( $commits as $commit ) { | |
if( !$commit ) | |
continue; | |
preg_match( $revision_regex, $commit, $revision ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin name: nginx Pretty Permalinks | |
Description: Remove index.php from permalinks | |
*/ | |
add_filter( 'got_rewrite', '__return_true', 999 ); |