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
# Search WordPress | |
# usage wpgrep 'function the_content' | |
jsgrep() { # search development scripts | |
find . \( -name "*.dev.js" -print \) | xargs grep -n "$1" | |
} | |
cssgrep() { # search development css files | |
find . \( -name "*.dev.css" -print \) | xargs grep -n "$1" | |
} | |
phpgrep() { # search php files | |
find . \( -name "*.php" -print \) | xargs grep -n "$1" |
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
/** | |
* Theme Name: WaPo Blogs | |
* Theme URI: http://www.washingtonpost.com | |
* Author: The Washington Post | |
* Description: WaPo Blog Theme | |
* Version: 0.1 | |
* License: GNU General Public License | |
* License URI: license.txt | |
**/ |
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 | |
/** | |
* Hook actions in that run on every page-load | |
* | |
* @uses add_action() | |
*/ | |
private function add_actions() { | |
add_action( 'wp_enqueue_scripts', 'enqueue_scripts' ); | |
} |
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 | |
$uri = str_replace( '%20', ' ', $_SERVER['REQUEST_URI'] ); | |
highlight_file( $_SERVER['DOCUMENT_ROOT'] . preg_replace( '/\.phps$/', '.php', $uri ) ); |
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 | |
/** | |
* Creates nicer default avatars | |
* by using first initial on flat color | |
* | |
* How to: echo create_avatar( 'yurivictor', 48 ); | |
* Example: http://yurivictor.com/avatars | |
* | |
* @var string $user, the name of the user to create the avatar | |
* @var int $size, the size in px of the avatar |
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 | |
/** | |
* Generate meta keywords from post tags | |
* | |
* @uses wp_get_post_tags | |
* @return string keywords | |
* | |
* Usage: | |
* <meta name="keywords" content="<?php echo get_meta_keywords(); ?>"> |
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 | |
/** | |
* Loads and substantiates all classes in the classes folders | |
* Classes should be named in the form of Washington_Post_{Class_Name} | |
* Files should be the name of the class name e.g. class-name.php | |
* Classes will be autoloaded as $object->{class_name} | |
*/ | |
function _load_subclasses() { | |
// load all core classes |
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
# Requires: xcode, xcode command line tools | |
# Need to do: | |
# nginx.conf | |
# php-fpm plist | |
# Install homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" | |
# Install requirements |
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 | |
/** | |
* Load a template. MVC FTW! | |
* | |
* @param string $template the template to load, without extension (assumes .php). File should be in templates/ folder | |
* @param args array of args to be run through extract and passed to template | |
*/ | |
function template( $template, $args = array() ) { | |
extract( $args ); |
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
import json | |
import requests | |
from pyquery import PyQuery as pq | |
def get_transcripts(): | |
url = 'http://www.westwingtranscripts.com/search.php?flag=getTranscript&id=' | |
for x in range( 1, 156 ): |