<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Down Lifes Road...</title>
	<atom:link href="http://www.downlifesroad.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.downlifesroad.com</link>
	<description></description>
	<pubDate>Thu, 18 Sep 2008 22:38:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Old code.</title>
		<link>http://www.downlifesroad.com/2008/09/18/old-code/</link>
		<comments>http://www.downlifesroad.com/2008/09/18/old-code/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 22:35:59 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/?p=12</guid>
		<description><![CDATA[I love coming across old code *cough* garbage *cough*
The purpose of this was to take a title, and create something url safe and in the fashion a client was wanting. The first function was old code, so don&#8217;t blame me.

function cleanUrl($url)
{
  $find =        array('/--/', '/ - /','/ [...]]]></description>
			<content:encoded><![CDATA[<p>I love coming across old code *cough* garbage *cough*</p>
<p>The purpose of this was to take a title, and create something url safe and in the fashion a client was wanting. The first function was old code, so don&#8217;t blame me.</p>
<pre lang="php">
function cleanUrl($url)
{
  $find =        array('/--/', '/ - /','/ /', '/!/', '/"/', "/'/", '/--/');
  $replace =    array('-', '-', '-', '', '', '', '-');

  $result = strtr($url, "`~@#$%^&#038;*()_=+|[]{};:,./<>?", "---------------------------");

  return strtolower(preg_replace($find, $replace, strip_tags(stripslashes(trim($result)))));
}
</pre>
<p>Isn&#8217;t it horrible?</p>
<p>I rewrote the function to&#8230;</p>
<pre lang="php">
function cleanUrl($url)
{
  $url = strtolower($url);

  $url = preg_replace("/[^a-z0-9\s+]/", '', $url);
  $url = preg_replace("/[\s]{1,}/", '-', $url);

  return $url;
}
</pre>
<p>That makes me happier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/09/18/old-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lazy day</title>
		<link>http://www.downlifesroad.com/2008/09/13/lazy-day/</link>
		<comments>http://www.downlifesroad.com/2008/09/13/lazy-day/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 17:30:02 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/?p=8</guid>
		<description><![CDATA[Today is rainy and full of nastiness. (Thanks Ike!)
I should have gotten out to play disc golf while the weather was beautiful, I just didn&#8217;t feel too hot.
Called my sister Meagan a few times, her voicemail is picking up so I&#8217;m yelling in a demonic sounding voice and hanging up. Hopefully it freaks them out [...]]]></description>
			<content:encoded><![CDATA[<p>Today is rainy and full of nastiness. (Thanks Ike!)</p>
<p>I should have gotten out to play disc golf while the weather was beautiful, I just didn&#8217;t feel too hot.</p>
<p>Called my sister Meagan a few times, her voicemail is picking up so I&#8217;m yelling in a demonic sounding voice and hanging up. Hopefully it freaks them out a bit. If not, well, no loss.</p>
<p>Work is going well, moving forward on some things and looking good.</p>
<p>Snapped a great picture of my brother in law, and his wifes brother being dorks. Put it up on my facebook in the mobile uploads.</p>
<p>This turned into more of a journal entry, rock on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/09/13/lazy-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ewerl Function</title>
		<link>http://www.downlifesroad.com/2008/06/29/ewerl-function/</link>
		<comments>http://www.downlifesroad.com/2008/06/29/ewerl-function/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 02:16:39 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/2008/06/29/ewerl-function/</guid>
		<description><![CDATA[Ewerl is a new URL rewritting site with cool features.
Here&#8217;s a simple function to return the Ewerl url. It&#8217;s only being used for the main url, but could easily be adjusted to return an array. I just didn&#8217;t have a need for it in my case at this time.

/**
 * Returns an Ewerl url if [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ewerl.com" title="Ewerl" target="_blank">Ewerl</a> is a new URL rewritting site with cool features.</p>
<p>Here&#8217;s a simple function to return the Ewerl url. It&#8217;s only being used for the main url, but could easily be adjusted to return an array. I just didn&#8217;t have a need for it in my case at this time.</p>
<pre lang="php">
/**
 * Returns an Ewerl url if available.
 * Otherwise the original that was passed in.
 * Returns false if..
 * 1. JSON extension isn't installed.
 * 2. No url was entered.
 * 3. No response from server.
 *
 * @todo Add URL validation.
 *
 * @param string $url
 * @return string URL, or false.
 * @author Casey Wilson <caseyw@downlifesroad.com>
 */
function getEwerl($url) {
	/**
	 * Verify JSON extension is loaded.
	 */
	if (!extension_loaded('JSON')) return false;

	/**
	 * Url wasn't passed
	 */
	if (!$url) return false;

	/**
	 * Assign / Prep vars.
	 */
	$postUrl = 'http://ewerl.com/api/v1/make/url=';
	$urlEncoded = base64_encode($url);

	$response = file_get_contents($postUrl . $urlEncoded);

	if (!$response) {
		return $url;
	}

	/**
	 * Should have returned a JSON object.
	 */
	$jsonObj = json_decode($response);

	/**
	 * If either Status not set, or status is false, return original url.
	 */
	if (!isset($jsonObj->status) || $jsonObj->status == 'FALSE') {
		return $url;
	}

	return $jsonObj->url_main;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/06/29/ewerl-function/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery</title>
		<link>http://www.downlifesroad.com/2008/06/29/jquery/</link>
		<comments>http://www.downlifesroad.com/2008/06/29/jquery/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 14:56:34 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/2008/06/29/jquery/</guid>
		<description><![CDATA[My expierence with jQuery thus far hasn&#8217;t been to bad. I&#8217;m starting to see the power and simplicity of it.
I&#8217;ve never been a JS guy, never been in a position to really need to do much with it since I&#8217;ve basically always been a backend coder. I need to really jump in there, get a [...]]]></description>
			<content:encoded><![CDATA[<p>My expierence with jQuery thus far hasn&#8217;t been to bad. I&#8217;m starting to see the power and simplicity of it.</p>
<p>I&#8217;ve never been a JS guy, never been in a position to really need to do much with it since I&#8217;ve basically always been a backend coder. I need to really jump in there, get a good feel for both JS and jQuery. So far though, I can say I&#8217;m really starting to like it, only been at it a few days thus far so we&#8217;ll see here soon what the final say is.</p>
<p>Thanks to good friends, and long late night chats with people smarter than I.</p>
<p>The open source community as a whole rocks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/06/29/jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Url to TinyUrl Function</title>
		<link>http://www.downlifesroad.com/2008/06/21/url-to-tinyurl-function/</link>
		<comments>http://www.downlifesroad.com/2008/06/21/url-to-tinyurl-function/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 03:29:19 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/2008/06/21/url-to-tinyurl-function/</guid>
		<description><![CDATA[I needed to transform some long urls into tiny ones :p
Figured I&#8217;d post something up here that may be useful to someone else.
Code was updated.

/**
 * Get TinyUrl for $url
 *
 * @param string $url Must be a valid url
 */
function getTinyUrl($url) {
	if (! $url) {
		return false;
	}

	if (strlen ( $url ) < 30) {
		return $url;
	}

	$response [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to transform some long urls into tiny ones :p</p>
<p>Figured I&#8217;d post something up here that may be useful to someone else.</p>
<p>Code was updated.</p>
<pre lang="php">
/**
 * Get TinyUrl for $url
 *
 * @param string $url Must be a valid url
 */
function getTinyUrl($url) {
	if (! $url) {
		return false;
	}

	if (strlen ( $url ) < 30) {
		return $url;
	}

	$response = file_get_contents ( 'http://tinyurl.com/api-create.php?url=' . $url );

	return ($response) ? $response : $url;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/06/21/url-to-tinyurl-function/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New blog.</title>
		<link>http://www.downlifesroad.com/2008/01/11/new-blog/</link>
		<comments>http://www.downlifesroad.com/2008/01/11/new-blog/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 04:08:08 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.downlifesroad.com/2008/01/11/new-blog/</guid>
		<description><![CDATA[I was talking to Elazar over at phpc, he said I should really get a blog. So here it goes.
I gave him a link in the blogroll, check out his site. He&#8217;s written some very nice articles on Web Scraping.
Night!
]]></description>
			<content:encoded><![CDATA[<p>I was talking to Elazar over at phpc, he said I should really get a blog. So here it goes.</p>
<p>I gave him a link in the blogroll, check out his site. He&#8217;s written some very nice articles on Web Scraping.</p>
<p>Night!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.downlifesroad.com/2008/01/11/new-blog/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
