<?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>sixtyseconds creative media : blog</title>
	<atom:link href="http://blog.sixtyseconds.co.za/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sixtyseconds.co.za</link>
	<description></description>
	<lastBuildDate>Thu, 08 Jul 2010 15:07:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Crispy text in Chrome</title>
		<link>http://blog.sixtyseconds.co.za/2010/07/crispy-text-in-chrome/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/07/crispy-text-in-chrome/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 15:07:59 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=52</guid>
		<description><![CDATA[Been bumping around on a social media website and one of the funny things I read about (in this article) as that setting a transparent text-shadow on text forces Chrome&#8217;s sub-pixel anti-aliasing. text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01); Here&#8217;s a quick example:]]></description>
			<content:encoded><![CDATA[<p>Been bumping around on a social media website and one of the funny things I read about (<a href="http://ajaxian.com/archives/text-rendering-optimizelegibility-can-you-read-me-now">in this article</a>) as that setting a transparent text-shadow on text forces Chrome&#8217;s sub-pixel anti-aliasing.</p>
<blockquote><p>text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01);</p></blockquote>
<p>Here&#8217;s a quick example:</p>

<a href='http://blog.sixtyseconds.co.za/2010/07/crispy-text-in-chrome/screen-shot-2010-07-08-at-4-44-21-pm/' title='Screen shot 2010-07-08 at 4.44.21 PM'><img width="150" height="52" src="http://blog.sixtyseconds.co.za/wp-content/uploads/2010/07/Screen-shot-2010-07-08-at-4.44.21-PM-150x52.png" class="attachment-thumbnail" alt="Screen shot 2010-07-08 at 4.44.21 PM" title="Screen shot 2010-07-08 at 4.44.21 PM" /></a>
<a href='http://blog.sixtyseconds.co.za/2010/07/crispy-text-in-chrome/screen-shot-2010-07-08-at-4-44-30-pm/' title='Screen shot 2010-07-08 at 4.44.30 PM'><img width="150" height="51" src="http://blog.sixtyseconds.co.za/wp-content/uploads/2010/07/Screen-shot-2010-07-08-at-4.44.30-PM-150x51.png" class="attachment-thumbnail" alt="Screen shot 2010-07-08 at 4.44.30 PM" title="Screen shot 2010-07-08 at 4.44.30 PM" /></a>

]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/07/crispy-text-in-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The best String.trim()&#8230;</title>
		<link>http://blog.sixtyseconds.co.za/2010/06/the-best-string-trim/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/06/the-best-string-trim/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 15:03:34 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=47</guid>
		<description><![CDATA[&#8230;trims characters that aren&#8217;t even there! I was having a strange bug (while developing the message/user polling for my MooTools chat class) where trimming wasn&#8217;t stripping the whitespace in the returned data. You see, unlike many good client-server apps, I am not using JSON, but rather a specialized CSV format. The regular expression methods I [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;trims characters that aren&#8217;t even there!</p>
<p>I was having a strange bug (while developing the message/user polling for my <a href="http://github.com/sixtyseconds/mootools-templates">MooTools chat class</a>) where trimming wasn&#8217;t stripping the whitespace in the returned data. You see, unlike many good client-server apps, I am not using JSON, but rather a specialized CSV format. The regular expression methods I tried didn&#8217;t work.</p>
<p>The character matching/traversal methods I tried didn&#8217;t work. And then I found out that the character code for the whitespace characters that were popping up were 65279. Sixty seconds later (thanks to Google!) I found <a href="http://www.fileformat.info/info/unicode/char/feff/index.htm">this article</a>. So my trim method now looks something like this:</p>
<script src="http://gist.github.com/422472.js"></script>
<p>Did I mention it happens to be very fast? <img src='http://blog.sixtyseconds.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/06/the-best-string-trim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery and assumptions&#8230;</title>
		<link>http://blog.sixtyseconds.co.za/2010/06/jquery-and-assumptions/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/06/jquery-and-assumptions/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 07:40:01 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[assumptions]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=41</guid>
		<description><![CDATA[I have been working on a bridge between my PHP and MooTools/jQuery template parsers. So far all has been going well, until I decided to try and load the templates via script tag injection. The MooTools version went swimmingly&#8230; The jQuery version, not so much. It seems that when you do $(&#8216;&#60;script&#8230;&#8217;).appendTo(&#8216;head&#8217;), jQuery assumes you [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a bridge between my <a href="http://github.com/sixtyseconds/php-templates">PHP</a> and <a href="http://github.com/sixtyseconds/mootools-templates">MooTools</a>/<a href="http://github.com/sixtyseconds/jquery-templates">jQuery</a> template parsers. So far all has been going well, until I decided to try and load the templates via script tag injection. The <a href="http://mootools.net/">MooTools</a> version went swimmingly&#8230;</p>
<script src="http://gist.github.com/422060.js"></script>
<p>The <a href="http://jquery.com/">jQuery</a> version, not so much. It seems that when you do $(&#8216;&lt;script&#8230;&#8217;).appendTo(&#8216;head&#8217;), jQuery assumes you want to get the file with <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XHR</a>. No questions asked. It doesn&#8217;t actually do the XHR request until you append it to the head element (not sure where else it makes this assumption) but the assumption is wrong.</p>
<p>I specifically chose to load the templates with script injection so that the template loading wouldn&#8217;t clog up Firebug and could be done from another domain. Thanks jQuery! If you are wondering what worked; it&#8217;s actually quite easy to achieve with vanilla JavaScript&#8230;</p>
<script src="http://gist.github.com/422071.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/06/jquery-and-assumptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP objects vs. arrays</title>
		<link>http://blog.sixtyseconds.co.za/2010/06/php-objects-vs-arrays/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/06/php-objects-vs-arrays/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 12:57:57 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json_decode]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=38</guid>
		<description><![CDATA[Whenever I have to talk between PHP and JavaScript, and especially when it comes to JSON, I have to decide whether I am going to use arrays or objects. JavaScript plays well with both, but PHP doesn&#8217;t. json_decode outputs a steaming pile of stdClass instances which lack the simplicity of index accessors. I came up [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I have to talk between PHP and JavaScript, and especially when it comes to JSON, I have to decide whether I am going to use arrays or objects. JavaScript plays well with both, but PHP doesn&#8217;t. json_decode outputs a steaming pile of stdClass instances which lack the simplicity of index accessors. I came up with (or found?) this method to recursively cast an object to an array.</p>
<script src="http://gist.github.com/420913.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/06/php-objects-vs-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function.when</title>
		<link>http://blog.sixtyseconds.co.za/2010/06/function-when/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/06/function-when/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 12:22:53 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[vanilla]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=34</guid>
		<description><![CDATA[Ever wanted to run a snippet of code after a list of conditions were met, but weren&#8217;t sure when that would be? Now you can make functions wait until conditions are met, which will be checked at intervals (default: 100ms). Check out this example&#8230; EDIT: Thought just occurred to me that the vanilla javascript version [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to run a snippet of code after a list of conditions were met, but weren&#8217;t sure when that would be?</p>
<script src="http://gist.github.com/420871.js"></script>
<p>Now you can make functions wait until conditions are met, which will be checked at intervals (default: 100ms). Check out this example&#8230;</p>
<script src="http://gist.github.com/420879.js"></script>
<p>EDIT: Thought just occurred to me that the vanilla javascript version is much the same:</p>
<script src="http://gist.github.com/420885.js"></script>
<p>EDIT: For those of you jQuery enthusiasts out there:</p>
<script src="http://gist.github.com/422120.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/06/function-when/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t help myself&#8230;</title>
		<link>http://blog.sixtyseconds.co.za/2010/05/cant-help-myself/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/05/cant-help-myself/#comments</comments>
		<pubDate>Tue, 25 May 2010 09:12:40 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=32</guid>
		<description><![CDATA[So, I&#8217;ve been developing this jQuery chat thing, and it&#8217;s been teaching me so much about efficient data transfer and good API design. I have to say that I am by no means a David Walsh or an Aaron Newton, but I want to show you what I came up with after a few days [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been developing this jQuery chat thing, and it&#8217;s been teaching me so much about efficient data transfer and good API design. I have to say that I am by no means a David Walsh or an Aaron Newton, but I want to show you what I came up with after a few days of jQuery AJAX chat and a few hours of MooTools AJAX chat&#8230;</p>
<p>One of the most important questions you can ask, when developing something that is going to do a lot of data transfer (very quickly), is what data/information format you are going to use. As I see it; there are 3 widely available options when working with Javascript: CSV, XML and JSON. CSV is a simple format but what do you use as column/row delimiters? What if the data includes tabs or new lines? Bummer! Next up is XML. XML is horrible. Next up is JSON; this is probably the most widely used data format in Javascript. It&#8217;s concise and simple to do with both Javascript/PHP.</p>
<p>There are problems with JSON though &#8211; it requires a third-party library to parse it (from string to object, PHP -&gt; Javascript) in Javascript, or eval (evil). It also requires a third-party library in PHP to parse from/to JSON. So it&#8217;s a good format, but there are problems.</p>
<p>It is possible to use characters that users can&#8217;t input (control characters) &#8211; which are similar to \t and \n &#8211; to delimit CSV data. You can also do this in PHP and the only methods required in both Javascript/PHP are string split/join.</p>
<script src="http://gist.github.com/412943.js"></script>
<script src="http://gist.github.com/412944.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/05/cant-help-myself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript AJAX chat clients</title>
		<link>http://blog.sixtyseconds.co.za/2010/05/javascript-ajax-chat-clients/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/05/javascript-ajax-chat-clients/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:12:07 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=29</guid>
		<description><![CDATA[Over the last few days I have been building a jQuery AJAX chat application. It&#8217;s been tough &#8211; I am rather out of touch with jQuery. If you would like to see what it looks like, check out: this repo.]]></description>
			<content:encoded><![CDATA[<p>Over the last few days I have been building a jQuery AJAX chat application. It&#8217;s been tough &#8211; I am rather out of touch with jQuery. If you would like to see what it looks like, check out: <a href="http://github.com/sixtyseconds/jquery-chat-app">this repo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/05/javascript-ajax-chat-clients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery comet chat</title>
		<link>http://blog.sixtyseconds.co.za/2010/05/jquery-comet-chat/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/05/jquery-comet-chat/#comments</comments>
		<pubDate>Fri, 21 May 2010 07:23:56 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[comet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.sixtyseconds.co.za/?p=27</guid>
		<description><![CDATA[I have been tasked with creating a comet chat app (in jQuery!) within the next 3 days. This is huge, in both good and bad ways; it will be fun to do, but challenging to get a grip on jQuery (again) and deal with Comet. Once I&#8217;m done I will psot it all here and [...]]]></description>
			<content:encoded><![CDATA[<p>I have been tasked with creating a comet chat app (in jQuery!) within the next 3 days. This is huge, in both good and bad ways; it will be fun to do, but challenging to get a grip on jQuery (again) and deal with Comet. Once I&#8217;m done I will psot it all here and on GitHub. Good luck me!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/05/jquery-comet-chat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facelift! Linked Select</title>
		<link>http://blog.sixtyseconds.co.za/2010/05/facelift-linked-select/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/05/facelift-linked-select/#comments</comments>
		<pubDate>Wed, 19 May 2010 12:52:10 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Facelift!]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://verylastminute.wordpress.com/?p=16</guid>
		<description><![CDATA[The linked select (or chained drop-down if you prefer) is a simple solution to an old problem. If you build a site with it&#8217;s own database, and assuming there&#8217;s a big jumble of categories and sub-categories and sub-sub-categories etc., you may need javascript to associate values in 1 select element, with the values in another [...]]]></description>
			<content:encoded><![CDATA[<p>The linked select (or chained drop-down if you prefer) is a simple solution to an old problem. If you build a site with it&#8217;s own database, and assuming there&#8217;s a big jumble of categories and sub-categories and sub-sub-categories etc., you may need javascript to associate values in 1 select element, with the values in another (based on some hierarchical structure). And when you do, there are a number of ways you can go about it.</p>
<p>One of the methods I used (last time I had this problem) was to create a hidden select and shuffle all the spare (child) options off to it when filtering according to the value of a parent select element. I wrote a <a href="http://github.com/sixtyseconds/LinkedSelect/tree/22358d7e664dcec3e0a3a76333573266d09140a3">Moo class</a> for it too! Today we&#8217;re going to give it a facelift!</p>
<p>Before we can improve, we need to understand. So let&#8217;s look what this class does:</p>
<h2>Old school</h2>
<script src="http://gist.github.com/406289.js"></script>
<p>Firstly we create the ghost element and move all the child select&#8217;s options to it.</p>
<script src="http://gist.github.com/406293.js"></script>
<p>Then, in the filter method, we remove each option above the offset. The offset is the starting point from which our child&#8217;s options will be altered &#8211; this is so that we can have static options or even a placeholder option at the beginning of the child select&#8217;s options list. Then we filter through the options in the ghost select and move applicable options back to the child select based on the value of a particular attribute on the parent select.</p>
<p>If a &#8216;select&#8217; value is passed then we attempt to select the option with that value.</p>
<script src="http://gist.github.com/406294.js"></script>
<p>Lastly, in the filter method, we enable/disable the child depending on whether there are options (after the offset) in the child select. That&#8217;s all there is to it &#8211; it&#8217;s a simple plugin after all. Now let&#8217;s see how we can improve it.</p>
<h2>New school</h2>
<p>Firstly, there are a number of ways we can simplify the options we give this class, while keeping the same flexibility:</p>
<script src="http://gist.github.com/406318.js"></script>
<p>The previous options were a little confusing; basically we need to be able to specify which attribute the parent options filter on, and which attributes on the child are filtered by. We&#8217;ve renamed &#8216;child&#8217; to &#8216;selected&#8217; for the sake of clarity.</p>
<script src="http://gist.github.com/406326.js"></script>
<p>Our new initialize method looks quite like the old, but we&#8217;re assuming less about the environment by including a &#8216;container&#8217; option but defaulting to document.body. Because of our simpler options we can also get away with defining fewer variables, and still have readable code!</p>
<script src="http://gist.github.com/406331.js"></script>
<p>Our filter method also looks pretty much the same, but without the unnecessary variable declarations. We&#8217;re also erasing selected and disabled properties instead of setting them to blank. That&#8217;s it folks!</p>
<p><a href="http://www.jsfiddle.net/sixtyseconds/AvkCP/">demo</a> &#8211; <a href="http://github.com/sixtyseconds/LinkedSelect/tree/0.1">old school</a> &#8211; <a href="http://github.com/sixtyseconds/LinkedSelect/tree/0.2">new school</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/05/facelift-linked-select/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facelift!</title>
		<link>http://blog.sixtyseconds.co.za/2010/05/facelift/</link>
		<comments>http://blog.sixtyseconds.co.za/2010/05/facelift/#comments</comments>
		<pubDate>Wed, 19 May 2010 12:31:51 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Facelift!]]></category>

		<guid isPermaLink="false">http://verylastminute.wordpress.com/?p=10</guid>
		<description><![CDATA[I&#8217;m always looking at code I&#8217;ve written (barely a few months ago) and wondering just what I was thinking. It&#8217;s even worse when the plugin/snippet I wrote worked really well at the time (and in a few different situations), and is still being used in all its outdated glory! It&#8217;s times like that when I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always looking at code I&#8217;ve written (barely a few months ago) and wondering just what I was thinking. It&#8217;s even worse when the plugin/snippet I wrote worked really well at the time (and in a few different situations), and is still being used in all its outdated glory! It&#8217;s times like that when I scheme of ways to turn it into something shiny. Something beautiful.</p>
<p>I am going to be doing that to a few plugins over the next few weeks, in the hope that I can help others who are thinking about how they can improve their coding style/old code. We shall call these posts&#8230;em&#8230;Facelift!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sixtyseconds.co.za/2010/05/facelift/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
