<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.8.6" -->
<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/"
	>

<channel>
	<title>WebAppers &#187; Code</title>
	<link>http://www.webappers.com</link>
	<description>- Hunting the Best Open Source Resources for Web Developers</description>
	<pubDate>Fri, 17 May 2013 07:10:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
			<item>
		<title>Interactive Playground for Snippets of CSS &amp; HTML</title>
		<link>http://www.webappers.com/2013/04/18/interactive-playground-for-snippets-of-css-html/</link>
		<comments>http://www.webappers.com/2013/04/18/interactive-playground-for-snippets-of-css-html/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 07:01:04 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[License Free]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=8294</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=2044814974" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1994376794" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>Dabblet is an interactive playground for quickly testing snippets of CSS and HTML code. It uses -prefix-free, so that you won&#8217;t have to add any prefixes in your CSS code. You can save your work in Github gists, embed it in other websites and share it with others.
It currently only supports modern versions of Chrome, [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1952441560" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=480960541" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="Dabblet" href="http://dabblet.com/" target="_blank">Dabblet</a> is<strong> an interactive playground for quickly testing snippets of CSS and HTML code</strong>. It uses -prefix-free, so that you won&#8217;t have to add any prefixes in your CSS code. You can save your work in Github gists, embed it in other websites and share it with others.</p>
<p>It currently only supports modern versions of Chrome, Safari and Firefox. All posted code belongs to the poster and no license is enforced. Dabblet itself is open source software and is distributed under a NPOSL-3.0 license. you can <a title="Dabblet on Github" href="https://github.com/LeaVerou/dabblet" target="_blank">fork dabblet on github</a> as well.</p>
<p style="text-align: center;"><a title="Dabblet" href="http://dabblet.com/" target="_blank"><img class="size-full wp-image-8295 aligncenter" title="dabblet" src="http://www.webappers.com/img/2013/04/dabblet.jpg" alt="dabblet" width="579" height="336" /></a></p>
<blockquote><p>Requirements: -<br />
Demo: <a title="demo" rel="nofollow" href="http://dabblet.com/" target="_blank">http://dabblet.com/</a><br />
License: NPOSL-3.0 License</p></blockquote>

<!-- Similar Posts took 0.327 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2013/04/18/interactive-playground-for-snippets-of-css-html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Interactive Challenges &amp; Writing jQuery in the Browser</title>
		<link>http://www.webappers.com/2013/03/05/interactive-challenges-writing-jquery-in-the-browser/</link>
		<comments>http://www.webappers.com/2013/03/05/interactive-challenges-writing-jquery-in-the-browser/#comments</comments>
		<pubDate>Tue, 05 Mar 2013 07:05:50 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[License Free]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=7928</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1938712826" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=2023980849" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>Try jQuery is a combination of videos, interactive console challenges, and writing code in the browser. You&#8217;ll need about 2 hours of time to make it through everything. There is a gentle introduction to what jQuery is, and what it can do.
It tells you how to search and walk through the DOM with selectors and [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1642079974" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=756876680" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="Try jQuery" href="http://try.jquery.com/" target="_blank">Try jQuery</a> is <strong>a combination of videos, interactive console challenges, and writing code in the browser</strong>. You&#8217;ll need about 2 hours of time to make it through everything. There is a gentle introduction to what jQuery is, and what it can do.</p>
<p>It tells you how to search and walk through the DOM with selectors and traversing. Add &amp; remove from the DOM, more traversing, and user events. Listen for events, handle them, and change the default event behavior of web browsers. Before landing, tame CSS with jQuery and animate elements on the page.</p>
<p style="text-align: center;"><a title="Try jQuery" href="http://try.jquery.com/" target="_blank"><img class="size-full wp-image-7929 aligncenter" title="try-jquery" src="http://www.webappers.com/img/2013/03/try-jquery.png" alt="try-jquery" width="580" height="385" /></a></p>
<blockquote><p>Requirements: jQuery Framework<br />
Demo: <a title="demo" rel="nofollow" href="http://try.jquery.com/" target="_blank">http://try.jquery.com/</a><br />
License: License Free</p></blockquote>

<!-- Similar Posts took 0.399 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2013/03/05/interactive-challenges-writing-jquery-in-the-browser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to Optimize Your Code in JavaScript</title>
		<link>http://www.webappers.com/2012/12/14/how-to-optimize-your-code-in-javascript/</link>
		<comments>http://www.webappers.com/2012/12/14/how-to-optimize-your-code-in-javascript/#comments</comments>
		<pubDate>Fri, 14 Dec 2012 07:01:43 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Information]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=7120</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=827185294" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1141969878" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>This article recently appeared on BuildNewGames.com, a collaboration by the teams at Bocoup and Internet Explorer. It is authorized to publish on WebAppers.
At Bocoup, my colleagues and I often laze about in antique leather armchairs, sipping Mai Tais, waxing rhetoric about important issues-of-the-day including international politics and automatic semicolon insertion. One thing I find fascinating [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=980273340" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=522034936" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p>This article recently appeared on <a href="http://buildnewgames.com" target="_blank">BuildNewGames.com</a>, a collaboration by the teams at <a href="http://www.bocoup.com/" target="_blank">Bocoup</a> and <a href="http://ie.microsoft.com/testdrive/" target="_blank">Internet Explorer.</a> It is authorized to publish on WebAppers.</p>
<p>At <a href="http://bocoup.com" target="_blank">Bocoup</a>, my colleagues and I often laze about in antique leather armchairs, sipping Mai Tais, waxing rhetoric about important issues-of-the-day including international politics and automatic semicolon insertion. One thing I find fascinating is how people working on different types of projects have different wisdom to share: best practices for jQuery plugins are different than those for Facebook apps, and tips for Backbone.js ecommerce sites may not be useful when developing real-time strategy games.</p>
<p><img class="alignnone size-full wp-image-7125" title="javascript-optimize" src="http://www.webappers.com/img/2012/12/javascript-optimize.png" alt="javascript-optimize" width="580" height="332" /></p>
<p>What I’d like to share in this article is some code organization tips and tricks I’ve learned while making HTML5 games. I’ve tried to keep them as generally useful as possible, but you’ll definitely get the most out of this if you make games like I do.</p>
<p>First I’ll discuss organizing JavaScript code into files and modules. Then I’ll talk about code sharing approaches such as component systems. Lastly I’ll share some ideas for writing data-driven code in games.</p>
<p><span id="more-7120"></span></p>
<h3 id="files-and-modules">Files and Modules</h3>
<p>It should go without saying that a large application all stuffed into one file is a maintenance nightmare. Still, even now, the logistics of organizing JavaScript in separate files are being ironed out. First let’s look at the file issue itself, then the more complex issue of what sorts of modules those files contain.</p>
<h3 id="many-files-in-development-concat-in-production">Many Files in Development, Concat in Production</h3>
<p>When setting up a new JavaScript project, I recommend using <a href="http://gruntjs.com/" target="_blank">grunt</a>, a build tool that has built-in tasks for concatenating all your files into one, then minifying the result. You want users to end up downloading just one minified JavaScript file. This is great in production, since it reduces HTTP requests and download sizes. In development, it’s not so good: having readable code in separate files is necessary for efficient debugging.</p>
<p>I recommend having something like this in your index.html:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span></pre>
</td>
<td class="code">
<pre><code><span class="line">&lt;head&gt;
</span><span class="line">  ...
</span><span class="line">  &lt;!-- source files for development --&gt;
</span><span class="line">  &lt;!-- &lt;script src="src/setup.js"&gt;&lt;/script&gt; --&gt;
</span><span class="line">  &lt;!-- &lt;script src="src/player.js"&gt;&lt;/script&gt; --&gt;
</span><span class="line">  &lt;!-- &lt;script src="src/enemy.js"&gt;&lt;/script&gt; --&gt;
</span><span class="line">  &lt;!-- &lt;script src="src/bullet.js"&gt;&lt;/script&gt; --&gt;
</span><span class="line">  &lt;!-- &lt;script src="src/explosion.js"&gt;&lt;/script&gt; --&gt;
</span><span class="line">
</span><span class="line">  &lt;!-- concatenated / minified source for production --&gt;
</span><span class="line">  &lt;script src="production/app.js"&gt;&lt;/script&gt;
</span><span class="line">   ...
</span><span class="line">&lt;/head&gt;</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>This way you can comment out app.js and uncomment the source files for easy development.</p>
<p>However, this isn’t ideal. One thing you might do is modify your build process to have options to build for development or for production, saving you the effort of manually commenting / uncommenting lines. No build tools do this out of the box as far as I know, but for some projects this extra effort of customizing your build process may be worthwhile.</p>
<h3 id="source-maps">Source Maps</h3>
<p>Google Chrome has a cool new feature called <a href="http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/" target="_blank">Source Maps</a> that solves this problem. When you use a JavaScript concatenator/minifier that supports Source Maps, the compiler will add a comment to the code that refers to the source map (a header can also be used). The source map contains all the necessary information for linking from the compiled code to the source file. As a result, development tools that support Source Maps will understand what file some given code originally came from. There is no longer any issue debugging / developing with minified code.</p>
<p>Right now the <a href="https://developers.google.com/closure/compiler/" target="_blank">Closure compiler</a> and Google Chrome are the only compiler and browser that support Source Maps, so it can only be used on certain projects. Still, if more tools start to support it, this may be the future of debugging JavaScript.</p>
<h3 id="iifes-and-namespaces">IIFEs and Namespaces</h3>
<p>Now that you have a build process that intelligently handles multiple files, what actually goes in those files?</p>
<p>The first concern is global variables. Since global variables in separate files are still shared, we can use <a href="http://benalman.com/news/2010/11/immediately-invoked-function-expression/" target="_blank">IIFEs</a> to give each file its own local scope. Here is an example:</p>
<p>file1.js</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  var i = 0;
</span><span class="line">
</span><span class="line">  setInterval(function() {
</span><span class="line">    i += 2;
</span><span class="line">    console.log("File 1 counter: " + i);
</span><span class="line">  }, 1000);
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>file2.js</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  var i = 0;
</span><span class="line">
</span><span class="line">  setInterval(function() {
</span><span class="line">    i += 5;
</span><span class="line">    console.log("File 2 counter: " + i);
</span><span class="line">  }, 1000);
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The first and last line of each file is the IIFE. The only purpose of those lines is to create a local scope for each file. As a result, the <code>i</code> variable in each file will not conflict.</p>
<p>This works to avoid conflicts and polluting the global scope, but what about when we do want to share state between files?</p>
<p>A global namespace is my favorite way to handle this. In this approach, your game will have one single variable in the global scope. It will contain a hierarchy of all the game’s global state. Here is an example:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  // create global namespace
</span><span class="line">  window.game = {};
</span><span class="line">
</span><span class="line">  // add some data
</span><span class="line">  game.player = {
</span><span class="line">    hp: 10,
</span><span class="line">    mp: 5
</span><span class="line">  };
</span><span class="line">
</span><span class="line">  game.enemies = [];
</span><span class="line">
</span><span class="line">  game.enemies.push({
</span><span class="line">    name: "zombie",
</span><span class="line">    hp: 10
</span><span class="line">  });
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Then, another file could access this information:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  // set up the UI
</span><span class="line">  document.getElementById("hp").innerHTML = game.player.hp;
</span><span class="line">  document.getElementById("mp").innerHTML = game.player.mp;
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Often it’s convenient to use the IIFE to pass through global variables as local variables. The previous example could be modified like so:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function(player) {
</span><span class="line">
</span><span class="line">  // set up the UI
</span><span class="line">  document.getElementById("hp").innerHTML = player.hp;
</span><span class="line">  document.getElementById("mp").innerHTML = player.mp;
</span><span class="line">
</span><span class="line">}(game.player));</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>A pattern called the Module Pattern is similar. In this pattern, the IIFE is modified to return a value that is put in the global scope:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span></pre>
</td>
<td class="code">
<pre><code><span class="line">window.game.boss = (function() {
</span><span class="line">
</span><span class="line">  var hp = 30;
</span><span class="line">
</span><span class="line">  if (game.temperature &lt; 5) {
</span><span class="line">    hp -= 10;
</span><span class="line">  }
</span><span class="line">
</span><span class="line">  return {
</span><span class="line">    name: "elder red kitten",
</span><span class="line">    hp: hp
</span><span class="line">  };
</span><span class="line">
</span><span class="line">})();</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Notice in the last line that we’ve moved the <code>()</code> outside of the parentheses that wrap the IIFE’s function. This is not necessary but is often done to indicate that the return value is used.</p>
<h3 id="module-systems">Module Systems</h3>
<p>With IIFEs and namespaces we have solved the global scope issue. However, we may still have issues in projects with complicated dependencies. In some games its reasonable to just include all your scripts in the order that they depend on each other. For projects with more complicated dependencies, especially multi-page apps with different script needs on each page, a module system may be helpful.</p>
<p><a href="http://requirejs.org/" target="_blank">RequireJS</a> is an advanced JavaScript module loader. With RequireJS, you can have just one <code>script</code> element in your HTML:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span></pre>
</td>
<td class="code">
<pre><code><span class="line">&lt;head&gt;
</span><span class="line">  ...
</span><span class="line">  &lt;script data-main="scripts/main" src="scripts/require.js"&gt;&lt;/script&gt;
</span><span class="line">  ...
</span><span class="line">&lt;/head&gt;</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Then, in your <code>main.js</code> file, you use <code>require</code> to load other scripts that you need:</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span></pre>
</td>
<td class="code">
<pre><code><span class="line">require(["scripts/world"], function(world) {
</span><span class="line">    // world.js will load, then this code will run
</span><span class="line">});</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Each other file loaded by <code>require</code> can have its own dependencies, and so on. You end up with a dependency graph that reflects your code’s actual needs, rather than a mysterious load order that just so happens to work. This makes it much easier to set up a separate page that needs some, but not all, of your scripts. Think of a save / load screen, or a high scores list, that needs information about loading player accounts, but not information about collecting powerups.</p>
<p>You need to follow the <a href="https://github.com/amdjs/amdjs-api/wiki/AMD" target="_blank">AMD</a> specification to use require.js, so you should familiarize yourself with that if you intend to use it.</p>
<p>Now that we have these basics worked out, we can move on to the fun stuff: how to organize the code itself.</p>
<h3 id="code-sharing">Code Sharing</h3>
<p>A whole lot of code organization boils down to code sharing. How do you share code that is used in more than one place? It’s a big question, and ultimately the answer depends on your project, your language, your frameworks, and your personal preferences.</p>
<p>A common symptom of poor code sharing is <em>super objects</em>. A super object is an object that has too many responsibilities. It’s too big, and it contains a lot of code that would be better organized into different units. Often, super objects are a result of laziness. When writing new code, it’s easiest to just put the code in the nearest super object, rather than deciding where it really belongs. The best weapon in the fight against super objects is diligence.</p>
<p>Here’s an example. Let’s say you have player.js and enemy.js. You want to write the code wherein an enemy damages the player. At first, it seems convenient to put it in player.js, since the code concerns the player’s properties.</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  game.player = {
</span><span class="line">
</span><span class="line">    receiveDamage(amount) {
</span><span class="line">      if (Math.random() &lt; this.resist) {
</span><span class="line">        amount /= 2;
</span><span class="line">      }
</span><span class="line">      this.hp -= amount;
</span><span class="line">      if (this.hp &lt;= 0) {
</span><span class="line">        this.die();
</span><span class="line">      }
</span><span class="line">    }
</span><span class="line">
</span><span class="line">  };
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Later, we add a feature where an enemy can poison the player. Let’s add that code in there.</p>
<div class="bogus-wrapper">
<div class="highlight">
<table border="0">
<tbody>
<tr>
<td class="gutter">
<pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span></pre>
</td>
<td class="code">
<pre><code><span class="line">(function() {
</span><span class="line">
</span><span class="line">  game.player = {
</span><span class="line">
</span><span class="line">    receiveDamage(amount, enemy) {
</span><span class="line">      if (Math.random() &lt; this.resist) {
</span><span class="line">        amount /= 2;
</span><span class="line">      }
</span><span class="line">      this.hp -= amount;
</span><span class="line">      if (this.hp &lt;= 0) {
</span><span class="line">        this.die();
</span><span class="line">      }
</span><span class="line">      else if (enemy.poisonous) {
</span><span class="line">        this.setPoisoned(true);
</span><span class="line">      }
</span><span class="line">    }
</span><span class="line">
</span><span class="line">  };
</span><span class="line">
</span><span class="line">}());</span></code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Then we add enemies that can blind the player. Then enemies that can stun the player. <code>receiveDamage</code> is getting too big, and <code>player</code> is becoming a super object.</p>
<p>One problem is that receiveDamage is very entangled with both the <code>enemy</code> and <code>player</code> objects. To untangle this code, we should put the enemy’s responsibilities in one place, and the player’s responsibilities in another.</p>
<p>Another issue is that there is only one type of player, but many types of enemies. In this case, each type of enemy should describe its own unique interaction with the player, rather than having the player, or a common <code>enemy</code> object, describe every type of interaction.</p>
<p>Let’s rewrite this code in 3 different files.</p>
<p>Now we can extend this code in a more reasonable way. You may have noticed that the poisonous enemy uses <em>explicit delegation</em> to call <code>enemy.damagePlayer</code>. This is perhaps the simplest form of code sharing, and it works, but this is a clear example where implicit delegation via <em>inheritance</em> may be preferable. We could refactor this code to use inheritance, but instead, let’s discuss another option…</p>
<h3 id="components">Components</h3>
<p>Laziness isn’t the only cause of super objects. A more subtle problem is when your code sharing strategy doesn’t suit your object model. Many classically-trained programmers have been taught that inheritance is a one-size-fits-all code sharing strategy. In fact, many programming languages seem to have that assumption baked in. Let’s show an example where classical inheritance falls short, then discuss an alternative.</p>
<p>Here is some simple code to start with:</p>
<p>Maybe you wrote this code by writing methods as they became useful. But, stepping back, you realized this: all of these objects need to be able to do all of these things! Using inheritance, you might move all these methods up to a common parent, like so:</p>
<p>Now the common behavior is shared, but you can still add custom code for each type of entity.</p>
<p>There are two potential problems here. First, it’s possible that <code>entity</code> will end up being a super object. Second, it’s possible that while most enemies can move, some can’t! Or that there are rare indestructible crates! How do we deal with these exceptions?</p>
<p>For many applications, inheritance works great. It turns out, though, that the problems I just described are very common in game development. For this reason, many game developers use <em>components</em>.</p>
<p>With inheritance, objects get their behavior from their place in the inheritance hierarchy. With components, objects contain any number of components which determine their behavior. These components can be mixed and matched differently in each object. Let’s look at an example using components:</p>
<p>The first thing you’ll notice in this code is that a simple component system is implemented in componentSystem.js. Some game frameworks provide their own more robust component systems. Then there are files for each component that entities can contain. At the end there is some code demonstrating how to use the component system to create entities with different capabilities.</p>
<p>At first, it might seem strange to check if a method exists when you want to use it. You may not always need to do that, for example in code where you can safely assume a method will be present, or for methods that you know are always present. You could even create a component system where this check is not necessary. For my games, I tend to embrace <a href="http://en.wikipedia.org/wiki/Duck_typing" target="_blank">duck typing</a>. I’ve found that the test isn’t tedious because it’s important to consider what might need to go in the <code>else</code> block.</p>
<p>You could build a more complex component system where components remain encapsulated after they’ve been added to an entity, which may be useful if you want to achieve state that is private to each component. This may be seen as a “true” component system, where what I’ve built in this previous example may be closer to <em>mixins</em>, or abstract base classes with multiple inheritance. The lines between these concepts tend to get blurry in JavaScript, and either way, what we’ve built in this example is incredibly expressive as is.</p>
<h3 id="code-and-data">Code and Data</h3>
<p>Another aspect of code organization in games is data. Data-driven programming involves a separation of code and data, where the code reads in data files that describe objects and their states, then the code is responsible for describing how those objects behave and interact. A common example in games is world files: descriptions of maps and monsters read in and brought to life by the game code.</p>
<p>Let’s look at a simple example of some data-driven code:</p>
<p>This is great for two reasons. One, a separation of data and logic makes for more maintainable and more reusable code. Two, a team member without programming experience is better able to contribute to content creation.</p>
<p>That should be easy enough. What’s less clear is what happens when the line between code and data gets blurry. Let’s say that we want to create some code that is only relevant to dragons:</p>
<p>Now damage against dragons is reduced by half. Maybe lots of enemies have this “half damage” trait? You’d be better off making a <code>halfDamage</code> property in your data format. That’s pretty straightforward.</p>
<p>On the other hand, it depends on how your data will grow. The direction we just described will work well if you have a small number of traits that are frequently reused. Where this approach falls short is when you have a large number of enemies with unique properties. You’ll end up with a big, complicated data format that is mostly dedicated to describing exceptions to the rules.</p>
<p>What I advocate in these cases is <em>data-like code</em>. Rather than using JSON, we’ll use JavaScript that happens to be mostly data, but with the ability to add custom code at predefined locations. Here is an example:</p>
<p>We’ve added the ability for enemies to define a custom filter on the amount of damage they receive. We can easily add one enemy that always takes half damage, then another enemy that takes double damage. I added <code>self</code> as an argument to <code>filterDamage</code> because it’s very useful in these types of data formats: you may want to filter damage differently based on the enemy’s state. The best part is, you can create all kinds of unique enemies without modifying the data format. The code and data are still mostly separate, except where a little overlap is appropriate. And a non-programmer could still work with this data pretty easily, until they need to ask for help with a special enemy (which they would have had to do anyway).</p>
<p>Of course, if your game doesn’t need anything this complicated, it’s always best to stick with the simplest data format that works.</p>
<h3 id="conclusion">Conclusion</h3>
<p>I hope these tips were helpful for you. If you want to play a game I developed where I learned some of these lessons, check out <a href="http://startcontinue.com" target="_blank">91</a>. If you want to see a game framework that uses a cool component system as described in this article, check out my <a href="http://incompl.github.com/boxbox/" target="_blank">boxbox</a> project. Have fun making games!</p>
<h3>About the Author</h3>
<p>Greg is a hacker at <a href="http://bocoup.com/" target="_blank">Bocoup</a>. You can follow his blog at <a href="http://incompl.com/" target="_blank">incompl.com</a>.</p>

<!-- Similar Posts took 0.428 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/12/14/how-to-optimize-your-code-in-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Check HTML Source Code Conforms to Coding Standard</title>
		<link>http://www.webappers.com/2012/12/06/check-html-source-code-conforms-to-coding-standard/</link>
		<comments>http://www.webappers.com/2012/12/06/check-html-source-code-conforms-to-coding-standard/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 02:01:13 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[BSD License]]></category>
		<category><![CDATA[Code]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=7076</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=686387156" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1513133047" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>HTML_CodeSniffer is a client-side script that checks HTML source code and detects violations of a defined coding standard. HTML_CodeSniffer is written entirely in JavaScript, does not require any server-side processing and can be extended by developers to enforce custom coding standards by creating your own &#8220;sniffs&#8221;.
HTML_CodeSniffer will provide a list of known and potential violations [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1104985585" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=350332746" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="HTML_CodeSniffer" href="http://squizlabs.github.com/HTML_CodeSniffer/" target="_blank">HTML_CodeSniffer</a> is <strong>a client-side script that checks HTML source code and detects violations of a defined coding standard</strong>. HTML_CodeSniffer is written entirely in JavaScript, does not require any server-side processing and can be extended by developers to enforce custom coding standards by creating your own &#8220;sniffs&#8221;.</p>
<p><a title="HTML_CodeSniffer" href="http://squizlabs.github.com/HTML_CodeSniffer/" target="_blank">HTML_CodeSniffer</a> will provide a list of known and potential violations to the calling script. It also comes with a pop-up auditor interface, accessible via a bookmarklet, letting you browse through messages emitted from one of the defined standards. Where possible, the auditor also points you to the HTML element causing the problem. HTML_CodeSniffer is released under a BSD-style licence.</p>
<p style="text-align: center;"><a title="HTML_CodeSniffer" href="http://squizlabs.github.com/HTML_CodeSniffer/" target="_blank"><img class="size-full wp-image-7077 aligncenter" title="html-codesniffer" src="http://www.webappers.com/img/2012/12/html-codesniffer.png" alt="html-codesniffer" width="580" height="374" /></a></p>
<blockquote><p>Requirements: -<br />
Demo: <a title="demo" rel="nofollow" href="http://squizlabs.github.com/HTML_CodeSniffer/" target="_blank">http://squizlabs.github.com/HTML_CodeSniffer/</a><br />
License: BSD License</p></blockquote>

<!-- Similar Posts took 0.334 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/12/06/check-html-source-code-conforms-to-coding-standard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Online CSS Sandbox &amp; Google&#8217;s Code Playground</title>
		<link>http://www.webappers.com/2012/10/01/online-css-sandbox-googles-code-playground/</link>
		<comments>http://www.webappers.com/2012/10/01/online-css-sandbox-googles-code-playground/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 07:01:54 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[License Free]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=6652</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1481976738" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1127404712" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>CSSDesk is an Online CSS Sandbox. It allows people to quickly test snippets of CSS code, and watch the result appear live. I had very high ambitions for the project. There are line numbers and syntax highlighting appear live in the text box as you type. One of the greatest things is that it allows [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1557392200" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=162509623" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="CSS Desk" href="http://cssdesk.com/" target="_blank">CSSDesk</a> is an <strong>Online CSS Sandbox</strong>. It allows people to quickly test snippets of CSS code, and watch the result appear live. I had very high ambitions for the project. There are line numbers and syntax highlighting appear live in the text box as you type. One of the greatest things is that it allows users to share their code with others as well.</p>
<p>And also, if you haven&#8217;t heard about <a title="Google's Code Playground" href="http://code.google.com/apis/ajax/playground/" target="_blank">Google&#8217;s Code Playground</a>, it&#8217;s a <strong>web-based tool that lets web developers try out all of the APIs that Google provides</strong>, tweak the code, and see the results. Google&#8217;s Code Playground lets you play around without opening an external editor, and all of the APIs are loaded for you in the Pick an API box.</p>
<p style="text-align: center;"><a title="CSS Desk" href="http://cssdesk.com/" target="_blank"><img class="size-full wp-image-6653 aligncenter" title="css-desk" src="http://www.webappers.com/img/2012/09/css-desk.png" alt="css-desk" width="580" height="344" /></a></p>
<blockquote><p>Requirements: -<br />
CSS Desk: <a title="demo" rel="nofollow" href="http://cssdesk.com/" target="_blank">http://cssdesk.com/</a><br />
Google Code Playground: <a title="demo" rel="nofollow" href="http://code.google.com/apis/ajax/playground/" target="_blank">http://code.google.com/apis/ajax/playground/</a><br />
License: License Free</p></blockquote>

<!-- Similar Posts took 0.331 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/10/01/online-css-sandbox-googles-code-playground/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Easily Embed Github Repo on Your Site with Repo.js</title>
		<link>http://www.webappers.com/2012/07/02/easily-embed-github-repo-on-your-site-with-repo-js/</link>
		<comments>http://www.webappers.com/2012/07/02/easily-embed-github-repo-on-your-site-with-repo-js/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 07:01:23 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[License Free]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=6251</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1786152391" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1247857189" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>Repo.js is a jQuery plugin that lets you easily embed a Github repo onto your site. This is great for other plugin or library authors that want to showcase the contents of a repo on their project pages.
Repo.js uses Markus Ekwall&#8217;s jQuery Vangogh plugin for styling of file contents. Vangogh, subsequently, utilizes highlight.js, written by [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1546296561" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1189309305" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="Repo.js" href="http://darcyclarke.me/dev/repojs/" target="_blank">Repo.js</a> is a jQuery plugin that lets you <strong>easily embed a Github repo onto your site</strong>. This is great for other plugin or library authors that want to showcase the contents of a repo on their project pages.</p>
<p>Repo.js uses Markus Ekwall&#8217;s jQuery Vangogh plugin for styling of file contents. Vangogh, subsequently, utilizes highlight.js, written by Ivan Sagalaev for syntax highlighting.</p>
<p style="text-align: center;"><a title="Repo.js" href="http://darcyclarke.me/dev/repojs/" target="_blank"><img class="size-full wp-image-6252 aligncenter" title="repo-js" src="http://www.webappers.com/img/2012/07/repo-js.jpg" alt="repo-js" width="580" height="312" /></a></p>
<blockquote><p>Requirements: jQuery Framework<br />
Demo: <a title="demo" rel="nofollow" href="http://darcyclarke.me/dev/repojs/" target="_blank">http://darcyclarke.me/dev/repojs/</a><br />
License: License Free</p></blockquote>

<!-- Similar Posts took 0.333 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/07/02/easily-embed-github-repo-on-your-site-with-repo-js/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Open Source Code Editor Built on Top of HTML, CSS &amp; JS</title>
		<link>http://www.webappers.com/2012/06/27/open-source-code-editor-built-on-top-of-html-css-js/</link>
		<comments>http://www.webappers.com/2012/06/27/open-source-code-editor-built-on-top-of-html-css-js/#comments</comments>
		<pubDate>Wed, 27 Jun 2012 07:01:47 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MIT License]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=6230</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1273012450" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1747539786" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>Brackets is an open-source editor for web design and development built on top of web technologies such as HTML, CSS and JavaScript. The project was created and is maintained by Adobe, and is released under an MIT License. What makes Brackets different from other web code editors?
Instead of cluttering up your coding environment with lots [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=337230953" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1532602401" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="Brackets" href="http://brackets.io/" target="_blank">Brackets</a> is an <strong>open-source editor for web design and development built on top of web technologies such as HTML, CSS and JavaScript</strong>. The project was created and is maintained by Adobe, and is released under an MIT License. What makes Brackets different from other web code editors?</p>
<p>Instead of cluttering up your coding environment with lots of panels and icons, the Quick Edit UI in Brackets puts context-specific code and tools inline. With Live Development, Brackets works directly with your browser to push code edits instantly, set breakpoints, and jump back and forth between your real source code and the browser view.</p>
<p style="text-align: center;"><a title="Brackets" href="http://brackets.io/" target="_blank"><img class="size-full wp-image-6231 aligncenter" title="brackets" src="http://www.webappers.com/img/2012/06/brackets.jpg" alt="brackets" width="580" height="332" /></a></p>
<blockquote><p>Requirements: -<br />
Demo: <a title="demo" rel="nofollow" href="http://brackets.io/" target="_blank">http://brackets.io/</a><br />
License: MIT License</p></blockquote>

<!-- Similar Posts took 0.332 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/06/27/open-source-code-editor-built-on-top-of-html-css-js/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Feature-Rich JavaScript Test Framework on Node</title>
		<link>http://www.webappers.com/2012/05/22/a-feature-rich-javascript-test-framework-on-node/</link>
		<comments>http://www.webappers.com/2012/05/22/a-feature-rich-javascript-test-framework-on-node/#comments</comments>
		<pubDate>Tue, 22 May 2012 07:01:29 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MIT License]]></category>
		<category><![CDATA[Tools]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=6065</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1023294364" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1574670303" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>Mocha is a feature-rich JavaScript test framework running on node and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
When testing synchronous code, omit the callback and Mocha will automatically continue on to the next test. Testing [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1480739919" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=920625690" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="Mocha" href="http://visionmedia.github.com/mocha/" target="_blank">Mocha</a> is a feature-rich JavaScript test framework running on node and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.</p>
<p>When testing synchronous code, omit the callback and Mocha will automatically continue on to the next test. Testing asynchronous code with Mocha could not be simpler. Simply invoke the callback when your test is complete. </p>
<p style="text-align: center;"><a title="Mocha" href="http://visionmedia.github.com/mocha/" target="_blank"><img class="size-full wp-image-6066 aligncenter" title="node-testing" src="http://www.webappers.com/img/2012/05/node-testing.jpg" alt="node-testing" width="580" height="404" /></a></p>
<blockquote><p>Requirements: Node.js<br />
Demo: <a title="demo" rel="nofollow" href="http://visionmedia.github.com/mocha/" target="_blank">http://visionmedia.github.com/mocha/</a><br />
License: MIT License</p></blockquote>

<!-- Similar Posts took 0.326 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/05/22/a-feature-rich-javascript-test-framework-on-node/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Mirror: In-Browser Code Editing Made Easy</title>
		<link>http://www.webappers.com/2012/03/06/code-mirror-in-browser-code-editing-made-easy/</link>
		<comments>http://www.webappers.com/2012/03/06/code-mirror-in-browser-code-editing-made-easy/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 07:12:31 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MIT License]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=5638</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1421563450" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1285697831" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>CodeMirror is a JavaScript library that can be used to create a relatively pleasant editor interface for code-like content &#8211; computer programs, HTML markup, and similar. If a mode has been written for the language you are editing, the code will be coloured, and the editor will optionally help you with indentation.
CodeMirror supports Autocompletion, Mode [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1401586231" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1212792628" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="CodeMirror" href="http://codemirror.net/" target="_blank">CodeMirror</a> is a JavaScript library that can be used to create a relatively pleasant editor interface for code-like content &#8211; computer programs, HTML markup, and similar. If a mode has been written for the language you are editing, the code will be coloured, and the editor will optionally help you with indentation.</p>
<p><a title="CodeMirror" href="http://codemirror.net/" target="_blank">CodeMirror</a> supports Autocompletion, Mode overlays, Search/replace, Code folding, HTML editor with preview, Auto-resizing editor, Setting breakpoints, Highlighting the current line, Highlighting selection matches, Theming, Stand-alone highlighting, Full-screen editing, Mode auto-changing, Visible tabs, Autoformatting of code, Emacs keybindings and Vim keybindings.</p>
<p>All of CodeMirror is released under a MIT-style license. To get it, you can download the latest release or the current development snapshot as zip files on GitHub.</p>
<p style="text-align: center;"><a title="CodeMirror" href="http://codemirror.net/" target="_blank"><img class="size-full wp-image-5639 aligncenter" title="code-mirror" src="http://www.webappers.com/img/2012/03/code-mirror.png" alt="code-mirror" width="480" height="316" /></a></p>
<blockquote><p>Requirements: JavaScript Enabled<br />
Demo: <a title="demo" rel="nofollow" href="http://codemirror.net/" target="_blank">http://codemirror.net/</a><br />
License: MIT License</p></blockquote>

<!-- Similar Posts took 0.341 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/03/06/code-mirror-in-browser-code-editing-made-easy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript Checking with Function&#8217;s Type Signatures</title>
		<link>http://www.webappers.com/2012/02/23/javascript-checking-with-functions-type-signatures/</link>
		<comments>http://www.webappers.com/2012/02/23/javascript-checking-with-functions-type-signatures/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 07:01:13 +0000</pubDate>
		<dc:creator>Ray Cheung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MIT License]]></category>


		<guid isPermaLink="false">http://www.webappers.com/?p=5590</guid>
		<description><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1162195033" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=896182557" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p>TypedJS uses a function&#8217;s type signature to generate input parameters, and evaluates the function upon these inputs to form a test case. This test case fails if an exception occurs, or the output violates function constraints. While type signatures provide a limited form of program specification, TypedJS adds a quick and rigorous sanity check to your [...]<h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rss.buysellads.com/click.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1969669308" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1270742&k=f0f765a4a2b8013472eb1ae2074fd0ed&a=1368900400&c=1989380327" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f0f765a4a2b8013472eb1ae2074fd0ed/zone/1270742" target="_blank">Advertise here via BSA</a></p><p><a title="TypedJS" href="http://typedjs.com/" target="_blank">TypedJS</a> <strong>uses a function&#8217;s type signature to generate input parameters, and evaluates the function upon these inputs to form a test case</strong>. This test case fails if an exception occurs, or the output violates function constraints. While type signatures provide a limited form of program specification, TypedJS adds a quick and rigorous sanity check to your deployment pipeline.</p>
<p>This is just a start. TypedJS will soon provide more complex forms of program specification, and analysis. It is licensed under MIT License.</p>
<p style="text-align: center;"><a title="TypedJS" href="http://typedjs.com/" target="_blank"><img class="size-full wp-image-5591 aligncenter" title="javascript-check" src="http://www.webappers.com/img/2012/02/javascript-check.jpg" alt="javascript-check" width="479" height="273" /></a></p>
<blockquote><p>Requirements: JavaScript Framework<br />
Demo: <a title="demo" rel="nofollow" href="http://typedjs.com/" target="_blank">http://typedjs.com/</a><br />
License: MIT License</p></blockquote>

<!-- Similar Posts took 0.349 ms --><h3>Sponsors</h3><p><a href="http://www.webiconset.com/?utm_source=WebAppers&utm_medium=cpc&utm_campaign=WebAppers%2BRSS">Professional Web Icons for Your Websites and Applications</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappers.com/2012/02/23/javascript-checking-with-functions-type-signatures/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
<!--
This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enchanced) (user agent is rejected)
Content Delivery Network via maxcdn.webappers.com (user agent is rejected)

Served from: ps11300.dreamhostps.com @ 2013-05-18 11:06:40 -->