This file contains hidden or 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
function neat_trim($str, $n, $delim='...') { | |
$len = strlen($str); | |
if ($len > $n) { | |
preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches); | |
return rtrim($matches[1]) . $delim; | |
} | |
else { | |
return $str; | |
} | |
} |
This file contains hidden or 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
// Switch out "DOMAIN" to be whatever the site domain is. | |
// | |
// ie. "colorjar" for http://colorjar.com | |
$.map($('a'), function(link){ | |
if (link.href.search(/.DOMAIN./) === -1){ | |
$(link).attr('target', '_blank'); | |
} | |
}); |
This file contains hidden or 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] | |
s = status | |
st = stash | |
c = commit | |
ca = commit -a | |
a = add | |
rma = rm $(git ls-files --deleted) | |
b = branch | |
m = merge | |
f = fetch |
This file contains hidden or 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
# http://collectiveidea.com/blog/archives/2010/08/03/happy-git-commits/ | |
# | |
# This makes adding a happy post commit to a project easy, and simplifies | |
# changing the sound file periodically. Simply re-run with a different | |
# sound file reference. | |
# | |
# Defaults to the "happykids.wav" file referenced in the blog post above ^ | |
# | |
# Example usage from within ~/.dotfiles | |
# - rake add_happy_commits[/Users/tnovinger/code/my_project, vuvuzelas.mp3] |
This file contains hidden or 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: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
This file contains hidden or 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
function custom_field($key) { echo get_custom_field($key); } | |
function get_custom_field($key, $echo = FALSE) | |
{ | |
global $post; | |
$custom_field = get_post_meta($post->ID, $key, true); | |
if ($echo == FALSE) { return $custom_field; } | |
echo $custom_field; | |
} |
This file contains hidden or 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: Image P tag remover | |
Description: Plugin to remove p tags from around images and iframes in content outputting, after WP autop filter has added them. (oh the irony) | |
Version: 1.1 | |
Author: Fublo Ltd | |
Author URI: http://blog.fublo.net/2011/05/wordpress-p-tag-removal/ | |
*/ | |
function filter_ptags_on_images($content) |
This file contains hidden or 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 | |
define('YOUR_APP_ID', 'YOUR APP ID'); | |
//uses the PHP SDK. Download from https://github.com/facebook/php-sdk | |
require 'facebook.php'; | |
$facebook = new Facebook(array( | |
'appId' => YOUR_APP_ID, | |
'secret' => 'YOUR APP SECRET', |
This file contains hidden or 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
# This is a template .gitignore file for git-managed WordPress projects. | |
# | |
# Fact: you don't want WordPress core files, or your server-specific | |
# configuration files etc., in your project's repository. You just don't. | |
# | |
# Solution: stick this file up your repository root (which it assumes is | |
# also the WordPress root directory) and add exceptions for any plugins, | |
# themes, and other directories that should be under version control. | |
# | |
# See the comments below for more info on how to add exceptions for your |