<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Justin McCandless</title>
    <link>https://justinmccandless.com/</link>
    <description>Recent content on Justin McCandless</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 25 Feb 2018 21:05:50 -0800</lastBuildDate>
    <atom:link href="https://justinmccandless.com/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Reading Molecular Data in JavaScript with PDB</title>
      <link>https://justinmccandless.com/post/parsing-pdb-files-in-javascript/</link>
      <pubDate>Sun, 25 Feb 2018 21:05:50 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/parsing-pdb-files-in-javascript/</guid>
      <description>

&lt;p&gt;The &lt;a href=&#34;https://www.rcsb.org/&#34;&gt;RCSB&lt;/a&gt; has a really great library of data for thousands of proteins in its Protein Data Bank, but sadly the formats that they offer are ancient.  Both PDB and mmCIF formats use character indices to describe data fields, making them more suited to be read into FORTRAN than transferred over the modern web.  After running into this problem enough times myself, I&amp;rsquo;m releasing the open source &lt;a href=&#34;https://www.npmjs.com/package/parse-pdb&#34;&gt;parse-pdb&lt;/a&gt; package in an attemp to save other people some time wrangling &lt;code&gt;while&lt;/code&gt; loops and &lt;code&gt;substring&lt;/code&gt; calls.&lt;/p&gt;

&lt;h2 id=&#34;getting-started:64ed04de23e59124c044db9a59f9dc64&#34;&gt;Getting Started&lt;/h2&gt;

