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
function generateSlug($phrase, $maxLength=50){ | |
$result = strtolower($phrase); | |
$result = preg_replace("/[^a-z0-9]/", "-", $result); | |
$result = trim(preg_replace("/-+/", "-", $result)); | |
$result = trim(substr($result, 0, $maxLength)); | |
$result = preg_replace("/^-/", "", $result); | |
$result = preg_replace("/-$/", "", $result); | |
return $result; | |
} | |
// Pretty simple: keeps numbers and letters and makes everything else dashes. Removes multiple dashes in a row. |
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
function ob_local_dev($buffer){ | |
$old = "http://example.com"; | |
$new = "http://dev.example.com"; | |
return str_replace($old, $new, $buffer); | |
} | |
ob_start("ob_local_dev"); |
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 | |
/* | |
Template Name: Redirect | |
*/ | |
if(! empty($url = get_post_meta(get_the_id(), 'redirect', true))){ | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: ". $url); | |
die(); | |
} | |
?> |
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 | |
// Begin Copy into functions.php | |
function image_category() { | |
$labels = array( | |
'name' => 'Image Categories', | |
'singular_name' => 'Image Category', | |
'menu_name' => 'Image Categories', | |
'all_items' => 'All Image Categories', | |
'parent_item' => 'Parent Image Category', |
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 | |
defaults write com.apple.finder CreateDesktop -bool false | |
killall Finder | |
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' & | |
exit |
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 | |
/* | |
Copyright (c) 2012 Twilio, Inc. | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, | |
copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the |
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 var_pre($var, $msg = NULL){ | |
/* | |
Helper Function: | |
Use *instead of* var_dump(); | |
will output var_dump wrapped with <pre></pre> and give an optional 2nd param for a message. | |
*/ | |
echo "\n<pre>"; | |
if($msg !== NULL){ | |
echo "\n".$msg."\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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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
cd /path/to/wordpress/install/ | |
find . -type f -exec chmod 644 {} \; | |
find . -type d -exec chmod 755 {} \; | |
find . -name "wp-config.php" -exec chmod 640 {} \; |
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
<!-- Generating Template: <?php echo basename(__FILE__, '.php'); ?>.php --> |
OlderNewer