<?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>digitalize.ca &#187; Web Development</title>
	<atom:link href="http://digitalize.ca/cat/blog/web-development-blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://digitalize.ca</link>
	<description>The webpage of Mohammad Jangda</description>
	<lastBuildDate>Thu, 22 Jul 2010 21:23:31 +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>jQuery Plugin: HTML5 Inline Data</title>
		<link>http://digitalize.ca/2010/07/jquery-plugin-html5-inline-data/</link>
		<comments>http://digitalize.ca/2010/07/jquery-plugin-html5-inline-data/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 21:23:31 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=673</guid>
		<description><![CDATA[HTML5 Data Attributes are sexy. What&#8217;s sexier is an easy way to work with these data attributes using jQuery. Sure, you could do something like: jQuery('#pancakes').attr('data-type'); But who wants to type the &#8220;data-&#8221; prefix over and over again? So, here&#8217;s a quick little plugin I whipped up. It&#8217;s probably terrible when it comes to jQuery [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ejohn.org/blog/html-5-data-attributes/">HTML5 Data Attributes</a> are sexy.</p>
<p>What&#8217;s sexier is an easy way to work with these data attributes using jQuery.</p>
<p>Sure, you could do something like:</p>
<pre>
jQuery('#pancakes').attr('data-type');
</pre>
<p>But who wants to type the <strong>&#8220;data-&#8221;</strong> prefix over and over again? </p>
<p>So, here&#8217;s a quick little plugin I whipped up. It&#8217;s probably terrible when it comes to jQuery plugin standards (I do <a href="http://digitalize.ca/wordpress-plugins/">WordPress plugins</a>, not jQuery), but it works. It works as a getter and setter.</p>
<p><strong>Bonus:</strong> If you&#8217;re using jQuery 1.4.1+, the plugin supports well-formed JSON objects as data attribute values.</p>
<p><script src="http://gist.github.com/486451.js?file=jquery.inlinedata.js"></script><br />
<noscript></p>
<pre>
/*
* Inline Data - get and set HTML5 data attributes! Yay!
*
* Copyright (c) 2010 Mohammad Jangda (http://digitalize.ca), Vortex Mobile (http://www.vortexmobile.ca)
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
*/

(function($) {
    $.fn.inlinedata = function(name, value) {

        var prefix = 'data-';
        var attr = prefix + name;
        var values = []

        this.each(function(i) {
            var attrValue;

            // Setting values
            if(value) {
                // If an array is passed, the array index should correspond to the collection index
                if($.isArray(value)) {
                    // Check, check, check the index. Because out of bounds exceptions are the devil!
                    if(typeof(value[i]) !== 'undefined')
                        attrValue = value[i];
                    else
                        attrValue = '';
                } else {
                    // Not an array, so we're just giving all the elements the same value
                    attrValue = value;
                }
                this.setAttribute(attr, attrValue);
            } else {
                // Getting values
                attrValue = this.getAttribute(attr);

                try {
                    // try parsing as JSON
                    attrValue = jQuery.parseJSON(attrValue);
                } catch(e) { }
            }
            attrValue = (attrValue) ? attrValue : '';
            values.push(attrValue);
        });

        if(values.length == 1)
            return values[0]

        return values;
    }
})(jQuery);
</pre>
<p></noscript></p>
<p>Usage is simple:</p>
<p><script src="http://gist.github.com/486451.js?file=jquery.inlinedata.usage.html"></script><br />
<noscript></p>
<pre>
<span id="hello" data-world="aloha"></span>

<span id="goodbye"></span>

<span class="cupcake" data-type="vanilla"></span>
<span class="cupcake" data-type="chocolate"></span>

<span class="icecream" data-type="fudge"></span>

<span class="donut" data-details='{"sprinkles":"many"}'></span>

<script type="text/javascript">
// Grab the data-world attrbute from the DOM element with id = hello
$('#hello').inlinedata('world'); // returns 'aloha'

// If the element doesn't have a matching attribute, it returns an empty string
$('#goodbye').inlinedata('world'); // returns ''

// Can be used with jQuery collections
// Collections get returned an array: ['abc', 'def']
$('.cupcake').inlinedata('type'); // returns ['vanilla', 'chocolate']

// If the collection only has one item, you get a string back: 'abc'
$('.icecream').inlinedata('type'); // returns 'fudge'

// You can set the data attribute as well by passing in a second parameter
$('#hello').inlinedata('world', 'jambo'); // sets data-world = jambo and returns 'jambo'

// You can set the data attribute for a collection too
$('.cupcake').inlinedata('type', 'delicious'); // sets data-type for all the elements in to 'delicious' and returns ['delicious', 'delicious']

// Want to store JSON objects in your data attributes? go right ahead! But, you need jQuery 1.4.1+
$('.donut').inlinedata('details'); // returns { sprinkles: "many" }

</script>
</pre>
<p></noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/07/jquery-plugin-html5-inline-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Tip: Save me from console.log errors</title>
		<link>http://digitalize.ca/2010/04/javascript-tip-save-me-from-console-log-errors/</link>
		<comments>http://digitalize.ca/2010/04/javascript-tip-save-me-from-console-log-errors/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 19:36:20 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[web inspector]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=498</guid>
		<description><![CDATA[It&#8217;s bound to happen. You build yourself a sweet webapp with some sweet javascript action and you unleash it to the world only to get angry emails yelling, &#8220;IT DOESn&#8217;T WoRK! FIX iT okAy?&#8221; And it&#8217;s the darndest problem because it&#8217;s happening to both IE and Firefox users (Chrome and Safari users have been silent) [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s bound to happen. You build yourself a sweet webapp with some sweet javascript action and you unleash it to the world only to get angry emails yelling, &#8220;IT DOESn&#8217;T WoRK! FIX iT okAy?&#8221; And it&#8217;s the darndest problem because it&#8217;s happening to both IE <em>and</em> Firefox users (Chrome and Safari users have been silent) and you can&#8217;t replicate it.</p>
<p>And then you spend hours trying to figure out the problem  to no avail, leaving you scratching that magnificent head of yours with luscious, flowing hair. You just can&#8217;t replicate the problem. But then, after hours and days of staring intently at the screen, you find it. It&#8217;s a rogue <strong>console.log</strong> call that you forgot to comment out. And then you spend the remainder of the week chastising yourself for being stupid.</p>
<p>It happens. (To be fair, it&#8217;s not your fault that your users don&#8217;t have Firebug or IE Developer Tools installed. Blame it on Mozilla/Microsoft.)</p>
<p>But there&#8217;s an easy solution. Just copy the following javascript somewhere in your project, and rest easy:</p>
<pre class="brush: jscript;">
if(typeof(console) === 'undefined') {
    var console = {}
    console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = function() {};
}
</pre>
<p>Code is also on the <a href="http://gist.github.com/384113">gisthub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/04/javascript-tip-save-me-from-console-log-errors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin: HTML Emails</title>
		<link>http://digitalize.ca/2010/04/wordpress-plugin-html-emails/</link>
		<comments>http://digitalize.ca/2010/04/wordpress-plugin-html-emails/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 16:35:51 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html emails]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=632</guid>
		<description><![CDATA[Tired of all those boring emails that you get from WordPress? Do you dread opening emails from WordPress because plain text and/or over-querystringified links terrify you? Rest easy friend, HTML emails for WordPress are here. HTML Emails replaces the standard WordPress emails with spruced up versions that simply look good. Sample included below: Currently, only [...]]]></description>
			<content:encoded><![CDATA[<p>Tired of all those boring emails that you get from WordPress? Do you dread opening emails from WordPress because plain text and/or over-querystringified links terrify you? Rest easy friend, HTML emails for WordPress are here.</p>
<p><a href="http://wordpress.org/extend/plugins/html-emails/" target="_blank">HTML Emails</a> replaces the standard WordPress emails with spruced up versions that simply look good. Sample included below:</p>
<p><a href="http://digitalize.ca/media/WordPressHTMLEmail1.png"><img src="http://digitalize.ca/media/WordPressHTMLEmail1-300x240.png" alt="New Comment Notification as seen in Gmail" title="New Comment Notification as seen in Gmail" width="300" height="240" class="aligncenter size-medium wp-image-631" /></a></p>
<p>Currently, only comment notifications are HTML-ized (new comment and comment moderation emails), but I&#8217;m hoping to add all other email notifications soon (and yes, that includes Multi-Site emails coming with WordPress 3.0).</p>
<p>While I have only tested the emails on Gmail, Gmail on Android, and Outlook, they should work on most email clients (including clients without HTML support). If you&#8217;re using a client other than the 3 I&#8217;ve listed, I would appreciate <a href="mailto:batmoo@gmail.com">an email</a> with info on whether the email looks like it should and works correctly.</p>
<p>Don&#8217;t like my design chops? (Go ahead, admit it!) I&#8217;ve got you covered! HTML emails makes it easy to fully customize the look and feel of emails sent by WordPress. See the Other Notes section on the Plugin page for details on how to customize emails. More detailed walkthroughs to come.</p>
<p>Grab it from the <a href="http://wordpress.org/extend/plugins/html-emails/" target="_blank">Plugin Directory</a> or install directly from WordPress (Plugins > Add New, search for HTML Emails).</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/04/wordpress-plugin-html-emails/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Plugin Preview: HTML Emails for WordPress</title>
		<link>http://digitalize.ca/2010/04/plugin-preview-html-emails/</link>
		<comments>http://digitalize.ca/2010/04/plugin-preview-html-emails/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 15:02:12 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=624</guid>
		<description><![CDATA[HTML emails from WordPress? Yes, please! Coming very, very soon!]]></description>
			<content:encoded><![CDATA[<p><a href="http://digitalize.ca/media/WordPressHTMLEmail.png"><img class="aligncenter size-full wp-image-625" title="WordPressHTMLEmail" src="http://digitalize.ca/media/WordPressHTMLEmail.png" alt="" width="658" height="528" /></a></p>
<p style="text-align: center;">HTML emails from WordPress? Yes, please!</p>
<p style="text-align: center;">Coming very, very soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/04/plugin-preview-html-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Magic: Building a static countdown clock using PHP and GD</title>
		<link>http://digitalize.ca/2010/03/php-magic-building-a-static-countdown-clock-using-php-and-gd/</link>
		<comments>http://digitalize.ca/2010/03/php-magic-building-a-static-countdown-clock-using-php-and-gd/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 21:17:11 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[glee]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=616</guid>
		<description><![CDATA[Update (2010-04-20): These Gleeks are crazy. Since being released, the clock has been viewed over 200,000 times. Insane. If you like Glee, you&#8217;ll like this. If you like image processing using PHP, you&#8217;ll like this even more. Using PHP and the GD image library*, it&#8217;s pretty easy to create a static, image-based countdown clock, which [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (2010-04-20):</strong> These Gleeks are crazy. Since being released, the clock has been viewed over 200,000 times. Insane.</p>
<p>If you like Glee, you&#8217;ll like this. If you like image processing using PHP, you&#8217;ll like this even more.</p>
<p>Using PHP and the GD image library*, it&#8217;s pretty easy to create a static, image-based countdown clock, which is useful for situations where javascript cannot be used (think <a href="http://wordpress.com">WordPress.com</a>/<a href="http://blogger.com">Blogger</a>). A new image is automatically generated server-side for every minute (assuming a request is made for the clock for that minute), and all images are cached to avoid killing the server processor. Check it out in action on <a href="http://gleeksunited.wordpress.com/2010/03/02/42-days-until-glee/">Gleeks United</a> or after the jump.</p>
<p>Don&#8217;t have code yet, but I&#8217;ll post it when I get a chance.</p>
<p><span id="more-616"></span></p>
<p><span style="display:block;text-align:center;"><br />
<strong>Vertical version:</strong><br />
<img src="http://digitalize.ca/glee/countdown.php" alt="Glee Countdown!"><br />
<span style="display:block;text-align:center;font-size:10px;">Powered by <a href="http://gleeksunited.wordpress.com" target="_blank">Gleeks United</a></span><br />
</span></p>
<p><strong>Horizontal version:</strong><br />
<img src="http://digitalize.ca/glee/countdown-h.php" alt="Glee Countdown!"><br />
<span style="display:block;text-align:center;font-size:10px;">Powered by <a href="http://gleeksunited.wordpress.com" target="_blank">Gleeks United</a></span></p>
<p><small>* Yes, ImageMagick could work too, but it&#8217;s too much of a pain to install.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/03/php-magic-building-a-static-countdown-clock-using-php-and-gd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQTouch: Tap vs Click</title>
		<link>http://digitalize.ca/2010/02/jqtouch-tap-vs-click/</link>
		<comments>http://digitalize.ca/2010/02/jqtouch-tap-vs-click/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 16:42:38 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jqtouch]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=570</guid>
		<description><![CDATA[jQTouch has a sweet feature which adds a fast touch or &#8220;tap&#8221; event. It&#8217;s pointless for me to try and rephrase, so learn all about it on the jQTouch blog: Milliseconds Responsiveness and the Fast Tap Now, the only downside to the tap event, is that it doesn&#8217;t work on anything other than Mobile Safari. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jqtouch.com">jQTouch</a> has a sweet feature which adds a fast touch or &#8220;tap&#8221; event. It&#8217;s pointless for me to try and rephrase, so learn all about it on the jQTouch blog: <a href="http://blog.jqtouch.com/post/205113875/milliseconds-responsiveness-and-the-fast-tap">Milliseconds Responsiveness and the Fast Tap</a></p>
<p>Now, the only downside to the tap event, is that it doesn&#8217;t work on anything <em>other</em> than Mobile Safari. So for iPhones, you can use tap event, but non-iPhones, you have to use click event. You could just make things easy on yourself and use clicks across the board, but I can tell you that the tap event immensely increases the performance and responsivity for jQTouch apps on iPhones. Good news is, there&#8217;s an easy way to work with both.</p>
<p>The code below was inspired by <a href="http://groups.google.com/group/jqtouch/browse_thread/thread/4de4f07cb233aabc?tvc=2#07e694cadd199702">Samuel&#8217;s message</a> on the jQTouch Google Group.</p>
<pre class="brush: xml;">
&lt;script type=&quot;text/javascript&quot;&gt;
var userAgent = navigator.userAgent.toLowerCase();
var isiPhone = (userAgent.indexOf('iphone') != -1 || userAgent.indexOf('ipod') != -1) ? true : false;
clickEvent = isiPhone ? 'tap' : 'click';
&lt;/script&gt;
</pre>
<p>You can now easily bind your events as follows:</p>
<pre class="brush: xml;">
&lt;a href=&quot;#link&quot; id=&quot;mylink&quot;&gt;Click or Tap me!&lt;/a&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$('#mylink').bind(clickEvent, function() {
    e.preventDefault();
    alert('Yay! You just ' + clickEvent + 'ed me!');
});
&lt;/script&gt;
</pre>
<p>Note: in my testing, the tap event doesn&#8217;t register too well on the iPod Touch. If that seems to be the case, I&#8217;d recommend defaulting iPod Touches to use clicks instead. However, since the iPod Touch user agent includes the term &#8220;iPhone&#8221;, we have to un-include it from our tap list:</p>
<pre class="brush: xml;">
&lt;script type=&quot;text/javascript&quot;&gt;
var userAgent = navigator.userAgent.toLowerCase();
var isiPhone = (userAgent.indexOf('iphone') != -1) ? true : false;
if(userAgent.indexOf('ipod') != -1) isiPhone = false; // turn off taps for iPod Touches
clickEvent = isiPhone ? 'tap' : 'click';
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/02/jqtouch-tap-vs-click/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>jQuery.data() = love</title>
		<link>http://digitalize.ca/2010/02/jquery-data-love/</link>
		<comments>http://digitalize.ca/2010/02/jquery-data-love/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 13:33:09 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[awesome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=494</guid>
		<description><![CDATA[Why did I never know about jQuery.data()? More details to come about fun things you can do with it.]]></description>
			<content:encoded><![CDATA[<p>Why did I never know about <a href="http://stackoverflow.com/questions/182630/jquery-tips-and-tricks/382834#382834">jQuery.data()</a>?</p>
<p>More details to come about fun things you can do with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/02/jquery-data-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Distraction-free WordPress-ing</title>
		<link>http://digitalize.ca/2010/01/distraction-free-wordpress-ing/</link>
		<comments>http://digitalize.ca/2010/01/distraction-free-wordpress-ing/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 17:58:52 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[distraction-free]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=537</guid>
		<description><![CDATA[Here&#8217;s a sneak peek at a plugin I&#8217;ve been working on. If you blog using WordPress and you&#8217;re a fan of WriteRoom, OmmWriter, or similar tools that help you focus on your words instead of the tools you&#8217;re using, then this plugin will soon make your wildest dreams come true (and give you a simple [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_538" class="wp-caption aligncenter" style="width: 563px"><a href="http://digitalize.ca/media/zen-for-wordpress.png"><img class="size-large wp-image-538  " title="Zen: distraction-free writing for WordPress" src="http://digitalize.ca/media/zen-for-wordpress-1024x646.png" alt="" width="553" height="349" /></a><p class="wp-caption-text">Zen: distraction-free writing for WordPress.</p></div>
<p>Here&#8217;s a sneak peek at a plugin I&#8217;ve been working on. If you blog using WordPress and you&#8217;re a fan of <a href="http://www.hogbaysoftware.com/products/writeroom">WriteRoom</a>, <a href="http://www.ommwriter.com/">OmmWriter</a>, or similar tools that help you focus on your words instead of the tools you&#8217;re using, then this plugin will soon make your wildest dreams come true (and give you a simple clean environment to write to your heart&#8217;s content)! It looks like crap right now, but I&#8217;m working on polishing the look and adding some cool features (themes, backgrounds, etc.), and hopefully release something soon.</p>
<p>If there are any features you&#8217;d like to see, add a comment or <a href="mailto:batmoo@gmail.com">contact moi</a>.</p>
<p><a href="http://wordpress.org/extend/plugins/zen/">Zen</a>: <strike>coming soon to a</strike><strong>now available in a</strong> WordPress Plugin Directory near you!</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/01/distraction-free-wordpress-ing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
