<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mouse pi-lot &#187; Code</title>
	<atom:link href="http://mousepilot.co.uk/topics/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://mousepilot.co.uk</link>
	<description>–noun: A computer user lacking in any recognisable skills&#34;</description>
	<lastBuildDate>Thu, 03 Feb 2011 09:48:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Reading GET variables with JavaScript</title>
		<link>http://mousepilot.co.uk/2011/02/reading-get-variables-with-javascript/</link>
		<comments>http://mousepilot.co.uk/2011/02/reading-get-variables-with-javascript/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 09:47:29 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=42</guid>
		<description><![CDATA[I found a great piece of code whilst trying to figure out how to read get variables with javascript. function $_GET(q,s) { s = s ? s : window.location.search; var re = new RegExp('&#038;'+q+'(?:=([^&#038;]*))?(?=&#038;&#124;$)','i'); return (s=s.replace(/^?/,'&#038;').match(re)) ? (typeof s[1] == &#8230; <a href="http://mousepilot.co.uk/2011/02/reading-get-variables-with-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I found a great piece of code whilst trying to figure out how to read get variables with javascript.</p>
<p><code><br />
    function $_GET(q,s) {<br />
        s = s ? s : window.location.search;<br />
        var re = new RegExp('&#038;'+q+'(?:=([^&#038;]*))?(?=&#038;|$)','i');<br />
        return (s=s.replace(/^?/,'&#038;').match(re)) ? (typeof s[1] == 'undefined' ? '' : decodeURIComponent(s[1])) : undefined;<br />
    }<br />
</code></p>
<p>Credit goes to <a href="http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/">Online Aspect</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2011/02/reading-get-variables-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy code: ifelse()</title>
		<link>http://mousepilot.co.uk/2010/09/handy-code-ifelse/</link>
		<comments>http://mousepilot.co.uk/2010/09/handy-code-ifelse/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 13:07:29 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=29</guid>
		<description><![CDATA[As with most web developers about half of my code is collecting information via forms (the other half is presenting that information). When a form is submitted there are a variety of variables that I might want to display back &#8230; <a href="http://mousepilot.co.uk/2010/09/handy-code-ifelse/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As with most web developers about half of my code is collecting information via forms (the other half is presenting that information).  When a form is submitted there are a variety of variables that I might want to display back to the user in the form elements.  The code snippet below simplifies how I handle which variable to display.</p>
<p>Previously my code for an input field would have used a lot of nested inline if statements to determine which variable to fill the field with.  It might have looked something like this:</p>
<p><code>echo '&lt;input type="text" name="email"  value="' . (($_POST['email']) ? $_POST['email'] : (($user['email']) ? $user['email'] : 'Email') . '" /&gt;';</code></p>
<p>The code above would show the posted email address first, and if that&#8217;s not present defer to one from the database.  If neither of those are present then it would display a label, &#8220;Email&#8221; in this case.</p>
<p>That&#8217;s a nightmare to manage, and it looks nasty.  So I wrote a function called postOrNot($post, $other) which simplified the inline if statement a touch.  If the first variable was present, it was displayed, if not then it would display the 2nd.</p>
<p>With the introduction of &#8220;func_get_args()&#8221; to the function it can handle any number of arguments, falling over to each one in turn, and finally returning false if none are present.</p>
<p><code>function ifelse(){<br />
    if(func_num_args() < 2) trigger_error("ifelse() requires 2 or more arguements", E_USER_ERROR);<br />
    else {<br />
        $args = func_get_args();<br />
        foreach($args as $arg){<br />
            if($arg) return $arg;<br />
        }<br />
        return false;<br />
    }<br />
}</code></p>
<p>It's a function that I use pretty much every day and saves me lines and lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2010/09/handy-code-ifelse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 posts before failure</title>
		<link>http://mousepilot.co.uk/2009/07/3-posts-before-failure/</link>
		<comments>http://mousepilot.co.uk/2009/07/3-posts-before-failure/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 20:48:36 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=11</guid>
		<description><![CDATA[Ugn!! I swore that this 3rd attempt at a blog would be successful, and that I&#8217;d update it regularly with insightful and useful comments to amuse and inform. 3 Posts in the first 2 days of my new site, and &#8230; <a href="http://mousepilot.co.uk/2009/07/3-posts-before-failure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ugn!! I swore that this 3rd attempt at a blog would be successful, and that I&#8217;d update it regularly with insightful and useful comments to amuse and inform.</p>
<p>3 Posts in the first 2 days of my new site, and then silence&#8230; this seems to indicate that I am not cut out for blogging.  I shall however persist, and today&#8217;s very short post shall contain 2 things, a link to the tools from the old mousepilot website, and a list of future posts which I <strong>shall</strong> complete.</p>
<p>So, the link.  At <a href="http://3dpixel.net">3DPixel.net</a> we combined my two very simple tools from the old site along with a couple of others and created our tools website <a href="http://3dpx.net">3dpx.net</a>.  Mainly just as a place where things we use every day can reside, but also as a tool for anyone else to use.</p>
<p>&#8230;.and now the list:</p>
<ol>
<li>Complaining post about the complete lack of consideration and awareness in society, particularly focusing on muppets in Sainsburies and plebs on the road</li>
<li>Tutorial on how to right a funky jquery/php application to upload, resize and crop images</li>
<li>Complaining post about benefits</li>
</ol>
<p>I swear to the gods of beer and pizza, that I&#8217;ll update again soon <img src='http://mousepilot.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2009/07/3-posts-before-failure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Very Excited about CSS3</title>
		<link>http://mousepilot.co.uk/2009/06/very-excited-about-css3/</link>
		<comments>http://mousepilot.co.uk/2009/06/very-excited-about-css3/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 20:43:15 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=9</guid>
		<description><![CDATA[After spending a portion of the weekend coding my shiny new site I&#8217;ve really got the CSS bug again. So I was delighted when I checked Smashing Magazine for new articles and stumbled on their latest article about CSS3! As &#8230; <a href="http://mousepilot.co.uk/2009/06/very-excited-about-css3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After spending a portion of the weekend coding my shiny new site I&#8217;ve really got the CSS bug again.  So I was delighted when I checked <a href="http://smashingmagazine.com">Smashing Magazine</a> for new articles and stumbled on their latest article about <a href="http://www.smashingmagazine.com/2009/06/15/take-your-design-to-the-next-level-with-css3/">CSS3</a>!</p>
<p>As usual, their article is an amalgamation of many many sources and very comprehensive.  Wide support for attribute selectors is particularly good news as it means no more damn id&#8217;s on inputs!  Psuedo classes look particularly useful for lots of things, but support for odd/even in table rows is pretty cool.  Columns, Shadows (text and background), Border Images, Word Wrap are all very cool, but what I&#8217;m bowled over to see is <strong>multiple layered backgrounds</strong>.  It&#8217;s a feature I&#8217;ve craved for so long, but honestly never expected to see, AND IT&#8217;S HERE!</p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2009/06/very-excited-about-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new beginning without Internet Explorer 6</title>
		<link>http://mousepilot.co.uk/2009/06/a-new-beginning-without-internet-explorer-6/</link>
		<comments>http://mousepilot.co.uk/2009/06/a-new-beginning-without-internet-explorer-6/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 20:32:09 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=5</guid>
		<description><![CDATA[At 3DPixel made the decision a few months ago that 7 years was a pretty good run for Internet Explorer 6, and that enough was enough. So we killed support for it in all future projects. At the time, I &#8230; <a href="http://mousepilot.co.uk/2009/06/a-new-beginning-without-internet-explorer-6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="/images/ie6dead.jpg" alt="IE6 Dead" align="left" />At <a href="http://3dpixel.net">3DPixel</a> made the decision a few months ago that 7 years was a pretty good run for Internet Explorer 6, and that enough was enough.  So we killed support for it in all future projects.</p>
<p>At the time, I don&#8217;t think I really considered the implications this would have to future designs, but 2 projects down the line, I have to say <strong>THANK GOD</strong>.  I feel like a coder reborn (cheesy I know), I&#8217;ve rediscovered the joys of transparency, inline-blocks, and padding that doesn&#8217;t make me want to tear my own face off.</p>
<p>I&#8217;m also actually taking the time to look into CSS3, now that there&#8217;s actually a chance I&#8217;ll use it.  Rounded corners are a godsend!</p>
<p>So I&#8217;d encourage any other coders out there to follow in the footsteps of <a href="http://3dpixel.net">3DPixel</a>, Facebook, Apple.. and numerous other big name websites, and lets kill it off for good!</p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2009/06/a-new-beginning-without-internet-explorer-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Rounded Corners</title>
		<link>http://mousepilot.co.uk/2009/06/css-rounded-corners/</link>
		<comments>http://mousepilot.co.uk/2009/06/css-rounded-corners/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 16:26:10 +0000</pubDate>
		<dc:creator>Simon Stevens</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://mousepilot.co.uk/?p=3</guid>
		<description><![CDATA[My first post on my shiny new blog is being written whilst I&#8217;m actually coding the template. The CSS3 spec gives us access to rounded corners without the need for images and loads of xhtml.  Just add the following to &#8230; <a href="http://mousepilot.co.uk/2009/06/css-rounded-corners/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My first post on my shiny new blog is being written whilst I&#8217;m actually coding the template.</p>
<p>The CSS3 spec gives us access to rounded corners without the need for images and loads of xhtml.  Just add the following to the appropriate &lt;div&gt;.  I&#8217;ve absolutely no idea whether this works in IE7+ but I suspect it doesn&#8217;t and as it&#8217;s for my personal blog, I don&#8217;t care.  Internet Explorer users deserve to look at shitty looking pages tbh :p</p>
<p><code>-moz-border-radius: 5px;<br />
		-webkit-border-radius: 5px;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mousepilot.co.uk/2009/06/css-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

