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
# 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 and open WordPress hooks | |
function action() { | |
ack "do_action\(\s*('|\")$1('|\")" | awk {'print $1'} | sed 's/:$//g' | xargs st | |
} | |
function filter() { | |
ack "apply_filters\(\s*('|\")$1('|\")" | awk {'print $1'} | sed 's/:$//g' | xargs st | |
} |
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: Front page first paragraph | |
Plugin URI: http://example.com/ | |
Description: Only use the first paragraph of posts on the front page | |
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
# For patches, lower numbers are better | |
function redgreen() { | |
ack "^[-|\+]" -oh | sort | uniq -c | ack [0-9]+ -oh | xargs | awk '{print $1 - $2}' | |
} | |
# Example usage | |
# $ svn di | redgreen | |
# $ -150 |
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 | |
/* Get all our options from the database */ | |
global $options; | |
foreach ($options as $value) { | |
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; | |
} else { $$value['id'] = get_settings( $value['id'] ); } | |
} | |
/* Get Portfolio category ID from the name */ |
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
Index: wp-content/mu-plugins/pig-setup.php | |
=================================================================== | |
--- wp-content/mu-plugins/pig-setup.php (revision 228) | |
+++ wp-content/mu-plugins/pig-setup.php (working copy) | |
@@ -21,7 +21,7 @@ | |
pig_register_question( 'Additional Comments', '%s waxes poetic about food…', false ); | |
pig_register_question( 'What are some topics you are good at speaking about?', '%s knows a bit about…', false ); | |
} | |
-add_action( 'bp_init', 'a8c_pig_setup_questions' ); | |
+add_action( 'pig_loaded', 'a8c_pig_setup_questions' ); |
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
RewriteCond %{REQUEST_URI} ^.*/wp-admin$ | |
RewriteRule ^(.+)$ http://%{HTTP_HOST}/wp-admin/ [R,L] |
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
define( 'WP_SITEURL_SUBDIR', 'wp' ); | |
define('PATH_CURRENT_SITE', '/'); |
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: Move Old Urgent Posts | |
*/ | |
function es_update_urgent_post_cats( $post_id ) { | |
// Get our category | |
$the_category = 'urgent'; | |
$the_category_obj = get_category_by_slug( $the_category ); | |
$the_category_id = $the_category_obj->term_id; |
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 | |
/** | |
* Generic function to add body classes | |
* Can take either a string of space-separated classes or an array | |
* | |
* Requires PHP 5.3 for access to closures | |
*/ | |
function es_add_body_class( $new_classes ) { | |
// Turn the input into an array we can loop through |