wget in OS X

I like to wget things from the command line as much as possible. Unfortunately, by default, OS X does not include the wget utility (why?). We can get around this by using cURL for quickly downloading thing from the terminal. Here is an example:

 curl http://downloads.wordpress.org/plugin/static-html-output-plugin.zip > plugin.zip

The above will save the destination file with the specified local filename.

View errors on Media Temple (dv) hosting

If you are experiencing errors on your MediaTemple (dv) server, which is usually preconfigured to run in “production mode” (ie, display little to no errors in the browser), you may login via SSH and view a live sample of the latest errors here:

 tail -f error_log

The above is run from the following directory:

 /var/www/vhosts/yourdomain.com/statistics/logs

Stupid WordPress Tricks

Accessing WordPress $post variable data:

http://www.velvetblues.com/web-development-blog/wordpress-post-variable-reference/

Add this to functions.php to remove white space from around the_title() tag:

add_filter(‘wp_title’, create_function(‘$a, $b’,’return str_replace(” $b “,”",$a);’), 10, 2);

I use the following combination of tag generation code for this blog, I prefer it over any SEO plugins and it works well:

<? if(is_home()):?>
<?=get_bloginfo(“name”);?> | <?=get_bloginfo( “description” );?>
<? elseif(is_front_page()):?>
<?=get_bloginfo(“name”);?> | <?=get_bloginfo( “description” );?>
<? else: ?>
<?php wp_title(”); ?> | <?=get_bloginfo( ‘name’ );?>
<? endif;?>


” />

” />

 | ” />


,internet consultant,internet consultant in china,china it professional,it support in china” />

,internet consultant,internet consultant in china,china it professional,it support in china” />

,,internet consultant,internet consultant in china,china it professional,it support in china” />

Re-organize all posts if set by date (MySQL):

update wp_posts
set post_date = str_to_date(
concat(
floor(1 + rand() * (12-1)), /* Generate a random month */
‘-’,
floor(1 + rand() * (26 -1)), /* Generate a random day */
‘-’,
’2009′
),
‘%m-%d-%Y’
);