Archive for category Programming

Force PHP function to return instead of echo

Have you ever working on some PHP software that had functions that echo’ed and you want them to return so you can echo later or pass the data to something else? I found a nice way of presenting the solution. All of the php functions that start with ob_ such as ob_start() allow you to [...]

Tags: , , , , ,

Text File Paragraph Formatting with Vim

I recently had to fix 50 files of plain text user content to be more readable. Line breaks needed to be added to make the paragraphs look more coherent. Here is my solution to fixing a file quickly.
Add the following to your .vimrc Set 100 to the max number of characters that you want in [...]

Tags: , , , ,

Integrating Zenphoto and Wordpress

Update: I am now using google picasa with the kpicasa plugin. I've determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this [...]

Tags: , , , ,

Hardlink Wordpress Navigation

This cool little theme code snippet allows the wordpress navigation to link to a page outside of wordpress. It takes advantage of custom fields for pages. Just place this code at the top of your themes header.php file
<?php
/*
Copyright (c) 2009 < Nate Nuzum >
Use under terms of MIT license
*/
global $post;
$redirect = get_post_meta($post->ID, 'redirect', true);
if [...]

Tags: , , , , , , ,

Google Thinks Server is Spanish

I was working with google calendar xml feeds the other day, and the funniest thing was happening. If I went to the feed on my computer, it would show up in English. If my server downloaded it, it would show up in Spanish, with all of my events translated. After several hours of looking into [...]

Tags: , , , , ,