&lt;p&gt;You can install the library just like you would any other npm module:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install --save parse-pdb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;From there you&amp;rsquo;ll just import the module and call it with a string containing an entire PDB file.  Node&amp;rsquo;s &lt;code&gt;fs&lt;/code&gt; modules is nice for reading this info in from a file, but if you want to get it directly from RCSB or any other way it works too.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;const parsePdb = require(&#39;parse-pdb&#39;);
const { readFileSync } = require(&#39;fs&#39;);

const pdbString = readFileSync(&#39;./3aid.pdb&#39;, &#39;utf8&#39;);

const parsed = parsePdb(pdbString);
// parsed now contains a nice javascript object with all the 3AID PDB data!
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;a-returned-format-that-s-actually-useable:64ed04de23e59124c044db9a59f9dc64&#34;&gt;A Returned Format That&amp;rsquo;s Actually Useable&lt;/h2&gt;

&lt;p&gt;The object that you get back, called &lt;code&gt;parsed&lt;/code&gt; in the example above, contains the basic data from the PDB more or less as-is, but it also has some more user-friendly derived data as well.&lt;/p&gt;

&lt;p&gt;The basic data is parsed from the ATOM and SEQRES entries in the PDB.  These are both arrays of objects that contain every data value in the row as a key/value pair.  See the &lt;a href=&#34;https://github.com/justinmc/parse-pdb#json-format&#34;&gt;output format documentation&lt;/a&gt; for a list of every property and its type.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;console.log(parsed.atoms); // [ { serial: 1, ... }, ...1845 others ]


console.log(parsed.seqRes); // [ { serNum: 1, ... }, ...1845 others ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In addition, I&amp;rsquo;ve also parsed out &lt;code&gt;residues&lt;/code&gt; and &lt;code&gt;chains&lt;/code&gt; for convenience and given them references to their lower level elements.  For example, you can get residues in a chain or atoms in a residue:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;const residue = parsed.residues[0];
const residuesAtoms = residue.atoms; // array of 9 objects from parsed.atoms

const chain = parsed.chains.get(residue.chainID);
const siblingResidues = chain.residues; // array of 99 residues
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;let-s-make-protein-data-easier-to-work-with-on-the-modern-web:64ed04de23e59124c044db9a59f9dc64&#34;&gt;Let&amp;rsquo;s Make Protein Data Easier to Work with on the Modern Web&lt;/h2&gt;

&lt;p&gt;I hope this parser can be of use to other people and help bridge the gap between scientific computing and the modern web.  However, I&amp;rsquo;m more comfortable with the computing side than the science side, and this is just my guess at what others might find useful.  If you&amp;rsquo;ve got any ideas for what might make this more useful to you, open an issue (or a pull request!) on the &lt;a href=&#34;https://github.com/justinmc/parse-pdb&#34;&gt;Github repository&lt;/a&gt;, or just drop a comment below.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>&#34;A Review of Bluegogo Bike Share&#34; on Medium</title>
      <link>https://justinmccandless.com/post/bluegogo/</link>
      <pubDate>Mon, 20 Feb 2017 21:05:50 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/bluegogo/</guid>
      <description>&lt;p&gt;
I just posted a review of the bike share service Bluegogo over on Medium, which you can check out &lt;a href=&#34;https://medium.com/@justinjmcc/a-review-of-bluegogo-bike-share-in-sf-ee4c0934d156#.ua0u2jo6x&#34;&gt;right here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
As someone who&#39;s interested in transportation and especially bicycling, I had a lot of fun biking around town trying out the service, taking pictures, and writing about my experience.  I&#39;ve been longingly looking at the Bay Area Bike Share stations for awhile, sad that they don&#39;t make any financial sense for my use cases, so I was happy that something new has come to town.
&lt;/p&gt;
&lt;p&gt;
Enjoy the article, and hopefully I&#39;ll have some new tech stuff for this blog shortly.
&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>HTML5 Audio with React</title>
      <link>https://justinmccandless.com/post/html5-audio-with-react/</link>
      <pubDate>Sat, 12 Mar 2016 22:48:42 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/html5-audio-with-react/</guid>
      <description>&lt;p&gt;The HTML5 audio tag provides a great way to work with simple audio in a web app, but when you’re using React’s nice pattern in the rest of your app, it can be a pain to go back to messing directly with DOM objects.  The &lt;a href=&#34;https://www.npmjs.com/package/react-audio-player&#34;&gt;ReactAudioPlayer&lt;/a&gt; module provides a thin wrapper to the audio tag that fits right into a React app.&lt;/p&gt;

&lt;p&gt;ReactAudioPlayer is something I wrote while working on an audio project.  It passes through all of the typical attributes that the audio tag uses (listed nicely on the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio&#34;&gt;MDN audio article&lt;/a&gt;).  Most importantly, it provides a nice interface to all of the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events&#34;&gt;events fired by the audio tag&lt;/a&gt;.  So instead of messing with references to your audio tag and setting event listeners everywhere, you can do this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;ReactAudioPlayer
  onPause={this.onPause}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This follows for any other event you can listen to on the audio tag.  And of course, any changes to the passed in &lt;code&gt;props&lt;/code&gt; will update the audio tag immediately.  This includes the &lt;code&gt;src&lt;/code&gt; attribute, which will change the currently playing or loaded media in the audio tag.&lt;/p&gt;

&lt;p&gt;ReactAudioPlayer is an npm module, so you can install it in your app with &lt;code&gt;npm install --save react-audio-player&lt;/code&gt;.  Check it out &lt;a href=&#34;https://www.npmjs.com/package/react-audio-player&#34;&gt;on npm&lt;/a&gt; and &lt;a href=&#34;https://github.com/justinmc/react-audio-player&#34;&gt;on github&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Setting up HTTPS on Node for Free with Let&#39;s Encrypt</title>
      <link>https://justinmccandless.com/post/setting-up-https-on-node-for-free-with-lets-encrypt/</link>
      <pubDate>Sat, 27 Feb 2016 22:08:27 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/setting-up-https-on-node-for-free-with-lets-encrypt/</guid>
      <description>&lt;p&gt;Given how vitally important running your site in HTTPS is, it&#39;s disappointing how high the barrier to entry is.  Some services like Heroku do make it easy to set up, but you will have to pay for that simplicity.&lt;/p&gt;

&lt;p&gt;Recently, the EFF and several other organizations put together a project called &lt;a href=&#34;https://letsencrypt.org/&#34;&gt;Let&#39;s Encrypt&lt;/a&gt;, which hopes to lower this barrier to entry.  Let&#39;s Encrypt is a free certificate authority and collection of software that makes it easy to obtain and autorenew certificates for any site.  As someone who is passionate about the cause for encryption, but has also cheaped out on spending the time and money to set up HTTPS on a few too many side projects, this was exactly what my conscience needed.&lt;/p&gt;

&lt;p&gt;Getting set up was not without its headaches though; Let&#39;s Encrypt is a new and very ambitious project with support spread across many different platforms.  In this article, I&#39;ll do my best to point you in the right direction using what I learned while setting up HTTPS for an Express app.&lt;/p&gt;

&lt;h2 id=&#34;letsencryptexpress&#34;&gt;Let&#39;s Encrypt Express&lt;/h2&gt;

&lt;p&gt;We&#39;re going to be using a great library called &lt;a href=&#34;https://github.com/Daplie/letsencrypt-express&#34;&gt;letsencrypt-express&lt;/a&gt;.  This will generate our certificate, store it on the filesystem, and renew the certificate whenever needed, without taking down the server.&lt;/p&gt;

&lt;p&gt;If you were to jump into Let&#39;s Encrypt straight from the &lt;a href=&#34;https://letsencrypt.org/getting-started/&#34;&gt;getting started guide&lt;/a&gt; on their site, you&#39;d realize how much letsencrypt-express is doing for you.  The Let&#39;s Encrypt site introduces a command line tool for generating certificates that is much more manual.  If you&#39;re looking to use Let&#39;s Encrypt on another platform or on a server like nginx, that might be a good place to start, but if you&#39;re on Node, stick with letsencrypt-express or other implementations by the same author, &lt;a href=&#34;https://github.com/Daplie&#34;&gt;Daplie&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&#34;https://github.com/Daplie/letsencrypt-express&#34;&gt;letsencrypt-express README&lt;/a&gt; has two different sections of code that you&#39;ll need to include in your app (if you just want to see it already set up in a working app, check out my &lt;a href=&#34;https://github.com/justinmc/letsencrypt-express-example&#34;&gt;example project&lt;/a&gt;).  The first section is &lt;a href=&#34;https://github.com/Daplie/letsencrypt-express#setup-same-for-all-examples&#34;&gt;setup&lt;/a&gt;, which creates the &lt;code&gt;lex&lt;/code&gt; object with some configuration.  Be sure to change the email to your actual email address, and also take a look at &lt;code&gt;configDir&lt;/code&gt;.  This is where your certificates will be installed.  Your app will have to have read and write permissions in this directory.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&#34;https://github.com/Daplie/letsencrypt-express#express&#34;&gt;Express section&lt;/a&gt; has the next bit of code you&#39;ll need to include.  It sets up your app to listen on both production HTTP and HTTPS ports, so if your situation is different, be sure to change those ports.  In reality you&#39;ll probably want to set up a conditional depending on what environment your app is running on.&lt;/p&gt;

&lt;h2 id=&#34;runit&#34;&gt;Run It&lt;/h2&gt;

&lt;p&gt;If you run the server at this point, accessing it at a non-HTTPS port should access your app like normal.  Accessing it via HTTPS should also bring up your app, and if you look at the server&#39;s output on the command line, you&#39;ll see detailed output telling you that letsencrypt-express has generated and started using your certificate.  If you open the directory you specified earlier, you should see a folder containing the generated files.&lt;/p&gt;

&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;

&lt;p&gt;With this setup, you&#39;ll have to be doing this on a web server; the app won&#39;t load via HTTPS on your local machine.  If you try you might get an error like &lt;code&gt;Error creating new authz :: DNS name does not have enough labels&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Also, as of this writing, the current version of letsencrypt-express has a few problems.  If you get the error &lt;code&gt;TypeError: dest.end is not a function&lt;/code&gt; when accessing the server, then you might want to try downgrading to the &lt;code&gt;1.1.1&lt;/code&gt; version.  If the server complains about missing the http2 module when starting, just install it manually.&lt;/p&gt;

&lt;p&gt;If you can&#39;t access your app via HTTPS at all, make sure that your server is configured to allow connections on port 443.&lt;/p&gt;

&lt;h2 id=&#34;testingmode&#34;&gt;Testing Mode&lt;/h2&gt;

&lt;p&gt;Assuming you got everything running using the code from the README, you are currently running in testing mode.  letsencrypt-express uses a non-production certificate in this mode that your browser might complain about.  To use it in production mode and use a certificate that your browser should accept, just remove the &lt;code&gt;.testing()&lt;/code&gt; call and include it like this instead: &lt;code&gt;var LEX = require(&#39;letsencrypt-express&#39;);&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&#34;fromhere&#34;&gt;From Here&lt;/h2&gt;

&lt;p&gt;When your certificate expires, letsencrypt-express should generate a new one in the background without you needing to do anything.  You now have a working HTTPS app with a free and open certificate authority!  Now go use this setup for all your apps and let&#39;s build a more secure internet.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Using ES6 Generators to Manage Dialog Flow in a Game</title>
      <link>https://justinmccandless.com/post/using-es6-generators-to-manage-dialog-flow-in-a-game/</link>
      <pubDate>Sun, 19 Apr 2015 21:07:44 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/using-es6-generators-to-manage-dialog-flow-in-a-game/</guid>
      <description>&lt;p&gt;Remember how great it was when you first started using promises to combat javascript callback hell?  Your code was much more concise, easier to understand, and didn&#39;t nest a million levels deep...&lt;/p&gt;

&lt;p&gt;Well EcmaScript 6 generators promise (no pun intended) to bring about a similar revolution in the way we deal with asynchronous code.  We&#39;ve been hearing about how complex code dealing with API calls and user interactions will be able to look just like synchronous code, with everything happening in one flow and being much easier to follow.  It sounded great, I looked over some brief code examples and it made sense, I played around with it myself and started to understand all the &lt;code&gt;function*&lt;/code&gt;s and &lt;code&gt;yield&lt;/code&gt;s, but I was waiting for one more thing: a example of a real world app benefiting from generators.&lt;/p&gt;

&lt;p&gt;I ran into a nice use case in a side project today, so I decided to write that generator example app myself.  Feel free to jump ahead to the full &lt;a href=&#34;http://justinmccandless.com/demos/gen/index.html&#34;&gt;live demo&lt;/a&gt; and its &lt;a href=&#34;https://github.com/justinmc/es6-generator-dialog&#34;&gt;source code&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&#34;gamedialoggoodandbad&#34;&gt;Game Dialog Good and Bad&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;http://justinmccandless.com/demos/gen/index.html&#34; target=&#34;_blank&#34;&gt;&lt;img src=&#34;http://184.106.225.148/public/U8iOe5Vedy.gif&#34; alt=&#34;screenshot&#34; title=&#34;screenshot&#34; style=&#34;width: 600px;&#34; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A series of dialog text in a game is a great example of where generators excel.  In the game designer&#39;s mind, a series of dialog blurbs come into the game one after the other in a very linear and simple way based on the user&#39;s input.  Using callbacks and nesting each blurb another level deep just gets in the way.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;makeTextbox(&#39;Hello!  Click to continue.&#39;);

events.on(&#39;click&#39;, function() {

  makeTextbox(&#39;I\&#39;m the second text bubble, yay!&#39;);

  events.on(&#39;click&#39;, function() {
    makeTextbox(&#39;I hope we don\&#39;t have too many more of these...&#39;);
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;There is no benefit to the developer for nesting all of these like this.  And this is not even considering branching options or more complex conditions.&lt;/p&gt;

&lt;p&gt;With generators, we can flatten it out like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;makeTextbox(&#39;Hello!  Click to continue.&#39;);

yield events.on(&#39;click&#39;, function() {
  makeTextbox(&#39;I\&#39;m the second text bubble, yay!&#39;);
  generator.next();
});

yield events.on(&#39;click&#39;, function() {
  makeTextbox(&#39;And we can have as many more as we want without nesting.&#39;);
  generator.next();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2 id=&#34;howgeneratorswork&#34;&gt;How Generators Work&lt;/h2&gt;

&lt;p&gt;I won&#39;t bother repeating what&#39;s already &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator&#34;&gt;well documented on MDN&lt;/a&gt; and explained in a &lt;a href=&#34;http://www.2ality.com/2015/03/es6-generators.html&#34;&gt;very thorough article at 2ality&lt;/a&gt;, but here&#39;s the basics that you need to get through this article.&lt;/p&gt;

&lt;p&gt;When using ES6 generators, you&#39;ll be declaring a generator function with the function* syntax:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function* gen() { 
  yield 1;
  yield 2;
  yield 3;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then using it to create a generator:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var g = gen();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And calling &lt;code&gt;next&lt;/code&gt; to progress through the yield statements:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;g.next()  // 1
g.next()  // 2
g.next()  // 3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Notice how in the generator function, execution pauses until we call &lt;code&gt;next&lt;/code&gt; again.  This is what we will exploit to write code that &#34;waits&#34; for something external to happen, like an API call to return or a user to perform an action.&lt;/p&gt;

&lt;h2 id=&#34;gettingsetup&#34;&gt;Getting Set Up&lt;/h2&gt;

&lt;p&gt;As of this writing, native support for generators is not very thorough.  An easy way to get around this and start using generators now is to use something like &lt;a href=&#34;https://babeljs.io/&#34;&gt;Babel&lt;/a&gt;, a compiler that compiles ES6 to ES5.&lt;/p&gt;

&lt;p&gt;Even easier, my example project mentioned above (&lt;a href=&#34;https://github.com/justinmc/es6-generator-dialog&#34;&gt;available on Github&lt;/a&gt;) will give you a full setup with Gulp, Browserify, and Babel, and compile any changes to the code automatically for you.&lt;/p&gt;

&lt;h2 id=&#34;afullyfeaturedexample&#34;&gt;A Fully Featured Example&lt;/h2&gt;

&lt;p&gt;Go ahead and run through the &lt;a href=&#34;http://justinmccandless.com/demos/gen/index.html&#34;&gt;live demo&lt;/a&gt; really quickly.  Let&#39;s take a look at the generator code that makes that happen (you can see the full source of this file &lt;a href=&#34;https://github.com/justinmc/es6-generator-dialog/blob/master/app/scripts/main.js&#34;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/7c33d43c645baeb23c16.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;That sure is a lot easier to read than a ton of nested callbacks or promises.&lt;/p&gt;

&lt;p&gt;We&#39;re using the &lt;code&gt;yield&lt;/code&gt; operator to show when our code will pause, and &lt;code&gt;this.flowGen.next()&lt;/code&gt; to indicate that the previous event has happened and we can continue.  The result is a flat code structure despite having many layers of asynchronous code waiting for user input.&lt;/p&gt;

&lt;h2 id=&#34;fromhere&#34;&gt;From Here&lt;/h2&gt;

&lt;p&gt;I encourage you to pull down the &lt;a href=&#34;https://github.com/justinmc/es6-generator-dialog&#34;&gt;demo source code&lt;/a&gt; and play around with it or build something yourself, as building something real that takes advantage of generators is really the hardest part of learning them.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Getting a Distributed Static Website Running with Maelstrom</title>
      <link>https://justinmccandless.com/post/getting-a-distributed-static-website-running-with-maelstrom/</link>
      <pubDate>Sun, 12 Apr 2015 12:21:50 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/getting-a-distributed-static-website-running-with-maelstrom/</guid>
      <description>&lt;p&gt;BitTorrent&#39;s &lt;a href=&#34;http://project-maelstrom.bittorrent.com/&#34;&gt;Project Maelstrom&lt;/a&gt; is a web browser for the decentralized web that downloads assets via torrent instead of web server.  It was recently released to the public as a beta, and with it a simple Python tool to create torrents optimized for Maelstrom from static websites.  That got me really excited, so I went through the simple process of serving up my own static site via torrent.&lt;/p&gt;

&lt;p&gt;What better content to serve this way than &lt;a href=&#34;http://multitasq.com/&#34;&gt;Multitasq&lt;/a&gt;, a backend-less HTML5 app I wrote awhile back.  If you&#39;re following along with the article and need something to serve up, grab the &lt;a href=&#34;git@github.com:justinmc/multitasq.git&#34;&gt;source code&lt;/a&gt;, run &lt;code&gt;npm install&lt;/code&gt;, &lt;code&gt;bower install&lt;/code&gt;, and &lt;code&gt;gulp&lt;/code&gt;, and then all your static assets will be in the dist/ directory.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://justinmccandless.com/img/posts/maelstrom/browser.png&#34; alt=&#34;maelstrom multitasq screenshot&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;creatinganoptimizedtorrent&#34;&gt;Creating an Optimized Torrent&lt;/h2&gt;

&lt;p&gt;First we&#39;re going to create the torrent file that will be used the same way that a url is used on the everyday web.  Start by cloning BitTorrent&#39;s &lt;a href=&#34;https://github.com/bittorrent/torrent-web-tools&#34;&gt;torrent-web-tools&lt;/a&gt; project from Github.  Use generator.py as described in the README to create a torrent for whatever static site you want to serve.  Make sure that you have an index.html in the root directory.&lt;/p&gt;

&lt;p&gt;Right now it&#39;s also important to note that when we seed this torrent file with our torrent client, it&#39;s going to look for the files in its default download directory.  So, you might want to move the root directory of your static website content into ~/Downloads/ or wherever that is before generating the torrent file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;generator.py ~/Downloads/multitasq/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2 id=&#34;seedingyourtorrent&#34;&gt;Seeding Your Torrent&lt;/h2&gt;

&lt;p&gt;Now you just need to seed the torrent you created so that Maelstrom has a place to download the site&#39;s assets from.  The torrent-web-tools README suggests using only uTorrent or BitTorrent for this right now, so open up either of those and add your torrent file.  As long as it can find your files in the download directory ok, you should see that it&#39;s seeding your content.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://justinmccandless.com/img/posts/maelstrom/torrent.png&#34; alt=&#34;torrent screen shot&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;openitinmaelstrom&#34;&gt;Open it in Maelstrom&lt;/h2&gt;

&lt;p&gt;From here we can open up the site just like a normal site in a web browser.  Open Maelstrom and then open the torrent file that you created.  It might be slow at first, but you should see your torrent program start uploading the content of your torrent and Maelstrom should load up the page.&lt;/p&gt;

&lt;h2 id=&#34;fromhere&#34;&gt;From Here&lt;/h2&gt;

&lt;p&gt;Anyone with the torrent file you created (or magnet link) should be able to use your website in Maelstrom, all without a centralized server.  For example, you can view the copy of Multitasq that I created while writing this article here: &lt;a href=&#34;bittorrent://f5baf0471f0d40a9b1dbd1b5fde3d22f7800aef4/index.html&#34;&gt;bittorrent://f5baf0471f0d40a9b1dbd1b5fde3d22f7800aef4/index.html&lt;/a&gt; (sorry if I&#39;m not always seeding!).&lt;/p&gt;

&lt;p&gt;This technology has a lot of potential and I&#39;m excited to see where it goes from here.  I guess that depends on the developers that are using it and what we create though, so get hacking!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SVG viewBox sandBox</title>
      <link>https://justinmccandless.com/post/svg-viewbox-sandbox/</link>
      <pubDate>Sat, 11 Apr 2015 12:40:28 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/svg-viewbox-sandbox/</guid>
      <description>&lt;p&gt;Awhile back I wrote an &lt;a href=&#34;http://justinmccandless.com/blog/Making+Sense+of+SVG+viewBox%27s+Madness&#34;&gt;article about SVG viewBox&lt;/a&gt; after being confused by it for so long.  Just recently I went back and wrote a live updating sandbox app in React that allows you to quickly play around with different viewBox setups and see the result instantly.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href=&#34;http://justinmccandless.com/demos/viewbox/index.html&#34;&gt;live demo here&lt;/a&gt; and see if you can follow  how different changes to viewBox and preserveAspectRatio affect the SVG.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&#34;https://github.com/justinmc/svg-viewbox-sandbox&#34;&gt;source code&lt;/a&gt; is also available on Github.&lt;/p&gt;

&lt;p&gt;And of course if you&#39;re still thoroughly confused by viewBox after all of the above, definitely take a look at my article &lt;a href=&#34;http://justinmccandless.com/blog/Making+Sense+of+SVG+viewBox%27s+Madness&#34;&gt;Making Sense of SVG viewBox&#39;s Madness&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Formatting Currency in Javascript</title>
      <link>https://justinmccandless.com/post/formatting-currency-in-javascript/</link>
      <pubDate>Sat, 13 Dec 2014 17:28:26 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/formatting-currency-in-javascript/</guid>
      <description>&lt;p&gt;I just had more trouble than I should have trying to figure out how to properly format currency, so it&#39;s going up as a blog post.  &lt;code&gt;Intl&lt;/code&gt;, the new feature available in modern browsers for internationaliztion, is actually really great for localizing and formatting things like currency, but here&#39;s to hoping this saves someone time digging through the spec.&lt;/p&gt;

&lt;p&gt;Here&#39;s the code you want for USD:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;var nf = new Intl.NumberFormat(&amp;lsquo;en-US&amp;rsquo;, {
  style: &amp;lsquo;currency&amp;rsquo;,
  currency: &amp;lsquo;USD&amp;rsquo;,
  minimumFractionDigits: 2,
  maximumFractionDigits: 2
});
nf.format(123456.789); // &amp;lsquo;$123,456.79&amp;rsquo;
&lt;/code&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;p&gt;The &lt;code&gt;minimumFractionDigits&lt;/code&gt; and &lt;code&gt;maximumFractionDigits&lt;/code&gt; options are what took me so long to find.  When you format currency, at least for USD in English, you usually don&amp;rsquo;t want any more than 2 &amp;ldquo;cents&amp;rdquo; places displayed, or any less as well (it&amp;rsquo;s $3.50, not $3.5).  These two options will ensure you always get 2 digits of cents.&lt;/p&gt;&lt;/p&gt;

&lt;p&gt;If you&#39;d like more info on Intl, NumberFormat, and what they can do, &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat&#34;&gt;MDN explains this&lt;/a&gt; very thoroughly.  I ran into this while using &lt;a href=&#34;http://formatjs.io/&#34;&gt;Formatjs&lt;/a&gt;, which has been great while doing fully featured internationalization with Handlebars.  Lastly, keep in mind that Intl is &lt;a href=&#34;https://github.com/andyearnshaw/Intl.js/&#34;&gt;shimmed&lt;/a&gt; if you need better browser support.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A Starting Point for Routed Meteor Apps</title>
      <link>https://justinmccandless.com/post/a-starting-point-for-routed-meteor-apps/</link>
      <pubDate>Sat, 13 Dec 2014 16:52:26 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/a-starting-point-for-routed-meteor-apps/</guid>
      <description>

&lt;p&gt;There are a lot of really cool demos out there for simple, single page Meteor apps.  When you want to get a bit more practical and add a few different states with routes, Meteor still works great, but the initial work for getting this running can be a bit more strenuous.  This post and my open source boilerplate project &lt;a href=&#34;https://github.com/justinmc/meteorplate&#34;&gt;Meteorplate&lt;/a&gt; aim to help get you up and running in the shortest time possible.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2&gt;Get Started Now&lt;/h2&gt;

&lt;p&gt;If you want to play around with this and see if it fits your app, &lt;s&gt;&lt;a href=&#34;http://meteorplate.meteor.com&#34;&gt;check out the live demo&lt;/a&gt;&lt;/s&gt;.  If you want to jump into the code right now, clone the &lt;a href=&#34;https://github.com/justinmc/meteorplate&#34;&gt;Meteorplate Github repo&lt;/a&gt;, run &lt;code&gt;meteor&lt;/code&gt;, and start hacking on your app.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2&gt;Meteorplate&lt;/h2&gt;

&lt;p&gt;Back in the early days of Meteor, I recommended using the Backbone router and views to solve this problem &lt;a href=&#34;http://www.justinmccandless.com/blog/A+Starting+Point+for+Meteor+and+Backbone+Apps&#34;&gt;in another article&lt;/a&gt;.  Since then, Meteor has come a long way, and the community around it has too.  This time around, we&#39;re going to solve this problem in Meteor 1.0+ using native Meteor templates directly as views and the widely used &lt;a href=&#34;https://github.com/EventedMind/iron-router&#34;&gt;Iron Router&lt;/a&gt; for routes.&lt;/p&gt;

&lt;p&gt;With just a little boilerplate, we&#39;ll allow page structure to be rendered with a changing main view, permissions for pages based on user accounts, and even let Google Analytics track page changes.  All this will still be reactive and take full advantage of Meteor&#39;s live real-time setup.&lt;/p&gt;

&lt;h2&gt;App Structure&lt;/h2&gt;

&lt;p&gt;Meteorplate is fittingly using &lt;a href=&#34;http://html5boilerplate.com/&#34;&gt;HTML5 Boilerplate&lt;/a&gt;, along with the typical Meteor &lt;code&gt;client/&lt;/code&gt;, &lt;code&gt;public/&lt;/code&gt;, and &lt;code&gt;server/&lt;/code&gt; directories at the top level, so the folder structure should be familiar.  Inside of &lt;code&gt;client/&lt;/code&gt;, we&#39;ve put all of the templates in the &lt;code&gt;templates/&lt;/code&gt; directory as plain html (such as &lt;a href=&#34;https://github.com/justinmc/meteorplate/blob/master/client/templates/home.html&#34;&gt;this one for the homepage&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Inside &lt;code&gt;client/js/&lt;/code&gt;, &lt;a href=&#34;https://github.com/justinmc/meteorplate/blob/master/client/js/main.js&#34;&gt;main.js&lt;/a&gt; kicks off the app and sets everything up for Meteor.  The &lt;code&gt;views/&lt;/code&gt; director contains all definitions of template methods and events (such as the &lt;a href=&#34;https://github.com/justinmc/meteorplate/blob/master/client/js/views/colors.js&#34;&gt;colors page view&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The last big piece is where we use Iron Router in &lt;a href=&#34;https://github.com/justinmc/meteorplate/blob/master/client/js/routes.js&#34;&gt;routes.js&lt;/a&gt;.  In here, we&#39;ve just provided a light wrapper around Iron Router&#39;s usual functionality in order to provide the nice features mentioned above.  To add a route, just define a new Iron Router route in the &lt;code&gt;define&lt;/code&gt; method and call &lt;code&gt;render()&lt;/code&gt; with the Meteor template that you want to render.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;All of this will provide you a nice setup for a fully featured Meteor app.  To get started, clone the &lt;a href=&#34;https://github.com/justinmc/meteorplate&#34;&gt;Meteorplate repo&lt;/a&gt; and start building your app quickly on top of this solid foundation.&lt;/p&gt;

&lt;h4 id=&#34;update:edfdb9c83c1b92828a57aa71899231d3&#34;&gt;Update&lt;/h4&gt;

&lt;p&gt;Meteor has stopped their free hosting period, which has killed my live demo for this project.  If you want to try it, I encourage you to clone the &lt;a href=&#34;https://github.com/justinmc/meteorplate&#34;&gt;repository&lt;/a&gt; and run it yourself with the &lt;code&gt;meteor&lt;/code&gt; command.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Announcing Mentorthing</title>
      <link>https://justinmccandless.com/post/announcing-mentorthing/</link>
      <pubDate>Sun, 12 Oct 2014 18:56:12 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/announcing-mentorthing/</guid>
      <description>&lt;p&gt;Today marks the soft launch of a project I&#39;ve been working on with some friends called &lt;a href=&#34;http://www.mentorthing.com/&#34;&gt;Mentorthing&lt;/a&gt;.  I work on a lot of side projects for fun and for a technical challenge, but this one I&#39;m really hoping can make a difference for a few people.&lt;/p&gt;

&lt;p&gt;The idea behind Mentorthing is to create an open platform where anyone can put themselves out there as a mentor, and anyone else can seek their help as a mentee.  No vetting process or exclusivity whatsoever.&lt;/p&gt;

&lt;p&gt;I don&#39;t need to tell you how valuable a good mentor can be in any sort of education, but the problem is access to mentors.  The current avenues that students and learners have for finding a mentor are often exclusive and antiquated, like alumni or corporate mentorship programs.&lt;/p&gt;

&lt;p&gt;Mentorthing hopes to be an inclusive platform, where knowledgeable people can declare to the world that they&#39;re willing to help, and anyone has the ability to strike up a conversation and see if they could benefit.  It&#39;s a system that I really hope can help a few people achieve their goals.&lt;/p&gt;

&lt;p&gt;We&#39;re a small community that&#39;s just starting out, so if this sounds interesting to you, I encourage you to sign up and &lt;a href=&#34;http://www.mentorthing.com/&#34;&gt;check it out&lt;/a&gt;.  No pressure, you&#39;re totally able to just put in your info and wait and see if anyone is interested in talking to you.  It&#39;s a work in progress, so feel free to reach out to me personally with suggestions or other ways to get involved.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Sharing JavaScript Between the Front and Back End</title>
      <link>https://justinmccandless.com/post/sharing-javascript-between-the-front-and-back-end/</link>
      <pubDate>Sun, 12 Oct 2014 18:05:27 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/sharing-javascript-between-the-front-and-back-end/</guid>
      <description>&lt;p&gt;There are a lot of advantages to running Nodejs, but one that&#39;s not taken advantage of as much as it could be is sharing code between the front and back ends.  You&#39;re running the same language on both sides of the stack, so why rewrite code that&#39;s run on both?&lt;/p&gt;

&lt;p&gt;You can get pretty fancy with this.  If you&#39;re familiar with &lt;a href=&#34;http://www.meteor.com&#34;&gt;Meteor&lt;/a&gt;, you know how easy this platform makes it to forget the distinction between frontend and backend altogether.  Even without a huge framework though, doing something like sharing data models on both sides is quite a nifty trick to prevent having to write things like validation twice.&lt;/p&gt;

&lt;p&gt;One place that this sort of code sharing can quickly and easily make a difference is in config.  You probably have a few constants that are needed by both the frontend and backend, and instead of defining them twice or fetching them from the server, you can simply share the config code on both sides.&lt;/p&gt;

&lt;p&gt;Here&#39;s how that might look:&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/e143e7ff5027db2eba86.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;This code could be run by the frontend and the backend without any trouble.  On the frontend, config would be assigned as a global variable, and on the backend, it would be exported as a node module.  All in the same file, without repeating any config.&lt;/p&gt;

&lt;p&gt;This is a super simple example, but if you have been repeating any code in your javascript front and back ends, I hope you see how easy it is to share code to both.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Write Your Commit Message First and Code Second</title>
      <link>https://justinmccandless.com/post/write-your-commit-message-first-and-code-second/</link>
      <pubDate>Sun, 03 Aug 2014 11:08:45 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/write-your-commit-message-first-and-code-second/</guid>
      <description>&lt;p&gt;It hit me the other day at work.  I&#39;ve been using git wrong all along.  The workflow for using version control shouldn&#39;t be to write a hacked together summary of all the code changes I just made every time I get the project in a sane state.  It should be to write a contract with myself describing the state of the project after some incremental improvement, and then to write that improvement.  How did I ever think otherwise?&lt;/p&gt;

&lt;h3 id=&#34;improvingproductivity&#34;&gt;Improving Productivity&lt;/h3&gt;

&lt;p&gt;I&#39;m a big fan of always striving to improve my productivity as a programmer, and one of the biggest lessons learned over the years has been to work in short, manageable chunks.  This tries to maximize the use of our natural ability to focus, and it helps avoid the huge time sink of a project with tons of different ongoing improvements that will take forever to get back into a working state.  Despite my best efforts though, scope always tends to creep broader and broader as I work.&lt;/p&gt;

&lt;p&gt;Writing a commit message first works wonders on reigning this in.  Whenever I start to get sidetracked with tangential work, I can look at my prewritten commit message to see exactly how the project should work when I&#39;m finished.  Whenever I get distracted by a meeting or come back from lunch, a quick look at my commit message and see exactly what I was working on.  It helps me to plan in advance, to stay on track, and to deliver what I said I would when I actually do commit.&lt;/p&gt;

&lt;h3 id=&#34;tddlite&#34;&gt;TDD Lite&lt;/h3&gt;

&lt;p&gt;You might be drawing similarities between this method and test driven development.  Test driven development follows an even more strict adherence to this plan first, code second pattern, and there&#39;s a reason why many teams have found a ton of success with it.  Test driven development requires quite a bit of overhead work and buy-in from the team, however, and might not be something everyone can spend the time to commit to.&lt;/p&gt;

&lt;p&gt;Commit message first development follows a similar pattern and starts to provide a lot of the same benefits, but is almost painless to implement.  You&#39;ll be planning out what you want your code to do, keeping yourself on track along the way, and delivering something to meet your original criteria just like in TDD.  The pattern is similar, but it&#39;s a lot easier to get going.&lt;/p&gt;

&lt;h3 id=&#34;howtowriteacommitmessagefirst&#34;&gt;How to Write a Commit Message First&lt;/h3&gt;

&lt;p&gt;Writing your commit messages first can be as easy as storing a string in a command line variable.  Plan out the state your project will be in after a manageable chunk of coding, and save a message that describes it like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;msg=&#34;Profile images over 4mb are rejected&#34;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Later on while coding, if you need a reminder of exactly what it is you should be doing, you can output your saved message like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo $msg
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, when you&#39;re ready to commit, this is how you would commit in git with your pre-saved message:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git commit -am &#34;$msg&#34;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pretty simple workflow with just about zero overhead to get started.&lt;/p&gt;

&lt;p&gt;Being an efficient programmer is something of a holy grail that can never be fully achieved, but if you work at it there are always new ways to improve.  Writing my commit messages first has been a great way to keep myself working efficiently, and even to write better commit messages while I&#39;m at it.  It might not be perfect for every coding style, but there&#39;s not much holding you back from seeing for yourself how it works for you.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Building a Requirejs Project to a Single, Reusable File</title>
      <link>https://justinmccandless.com/post/building-a-requirejs-project-to-a-single-reusable-file/</link>
      <pubDate>Mon, 10 Mar 2014 00:03:32 -0700</pubDate>
      
      <guid>https://justinmccandless.com/post/building-a-requirejs-project-to-a-single-reusable-file/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://requirejs.org/&#34;&gt;Requirejs&lt;/a&gt; is great for breaking up JavaScript projects into multiple files, but what happens when you want to use your Requirejs code in another project?  Ideally, no one should have to individually import your modules, or even use Requirejs at all.  Luckily this is all part of the plan for Requirejs projects, and with a bit of tweaking with the finicky r.js tool, you&#39;ll be able to build to a single file with no dependencies.&lt;/p&gt;

&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;

&lt;p&gt;We&#39;ll be using two tools to do this: the command line &lt;a href=&#34;https://github.com/jrburke/r.js&#34;&gt;r.js&lt;/a&gt; tool, and &lt;a href=&#34;https://github.com/jrburke/almond&#34;&gt;almond&lt;/a&gt;.  Feel free to use &lt;a href=&#34;http://gruntjs.com/&#34;&gt;Grunt&lt;/a&gt; or &lt;a href=&#34;http://gulpjs.com/&#34;&gt;Gulp&lt;/a&gt; with their respective Requirejs plugins &lt;a href=&#34;https://github.com/gruntjs/grunt-contrib-requirejs&#34;&gt;grunt-contrib-requirejs&lt;/a&gt; and &lt;a href=&#34;https://github.com/weisuke/gulp-module-requirejs&#34;&gt;gulp-module-requirejs&lt;/a&gt; instead of the command line tool itself, as the config is exactly the same, but in this article we&#39;ll use the command line tool for simplicity.&lt;/p&gt;

&lt;p&gt;Start off by installing r.js via npm:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install -g requirejs
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Also grab the almond.js file either from the &lt;a href=&#34;https://github.com/jrburke/almond&#34;&gt;repo&lt;/a&gt; or from bower:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bower install almond
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2 id=&#34;thecommandlinetool&#34;&gt;The Command Line Tool&lt;/h2&gt;

&lt;p&gt;You can find the official documentation for compiling a Requirejs project into one file under the &lt;a href=&#34;http://requirejs.org/docs/optimization.html&#34;&gt;optimization section of the Requirejs site&lt;/a&gt;.  That means we&#39;re talking exclusively about using r.js with the &lt;code&gt;-o&lt;/code&gt; flag, which is used like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;r.js -o &lt;build configuration&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Your build configuration can be one of two things.  It can be a path to your build file, or it can be your series of options directly on the command line.  In this article we&#39;re going to use a separate build file for clarity, but first an important distinction:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your main Requirejs file is not the same thing as your build file.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You&#39;ve probably written a main file for Requirejs before that looks something like this:&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/9460674.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;The config section might look similar to some of the build parameters given on the Requirejs site under optimization, but this is not what&#39;s used directly by &lt;code&gt;r.js -o&lt;/code&gt;; you need a separate build configuration.&lt;/p&gt;

&lt;h2 id=&#34;buildconfig&#34;&gt;Build Config&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&#34;http://requirejs.org/docs/optimization.html&#34;&gt;Requirejs optimization page&lt;/a&gt; also gives a description of most of the parameters used in the build file, and there is also a &lt;a href=&#34;https://github.com/jrburke/r.js/blob/master/build/example.build.js&#34;&gt;super detailed example in the repo&lt;/a&gt;.  Our basic build file for the sake of this article looks like this:&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/9460650.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;Here, r.js would be run from the root of the project (containing the &lt;code&gt;app/&lt;/code&gt; folder) like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;r.js -o build.js
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This build file references a Requirejs config file with &lt;code&gt;mainConfigFile&lt;/code&gt;; again note that they are two different things.  r.js will look in the given config file for any Requirejs config given with &lt;code&gt;requirejs.config&lt;/code&gt;.  Most importantly, it will grab your &lt;code&gt;paths&lt;/code&gt; parameter from there and use those paths to find all of your modules.  If you&#39;re not using a &lt;code&gt;mainConfigFile&lt;/code&gt; parameter in your build file, you can also specify the paths here, but this approach of referencing the config file avoids needing to repeat information.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;baseUrl&lt;/code&gt; determines the directory for the later &lt;code&gt;include&lt;/code&gt; parameter and also for the paths given in the config file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;out&lt;/code&gt; gives the output file path relative to where r.js was run.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;optimize&lt;/code&gt; parameter here is just telling r.js to minify the code when it concatenates everything, which is nice for your build process but not necessary.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;include&lt;/code&gt; points to an array of main Requirejs files to include, or just the single main file in our case.  Other files specified by &lt;code&gt;paths&lt;/code&gt; will still be included without repeating them here.  Note that this main file is the same as our &lt;code&gt;mainConfigFile&lt;/code&gt;.  That&#39;s because the this file contains our config as well as the entry point for our app and is used independently for each.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;name&lt;/code&gt; parameter is pointing to almond, relative to our &lt;code&gt;baseUrl&lt;/code&gt;, which will include almond in the build process.&lt;/p&gt;

&lt;p&gt;Keep in mind that r.js is incredibly finicky about these paths and you must get everything perfectly right!&lt;/p&gt;

&lt;h2 id=&#34;theresult&#34;&gt;The Result&lt;/h2&gt;

&lt;p&gt;Running this setup will gather all files in your project, concatenate them, minify them, and output them into the specified output file in a way that can be used by external projects.&lt;/p&gt;

&lt;p&gt;However, if you&#39;re not using almond, you&#39;ll notice that the user of your project still needs to include Requirejs!&lt;/p&gt;

&lt;h2 id=&#34;almond&#34;&gt;Almond&lt;/h2&gt;

&lt;p&gt;Almond allows you to build to a file without depending on Requirejs.  It&#39;s a bare bones AMD loader that replaces the minimal needed functionality of Requirejs and sticks itself into your final built file.&lt;/p&gt;

&lt;p&gt;If you included almond in the &lt;code&gt;name&lt;/code&gt; attribute in your build file as shown above, your output file will be ready to go.&lt;/p&gt;

&lt;h2 id=&#34;fromhere&#34;&gt;From Here&lt;/h2&gt;

&lt;p&gt;Requirejs can add a lot of headaches with how finicky it can be, but the benefits of breaking up your JavaScript nicely with AMD are pretty great.  Stick to a configuration similar to the above and you should be able to get your setup working smoothly.  And don&#39;t forget that you can stick the parameters in your build file into the task options for Grunt and use this easily in your build process.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A Tutorial for Getting Started with Gulp</title>
      <link>https://justinmccandless.com/post/a-tutorial-for-getting-started-with-gulp/</link>
      <pubDate>Sun, 23 Feb 2014 16:50:45 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/a-tutorial-for-getting-started-with-gulp/</guid>
      <description>&lt;p&gt;Awhile back I wrote a &lt;a href=&#34;http://www.justinmccandless.com/blog/A+Tutorial+for+Getting+Started+with+Grunt&#34;&gt;tutorial covering the basics of Grunt&lt;/a&gt;. Now that a new frontend build tool has entered the scene, I thought I&#39;d take a look and see if I could write a simple guide for &lt;a href=&#34;http://gulpjs.com/&#34;&gt;Gulp&lt;/a&gt; at the same level. This guide will take you from installation and getting set up through examples of real world build processes while laying out all of the tools out there to help you on the way.&lt;/p&gt;

&lt;h2 id=&#34;resources&#34;&gt;Resources&lt;/h2&gt;

&lt;p&gt;This article aims to be thorough, but you&#39;ll also be referring to a few other resources while working with Gulp.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&#34;https://github.com/gulpjs/gulp/&#34;&gt;Gulp Github repo&lt;/a&gt; is the main place to go for help. The README has a nice sample gulpfile, and the repo also contains &lt;a href=&#34;https://github.com/gulpjs/gulp/tree/master/docs&#34;&gt;Gulp&#39;s documentation&lt;/a&gt;. The &lt;a href=&#34;https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md&#34;&gt;getting started doc&lt;/a&gt; shows you how to install and create a blank gulpfile.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&#34;http://gulpjs.com/&#34;&gt;Gulp website&lt;/a&gt; mainly just refers to the Github repo, but it does contain an invaluable &lt;a href=&#34;http://gulpjs.com/plugins/&#34;&gt;plugin directory&lt;/a&gt; as well.&lt;/p&gt;

&lt;h2 id=&#34;whyafrontendbuildtool&#34;&gt;Why a Frontend Build Tool?&lt;/h2&gt;

&lt;p&gt;Sure you can just upload your raw development files to a web server and call it a day, but there are a lot of tools out there that can make a developer&#39;s life a lot easier, from &lt;a href=&#34;http://coffeescript.org/&#34;&gt;CoffeeScript&lt;/a&gt; to &lt;a href=&#34;http://www.jshint.com/&#34;&gt;jshint&lt;/a&gt; to &lt;a href=&#34;http://pivotal.github.io/jasmine/&#34;&gt;Jasmine&lt;/a&gt; testing. If you&#39;re going to utilize even a very simple build process, a tool like Gulp can make things much more automated.&lt;/p&gt;

&lt;p&gt;Gulp is a command line tool that you run at various points in your build process?—?or even continuously. If your build process previously consisted of compiling &lt;a href=&#34;http://sass-lang.com/&#34;&gt;Sass&lt;/a&gt; and minifying your JavaScript, Gulp could handle both of those for you at once, and it&#39;s much easier to configure than a bunch of bash commands. Even more importantly, it&#39;s portable thanks to npm, so you can build on any machine you check out your repo to after a simple &lt;code&gt;npm install&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&#34;gulpandgrunt&#34;&gt;Gulp and Grunt&lt;/h2&gt;

&lt;p&gt;The main difference you&#39;ll want to keep in mind between &lt;a href=&#34;http://gruntjs.com/&#34;&gt;Grunt&lt;/a&gt; and Gulp is that Grunt is controlled through configuration and Gulp is controlled through code. You tell Grunt what to do through a json file, but you create your Gulp build process by writing JavaScript and invoking Gulp&#39;s API.&lt;/p&gt;

&lt;p&gt;Besides that, you&#39;ve got two pretty similar tools. Both have the goal of automating your frontend build process. Both are written mainly in Node and set up with a variety of plugins using npm. And both have a friendly root level file to tell them what to do (Gruntfile.js and gulpfile.js).&lt;/p&gt;

&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;

&lt;p&gt;The documentation contained in the &lt;a href=&#34;https://github.com/gulpjs/gulp&#34;&gt;Gulp Github repo&lt;/a&gt; for getting up and running is actually quite effective, so check out the &lt;a href=&#34;https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md&#34;&gt;official getting started guide&lt;/a&gt; referenced above. You&#39;ll just be installing Gulp globally and then locally to your project using npm, so make sure you have &lt;a href=&#34;http://nodejs.org/&#34;&gt;Node&lt;/a&gt; installed. Just two simple commands here:&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install -g gulp
npm install --save-dev gulp
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&#34;helloworld&#34;&gt;Hello World&lt;/h2&gt;

&lt;p&gt;You can continue with the getting started guide to create a minimal gulpfile. Here&#39;s what my idea of a super basic one might look like:&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/9179795.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;You could now jump back to the command line and run this with the command &lt;code&gt;gulp&lt;/code&gt;. As you can probably tell, the only thing this does is output &#39;Hello world. &#39;&lt;/p&gt;

&lt;p&gt;Let&#39;s take a look at what &#39;s going on in this gulpfile. The first thing you might notice is that this is just JavaScript, it&#39;s not a json config file like with Grunt. It&#39;s using Node&#39;s require function to include &lt;code&gt;gulp&lt;/code&gt;, then defining a task.&lt;/p&gt;

&lt;p&gt;Tasks are the same concept from Grunt: you can define arbitrary tasks and run them from the command line with &lt;code&gt;gulp &lt;taskname&gt;&lt;/code&gt;. &lt;code&gt;default&lt;/code&gt; is the task called when no parameter is given. In Gulp though, tasks are just functions, and you can place whatever code you want inside of them.&lt;/p&gt;

&lt;h2 id=&#34;ausefulgulpfilecopyingfiles&#34;&gt;A Useful Gulpfile - Copying Files&lt;/h2&gt;

&lt;p&gt;Now to a gulpfile that does something useful. This is might be a setup you have for a simple &lt;a href=&#34;http://yeoman.io/&#34;&gt;Yeoman&lt;/a&gt; style app/ working directory and dist/ production directory. All it does is copy the javascript and html from the app/ directory to the dist/ directory.&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/9179801.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;Let&#39;s look at that &lt;code&gt;paths&lt;/code&gt; object we&#39;re defining. That&#39;s not something specific to Gulp - remember, we&#39;re just writing JavaScript here. We can define any sort of variable we like and use it however. Just notice the actual path strings I&#39;m setting. They work just like in Grunt, so &lt;code&gt;**&lt;/code&gt; is a wildcard meaning this and any subdirectory, and &lt;code&gt;*&lt;/code&gt; is a typical wildcard for the filename. Prepending a path with an exclamation mark tells Gulp to exclude that directory.&lt;/p&gt;

&lt;p&gt;In Gulp, you define the instructions for each task in a function passed as an argument to the task. &lt;code&gt;gulp.src&lt;/code&gt; takes an array of source paths. &lt;code&gt;gulp.dest&lt;/code&gt; copies results to a given directory. And &lt;code&gt;pipe&lt;/code&gt; chains tasks together.&lt;/p&gt;

&lt;p&gt;Note how I&#39;m concatenating the two paths arrays we defined in &lt;code&gt;paths&lt;/code&gt;. Again, you might be used to being stuck in the confines of Grunt&#39;s configuration specifics, but here we&#39;re just passing a parameter to a function. &lt;code&gt;gulp.src&lt;/code&gt; accepts an array of paths, so we can pass that however we want.&lt;/p&gt;

&lt;p&gt;Try this gulpfile out if you want, and you&#39;ll see the specified .html and .js files in the app/ directory will be copied into the new dist/ directory.&lt;/p&gt;

&lt;h2 id=&#34;arealgulpfile&#34;&gt;A Real Gulpfile&lt;/h2&gt;

&lt;p&gt;Let&#39;s take a look at one more example, this time something you might find in a real app. The main idea for this gulpfile is similar to our above example; we&#39;re still building development files from an app/ folder into a production dist/ folder, we&#39;re just doing a little bit of processing in between.&lt;/p&gt;

&lt;script src=&#34;https://gist.github.com/justinmc/9149719.js&#34;&gt;&lt;/script&gt;

&lt;p&gt;We&#39;re using five new plugins this time around: gulp-clean, gulp-jshint, gulp-concat, gulp-uglify, and gulp-imagemin. You can see the full list of plugins in the plugin directory on the Gulp site. Just like in Grunt, when you use a new plugin in Gulp, you&#39;ll have to install it with npm. So to install these plugins and write them to your package.json, use something like this:&lt;/p&gt;

&lt;p&gt;npm install --save-dev gulp-clean gulp-jshint gulp-concat gulp-uglify gulp-imagemin&lt;/p&gt;

&lt;p&gt;Notice the default task definition down towards the bottom of this gulpfile. You can define a task as a sequence of other tasks by passing an array of task names instead of a function. Here, the default task runs &lt;code&gt;clean&lt;/code&gt;, &lt;code&gt;scripts&lt;/code&gt;, &lt;code&gt;imagemin&lt;/code&gt;, and &lt;code&gt;copy&lt;/code&gt;, so let&#39;s take a close look at each of these.&lt;/p&gt;

&lt;h3 id=&#34;gulpclean&#34;&gt;&lt;a href=&#34;https://github.com/peter-vilja/gulp-clean&#34;&gt;gulp-clean&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This plugin will simply delete files for you, allowing you to get rid of old or transitional files. The first thing this gulpfile does is run gulp-clean on the production dist/ directory, just to make sure that nothing created in a previous build and later removed in app/ could be lingering around.&lt;/p&gt;

&lt;h3 id=&#34;scripts&#34;&gt;scripts&lt;/h3&gt;

&lt;p&gt;The scripts task is going to lint and uglify all of the app&#39;s JavaScript, concatenate it all into one file, and output it into our production directory.&lt;/p&gt;

&lt;h3 id=&#34;gulpjshint&#34;&gt;&lt;a href=&#34;https://github.com/wearefractal/gulp-jshint&#34;&gt;gulp-jshint&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;jshint&lt;/code&gt; is a great tool for catching errors and bad habits in your code, and this plugin just runs it on the given files. Note that we also need to use a reporter here if we want to see jshint&#39;s output on the command line. &lt;code&gt;jshint.reporter(&#39;default&#39;)&lt;/code&gt; is fine if you&#39;re not picky about what it shows you, but go ahead and look at the &lt;a href=&#34;https://github.com/wearefractal/gulp-jshint&#34;&gt;Github repo&lt;/a&gt; if you want to get more specific. And don &#39;t forget that this plugin will be looking in the root of your project for a &lt;code&gt;.jshintrc&lt;/code&gt; file to get your configuration preferences.&lt;/p&gt;

&lt;h3 id=&#34;gulpuglify&#34;&gt;&lt;a href=&#34;https://github.com/terinjokes/gulp-uglify&#34;&gt;gulp-uglify&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This plugin will minify your code by removing extra whitespace and other stuff that only matter to a human reader, not the browser. Pipe in the files you want it to operate on like normal.&lt;/p&gt;

&lt;h3 id=&#34;gulpconcat&#34;&gt;&lt;a href=&#34;https://github.com/wearefractal/gulp-concat&#34;&gt;gulp-concat&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This will concatenate all given files into one file to reduce the number of HTTP requests required to get your code. Just pass in the filename that you want it output as. Note that you should still add a &lt;code&gt;gulp.dest&lt;/code&gt; to the end of this to actually output the file into a given directory like normal.&lt;/p&gt;

&lt;h3 id=&#34;gulpimagemin&#34;&gt;&lt;a href=&#34;https://github.com/sindresorhus/gulp-imagemin&#34;&gt;gulp-imagemin&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This plugin reduces the weight of your images. Here it&#39;s used with &lt;code&gt;gulp.src&lt;/code&gt; and &lt;code&gt;gulp.dest&lt;/code&gt; like normal to output the final files to the production folder.&lt;/p&gt;

&lt;h3 id=&#34;multipleinstructionsinonetask&#34;&gt;Multiple Instructions in One Task&lt;/h3&gt;

&lt;p&gt;The copy task is very basic, just like in the previous example. Notice that this time we&#39;re creating multiple sets of instructions in one task, copying independent &lt;code&gt;gulp.src&lt;/code&gt; files to independent &lt;code&gt;gulp.dest&lt;/code&gt; destinations within the task function. This is perfectly OK in Gulp. Once again, it &#39;s just JavaScript.&lt;/p&gt;

&lt;h3 id=&#34;cwdoption&#34;&gt;cwd Option&lt;/h3&gt;

&lt;p&gt;Note the cwd parameter I&#39;m passing to gulp.src in most tasks. The basic usage of this does what you might expect, changing the working directory of the task so you don&#39;t have to repeat redundant subdirectories on all of your paths.&lt;/p&gt;

&lt;p&gt;It can also be used to tell Gulp to preserve your directory structure when outputting files, however. If you use the directory wildcard in your cwd like &lt;code&gt;app/**&lt;/code&gt; in the libs portion of the &lt;code&gt;copy&lt;/code&gt; task, Gulp will compare the directories it finds there with the paths provided in the base path in the first parameter, and use this to reconstruct your directory structure in the output. If this is omitted, all of your output files will be flattened into a single directory level.&lt;/p&gt;

&lt;h3 id=&#34;watch&#34;&gt;watch&lt;/h3&gt;

&lt;p&gt;The last thing to notice in this gulpfile is the &lt;code&gt;watch&lt;/code&gt; task. This watches the given path for any files to change, and executes the array of tasks when they do. This is great for when you&#39;re in the middle of development. It&#39;s a pain to switch to the terminal and run &lt;code&gt;gulp&lt;/code&gt; every time you make a small change, so set up a watch task like this to save you the trouble. It&#39;s not included in the &lt;code&gt;default&lt;/code&gt; task here, so keep in mind you would run it with &lt;code&gt;gulp watch&lt;/code&gt; from the command line.&lt;/p&gt;

&lt;h3 id=&#34;tasksinparallelandseries&#34;&gt;Tasks in Parallel and Series&lt;/h3&gt;

&lt;p&gt;A big caveat to watch out for when using Gulp is that &lt;strong&gt;all tasks are executed in parallel by default&lt;/strong&gt;.  This is very useful, but can cause problems if you&#39;re not careful.&lt;/p&gt;

&lt;p&gt;In the gulpfile above, our clean task must complete before any of our tasks that output files into the dist/ folder (scripts, imagemin, and copy).  We indicate that by passing &lt;code&gt;[&#39;clean&#39;]&lt;/code&gt; in as the second parameter to the definitions of these tasks.  This parameter is an array of any tasks that need to complete before the task being defined is run, so you can include as many as you want.&lt;/p&gt;

&lt;p&gt;Just make sure that your task that you want to complete first returns the Gulp stream (which is the result of a Gulp operation) when it completes, as done above in the clean task.  This tells Gulp that it has completed.  You can also take a callback as the parameter to your task and call it when the task completes, in case you aren&#39;t generating a stream.  The &lt;a href=&#34;https://github.com/gulpjs/gulp/blob/master/docs/recipes/running-tasks-in-series.md&#34;&gt;documentation explains this in detail&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;fromhere&#34;&gt;From Here&lt;/h2&gt;

&lt;p&gt;You should be able to set up the build process for a sizeable app with this guide alone, but I hope you don&#39;t stop there with learning Gulp. Don&#39;t forget to refer to the &lt;a href=&#34;http://gulpjs.com/plugins/&#34;&gt;Gulp plugin directory&lt;/a&gt; to get ideas on how you can use Gulp to automate much more than is covered in this article. There are already hundreds of plugins available, but Gulp is still lagging far behind Grunt in this area. If you&#39;re feeling really adventurous, check out the &lt;a href=&#34;https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/README.md&#34;&gt;documentation on creating your own plugin!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Update 2014.04.13&lt;/em&gt;
I added the above clarification about tasks in parallel and series due to running into problems with this in my own Gulp projects.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Announcing Mathpx</title>
      <link>https://justinmccandless.com/post/announcing-mathpx/</link>
      <pubDate>Mon, 17 Feb 2014 17:29:25 -0800</pubDate>
      
      <guid>https://justinmccandless.com/post/announcing-mathpx/</guid>
      <description>&lt;p&gt;Ever since I worked for a startup building educational kids apps in China, I&#39;ve been tossing around a few ideas about writing one of my own.  I may be biased as an engineer, but one of the main areas I perceive to be lacking both in the classroom and the app store is our ability to teach math.  &lt;a href=&#34;http://mathpx.justinmccandless.com&#34;&gt;Mathpx&lt;/a&gt; is my new experiment to rethink the way we teach the very fundamentals of arithmetic.&lt;/p&gt;

&lt;h2 id=&#34;mathnotmemorization&#34;&gt;Math not Memorization&lt;/h2&gt;

&lt;p&gt;When I was an undergraduate in electrical engineering at the University of Michigan, I took quite a few math-heavy courses, and I quickly discovered the obvious fact that you&#39;re a lot better off in a class when you understand the fundamentals as opposed to just regurgitating formulas.&lt;/p&gt;

&lt;p&gt;Some of my first rigorous math classes really made me realize how much I hadn&#39;t understood of the basics in grade school.  I had breezed through the Nevada public school system answering questions like &#34;What is pi?&#34; with &#34;3.14&#34; without realizing that was only the tip of the ice berg.&lt;/p&gt;

&lt;p&gt;With Mathpx, I wanted to help kids get a solid foundation in the most basic concepts possible.  Based on my own grade school experiences and my observations volunteering in classrooms, I realized that I had to take it way back.&lt;/p&gt;

&lt;h2 id=&#34;11disconnect&#34;&gt;1 + 1 = Disconnect&lt;/h2&gt;

&lt;p&gt;Enough has been said elsewhere about education systems&#39; reliance on memorization and testing, but the way we teach math doesn&#39;t just encourage memorization, it prevents anything deeper from day one.&lt;/p&gt;

&lt;p&gt;Why do we teach our children subtraction in the first grade but wait years to introduce the concept of negative numbers?  &lt;code&gt;2 - 1&lt;/code&gt; is something a toddler should be able to calculate, but change the order to &lt;code&gt;-1 + 2&lt;/code&gt; and that&#39;s taboo until middle school, and &lt;code&gt;2 - 1 = x&lt;/code&gt; has to remain hidden for even longer.&lt;/p&gt;

&lt;p&gt;Each of these problems are fundamentally the same thing, but with our grade school they require a leap in understanding to progress.  Why not just teach the fundamentals at the start?&lt;/p&gt;

&lt;h2 id=&#34;exitpaperfingersandapplesenteracomputer&#34;&gt;We&#39;re not Limited to Counting on our Fingers Any More&lt;/h2&gt;

&lt;p&gt;With the fairly recent rise of tablets, we&#39;re just getting started with what teachers can do when they&#39;re not limited to counting apples on their hands and writing problems on the board.  I scrapped all of this and tried to rethink what the connections to basic arithmetic really are, and this is what I came up with.&lt;/p&gt;

&lt;h2 id=&#34;mathpx&#34;&gt;Mathpx&lt;/h2&gt;

&lt;p&gt;In Mathpx, players count out the answers to basic arithmetic problems by dragging balls around the screen.  The written form of the problem sits right above and automatically updates, making the connection to pencil-and-paper math intuitive.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.justinmccandless.com/files/mathpx1.gif&#34; alt=&#34;Counting Screenshot&#34; title=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Pressing the equals button racks up all number balls, so it&#39;s easy to see if the two sides of the equation are equal or not.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.justinmccandless.com/files/mathpx2.gif&#34; alt=&#34;Addition Screenshot&#34; title=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Let&#39;s make the jump to subtraction.  Subtraction works the same way, but it shows numbers being subtracted as blue balls instead of red.  Now when the player presses the equals button, positives and negatives visually cancel out, and the remaining values rack up.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.justinmccandless.com/files/mathpx3.gif&#34; alt=&#34;Subtraction Screenshot&#34; title=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;With this visualization of math, why hold out on negatives for the next few years?  Here is the easy jump to negatives.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;http://www.justinmccandless.com/files/mathpx4.gif&#34; alt=&#34;Negatives Screenshot&#34; title=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Mathpx is designed to evoke a visualization of math that fits nicely with everything from counting to arithmetic with positives and negatives to algebra, because really, it&#39;s all one concept.&lt;/p&gt;

&lt;h2 id=&#34;thechallenge&#34;&gt;A Challenge&lt;/h2&gt;

&lt;p&gt;Don&#39;t believe me that your kid isn&#39;t ready to learn this level of math right now?  Hand them a device with Mathpx on it and see what happens.  When you&#39;re teaching the fundamentals from the start, kids can learn in an afternoon play session what the school system thinks should take years.&lt;/p&gt;

&lt;h2 id=&#34;getit&#34;&gt;The App&lt;/h2&gt;

&lt;p&gt;Mathpx is just a hobby experiment of mine, so you can play it for free right now in the browser at &lt;a href=&#34;http://mathpx.justinmccandless.com&#34;&gt;mathpx.justinmccandless.com&lt;/a&gt;.  It&#39;s also live on the &lt;a href=&#34;https://chrome.google.com/webstore/detail/mathpx/eopjfmdjkjcmapcgkobjfibcmlepehin?authuser=1&#34;&gt;Chrome Webstore&lt;/a&gt; and the &lt;a href=&#34;https://marketplace.firefox.com/app/mathpx/&#34;&gt;Firefox Marketplace&lt;/a&gt;, also for free.&lt;/p&gt;

&lt;p&gt;Hopefully I&#39;ll get around to releasing this on Android and iOS too, and if so I will update this page.  In the meantime, enjoy the app, and here&#39;s to better ways of teaching math.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>