<?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>Antelope Love Fan</title>
	<atom:link href="http://mark.biek.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://mark.biek.org/blog</link>
	<description>Life, programming, &#38; general geekery by Mark Biek</description>
	<lastBuildDate>Mon, 23 Jan 2012 13:00:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Get on your bike.  No excuses</title>
		<link>http://mark.biek.org/blog/2012/01/get-on-your-bike-no-excuses/</link>
		<comments>http://mark.biek.org/blog/2012/01/get-on-your-bike-no-excuses/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 13:00:10 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[cycling]]></category>

		<guid isPermaLink="false">http://mark.biek.org/blog/?p=1296</guid>
		<description><![CDATA[Don’t worry about how your bike looks. Don’t worry about your clothes. Don’t worry about the weather. If it’s cold, you’ll warm up again. If it’s wet, you’ll get dry again. Just get on your bike and ride it. Go as fast as you can. Or as fast as you want to. You don’t need [...]]]></description>
			<content:encoded><![CDATA[<p>Don’t worry about how your bike looks.</p>
<p>Don’t worry about your clothes.</p>
<p>Don’t worry about the weather. If it’s cold, you’ll warm up again. If it’s wet, you’ll get dry again.</p>
<p>Just get on your bike and ride it. Go as fast as you can. Or as fast as you want to.</p>
<p>You don’t need headphones.</p>
<p>Listen to the sounds of the world. The wind whistling in your ears. The sound of your heart pounding in your chest.</p>
<p>If you see someone else on a bike, wave to them.</p>
<p>Don’t worry about mountain bike, road bike, fixie, used, new, fancy brand, department store bike.</p>
<p>People should wave to other people on bikes.</p>
<p>We are brothers and sisters of the wheel and should acknowledge each other as such.</p>
]]></content:encoded>
			<wfw:commentRss>http://mark.biek.org/blog/2012/01/get-on-your-bike-no-excuses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pixel level drawing with the &lt;canvas&gt; element</title>
		<link>http://mark.biek.org/blog/2012/01/pixel-level-drawing-with-the-canvas-element/</link>
		<comments>http://mark.biek.org/blog/2012/01/pixel-level-drawing-with-the-canvas-element/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 16:46:45 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mark.biek.org/blog/?p=1287</guid>
		<description><![CDATA[Today we’re going to learn how to manipulate the HTML &#60;canvas&#62; element at the pixel level. To start, we need a canvas element: &#60;canvas id=&#8221;canvas&#8221; width=&#8221;640&#8243; height=&#8221;480&#62;&#8221; &#60;p&#62;Your browser doesn&#8217;t support canvas.&#60;/p&#62; &#60;/canvas&#62; Next get a handle to the canvas element and its 2d context. var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); Next, we [...]]]></description>
			<content:encoded><![CDATA[<p>Today we’re going to learn how to manipulate the HTML &lt;canvas&gt; element at the pixel level.</p>
<p>To start, we need a canvas element:</p>
<p>&lt;canvas id=&#8221;canvas&#8221; width=&#8221;640&#8243; height=&#8221;480&gt;&#8221;<br />
&lt;p&gt;Your browser doesn&#8217;t support canvas.&lt;/p&gt;<br />
&lt;/canvas&gt;</p>
<p>Next get a handle to the canvas element and its 2d context.</p>
<pre class="javascript">var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');</pre>
<p>Next, we create a ImageData element on the canvas that covers the entire canvas. This is we’re actually going to be drawing our pixels on.</p>
<pre class="javascript">var imgd = ctx.createImageData(canvas.width, canvas.height);</pre>
<p>The ImageData element is basically just a big array. Each block of 4 array elements corresponds to a single pixel.</p>
<p>The array indices in each pixel block control the color and alpha transparency as follows:</p>
<ul>
<li>i = Red value</li>
<li>i+1 = Green value</li>
<li>i+2 = Blue value</li>
<li>i+3 = Alpha</li>
</ul>
<div><img class="alignnone" title="ImageData element" src="http://i.imgur.com/77DH6.jpg" alt="" width="461" height="346" /></div>
<p>And here’s a simple function for drawing a single pixel given an x,y value and r,g,b:</p>
<pre class="javascript">var setPixel = function(imageData, point, r, g, b, a) {
    a = typeof a == 'undefined' ? 255 : a;
    i = (point.x + point.y * imageData.width) * 4;

    imageData.data[i  ] = r;
    imageData.data[i+1] = g;
    imageData.data[i+2] = b;
    imageData.data[i+3] = a;
};</pre>
<p>Let’s say we wanted to draw a red pixel at 100,100. Given the ImageData element we declared above, we’d call setPixel like this:</p>
<pre class="javascript">setPixel(imgd, {x:100,y:100}, 255, 0, 0);</pre>
<p>Notice we’re not passing a value for the alpha transparency. The setPixel defaults the alpha to fully opaque if a value is specified.</p>
<p>A more full-featured setPixel function can be found <a href="https://gist.github.com/1621650" target="_blank">here</a>. This version accepts HTML hex codes for colors and extends the Object prototype so we call it directly on the ImageData element like this:</p>
<pre class="javascript">imgd.setPixel({x:100,y:100}, ‘#f00’);</pre>
<p><a href="https://gist.github.com/1149516" target="_blank">Here’s a sample</a> that draws a <a href="http://en.wikipedia.org/wiki/Sierpinski_triangle" target="_blank">Sierpinski triangle</a> using the <a href="http://en.wikipedia.org/wiki/Chaos_game" target="_blank">chaos game</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mark.biek.org/blog/2012/01/pixel-level-drawing-with-the-canvas-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Year&#8217;s Resolutions</title>
		<link>http://mark.biek.org/blog/2011/12/new-years-resolutions/</link>
		<comments>http://mark.biek.org/blog/2011/12/new-years-resolutions/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 04:59:05 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://mark.biek.org/blog/?p=1284</guid>
		<description><![CDATA[2011 was an interesting year with lots of highs and lows. But rather than rehashing last year, I&#8217;ve decided to go on record with my New Year&#8217;s Resolutions in the hopes that a permanent record will help me stay honest: Starting tomorrow, no alcoholic beverages until I&#8217;m under 200lbs. Write at least one blog post [...]]]></description>
			<content:encoded><![CDATA[<p>2011 was an interesting year with lots of highs and lows.</p>
<p>But rather than rehashing last year, I&#8217;ve decided to go on record with my New Year&#8217;s Resolutions in the hopes that a permanent record will help me stay honest:</p>
<ul>
<li>Starting tomorrow, no alcoholic beverages until I&#8217;m under 200lbs.</li>
<li>Write at least one blog post or poem (I reserve the right to keep the poems to myself) per week.</li>
<li>Ride a century. The ideal would be 100-miles-to-nowhere in Cherokee.</li>
<li>Play more D&amp;D with the kids.</li>
<li>Do something cool with my Freeduino</li>
<li>Get a app published to the Android Market.</li>
</ul>
<div>So here&#8217;s to being the people we always wanted to be next year and here&#8217;s to not beating ourselves up too much if we can&#8217;t pull it off.</div>
]]></content:encoded>
			<wfw:commentRss>http://mark.biek.org/blog/2011/12/new-years-resolutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write a very simple jQuery Plugin</title>
		<link>http://mark.biek.org/blog/2011/06/how-to-write-a-very-simple-jquery-plugin/</link>
		<comments>http://mark.biek.org/blog/2011/06/how-to-write-a-very-simple-jquery-plugin/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 15:17:14 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://mark.biek.org/blog/?p=1277</guid>
		<description><![CDATA[One of the great things about jQuery is that it&#8217;s very easy to extend and has a great plugin ecosystem. Today, we&#8217;re going to create a very simple jQuery plugin which will change the border color of an element. Step 1: Protect the global scope The first thing to do is wrap your plugin code [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great things about jQuery is that it&#8217;s very easy to extend and has a great <a href="http://plugins.jquery.com/" target="_blank">plugin</a> ecosystem.</p>
<p>Today, we&#8217;re going to create a very simple jQuery plugin which will change the border color of an element.</p>
<h3>Step 1:  Protect the global scope</h3>
<p>The first thing to do is wrap your plugin code in an anonymous function that calls itself so we don&#8217;t pollute the global scope.</p>
<pre name="code" class="javascript">
(function($) {

})(jQuery);
</pre>
<p>Now any variables we declare inside that function will only exist within the local scope.  </p>
<p>We also pass the main jQuery object to our function.  This allows us to use the $ object even when jQuery is running in <a href="http://api.jquery.com/jQuery.noConflict/" target="_blank">noConflict</a> mode.</p>
<h3>Step 2:  Create our plugin function and make sure it&#8217;s chainable</h3>
<p>We going to add a function called <strong>borderize</strong> to the jQuery object.  </p>
<pre name="code" class="javascript">
(function($) {
    $.fn.borderize = function(opts) {
        return this.each( function() {
        });
    };
})(jQuery);
</pre>
<p>The <strong> return this.each();</strong> is important because it allows our plugin to be chainable by returning the object the function is being called on.</p>
<p>That means we&#8217;ll be able to do things like this:</p>
<p>$(&#8216;#Foo&#8217;).borderize().css(&#8216;width&#8217;, &#8217;500px&#8217;);</p>
<h3>Step 3:  Setup some default options for the plugin but allow the end-user to change them.</h3>
<p>We set our default border color to red.  If <strong>borderize()</strong> is called without any arguments, the border color will still be red.</p>
<pre name="code" class="javascript">
(function($) {
    $.fn.borderize = function(opts) {
        return this.each( function() {
            var settings = {
                borderColor: '#00ff00'
            };

            if(typeof opts == 'object') {
              $.extend(settings, opts);
            }
        });
    };
})(jQuery);
</pre>
<p>We use the <a href="http://api.jquery.com/jQuery.extend/" target="_blank">$.extend</a> function to update our settings object with any options the user might pass in.</p>
<pre name="code" class="javascript">
$('#Foo').borderize( { borderColor: '#000' } );
</pre>
<p>In the above, we&#8217;re passing in black for the border color.  <strong>$.extend</strong> will overwrite the value of borderColor in <strong>settings</strong> with the value passed in via <strong>opts</strong></p>
<h3>Step 4:  Make the plugin actually do something</h3>
<p>Now that the scaffold of our plugin, we add a call to <a href="http://api.jquery.com/css/" target="_blank">$.css</a> to actually change the border color of the passed in object.</p>
<pre name="code" class="javascript">
(function($) {
    $.fn.borderize = function(opts) {
        return this.each( function() {
            var settings = {
                borderColor: '#00ff00'
            };

            if(typeof opts == 'object') {
              $.extend(settings, opts);
            }

            $(this).css('border', '1px solid ' + settings.borderColor);
        });
    };
})(jQuery);
</pre>
<h3>Step 5:  A final demo</h3>
<p>Here&#8217;s a working <a href="http://jsfiddle.net/antelopelovefan/EGBcm/" target="_blank">jsfiddle demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mark.biek.org/blog/2011/06/how-to-write-a-very-simple-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Must-Have Chrome Extensions</title>
		<link>http://mark.biek.org/blog/2011/03/must-have-chrome-extensions/</link>
		<comments>http://mark.biek.org/blog/2011/03/must-have-chrome-extensions/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 13:32:52 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[chrome]]></category>

		<guid isPermaLink="false">http://mark.biek.org/blog/?p=1269</guid>
		<description><![CDATA[Here&#8217;s a short list of the Chrome extensions that I use all day, every day. MeasureIt! Web Developer HTML Validator Google Analytics Debugger And let&#8217;s also not forget the Chrome Developer Tools that are built into Chrome. Once you turn on XMLHttpRequest logging, it can do everything Firebug does.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a short list of the Chrome extensions that I use all day, every day.</p>
<p><a href="https://chrome.google.com/webstore/detail/aonjhmdcgbgikgjapjckfkefpphjpgma" target="_blank">MeasureIt!</a></p>
<p><a href="https://chrome.google.com/webstore/detail/bfbameneiokkgbdmiekhjnmfkcnldhhm" target="_blank">Web Developer</a></p>
<p><a href="https://chrome.google.com/webstore/detail/cgndfbhngibokieehnjhbjkkhbfmhojo" target="_blank">HTML Validator</a></p>
<p><a href="https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna" target="_blank">Google Analytics Debugger</a></p>
<p>And let&#8217;s also not forget the <a href="http://code.google.com/chrome/devtools/">Chrome Developer Tools</a> that are built into Chrome.  Once you turn on XMLHttpRequest logging, it can do everything Firebug does.</p>
]]></content:encoded>
			<wfw:commentRss>http://mark.biek.org/blog/2011/03/must-have-chrome-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  mark.biek.org/blog/feed/ ) in 0.20312 seconds, on Feb 6th, 2012 at 2:36 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 6th, 2012 at 3:36 am UTC -->
