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 | |
$path_to_file = '...'; | |
$file = explode( "\n", file_get_contents( $path_to_file ) ); | |
// Finds local variables that are undeclared. | |
// | |
// Doesn't understand foreach() variables, dockblocks, sprintf arguments, | |
// variables returned by reference from a function like preg_match() or parse_str(), |
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
#!/bin/sh | |
function svn() { | |
if [ "$1" == "ci" ] && [ "$2" == "-m" ] && [ -z "$4" ] && [ "$(svn stat --ignore-externals | grep '^[^?X]' | wc -l | awk '{print $1}')" -gt 1 ]; then | |
svn stat --ignore-externals | grep '^[^?X]' | |
echo "" | |
echo $3 | |
echo "" | |
echo "Unbounded commit... What are you doing, man?" | |
else | |
/usr/bin/svn "$@" |
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: Highlight Scheduled Posts | |
* Author: Andrew Nacin | |
* Author URI: http://nacin.com | |
*/ | |
add_action( 'admin_head-edit.php', 'meyer_highlight_scheduled_posts' ); | |
function meyer_highlight_scheduled_posts() { | |
echo "<style> tr.status-future { background-color: #ffffe0 }</style>\n"; | |
} |
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 | |
class foo { | |
function bar() {} | |
} | |
$GLOBALS['fb'] =& new foo; | |
function foo_bar($buffer) { | |
$GLOBALS['fb']->bar(); |
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 | |
register_shutdown_function( 'ob_end_flush' ); | |
class foo { | |
function __construct() { | |
register_shutdown_function( array( &$this, '__destruct' ) ); | |
} | |
function bar( $buffer ) { |
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
# SVN override to prevent commits that try to implicitly commit more than one file. | |
# Has weaned me off of svn ci -m very effectively. I now almost always use svn ci, | |
# which usually results in me writing longer and more helpful commit messages. | |
# Also, it prevents me from committing unrelated code, so there's that. | |
# | |
# Also checks for error_log, var_dump, and console.log, and rejects these commits. | |
function svn() { | |
if [ "$1" == "ci" ] && [ "$2" == "-m" ] && [ -z "$4" ] && [ "$(svn stat --ignore-externals | grep '^[^?X]' | wc -l | awk '{print $1}')" -gt 1 ]; then | |
svn stat --ignore-externals | grep '^[^?X]' |
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: jQuery extends WordPress XML-RPC | |
* Description: Enables XML-RPC and adds custom methods. | |
*/ | |
add_action( 'enable_xmlrpc', '__return_true' ); | |
function jquery_get_post_paths( $args ) { | |
$post_type = sanitize_key( $args[0] ); |
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 jquery_posts_only_for_searches( $query ) { | |
if ( $query->is_main_query() && $query->is_search() ) | |
$query->set( 'post_type', 'post' ); | |
} | |
add_action( 'pre_get_posts', 'jquery_posts_only_for_searches' ); |
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 | |
add_action( 'init', function() { | |
register_post_type( 'plugin', array( | |
'name' => 'Plugin', | |
'public' => true, | |
'rewrite' => false, | |
) ); | |
} ); |
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 | |
add_action( 'init', 'jquery_unfiltered_html_for_term_descriptions' ); | |
add_action( 'set_current_user', 'jquery_unfiltered_html_for_term_descriptions' ); | |
function jquery_unfiltered_html_for_term_descriptions() { | |
remove_filter( 'pre_term_description', 'wp_filter_kses' ); | |
remove_filter( 'pre_term_description', 'wp_filter_post_kses' ); | |
if ( ! current_user_can( 'unfiltered_html' ) ) | |
add_filter( 'pre_term_description', 'wp_filter_post_kses' ); | |
} |