<?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>DrPunchBlog &#187; CODE</title>
	<atom:link href="http://yo.drpunchman.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://yo.drpunchman.com</link>
	<description>Living the feaver dream.</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:59 +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>Panning for jQuery Gold!</title>
		<link>http://yo.drpunchman.com/2012/02/01/panning-for-jquery-gold/</link>
		<comments>http://yo.drpunchman.com/2012/02/01/panning-for-jquery-gold/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 01:48:41 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Gold]]></category>
		<category><![CDATA[bullet list]]></category>
		<category><![CDATA[crazy code]]></category>
		<category><![CDATA[weird ideas]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7988</guid>
		<description><![CDATA[I needed some cool ideas for work. This is what I found: Sliding date picker Easing Animation Examples jQuery Transit (animation made easy) Jeditable ( &#8216;j-edit-table&#8217; or  &#8217;jedi-table&#8217; ?  ) APE (Ajax Push Engine) Raphaël (vectors for JavaScript) jQuery Map Building  History Slider Timeline Time Glider (this could be done better) Timelinr Slider Clock (love) 3D [...]]]></description>
			<content:encoded><![CDATA[<p>I needed some cool ideas for work.<br />
<a href="http://yo.drpunchman.com/2012/02/01/panning-for-jquery-gold/gold-panning/" rel="attachment wp-att-7989"><img class="aligncenter size-full wp-image-7989" title="gold-panning" src="http://yo.drpunchman.com/wp-content/uploads/2012/02/gold-panning.jpeg" alt="" width="640" height="440" /></a></p>
<table width="520" border="0">
<tbody>
<tr>
<td width="60%">
<h3>This is what I found:</h3>
<ul>
<li><a href="http://ajaxorized.com/introducing-the-sliding-date-picker/" target="_blank">Sliding date picker</a></li>
<li><a href="http://www.lemonsanver.com/jQuery/easingAnimationPlugin.html" target="_blank">Easing Animation Examples</a></li>
<li><a href="http://ricostacruz.com/jquery.transit/" target="_blank">jQuery Transit </a>(animation made easy)</li>
<li><a href="http://www.appelsiini.net/projects/jeditable" target="_blank">Jeditable</a> ( &#8216;j-edit-table&#8217; or  &#8217;jedi-table&#8217; ?  )</li>
<li><a href="http://www.ape-project.org/" target="_blank">APE</a> (Ajax Push Engine)</li>
<li><a href="http://raphaeljs.com/" target="_blank">Raphaël</a> (vectors for JavaScript)</li>
<li><a href="http://www.gethifi.com/blog/a-jquery-plugin-for-zoomable-interactive-maps" target="_blank">jQuery Map Building </a></li>
<li><a href="http://tutorialzine.com/2009/10/google-wave-history-slider-jquery/" target="_blank">History Slider</a></li>
<li><a href="http://tutorialzine.com/2010/01/advanced-event-timeline-with-php-css-jquery/" target="_blank">Timeline</a></li>
<li><a href="http://timeglider.com/jquery/" target="_blank">Time Glider </a>(this could be done better)</li>
<li><a href="http://www.csslab.cl/2011/08/18/jquery-timelinr/" target="_blank">Timelinr</a></li>
<li><a href="http://home.comcast.net/~vonholdt/test/clock_slide/index.htm" target="_blank">Slider Clock</a> (love)</li>
<li><a href="http://www.hotajax.org/images--gallery/others/123-3d-gallery.html" target="_blank">3D Gallery</a></li>
<li><a href="http://f6design.com/journal/2011/08/06/build-a-parallax-scrolling-website-interface-with-jquery-and-css/" target="_blank">Simple Parallax</a></li>
<li><a href="http://workshop.rs/projects/jqfancytransitions/" target="_blank">jqFancyTransitions</a></li>
<li><a href="http://www.openstudio.fr/jquery-virtual-tour/" target="_blank">jQuery Virtual Tour</a></li>
</ul>
</td>
<td valign="top" width="40%">
<h3>Other Sites Worth Noting</h3>
<ul>
<li><a href="http://f6design.com/journal/" target="_blank">f6design</a></li>
<li><a href="http://tutorialzine.com/" target="_blank">Tutorialzine.com<br />
</a></li>
<li><a href="http://knockoutjs.com/examples/" target="_blank">Knockout</a></li>
<li><a href="http://framework.gregbabula.info/" target="_blank">G5 Framework</a></li>
<li><a href="http://jqueryfordesigners.com/" target="_blank">jQuery for Designers</a></li>
<li><a href="http://tympanus.net/codrops/" target="_blank">Codrops</a> (so much stuff)</li>
</ul>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2012/02/01/panning-for-jquery-gold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2012/02/gold-panning-150x150.jpg" length="10741" type="image/jpg" />	</item>
		<item>
		<title>jQuery + KnockOut = Awesome Forms</title>
		<link>http://yo.drpunchman.com/2012/01/19/jquery-knockout-awesome-forms/</link>
		<comments>http://yo.drpunchman.com/2012/01/19/jquery-knockout-awesome-forms/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 03:55:43 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[KnockOut]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7984</guid>
		<description><![CDATA[A fun little Newsletter generator I am working on that uses KnockOut and jQuery in magical and new amazing ways! It is kinda ugly right now, because it is still in process&#8211;so shut up. Knockout: (you only get a sample, you don&#8217;t need to see all of the crazy) Here is the html template. (yes [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-7986" title="newsletter" src="http://yo.drpunchman.com/wp-content/uploads/2012/01/newsletter.jpg" alt="" width="560" height="672" /></p>
<p>A fun little Newsletter generator I am working on that uses KnockOut and jQuery in magical and new amazing ways! It is kinda ugly right now, because it is still in process&#8211;so shut up.</p>
<p><span id="more-7984"></span>Knockout: (you only get a sample, you don&#8217;t need to see all of the crazy)</p>
<pre class="brush: jscript; title: ; notranslate">

// let's list out the images to select
function f_imgBig()
{
	var newArray = Array();
	newArray.push(

	&quot;images/366_A.jpg&quot;,
	&quot;images/366_B.jpg&quot;,
	&quot;images/366_C.jpg&quot;,
	&quot;images/366_D.jpg&quot;,
	&quot;images/366_E.jpg&quot;,
	&quot;images/366_none.jpg&quot;
	);

	return newArray;
}

function f_imgBigSel()
{
	var newArray = Array();
	newArray = f_imgBig() ;

	return newArray[0];
}
// now let's add in the viewModel and sorting
var viewModel = {}; // always outside of the document load
$(function() {

&lt;!-- drag drop sort --&gt;
	$( &quot;#leftA,#leftB,#leftC&quot; ).sortable({ connectWith: ['#leftA','#leftB','#leftC'] });

&lt;!-- VIEW --&gt;

viewModel = {
	postList_L: ko.observableArray( leftPost() ),
        addPost_L: function () {
	this.postList_L.push({
		img	: f_imgBig(),
		imgSel	: ko.observable(f_imgBigSel())
	});},

ko.applyBindings(viewModel);

});
</pre>
<p>Here is the html template.<br />
(yes I am using tables, don&#8217;t worry about it)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;pre&gt;&lt;!-- LEFT --&gt;
    &lt;table data-bind=&quot;visible: postList_L().length &gt; 0&quot; bgcolor=&quot;#FFFFFF&quot;&gt;

        &lt;tr&gt;&lt;td id=&quot;module_area&quot;&gt;

        &lt;ul data-bind='template: { xxxxxxxx id=&quot;leftB&quot; &gt;&lt;/ul&gt;

        &lt;ul data-bind='template: { name: &quot;postTemplate_L&quot;, foreach: postList_L }' id=&quot;leftA&quot; &gt;&lt;/ul&gt;

        &lt;ul data-bind='template: { xxxxxxxx id=&quot;leftC&quot; &gt;&lt;/ul&gt;

        &lt;/td&gt;&lt;/tr&gt;

    &lt;/table&gt;

    &lt;input name=&quot;AddPost&quot; type=&quot;image&quot; src=&quot;_css/img/20.gif&quot; data-bind=&quot;click: addPost_L&quot; id=&quot;addPost&quot;&gt;

&lt;!-- post --&gt;
	&lt;script type=&quot;text/html&quot; id=&quot;postTemplate_L&quot;&gt;
        &lt;li style=&quot;background:#EFE;&quot; id=&quot;sel&quot;&gt;
        &lt;div id=&quot;mov&quot;&gt;&lt;/div&gt;
		&lt;input name=&quot;del&quot; type=&quot;image&quot; src=&quot;_css/img/20.gif&quot; 
data-bind=&quot;click: function(){ viewModel.removePost_L($data); }, 
visible: viewModel.postList_L().length &gt; 1&quot; id=&quot;del&quot;&gt;

		&lt;input type=&quot;image&quot; data-bind=&quot;attr: { src: imgSel }&quot; /&gt;
		&lt;select data-bind=&quot;options: img, value: imgSel&quot; /&gt;

        &lt;/li&gt;
    &lt;/script&gt;&lt;/pre&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2012/01/19/jquery-knockout-awesome-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2012/01/Screen-Shot-2012-01-19-at-7.34.56-PM-150x150.png" length="21793" type="image/jpg" />	</item>
		<item>
		<title>jQuery Nav with Arrow Support</title>
		<link>http://yo.drpunchman.com/2012/01/17/jquery-nav-with-arrow-support/</link>
		<comments>http://yo.drpunchman.com/2012/01/17/jquery-nav-with-arrow-support/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 21:46:57 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Shake Weight]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7966</guid>
		<description><![CDATA[Ignore the man behind the curtain&#8230; I&#8217;ve scrambled the text so you can&#8217;t see my super secrete message in the nav (hint: Ovaltine). The menu itself is what&#8217;s important anyway, not the text. The &#8220;how-to&#8221; follows: The drop-down is a standard drop down nav, however the left and right arrows at the top allow you [...]]]></description>
			<content:encoded><![CDATA[<p>Ignore the man behind the curtain&#8230;<br />
<img src="http://yo.drpunchman.com/wp-content/uploads/2012/01/jquery_menu.jpg" alt="" title="jquery_menu" width="542" height="389" class="aligncenter size-full wp-image-7967" /><br />
I&#8217;ve scrambled the text so you can&#8217;t see my super secrete message in the nav (hint: Ovaltine). The menu itself is what&#8217;s important anyway, not the text. </p>
<p>The &#8220;how-to&#8221; follows:</p>
<p><span id="more-7966"></span></p>
<p>The drop-down is a standard drop down nav, however the left and right arrows at the top allow you to change pages using your keyboard as well.</p>
<p>the nav:<br />
The array breaks out into [page name,page title]</p>
<pre class="brush: jscript; title: ; notranslate">
var arr = Array(
['1a','Immitto reprobo'],
['1b','Eeros enim'],
['1c','Aex inhibeo'],
['1d','Dolore nisl ut'],
['1e','Dloquor volutpat'],

['2a','Vel suscipit'],
['2b','Sin proprius'],
['2c','Natu lucidus'],
['2d','Delenit lobortis'],
['2e','Vel vel'],
['2f','Nisl, dignissim'],
['2g','Piusto elit'],

['3a','Pignissim capto'],
['3b','Ulciscor'],
['3c','Papto odio abdo'],
['3d','Sibidem hos si esse']
); 

// add the links to the navigation
function writeArr( i, length ){
for( i; i &lt; length; i++ )
{
// I added line breaks for easy reading.
document.write( '&lt;li id=&quot;verse&quot;&gt;&lt;a href=&quot;#&quot;
num=&quot;'+(i+&quot;s&quot;)+'&quot; page=&quot;'+arr[i][0]+'&quot;
title=&quot;'+arr[i][1]+'&quot; &gt;'+arr[i][1]+'&lt;/a&gt;&lt;/li&gt;' );
}
};
</pre>
<p>The Drop-Down itself is based off of Vimeo&#8217;s design, the tutorial is [ <a href="http://www.jankoatwarpspeed.com/post/2009/01/19/Create-Vimeo-like-top-navigation.aspx" target="_blank">here</a> ].</p>
<pre class="brush: xml; title: ; notranslate">
&lt;li&gt;&lt;div id=&quot;nav&quot;&gt;&lt;/div&gt;
&lt;ul&gt;
     &lt;li id=&quot;chapter&quot;&gt;
        &lt;img class=&quot;corner_inset_left&quot;
src=&quot;_css/nav/corner_inset_left.png&quot;/&gt;
Chapter One
       &lt;img class=&quot;corner_inset_right&quot;
src=&quot;_css/nav/corner_inset_right.png&quot;/&gt;
   &lt;/li&gt;
       &lt;script&gt;writeArr(0,5);&lt;/script&gt;
   &lt;li id=&quot;chapter&quot;&gt;Chapter Two&lt;/li&gt;
       &lt;script&gt;writeArr(5,12);&lt;/script&gt;
   &lt;li id=&quot;chapter&quot;&gt;Chapter Three&lt;/li&gt;
      &lt;script&gt;writeArr(12,16);&lt;/script&gt;
   &lt;li class=&quot;last&quot;&gt;
     &lt;img class=&quot;corner_left&quot; src=&quot;_css/nav/corner_left.png&quot;/&gt;
     &lt;img class=&quot;middle&quot; src=&quot;_css/nav/dot.gif&quot;/&gt;
     &lt;img class=&quot;corner_right&quot;  src=&quot;_css/nav/corner_right.png&quot;/&gt;
   &lt;/li&gt;
 &lt;/ul&gt;
&lt;/li&gt;
</pre>
<p>As you can see the actual content is pulled from our JavaScript Array. (I just wanted to keep it all tidy).</p>
<p>Here is the navigation control:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script&gt;
var pageNum = 0;

// you can move the array code to here..

// wait for when the doc is ready
$(function(){
	$(&quot;#verse a&quot;).click(function() {
		pageNumArr = $(this).attr(&quot;num&quot;).split('s');
		pageNum = pageNumArr[0];
		nextprev();
	});

// always update the title text on the page
	$('#title').html( arr[0][1] );

// next &amp; previous icons at the top
	$('#prev').click(function(){
		goNext();
	});

	$('#next').click(function(){
		goNext();
	});

// keyboard arrow keys
	$('body').keyup(function (event) {

		if (event.keyCode == 37) {
		  goNext();
		} else if (event.keyCode == 39) {
		  goPrev();
		}
	});

// control what page you are going to
	function goNext(){
		pageNum--;
		if( pageNum &lt; 0 ){ pageNum = arr.length-1 };
		nextprev();
	}

	function goPrev(){
		pageNum++;
		if( pageNum &gt;= arr.length ){ pageNum = 0 };
		nextprev();
	}

// make sure all the nav functions go to the same place
	function nextprev(){
		var title= arr[pageNum][1];
		var page= arr[pageNum][0];
// changes page header --&gt;
		$(&quot;#title&quot;).replaceWith('&lt;span id=&quot;title&quot;&gt;'+title+'&lt;/span&gt;');
// add new page --&gt;
		$(&quot;#page&quot;).load( &quot;pages/&quot;+page+&quot;.html&quot; );

		$(&quot;a&quot;).removeClass(&quot;sel&quot;);
		$(&quot;a[num^=&quot;+pageNum+&quot;s]&quot;).addClass(&quot;sel&quot;);
/* FUN FACT:
	using $(&quot;a[num^=&quot;+pageNum+&quot;]&quot;) will select &quot;1&quot; and &quot;10,11,12,..&quot;
	as well, because they all start with the number &quot;1&quot;. Which is
	kinda fucked up, so I added a text character at the end &quot;s&quot; so
	&quot;1s&quot; is now unique.
	&quot;11s&quot; and/or &quot;21s&quot; are not effected, but if I had &quot;1s1&quot; then
	I'd be back to the drawing board.
*/
	}

// this will update the nav for the first use.
	nextprev();
});

&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2012/01/17/jquery-nav-with-arrow-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2012/01/jquery_menu-150x150.jpg" length="6007" type="image/jpg" />	</item>
		<item>
		<title>Wiggle it, just a little bit</title>
		<link>http://yo.drpunchman.com/2011/12/15/wiggle-it-just-a-little-bit/</link>
		<comments>http://yo.drpunchman.com/2011/12/15/wiggle-it-just-a-little-bit/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:55:43 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[AfterEffects]]></category>
		<category><![CDATA[Expressions]]></category>
		<category><![CDATA[jiggle]]></category>
		<category><![CDATA[Party]]></category>
		<category><![CDATA[sliders]]></category>
		<category><![CDATA[wiggle]]></category>
		<category><![CDATA[wobble]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7952</guid>
		<description><![CDATA[Its a wiggle party, and your booty is invited.  I thought there was a ready-made expression for this? &#8220;Wobble&#8221;,&#8221;Wiggle&#8221;,&#8221;Jiggle&#8221;? Screw it, So&#8230; I kinda made my own. Firstly, let&#8217;s add some sliders:  Next we attach the code: (This is what I added to the Anchor Point, because the Position was pathed out elsewhere.) At the end [...]]]></description>
			<content:encoded><![CDATA[<p>Its a wiggle party, and your booty is invited.<br />
<img class="aligncenter size-full wp-image-7954" title="wiggle party" src="http://yo.drpunchman.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-15-at-10.49.06-AM.png" alt="" width="475" height="415" /> I thought there was a ready-made expression for this? &#8220;Wobble&#8221;,&#8221;Wiggle&#8221;,&#8221;Jiggle&#8221;? Screw it, So&#8230; I kinda made my own.<br />
<span id="more-7952"></span></p>
<p>Firstly, let&#8217;s add some sliders:<br />
<img class="aligncenter size-full wp-image-7955" title="Slider Party" src="http://yo.drpunchman.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-15-at-10.52.03-AM.png" alt="" width="558" height="182" /> Next we attach the code:<br />
(This is what I added to the Anchor Point, because the Position was pathed out elsewhere.)</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;pre&gt;segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
slideMin = effect(&quot;MinValS&quot;)(&quot;Slider&quot;);
slideMax = effect(&quot;MaxValS&quot;)(&quot;Slider&quot;);
minVal = [slideMin, slideMin];
maxVal = [slideMax, slideMax];

seedRandom(index,true);
segDur = random(segMin, segMax);
seed = Math.floor(time/segDur);
segStart = seed*segDur;
seedRandom(seed,true);
startVal =  random(minVal,maxVal);
seedRandom(seed+1,true);endVal = random(minVal,maxVal);

ease(time,segStart,segStart + segDur, startVal, endVal);
</pre>
<p>At the end of it I parented all of the objects to a new null, so I can tweak the X/Y to adjust for the offsets of the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/12/15/wiggle-it-just-a-little-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-15-at-10.49.06-AM-150x150.png" length="28832" type="image/jpg" />	</item>
		<item>
		<title>Loop Faster, Damnit!</title>
		<link>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/</link>
		<comments>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 19:07:16 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Beer]]></category>
		<category><![CDATA[faster code]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7911</guid>
		<description><![CDATA[Taking your loops from 0.03 to 0.02+/-! A while ago, I was talking (probably here somewhere) about increasing the speed of FOR loops in ActionSctipt. They both do the same thing, but with the variables pre-defined, the second FOR is faster. It isn&#8217;t trying to run a function AND calculate the length of an an [...]]]></description>
			<content:encoded><![CDATA[<p>Taking your loops from 0.03 to 0.02+/-!</p>
<p>A while ago, I was talking (probably here somewhere) about increasing the speed of FOR loops in ActionSctipt.</p>
<pre class="brush: as3; title: ; notranslate">
var arr:Array = new Array(&quot;kittens&quot;,&quot;bunnies&quot;,&quot;puppies&quot;,&quot;whores dressed like french maids&quot;);
// slow:
for( var i:uint = 0; i &lt; arr.length(); i++ )
{
trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}

// fast:
var i:uint = 0;
var l:uint = arr.length();
for( i; i &lt; l; i++ )
 {
      trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
 }

// personal favorite (although I need to test the speed)
var i:uint = 0;
for( i in arr )
{
trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}
</pre>
<p>They both do the same thing, but with the variables pre-defined, the second FOR is faster. It isn&#8217;t trying to run a function AND calculate the length of an an array.</p>
<p>For jQuery, the effect is the same &#8212; my guess is that is a global coding thing.<br />
Although, it goes counter to conventional thinking (having more code on the page = slower load), the truth is: cleanly defined variables will produce faster (efficient) processing, even if it does mean more lines of code.</p>
<pre class="brush: jscript; title: ; notranslate">
// slow
$(&quot;.cuteStuff&quot;).each( function()
{
    for ( var arr, i = -1; arr = $arr[++i] )
    {
        document.write( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
    }
});
// faster
var $arr = $(&quot;#cuteStuff&quot;); &lt;!-- ID's are faster then CLASSES --&gt;
for ( var arr, i = -1; arr = $arr[++i] )
{
    document.write( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}
</pre>
<p>Here the main difference is that in the &#8220;slow&#8221; example, you are calling a function every time the page reads a div tag. (Think of it like, each div tag is a glass of beer, you find it drink it, and move on to the next.)<br />
In the &#8220;fast&#8221; example you are putting all the div tags into a make-shift array and just chugging it. (This time you are pouring each div tag into a beer bong and now chug them all at once.)</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ND3D: The Revenge.</title>
		<link>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/</link>
		<comments>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 06:16:01 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[ASE]]></category>
		<category><![CDATA[Banner]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Modo]]></category>
		<category><![CDATA[Mustachio]]></category>
		<category><![CDATA[Zero]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7890</guid>
		<description><![CDATA[An update to last year&#8217;s ND3D banner test. Now it is all about, fitting it in the pipeline. The major issue is that creating an ASE file is stupid. 3Ds Max makes .ASE files, and 3Ds Max is for fools. Thanks to SupaMonke (again) for saving my skin. Harry, found a plugin, it didn&#8217;t work, [...]]]></description>
			<content:encoded><![CDATA[<p>An update to last year&#8217;s ND3D banner test.<br />
<img class="aligncenter size-medium wp-image-7891" title="Viva La 3D" src="http://yo.drpunchman.com/wp-content/uploads/2011/11/jiri-ruzek-3d-vikencia-01-300x202.jpg" alt="" width="300" height="202" /><br />
Now it is all about, fitting it in the pipeline.</p>
<p>The major issue is that creating an ASE file is stupid.<br />
3Ds Max makes .ASE files, and 3Ds Max is for fools.</p>
<p><span id="more-7890"></span>Thanks to <a href="http://www.supamonke.com/" target="_blank">SupaMonke</a> (again) for saving my skin. Harry, found a plugin, it didn&#8217;t work, so he rebuilt it. He is insane.</p>
<p>So&#8230;</p>
<ol>
<li>Download <a href="http://www.nulldesign.de/projects/nd3d-as3-3d-engine/" target="_blank">ND3D</a></li>
<li>Build your file in <a href="http://www.luxology.com/modo/" target="_blank">Modo</a></li>
<li>Use Harry&#8217;s <a href="http://drpunchman.com/_downloads/ND3D_fix.zip" target="_blank">plugin</a></li>
<li>Export an ASE file</li>
<li>Open the ASE file in TextEdit</li>
<ol>
<li>copy the &#8220;*MESH_VERTEX&#8221; bit with all the numbers</li>
<li>convert the numbers into an array [0,-0.3400 0.6099,0.3464],[1,-0.3400,0.5570,0.5080],[...</li>
</ol>
<li>Duplicate one of the objects in the <em>de/nulldesign/nd3d/objects/</em> folder.</li>
<li>Name it whatever, and remember to name the class and constructor to match...</li>
<li>Drop the array in (ok, I'm just getting tired writing this, I'm going to coast along for the rest of this... read my other post [<a href="http://yo.drpunchman.com/2010/03/03/nd3d-make-your-own-primitives/" target="_blank">here</a>] to figure this shit out&#8230; I&#8217;m going to ramble).</li>
<li>Oh, hi- you’re the phone guy right?</li>
<li>That’s what it says on my van!</li>
<li>Great, well, why don’t you just come in and get started… I’ve been having problems with my phone connection.</li>
<li>Hmmm, well it looks to me someone put this weird plastic thing where the tin can goes.</li>
<li>Ya! You’ve got quite the sense of humor.</li>
<li>No, seriously… what is this?</li>
<li>You’re kidding right? It’s a phone…</li>
<li>pulling wires, and a loud SHOCK</li>
<li>HOLLY MOTHER! That thing bit me! What are all these little colored metal things?</li>
<li>Those are wires… phone wires- for the phone. And I think it shocked you… with e-lec-tricity</li>
<li>E-lect-what now?</li>
<li>End Scene.</li>
<li>&#8230;and you&#8217;re done!</li>
</ol>
<div>&#8230;fuck it, here is a picture of a frenchman with a mustache:<br />
<img class="aligncenter size-full wp-image-7892" title="Mustachio" src="http://yo.drpunchman.com/wp-content/uploads/2011/11/Mustachio.jpg" alt="" width="600" height="379" /></div>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/11/jiri-ruzek-3d-vikencia-01-150x150.jpg" length="8474" type="image/jpg" />	</item>
		<item>
		<title>Bring the noise!</title>
		<link>http://yo.drpunchman.com/2011/10/28/bring-the-noise/</link>
		<comments>http://yo.drpunchman.com/2011/10/28/bring-the-noise/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 22:03:34 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actionscript 2.0]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[noise]]></category>
		<category><![CDATA[perlinNoise]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7876</guid>
		<description><![CDATA[Dynamically generated noise patterns. If you want an interactive example click [here]. After the jump is the AS2 code I&#8217;ve been playing with. It&#8217;s pretty rough, but you&#8217;ll get the idea. It attaches to a movie clip named &#8220;bg&#8221;. for help with filters click [here].]]></description>
			<content:encoded><![CDATA[<p>Dynamically generated noise patterns.<br />
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/10/Screen-shot-2011-10-28-at-3.09.40-PM.png" alt="" title="More Power" width="483" height="86" class="aligncenter size-full wp-image-7881" /><br />
If you want an interactive example click [<a href="http://polygeek.com/1780_flex_explorer-bitmapdata-perlin-noise" target="_blank">here</a>].</p>
<p>After the jump is the AS2 code I&#8217;ve been playing with.<br />
<span id="more-7876"></span><br />
It&#8217;s pretty rough, but you&#8217;ll get the idea.<br />
It attaches to a movie clip named &#8220;bg&#8221;.</p>
<pre class="brush: as3; title: ; notranslate">
import flash.display.BitmapData;
import flash.display.DisplayObject.blendMode;
import flash.display.BlendMode;
import flash.filters.*;
// NOISE -----------------------------

var bmp3:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc3:MovieClip = bg.createEmptyMovieClip(&quot;noise3&quot;, bg.getNextHighestDepth() );
mc3.attachBitmap(bmp3, this.getNextHighestDepth());
bmp3.noise( 11, 22, 234, 15, true);
mc3.blendMode = 13;
mc3._alpha = 70;

var bmp:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc:MovieClip = bg.createEmptyMovieClip(&quot;noise&quot;, bg.getNextHighestDepth() );
mc.attachBitmap(bmp, this.getNextHighestDepth());
var randomNum:Number = Math.floor(Math.random() * 50 ) + 50;
bmp.perlinNoise( 351, 91, 15, randomNum, false, false, 8, true);

mc.blendMode = 14;
mc._alpha = 70;

var bmp2:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc2:MovieClip = bg.createEmptyMovieClip(&quot;noise2&quot;, bg.getNextHighestDepth() );
mc2.attachBitmap(bmp2, this.getNextHighestDepth());
var randomNum2:Number = Math.floor(Math.random() * 50 ) + 50;
bmp2.perlinNoise( 96, 277, 15, randomNum2, false, true, 8, true);
mc2.blendMode = 13;
mc2._alpha = 70;

var ds:DropShadowFilter = new DropShadowFilter( 3, -45, 0x000000, 100, 2, 2, 3, 3, false, false, false );
mc.filters = [ds];
</pre>
<p>for help with filters click [<a href="http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001282.html" target="_blank">here</a>].</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/10/28/bring-the-noise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/10/Screen-shot-2011-10-28-at-3.09.40-PM-150x86.png" length="26748" type="image/jpg" />	</item>
		<item>
		<title>Diagrams &gt; Words</title>
		<link>http://yo.drpunchman.com/2011/09/30/diagrams-words/</link>
		<comments>http://yo.drpunchman.com/2011/09/30/diagrams-words/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 17:57:32 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[CODE]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[calls]]></category>
		<category><![CDATA[Faraday]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7843</guid>
		<description><![CDATA[Trying to help get my ideas across in an email, about 20 bullet points in, the diagram seemed like a better idea.  On a slightly side note, I&#8217;m more and more intregued with Faraday&#8217;s lines of force&#8230; not because of the science, but because Faraday was &#8220;math illiterate&#8221; and had to just draw out what [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to help get my ideas across in an email,<br />
about 20 bullet points in, the diagram seemed like a better idea. <img class="aligncenter size-full wp-image-7844" title="WebServicTraffic" src="http://yo.drpunchman.com/wp-content/uploads/2011/09/WebServicTraffic.jpg" alt="" width="551" height="351" /></p>
<p>On a slightly side note, I&#8217;m more and more intregued with Faraday&#8217;s lines of force&#8230; not because of the science, but because Faraday was &#8220;math illiterate&#8221; and had to just draw out what he thought was going on. The response from the scientific community was that ART &gt; MATH, being able to diagram what you are thinking apparently trumps equations.</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/09/30/diagrams-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/09/WebServicTraffic-150x150.jpg" length="6895" type="image/jpg" />	</item>
		<item>
		<title>Honda Trip Planner</title>
		<link>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/</link>
		<comments>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 02:41:10 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[Banner]]></category>
		<category><![CDATA[Honda]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=2051</guid>
		<description><![CDATA[Banner for the MCAV Trip Planner. No, I do not know what any of that means.]]></description>
			<content:encoded><![CDATA[<p>Banner for the MCAV Trip Planner.<br />
No, I do not know what any of that means.<br />
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.jpg" alt="" title="MCAV TripPlanner 160x600" width="160" height="600" class="alignleft size-full wp-image-2052" /><br />
<span id="more-2051"></span><br />

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="160" height="600">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.swf" width="160" height="600">
      <!--<![endif]-->
        MCAV Trip-Planner 160&#215;600 banner
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600-150x150.jpg" length="10564" type="image/jpg" />	</item>
		<item>
		<title>Honda CBR 250R Banner</title>
		<link>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/</link>
		<comments>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 02:45:28 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[banners]]></category>
		<category><![CDATA[CBR 250R]]></category>
		<category><![CDATA[Honda]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=2055</guid>
		<description><![CDATA[Here is one of the banners that I worked on for the Honda CBR 250R. Who names these bikes?]]></description>
			<content:encoded><![CDATA[<p>Here is one of the banners that I worked on for the Honda CBR 250R.<br />
Who names these bikes?</p>
<table>
<tr>
<td>
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.jpg" alt="" title="cbr250r_road_300x250" width="300" height="250" class="alignleft size-full wp-image-2056" />
</td>
<td>
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.jpg" alt="" title="cbr250r_road_160x90" width="160" height="90" class="alignleft size-full wp-image-2057" />
</td>
</tr>
</table>
<p><span id="more-2055"></span></p>
<table>
<tr>
<td>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        cbr250r road 300&#215;250
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

</td>
<td>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_2" width="160" height="90">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.swf" width="160" height="90">
      <!--<![endif]-->
        cbr250r road 160&#215;90
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250-150x150.jpg" length="8994" type="image/jpg" />	</item>
	</channel>
</rss>

