<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Fuzzy Tolerance]]></title>
  <link href="http://fuzzytolerance.info/atom.xml" rel="self"/>
  <link href="http://fuzzytolerance.info/"/>
  <updated>2013-05-17T15:17:47-04:00</updated>
  <id>http://fuzzytolerance.info/</id>
  <author>
    <name><![CDATA[Tobin Bradley]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Priceless]]></title>
    <link href="http://fuzzytolerance.info/blog/priceless/"/>
    <updated>2013-05-17T15:14:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/priceless</id>
    <content type="html"><![CDATA[<p><img class="center" src="https://lh6.googleusercontent.com/-N3SLYQck6CM/UZaAslfL2pI/AAAAAAAADs0/V9cOyPT11rI/w669-h1078-no/8.png" width="669" height="1078"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[iD is freaking awesome]]></title>
    <link href="http://fuzzytolerance.info/blog/id-is-freaking-awesome/"/>
    <updated>2013-05-08T09:50:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/id-is-freaking-awesome</id>
    <content type="html"><![CDATA[<p>I have written all manor of data maintenance apps over the years. One of the first apps I worked on professionally was a cadastral data maintenance monstrosity written in AML (<em>shudders</em>). I have created enough of these types of apps to know that I absolutely hate making these types of apps.</p>

<p>It isn&#8217;t just that they&#8217;re hard to code. And by hard to code, I mean really hard. They&#8217;re like ferreting a snowflake across the Sahara while trying to figure out what <a href="http://www.imdb.com/title/tt0414993/?ref_=sr_1">The Fountain</a> was about hard. It&#8217;s more this: it&#8217;s almost impossible to create a data maintenance app that people <em>want to use</em>. Data maintenance isn&#8217;t fun. By the time people open your app they are already pissed off. To create a data maintenance app that people actually want to use is something I had written off years ago<sup>1</sup>.</p>

<p>Which is why what MapBox has accomplished with <a href="http://ideditor.com/">iD</a> is so damn amazing. <em>It makes you want to use it.</em> It&#8217;s that good.</p>

<!-- more -->




<iframe src="http://player.vimeo.com/video/62308979" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>


<p>This is going to be a huge boon for <a href="http://www.openstreetmap.org/">OSM</a>. After using iD, if I were king I&#8217;d dump any number of our layers and vendor maintenance packages and have our staff just start editing OSM via iD and using it as our basemap. It&#8217;s that good.</p>

<p>The <a href="https://github.com/systemed/iD">iD editor itself is open source software</a> (<a href="https://github.com/systemed/iD/blob/master/LICENSE">WTFPL</a> licensed), and it is going to change the way we build web sites.</p>

<script async class="speakerdeck-embed" data-id="557b9de07eb00130163e123138152827" data-ratio="1.33333333333333" src="http://fuzzytolerance.info//speakerdeck.com/assets/embed.js"></script>


<p>No jQuery. No Bootstrap. No Backbone. No Leaflet or OpenLayers or other <em>mapping</em> libraries.</p>

<p>It&#8217;s <a href="http://d3js.org/">D3</a>.</p>

<p>When I can free up some time I&#8217;m going to dig into the code and try to ferret out the genius. Mad props to MapBox. iD is freaking awesome.</p>

<div class="footnotes">
    <sup>1</sup>By written off I mean relegated to vendors. Redirecting the bitching is worth the premium.
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Screencast 24: Build Something]]></title>
    <link href="http://fuzzytolerance.info/blog/screencast-24-build-something/"/>
    <updated>2013-04-29T15:25:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/screencast-24-build-something</id>
    <content type="html"><![CDATA[<iframe width="640" height="480" src="http://www.youtube.com/embed/jJJck-vQHHo" frameborder="0" allowfullscreen></iframe>




<!-- more -->


<h3>Resources</h3>

<ul>
<li><a href="https://trello.com/">Trello</a></li>
<li><a href="https://github.com/tobinbradley/leaflet-bootstrap-mapping-template">My Bootstrap/Leaflet template</a></li>
<li><a href="https://github.com/sergeche/emmet-sublime">Sublime Text - Emmet</a></li>
<li><a href="https://github.com/weslly/Nettuts-Fetch">Sublime Text - Fetch</a></li>
<li>The best Sublime Text tutorial I&#8217;ve found is <a href="http://net.tutsplus.com/articles/news/perfect-workflow-in-sublime-text-free-course/">this one by Nettuts+</a>.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[More on Build Processes for the Web]]></title>
    <link href="http://fuzzytolerance.info/blog/more-on-build-processes-for-the-web/"/>
    <updated>2013-04-12T14:04:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/more-on-build-processes-for-the-web</id>
    <content type="html"><![CDATA[<p>My last <a href="http://fuzzytolerance.info/blog/screencast-23-web-workflow-interation-and-build/">screencast</a> was about iteration and build processes for web development. Here&#8217;s a bit more on the build process.</p>

<p>The big 4 for web performance are (in this order):</p>

<ol>
<li><strong>gzip text before it leaves your server.</strong> All of that CSS, JavaScript, JSON, SVG, etc. should be squished before it travels across the wire.</li>
<li><strong>Smart caching.</strong> The fastest resource request is the one that never happens.</li>
<li><strong>Image optimization.</strong> Images are still the biggest pipe suck for the majority of sites.</li>
<li><strong>Concatenate and compress.</strong> Fewer HTTP requests and smaller files sizes are better.</li>
</ol>


<!-- more -->


<p>Chris Coyier gave one of his usual amazing talks on just this subject.</p>

<script async class="speakerdeck-embed" data-id="d5395a9026be013092b722000a1d8877" data-ratio="1.33333333333333" src="http://fuzzytolerance.info//speakerdeck.com/assets/embed.js"></script>


<p>The first two problems are part of your server configuration. If you&#8217;re on Apache, grab the <code>.htaccess</code> file in <a href="http://html5boilerplate.com/">html5boilerplate</a> and put it in your <code>httpd.conf</code> file. It&#8217;ll fix the first two problems and a bunch of others. The last two, ye developer, are in your court.</p>

<h3>Image Optimization</h3>

<p>Image optimization can save a remarkable amount of bandwidth and cut down page load time significantly. The best tool I&#8217;ve used is <a href="http://trimage.org/">Trimage (Linux)</a>, which is lossless, handles PNG and JPG, and can be automated via the command line as part of your build process. You only have to run it on an image once - running it successive times on the same image won&#8217;t do anything (hence <em>lossless</em>). As such I&#8217;ll usually comment it out of my build processes once the application is mature. Trimage was inspired by <a href="http://imageoptim.com/">ImageOptim</a> on OS X which you can use there; I haven&#8217;t found anything I like on Windows yet.</p>

<h3>Concatenation and Minification</h3>

<p>You&#8217;re doing two things here. The first is reducing the number of HTTP requests. The number of simultaneous requests to a server <a href="http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser">varies by the browser</a>, and currently range from 2 to 8. Once you hit that number the requests have to get in the queue, which slows page load. The second thing you are doing is minifying the concatenated file, removing any unnecessary characters/white space from the code. That lowers the size of the file over the network.</p>

<p>A common misunderstanding is that you don&#8217;t have to minify code if it is getting gzip&#8217;d before it leaves the server, as that will smush it up for you anyway. That is not the case; you should do both.</p>

<blockquote><p>Original: <strong>28,781</strong> bytes<br/>Minified: <strong>22,242</strong> bytes<br/>Gzipped: <strong>6,969</strong> bytes<br/>Min+Gzip: <strong>5,990</strong> bytes</p><footer><strong>DisgruntledGoat</strong> <cite><a href='http://stackoverflow.com/questions/807119/gzip-versus-minify'>Gzip Versus Minify - Stack Overflow</a></cite></footer></blockquote>


<h3>Side Note: Invalidating Cache on Individual Files</h3>

<p>You have far-out expiry dates for your JavaScript. Congrats! You just changed your HTML and JavaScript and now the two are out of sync and your site is busted. Balls!</p>

<p>There are various ways to deal with this. My preferred method is adding a phony GET parameter to the request.</p>

<figure class='code'><figcaption><span>Phony GET Parameter</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href=</span><span class="s">&quot;css/main.css?foo=2735&quot;</span><span class="nt">&gt;</span>
</span><span class='line'><span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;js/main.js?foo=2735&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>HTML isn&#8217;t cached, so the browser fetches it every time. When you change the GET argument on the URL, the browser will see a different URL from the one it got last time, invalidating the cache and fetching the file. This isn&#8217;t the only way to do it, and <a href="http://stackoverflow.com/questions/118884/what-is-an-elegant-way-to-force-browsers-to-reload-cached-css-js-files">there is some controversy about this approach</a>. It always seems to work though, and it is what Stack Overflow itself uses. Your CSS and JavaScript files of course completely ignore the argument. I usually use foo, short for <a href="http://en.wikipedia.org/wiki/Foobar">foobar</a>, which is generally synonymous with a placeholder or garbage.</p>

<h3>How I Do It</h3>

<p>I do this in two stages. I do concatenation as part of my iteration process so I can point the HTML links directly to what the final location will be. I use Guard for this, which also preprocesses my SASS into a single CSS file.</p>

<figure class='code'><figcaption><span>My Generic Guard File for Iteration</span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># sass to css</span>
</span><span class='line'><span class="n">guard</span> <span class="s1">&#39;sass&#39;</span><span class="p">,</span> <span class="ss">:input</span> <span class="o">=&gt;</span> <span class="s1">&#39;assets/sass&#39;</span><span class="p">,</span> <span class="ss">:output</span> <span class="o">=&gt;</span> <span class="s1">&#39;public/css&#39;</span><span class="p">,</span> <span class="ss">:line_numbers</span> <span class="o">=&gt;</span> <span class="kp">true</span><span class="p">,</span> <span class="ss">:all_on_start</span> <span class="o">=&gt;</span> <span class="kp">true</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># javascript concatenation to js/main.js</span>
</span><span class='line'><span class="n">guard</span> <span class="ss">:concat</span><span class="p">,</span> <span class="n">type</span><span class="p">:</span> <span class="s2">&quot;js&quot;</span><span class="p">,</span> <span class="n">files</span><span class="p">:</span> <span class="sx">%w(vendor/bootstrap/bootstrap-tooltip vendor/bootstrap/bootstrap-modal vendor/bootstrap/bootstrap-transition vendor/bootstrap/bootstrap-button vendor/bootstrap/bootstrap-popover vendor/bootstrap/bootstrap-alert vendor/jquery-ui-1.10.0.custom.min vendor/jquery.ui.slider.labels vendor/jquery.placeholder vendor/jquery.debounce plugins map page)</span><span class="p">,</span> <span class="n">input_dir</span><span class="p">:</span> <span class="s2">&quot;assets/scripts&quot;</span><span class="p">,</span> <span class="n">output</span><span class="p">:</span> <span class="s2">&quot;public/js/main&quot;</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># live reload</span>
</span><span class='line'><span class="n">guard</span> <span class="s1">&#39;livereload&#39;</span> <span class="k">do</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/js/.+\.(js)$}</span><span class="p">)</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/css/.+\.(css)}</span><span class="p">)</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/.+\.(html)$}</span><span class="p">)</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>I don&#8217;t minify at this stage. Debugging minified CSS and JavaScript during iteration is a pain in the ass. Instead my final build process including minification via <a href="http://yui.github.io/yuicompressor/">YUI-Compressor</a>, invalidating cache for CSS and JavaScript via text replacement, and image optimization. As I split time between Linux and Windows, I have separate build scripts for both. If you are using <a href="http://www.sublimetext.com/">Sublime Text</a>, you can differentiate your build process by platform like this (build files in your Packages/User folder with a .sublime-build extension):</p>

<figure class='code'><figcaption><span>webapp.sublime-build</span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="nt">&quot;shell&quot;</span><span class="p">:</span> <span class="s2">&quot;true&quot;</span><span class="p">,</span>
</span><span class='line'>    <span class="nt">&quot;selector&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="s2">&quot;Guardfile&quot;</span> <span class="p">],</span>
</span><span class='line'>    <span class="nt">&quot;linux&quot;</span><span class="p">:</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>        <span class="nt">&quot;cmd&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="s2">&quot;./build.sh&quot;</span> <span class="p">]</span>
</span><span class='line'>    <span class="p">},</span>
</span><span class='line'>    <span class="nt">&quot;windows&quot;</span><span class="p">:</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>        <span class="nt">&quot;cmd&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="s2">&quot;./build.ps1&quot;</span> <span class="p">]</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Windows gets a PowerShell Script and Linux gets a bash script.</p>

<figure class='code'><figcaption><span>build.sh</span></figcaption><div class="highlight"><table><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 class='bash'><span class='line'><span class="c">#! /bin/bash</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Generate Random Number for Cache Busting</span>
</span><span class='line'><span class="nv">rand</span><span class="o">=</span><span class="nv">$RANDOM</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Minify CSS and JavaScript</span>
</span><span class='line'>yui-compressor --type css -o public/css/main.css public/css/main.css
</span><span class='line'>yui-compressor --type js -o public/js/main.js public/js/main.js
</span><span class='line'>
</span><span class='line'><span class="c"># Bust cache for anything with foo argument</span>
</span><span class='line'>sed -i <span class="s2">&quot;s/?foo=[0-9]*/?foo=$rand/g&quot;</span> public/index.html
</span><span class='line'>
</span><span class='line'><span class="c"># Optimize Images</span>
</span><span class='line'>trimage -q -d public/images
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>build.ps1</span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='powershell'><span class='line'><span class="c"># Generate Random Number for Cache Busting</span>
</span><span class='line'><span class="nv">$rand</span> <span class="p">=</span> <span class="nb">Get-Random</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Minify CSS and JavaScript</span>
</span><span class='line'><span class="n">java</span> <span class="n">-jar</span> <span class="p">../</span><span class="n">yuicompressor</span><span class="p">-</span><span class="n">2</span><span class="p">.</span><span class="n">4</span><span class="p">.</span><span class="n">7</span><span class="p">.</span><span class="n">jar</span> <span class="p">-</span><span class="n">-type</span> <span class="n">css</span> <span class="n">-o</span> <span class="n">public</span><span class="p">/</span><span class="n">css</span><span class="p">/</span><span class="n">main</span><span class="p">.</span><span class="n">css</span> <span class="n">public</span><span class="p">/</span><span class="n">css</span><span class="p">/</span><span class="n">main</span><span class="p">.</span><span class="n">css</span>
</span><span class='line'><span class="n">java</span> <span class="n">-jar</span> <span class="p">../</span><span class="n">yuicompressor</span><span class="p">-</span><span class="n">2</span><span class="p">.</span><span class="n">4</span><span class="p">.</span><span class="n">7</span><span class="p">.</span><span class="n">jar</span> <span class="p">-</span><span class="n">-type</span> <span class="n">js</span> <span class="n">-o</span> <span class="n">public</span><span class="p">/</span><span class="n">js</span><span class="p">/</span><span class="n">main</span><span class="p">.</span><span class="n">js</span> <span class="n">public</span><span class="p">/</span><span class="n">js</span><span class="p">/</span><span class="n">main</span><span class="p">.</span><span class="n">js</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Bust cache for anything with foo argument</span>
</span><span class='line'><span class="p">(</span><span class="nb">Get-Content</span> <span class="n">public</span><span class="p">/</span><span class="n">index</span><span class="p">.</span><span class="n">html</span><span class="p">)</span> <span class="p">|</span> <span class="k">ForEach</span><span class="n">-Object</span> <span class="p">{</span> <span class="nv">$_</span> <span class="o">-replace</span> <span class="s2">&quot;^?foo=[0-9]*&quot;</span><span class="p">,</span> <span class="s2">&quot;foo=$rand&quot;</span> <span class="p">}</span> <span class="p">|</span> <span class="nb">Set-Content</span> <span class="n">public</span><span class="p">/</span><span class="n">index</span><span class="p">.</span><span class="n">html</span>
</span></code></pre></td></tr></table></div></figure>


<p>These scripts basically do the same thing. A random number is generated, the CSS and JavaScript files are minified, and some cache busting takes place in <code>index.html</code> via some regex text replacement. The only difference is the <code>bash</code> script also optimizes images. Once the build script is run, the application is ready for deployment on a web server.</p>

<h3>Easier Than It Looks</h3>

<p>This looks like a lot of work, and setting it up the first time can be. After that it&#8217;s a piece of cake. When I want to work on an app I fire up Guard, which does my livereload and preprocessing/concatenization. When I&#8217;m ready to deploy, I hit CTRL-B in Sublime Text and it minifies, does cache invalidation, and optimizes images. Getting the iteration and build processes set up for a new project takes minutes. And the most important thing: it&#8217;s automated. For a busy dev, no matter how compelling the benefits, if you can&#8217;t automate it, it probably isn&#8217;t going to happen.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Screencast 23: Web Workflow - Iteration and Build]]></title>
    <link href="http://fuzzytolerance.info/blog/screencast-23-web-workflow-interation-and-build/"/>
    <updated>2013-04-05T13:27:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/screencast-23-web-workflow-interation-and-build</id>
    <content type="html"><![CDATA[<iframe width="853" height="480" src="http://www.youtube.com/embed/AdneQZa5eHk" frameborder="0" allowfullscreen></iframe>




<!-- more -->




<figure class='code'><figcaption><span>Sample Guard File</span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># sass to css</span>
</span><span class='line'><span class="n">guard</span> <span class="s1">&#39;sass&#39;</span><span class="p">,</span> <span class="ss">:input</span> <span class="o">=&gt;</span> <span class="s1">&#39;assets/sass&#39;</span><span class="p">,</span> <span class="ss">:output</span> <span class="o">=&gt;</span> <span class="s1">&#39;public/css&#39;</span><span class="p">,</span> <span class="ss">:line_numbers</span> <span class="o">=&gt;</span> <span class="kp">true</span><span class="p">,</span> <span class="ss">:all_on_start</span> <span class="o">=&gt;</span> <span class="kp">true</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># This will concatenate the javascript files specified in :files to js/main.js</span>
</span><span class='line'><span class="n">guard</span> <span class="ss">:concat</span><span class="p">,</span> <span class="n">type</span><span class="p">:</span> <span class="s2">&quot;js&quot;</span><span class="p">,</span> <span class="n">files</span><span class="p">:</span> <span class="sx">%w(vendor/bootstrap/bootstrap-tooltip vendor/bootstrap/bootstrap-modal vendor/bootstrap/bootstrap-transition vendor/bootstrap/bootstrap-button vendor/bootstrap/bootstrap-popover vendor/bootstrap/bootstrap-alert vendor/jquery-ui-1.10.0.custom.min vendor/jquery.ui.slider.labels vendor/jquery.placeholder vendor/jquery.debounce plugins map page)</span><span class="p">,</span> <span class="n">input_dir</span><span class="p">:</span> <span class="s2">&quot;assets/scripts&quot;</span><span class="p">,</span> <span class="n">output</span><span class="p">:</span> <span class="s2">&quot;public/js/main&quot;</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># live reload</span>
</span><span class='line'><span class="n">guard</span> <span class="s1">&#39;livereload&#39;</span> <span class="k">do</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/js/.+\.(js)$}</span><span class="p">)</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/css/.+\.(css)}</span><span class="p">)</span>
</span><span class='line'>  <span class="n">watch</span><span class="p">(</span><span class="sr">%r{public/.+\.(html)$}</span><span class="p">)</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<h3>Resources</h3>

<ul>
<li><a href="http://net.tutsplus.com/tutorials/tools-and-tips/guard-is-your-best-friend/">Guard is Your Best Friend</a></li>
<li><a href="http://trimage.org/">Trimage</a></li>
<li><a href="http://fuzzytolerance.info/presentations/html5-ncgis2013.html#/10/1">Web App Development LifeCycle - Credit goes to Paul Irish</a></li>
<li><a href="https://github.com/tobinbradley/Mecklenburg-County-Quality-of-Life-Dashboard">Quality of Life Dashboard on Github</a></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Skookum Digital Works Talk]]></title>
    <link href="http://fuzzytolerance.info/blog/skookum-digital-works-talk/"/>
    <updated>2013-04-02T19:05:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/skookum-digital-works-talk</id>
    <content type="html"><![CDATA[<p>Here&#8217;s a talk I did at <a href="http://skookum.com/blog/sdw-tech-talks-gis-programming-open-government-data/">Skookum Digital Works</a> on the <a href="http://maps.co.mecklenburg.nc.us/qoldashboard">Quality of Life Dashboard</a>, our software stack and philosophy, and the challenges of being a &#8220;government tool&#8221;.</p>

<iframe width="560" height="315" src="http://www.youtube.com/embed/C4B1kkvpZdA" frameborder="0" allowfullscreen></iframe>


<p>Idiot that I am, I had no idea these <a href="http://techtalk.skookum.com/">Free Friday Tech Talks</a> were even happening. It&#8217;s a great venue with a lot of really smart attendees (best Q/A session <em>ever</em>). If you&#8217;re in the Charlotte area and you haven&#8217;t checked it out yet, I highly recommend it.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Upcoming Events in the Charlotte Area]]></title>
    <link href="http://fuzzytolerance.info/blog/upcoming-events-in-the-charlotte-area/"/>
    <updated>2013-03-22T10:01:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/upcoming-events-in-the-charlotte-area</id>
    <content type="html"><![CDATA[<p>Here&#8217;s some events the next few weeks if you&#8217;re in the Charlotte area and looking for something to do.</p>

<!-- more -->


<h4>March 26th 8:30am - 3:30pm: <a href="http://ui.uncc.edu/story/data-training-charlotte">Charlotte Data Day: Using Data for Community Development</a></h4>

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=320+E+9th+St,+Charlotte,+NC&amp;aq=0&amp;oq=320+E.+Ninth+St.&amp;sll=35.170517,-79.860994&amp;sspn=5.871831,10.777588&amp;t=m&amp;ie=UTF8&amp;hq=&amp;hnear=320+E+9th+St,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;z=14&amp;ll=35.22844,-80.834919&amp;output=embed"></iframe>


<br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=320+E+9th+St,+Charlotte,+NC&amp;aq=0&amp;oq=320+E.+Ninth+St.&amp;sll=35.170517,-79.860994&amp;sspn=5.871831,10.777588&amp;t=m&amp;ie=UTF8&amp;hq=&amp;hnear=320+E+9th+St,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;z=14&amp;ll=35.22844,-80.834919" style="color:#0000FF;text-align:left">View Larger Map</a></small>


<p>You need to register for it, but it&#8217;s free. I&#8217;ll be there at the Mecklenburg County table talking about open data and tools and whatnot. It&#8217;ll be at UNC Charlotte Center City campus, 320 E. Ninth St., in uptown Charlotte</p>

<h4>March 29th 12:00pm: <a href="http://techtalk.skookum.com/events/100993952/?eventId=100993952&amp;action=detail">Friday Tech Talk: Mecklenburg County GIS Programmer Tobin Bradley</a></h4>

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=121+W+Trade+St,+charlotte+nc&amp;aq=&amp;sll=35.221607,-80.839655&amp;sspn=0.011464,0.02105&amp;ie=UTF8&amp;hq=&amp;hnear=121+W+Trade+St+Suite+1900,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;ll=35.221607,-80.839655&amp;spn=0.011463,0.02105&amp;t=m&amp;z=14&amp;output=embed"></iframe>


<br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=121+W+Trade+St,+charlotte+nc&amp;aq=&amp;sll=35.221607,-80.839655&amp;sspn=0.011464,0.02105&amp;ie=UTF8&amp;hq=&amp;hnear=121+W+Trade+St,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;ll=35.221607,-80.839655&amp;spn=0.011463,0.02105&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left">View Larger Map</a></small>


<p>I&#8217;m doing a tech talk at Skookum Digital Works about the Quality of Life Dashboard but also about development, GIS and government in general. No slides, just nerd talk. It&#8217;s free but you need to register.</p>

<h4>April 18th All Day: <a href="http://www.surveymonkey.com/s/TBDYTWS">DIGI 2020</a></h4>

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=600+E+4th+St,+Charlotte,+NC&amp;aq=0&amp;oq=600+e+4th&amp;sll=35.22844,-80.834919&amp;sspn=0.011463,0.02105&amp;ie=UTF8&amp;hq=&amp;hnear=600+E+4th+St,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;ll=35.228444,-80.834913&amp;spn=0.011464,0.02105&amp;t=m&amp;z=14&amp;output=embed"></iframe>


<br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=600+E+4th+St,+Charlotte,+NC&amp;aq=0&amp;oq=600+e+4th&amp;sll=35.22844,-80.834919&amp;sspn=0.011463,0.02105&amp;ie=UTF8&amp;hq=&amp;hnear=600+E+4th+St,+Charlotte,+Mecklenburg,+North+Carolina+28202&amp;ll=35.228444,-80.834913&amp;spn=0.011464,0.02105&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left">View Larger Map</a></small>


<p>The 4th annual regional technology summit. Registration required, but it&#8217;s free. I&#8217;ll be hanging out at Mecklenburg County&#8217;s table from time to time.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Quick Hack: One Bootstrap Popover at a Time]]></title>
    <link href="http://fuzzytolerance.info/blog/quick-hack-one-bootstarp-popover-at-a-time/"/>
    <updated>2013-03-21T17:24:00-04:00</updated>
    <id>http://fuzzytolerance.info/blog/quick-hack-one-bootstarp-popover-at-a-time</id>
    <content type="html"><![CDATA[<p>Bootstrap is my new favorite front-end framework, and I really like the JavaScript <a href="http://twitter.github.com/bootstrap/javascript.html#popovers">popovers</a> for contextual information and help. One thing I don&#8217;t like about them is they aren&#8217;t aware of each other. If you only want 1 to be visible on your page at a time, here&#8217;s a quick hack. It does involve 1 global variable, which should make you feel dirty.</p>

<!-- more -->




<figure class='code'><figcaption><span>One Bootstrap Popover at a Time</span></figcaption><div class="highlight"><table><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>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
</pre></td><td class='code'><pre><code class='javascript'><span class='line'><span class="c1">// Global variable - cringe</span>
</span><span class='line'><span class="kd">var</span> <span class="nx">visiblePopover</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="c1">// enable popovers - all of mine in this instance have a class of .hov</span>
</span><span class='line'><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;.hov&quot;</span><span class="p">).</span><span class="nx">popover</span><span class="p">({</span> <span class="s1">&#39;container&#39;</span><span class="o">:</span> <span class="s1">&#39;body&#39;</span> <span class="p">});</span>
</span><span class='line'>
</span><span class='line'><span class="c1">// only allow 1 popover at a time</span>
</span><span class='line'><span class="c1">// all my popovers hav</span>
</span><span class='line'><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;.hov&#39;</span><span class="p">).</span><span class="nx">on</span><span class="p">(</span><span class="s1">&#39;click&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'>    <span class="c1">// don&#39;t fall through</span>
</span><span class='line'>    <span class="nx">e</span><span class="p">.</span><span class="nx">stopPropagation</span><span class="p">();</span>
</span><span class='line'>    <span class="kd">var</span> <span class="nx">$this</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
</span><span class='line'>    <span class="c1">// check if the one clicked is now shown</span>
</span><span class='line'>    <span class="k">if</span> <span class="p">(</span><span class="nx">$this</span><span class="p">.</span><span class="nx">data</span><span class="p">(</span><span class="s1">&#39;popover&#39;</span><span class="p">).</span><span class="nx">tip</span><span class="p">().</span><span class="nx">hasClass</span><span class="p">(</span><span class="s1">&#39;in&#39;</span><span class="p">))</span> <span class="p">{</span>
</span><span class='line'>        <span class="c1">// if another was showing, hide it</span>
</span><span class='line'>        <span class="nx">visiblePopover</span> <span class="o">&amp;&amp;</span> <span class="nx">visiblePopover</span><span class="p">.</span><span class="nx">popover</span><span class="p">(</span><span class="s1">&#39;hide&#39;</span><span class="p">);</span>
</span><span class='line'>        <span class="c1">// then store the current popover</span>
</span><span class='line'>        <span class="nx">visiblePopover</span> <span class="o">=</span> <span class="nx">$this</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
</span><span class='line'>        <span class="c1">// if it was hidden, then nothing must be showing</span>
</span><span class='line'>        <span class="nx">visiblePopover</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'><span class="p">});</span>
</span><span class='line'>
</span><span class='line'><span class="c1">// hide all popovers if any non-popover part of the body is clicked</span>
</span><span class='line'><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;body&quot;</span><span class="p">).</span><span class="nx">on</span><span class="p">(</span><span class="s1">&#39;click&#39;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
</span><span class='line'>    <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;.hov&quot;</span><span class="p">).</span><span class="nx">popover</span><span class="p">(</span><span class="s1">&#39;hide&#39;</span><span class="p">);</span>
</span><span class='line'>    <span class="nx">visiblePopover</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
</span><span class='line'><span class="p">});</span>
</span></code></pre></td></tr></table></div></figure>


<p>Check it out <a href="http://maps.co.mecklenburg.nc.us/labs/cg/">over here</a>. Click on a bubble at the top, then click on a different bubble or somewhere else on the page.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Dirt-Simple PostGIS HTTP API]]></title>
    <link href="http://fuzzytolerance.info/blog/dirt-simple-postgis-http-api/"/>
    <updated>2013-03-08T14:13:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/dirt-simple-postgis-http-api</id>
    <content type="html"><![CDATA[<p>One of the first projects I ever open sourced was a <a href="https://code.google.com/p/postgis-restful-web-service-framework/">PHP web service framework</a> I created for Mecklenburg back in 2010. It got a little coding love after its initial release (mostly from that mad genius <a href="http://geojason.info/">Jason Sanford</a>), but it really didn&#8217;t change much over time. It generally just worked, and I still get emails from people who use it today.</p>

<blockquote><p>Q: What&#8217;s the worst code you&#8217;ve seen recently?<br/>A: My own.</p><footer><strong>Jeff Atwood, Coding Horror</strong> <cite><a href='http://www.codinghorror.com/blog/2009/07/nobody-hates-software-more-than-software-developers.html'>www.codinghorror.com/blog/2009/&hellip;</a></cite></footer></blockquote>




<!-- more -->


<p>A little while back I did a <a href="http://fuzzytolerance.info/blog/screencast-15-ubersearch/">screencast on the Ubersearch</a> autocomplete thing, and when I dug into my old code I did a lot of frowning. People describe bad code as having a smell, but 3 cats have burned out my olfactory sense. Bad code gives me visual hallucinations. When I see bad code, I see this.</p>

<div class="aligncenter caption"><img src="https://lh6.googleusercontent.com/-YONSh5Nd-ps/UTo_ADJGnQI/AAAAAAAADns/9obIRewEXu4/s500/Anteater_by_highanxiety00.jpg"><br>My bad code totem animal is an anteater.</div>


<p>I think if you can always say the worst code you&#8217;ve ever seen is the code you wrote 6 months ago, you&#8217;re a good programmer. I wrote this code years ago. I saw a giant anteater when I looked at this code.</p>

<p>Part of me wanted to just point people to <a href="http://cartodb.com/">CartoDB</a>, which is like the Cadillac of this kind of stuff, but people still seem to be interested in this project, and there is something to be said for a really simple solution like this (the dependencies for CartoDB would choke a pony). So, I scrubbed it and tossed the <a href="https://github.com/tobinbradley/dirt-simple-postgis-http-api">new release on GitHub</a>. Among the changes are:</p>

<ul>
<li>I renamed it. The old title had REST in it, and REST it ain&#8217;t. At the time I kinda thought it was, at least in the common-language sense. Thanks to the many folks that helped educate me on this point.</li>
<li>Much, much, much cleaner code. The code reduction I&#8217;d guess is ~40%.</li>
<li>JSON or JSONP. That&#8217;s it. I can count the number of times I&#8217;ve used the myriad other return formats on no hands. You can still return JSON or GeoJSON as a field from a geometry column ala <code>fields=st_asgeojson(the_geom) as geojson</code> and then interpret that as JSON via <code>jQuery.parseJSON(the_json_value)</code> or something similar.</li>
<li>It uses PHP&#8217;s <code>json_encode</code> rather than my fugly recordset-to-JSON loop. It&#8217;s faster and does a perfect job of escaping junk in the return. You can get a record count via <code>the_json_return.length</code>.</li>
<li>Some sensible defaults so you don&#8217;t have to pass a bunch of empty arguments all the time. Curse my stupid brains.</li>
<li>Put in ST_ for the geometry functions so you don&#8217;t have to do the legacy SQL thing in PostGIS 2.0.</li>
<li>More friendly to different projections and geometry column names. I had 2264 and the_geom hard coded in a lot of places.</li>
<li>Much, much, much better documentation. I wasn&#8217;t doing anybody any favors with my old documentation, which probably should have come with gratis Tequila. I&#8217;m doing MarkDown conversion in JavaScript, so all the service docs are in MarkDown and the initial index.html content area is actually just GitHub&#8217;s  README.md. I thought this was clever. It also is using a much prettier Bootstrap layout.</li>
</ul>


<p>Enjoy, and patches are always welcome.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Automating Tile Generation with TileMill]]></title>
    <link href="http://fuzzytolerance.info/blog/automating-tile-generation-with-tilemill/"/>
    <updated>2013-03-08T10:32:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/automating-tile-generation-with-tilemill</id>
    <content type="html"><![CDATA[<p>MapBox hasn&#8217;t documented this anywhere that I can find, which either means (a) they haven&#8217;t gotten around to it or (b) this isn&#8217;t a stable API and it could change in a future TileMill release. If you automate your tile generation this way, make sure your job still works when you install a new version of TileMill. With all of that said, I&#8217;ve been asked this question often enough that I figured it deserved a post.</p>

<!-- more -->


<p>The first step is locating TileMill&#8217;s <code>index.js</code>. On Ubuntu it is sitting at <code>/usr/share/tilemill</code>. On Windows it&#8217;ll depend on whether you&#8217;re 32bit or 64bit, but assuming you put it in the default place it&#8217;ll be something like <code>C:\Program Files (x86)\TileMill-v0.10.1\tilemill</code>. Because TileMill&#8217;s node isn&#8217;t in the system path on Windows, before you do anything you&#8217;ll need to be in that folder.</p>

<figure class='code'><figcaption><span>Windows</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">cd</span> <span class="s2">&quot;C:\Program Files (x86)\TileMill-v0.10.1\tilemill&quot;</span>
</span></code></pre></td></tr></table></div></figure>


<p>Having node execute <code>index.js</code> by itself just launches TileMill, but there are other command options, including export. To see the full list of commands:</p>

<figure class='code'><figcaption><span>Windows</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>.<span class="se">\n</span>ode.exe .<span class="se">\i</span>ndex.js --help
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>Ubuntu</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>/usr/share/tilemill/index.js --help
</span></code></pre></td></tr></table></div></figure>


<p>That will give you:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><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 class='bash'><span class='line'>Usage: /usr/share/tilemill/index.js <span class="o">[</span><span class="nb">command</span><span class="o">]</span> --help <span class="k">for </span>a list of options.
</span><span class='line'>Available commands are:
</span><span class='line'>  start:   start application
</span><span class='line'>  core:    start ui server
</span><span class='line'>  <span class="nb">export</span>:  <span class="nb">export </span>project
</span><span class='line'>  <span class="nb">test</span>:    <span class="nb">test </span>server process
</span><span class='line'>  tile:    start tile server
</span></code></pre></td></tr></table></div></figure>


<p><code>export</code> is what we&#8217;re interested in. Firing that command without any arguments will give you your options.</p>

<figure class='code'><figcaption><span>Windows</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>.<span class="se">\n</span>ode.exe .<span class="se">\i</span>ndex.js <span class="nb">export</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>Ubuntu</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>/usr/share/tilemill/index.js <span class="nb">export</span>
</span></code></pre></td></tr></table></div></figure>


<p>You&#8217;ve got a lot of options.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><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>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>Usage: /usr/share/tilemill/index.js &lt;<span class="nb">command</span>&gt; <span class="o">[</span>options...<span class="o">]</span>
</span><span class='line'>Commands: <span class="nb">export </span>project
</span><span class='line'>  <span class="nb">export</span> &lt;project&gt; &lt;<span class="nb">export</span>&gt;
</span><span class='line'>
</span><span class='line'>Options:
</span><span class='line'>    --format<span class="o">=[</span>format<span class="o">]</span>                 Export format <span class="o">(</span>png|pdf|svg|mbtiles|upload|sync<span class="o">)</span>. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --bbox<span class="o">=[</span>xmin,ymin,xmax,ymax<span class="o">]</span>      Comma separated coordinates of bounding box to export. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --minzoom<span class="o">=[</span>zoom<span class="o">]</span>                  MBTiles: minimum zoom level to export. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --maxzoom<span class="o">=[</span>zoom<span class="o">]</span>                  MBTiles: maximum zoom level to export. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --width<span class="o">=[</span>width<span class="o">]</span>                   Image: image width in pixels. <span class="o">(</span>Default: 400<span class="o">)</span>
</span><span class='line'>    --height<span class="o">=[</span>height<span class="o">]</span>                 Image: image height in pixels. <span class="o">(</span>Default: 400<span class="o">)</span>
</span><span class='line'>    --url<span class="o">=[</span>url<span class="o">]</span>                       URL to PUT updates to. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --log                             Write crash logs to destination directory. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --quiet                           Suppresses progress output. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --scheme<span class="o">=[</span>scanline|pyramid|file<span class="o">]</span>  Enumeration scheme that defines the order in which tiles will be rendered. <span class="o">(</span>Default: <span class="s2">&quot;scanline&quot;</span><span class="o">)</span>
</span><span class='line'>    --job<span class="o">=[</span>file<span class="o">]</span>                      Store state in this file. If it exists, that job will be resumed. <span class="o">(</span>Default: <span class="nb">false</span><span class="o">)</span>
</span><span class='line'>    --list<span class="o">=[</span>file<span class="o">]</span>                     Provide a list file <span class="k">for </span>filescheme render. <span class="o">(</span>Default: <span class="nb">false</span><span class="o">)</span>
</span><span class='line'>    --metatile<span class="o">=[</span>num<span class="o">]</span>                  Metatile size. <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --scale<span class="o">=[</span>num<span class="o">]</span>                     Scale factor <span class="o">(</span>Default: undefined<span class="o">)</span>
</span><span class='line'>    --concurrency<span class="o">=[</span>num<span class="o">]</span>               Number of exports that can be run concurrently. <span class="o">(</span>Default: 4<span class="o">)</span>
</span><span class='line'>    --files<span class="o">=[</span>path<span class="o">]</span>                    Path to files directory. <span class="o">(</span>Default: <span class="s2">&quot;/home/gandalf/Documents/MapBox&quot;</span><span class="o">)</span>
</span><span class='line'>    --syncAPI<span class="o">=[</span>URL<span class="o">]</span>                   MapBox API URL. <span class="o">(</span>Default: <span class="s2">&quot;http://api.tiles.mapbox.com&quot;</span><span class="o">)</span>
</span><span class='line'>    --syncURL<span class="o">=[</span>URL<span class="o">]</span>                   MapBox sync URL. <span class="o">(</span>Default: <span class="s2">&quot;https://tiles.mapbox.com&quot;</span><span class="o">)</span>
</span><span class='line'>    --syncAccount<span class="o">=[</span>account<span class="o">]</span>           MapBox account name. <span class="o">(</span>Default: <span class="s2">&quot;&quot;</span><span class="o">)</span>
</span><span class='line'>    --syncAccessToken<span class="o">=[</span>token<span class="o">]</span>         MapBox access token. <span class="o">(</span>Default: <span class="s2">&quot;&quot;</span><span class="o">)</span>
</span><span class='line'>    --verbose<span class="o">=</span>on|off                  verbose logging <span class="o">(</span>Default: <span class="s2">&quot;on&quot;</span><span class="o">)</span>
</span><span class='line'>    --config<span class="o">=[</span>path<span class="o">]</span>                   Path to JSON configuration file.
</span></code></pre></td></tr></table></div></figure>


<p>Now you can automate tile generation. A batch file for Windows would look something like this.</p>

<figure class='code'><figcaption><span>Windows</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">cd</span> <span class="s2">&quot;C:\Program Files (x86)\TileMill-v0.10.1\tilemill&quot;</span>
</span><span class='line'>.<span class="se">\n</span>ode.exe .<span class="se">\i</span>ndex.js <span class="nb">export </span>meckbase C:<span class="se">\t</span>ile-depot<span class="se">\m</span>eckbase.mbtiles --format<span class="o">=</span>mbtiles --bbox<span class="o">=</span><span class="s2">&quot;-81.8949,34.7032,-79.8075,35.8768&quot;</span> --minzoom<span class="o">=</span>9 --maxzoom<span class="o">=</span>11 --metatile<span class="o">=</span>8
</span></code></pre></td></tr></table></div></figure>


<ul>
<li>For the project argument, you&#8217;re giving the name of the project folder in <code>MapBox\project</code>, which in this case is <code>meckbase</code>. <em>Do not put project.mml here.</em></li>
<li><code>metatile</code> is optional, but if you have a healthy amount of RAM bumping it up from the default 2 will make things go faster. It will also reduce rendering problems around tile edges.</li>
<li>It assumes <code>MapBox\project</code> is in the default install location. If you put it somewhere else, use the <code>--files=c:\path_to_project</code> option. If you get this wrong the command will give you a <em>can&#8217;t find project</em> message.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[On Strategic Planning]]></title>
    <link href="http://fuzzytolerance.info/blog/on-strategic-planning/"/>
    <updated>2013-02-20T20:15:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/on-strategic-planning</id>
    <content type="html"><![CDATA[<p>95% of strategic planning is crap, with a margin of error of ~5%. I have had a hand in a number of strategic plans and I have come to revile almost every aspect of them. <!-- more -->Rather than regale you with a long list of woe, here are my top two gripes:</p>

<ul>
<li><strong>They take an astounding amount of time.</strong> You tie up multiple people for man-years doing this stuff. You end up in the worst kind of meeting ever created - a bunch of tech-hipsters sitting around a table word-smithing a document - again and again and again. Because you are the only one that has heard about the Google Docs, 78 versions of the draft will be sitting in your inbox at any given time. You spend more time talking about doing things than it would take to <em>actually do the things</em>.</li>
<li><strong>They aren&#8217;t useful.</strong> Nobody is going to read it. You openly acknowledge as much when you slap an executive summary on the front. But you&#8217;re kidding yourself there too. The executives aren&#8217;t going to read the summary page. Nobody is going to read it. You could have dumped 40 pages from the <a href="http://cbsg.sourceforge.net/cgi-bin/live">Corporate Bullshit Generator</a> in a text file for all the good it will do. About a week after it is done and the mock celebrations are over, you will send it to the place where documents (and innovation and collaboration and dreams) go to die - <em>SharePoint</em>. And that will be that.</li>
</ul>


<p>So. Guess who got put in a group tasked with creating a new strategic plan?</p>

<p><img src="https://lh6.googleusercontent.com/-RIeu82sFjMw/USV_cgqGgCI/AAAAAAAADnA/ldErZyQgpQs/s800/Damn.jpg" class="aligncenter"></p>

<p>But I&#8217;m in a group with some smart folks. And I have a plan. I haven&#8217;t told them the plan yet. But it goes something like this: chuck the 40+ page document. Just forget it. What you want to make is something like this:</p>

<div class="aligncenter caption" style="width: 704px;"><img src="https://lh3.googleusercontent.com/-ceRy2pBIp6Q/USWBQx-ueMI/AAAAAAAADnM/Ma15XPgGmBU/s800/egovplan1.png" alt="" width="704" ><a href="http://maps.co.mecklenburg.nc.us/labs/cg">My mock draft.</a></div>


<p>You don&#8217;t need a strategic plan. You need a dashboard. An interactive dashboard that you can see on your computer, you can print on a piece of paper, you can put on the giant TV you wish you had in your common area. It can go everywhere. It&#8217;s easy to understand. One page. Every quarter, take an hour and update the sucker. Everybody is on the same page. It shows where you are going. It shows what you are doing. A strategic plan than is actually useful. Booyah. Done. If you really want to make a 40+ page document in addition to this to stick on SharePont for historic or masochistic purposes, feel free. Just don&#8217;t tell me about it.</p>

<p><strong>CAN I PULL OFF THIS MAD STROKE OF GENIUS?!</strong> Ah, no, probably not. But the idea that I could is going to get me through the next 6 months without clearing out my liquor cabinet.</p>

<p class="small"><sup>*</sup>Plus, I kinda wanted an excuse to fool around with D3. Alas, this ended up not being the project for it. I made the SVG in Inkscape and used a tiny bit of jQuery and Bootstrap to do popovers. Sigh.</p>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Screencast #22 - HTML5 Talk from NC GIS 2013]]></title>
    <link href="http://fuzzytolerance.info/blog/screencast-number-22-html5-talk-from-nc-gis-2013/"/>
    <updated>2013-02-13T12:49:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/screencast-number-22-html5-talk-from-nc-gis-2013</id>
    <content type="html"><![CDATA[<iframe width="640" height="360" src="http://www.youtube.com/embed/cfbK99KCU-U" frameborder="0" allowfullscreen></iframe>


<h3>Resources</h3>

<ul>
<li><a href="http://fuzzytolerance.info/presentations/html5-ncgis2013.html">Slideshow</a></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[New Year's Resolutions 2013]]></title>
    <link href="http://fuzzytolerance.info/blog/new-years-resolutions-2013/"/>
    <updated>2013-01-28T16:45:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/new-years-resolutions-2013</id>
    <content type="html"><![CDATA[<ul>
<li>Any meeting invitation I receive that doesn&#8217;t have an agenda attached goes straight to the recycle bin. If it has an agenda attached that doesn&#8217;t either interest or involve me in some way it merits a formal decline (and then straight to the recycle bin). Meetings that get by both of those filters will be met with more traditional <em>evasion-and-escape</em> techniques.</li>
<li>I am going to jump face-first into a modern web dev workflow. That means goodies like:

<ul>
<li>SASS</li>
<li>Client-side MVC</li>
<li>AMD</li>
<li>TDD</li>
<li><a href="http://yeoman.io/">Yeoman</a> for scaffolding and workflow</li>
</ul>
</li>
<li>I&#8217;m going to do something with <a href="http://qt-project.org/qt5">QT 5.0</a>. I don&#8217;t know what. It looks too awesome not to screw around with.</li>
<li>Completely overhaul my neglected <a href="http://maps.co.mecklenburg.nc.us/dataportal/">open data portal</a>.</li>
<li>Concision. Must work on. You&#8217;d think this wouldn&#8217;t be a problem for me - I have the social skills of a Yeti.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[I know this will irritate penguins, but...]]></title>
    <link href="http://fuzzytolerance.info/blog/i-know-this-will-irritate-penguins/"/>
    <updated>2013-01-28T11:33:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/i-know-this-will-irritate-penguins</id>
    <content type="html"><![CDATA[<p><img class="aligncenter" src="https://lh6.googleusercontent.com/-PiuVpWwP_Y4/UQalhqYBbCI/AAAAAAAADmE/JJInB0ReqDI/s800/7.png"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Screencast #21 - State of the Office 2013]]></title>
    <link href="http://fuzzytolerance.info/blog/screencast-number-21-state-of-the-office-2013/"/>
    <updated>2013-01-23T13:10:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/screencast-number-21-state-of-the-office-2013</id>
    <content type="html"><![CDATA[<div class="textcenter">
<iframe width="640" height="360" src="http://www.youtube.com/embed/rwkiNMSLMmQ" frameborder="0" allowfullscreen></iframe>
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[NC GIS 2013 Conference features Douglas Crockford]]></title>
    <link href="http://fuzzytolerance.info/blog/nc-gis-2013-conference-features-douglas-crockford/"/>
    <updated>2013-01-12T11:11:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/nc-gis-2013-conference-features-douglas-crockford</id>
    <content type="html"><![CDATA[<p><img class="aligncenter img-naked" src="https://lh6.googleusercontent.com/-maydUzi2EDM/UPGL2fafBPI/AAAAAAAADRI/Km7le38c6cU/s800/logoGIS.png"></p>

<p>The <a href="http://www.ncgisconference.com/2013/">2013 NC GIS Conference</a> on February 7-8 is coming up fast. This is one of the best conferences I go to, regularly drawing 900+ attendees with lots of great speakers from the region and around the country. This is going to be an especially big year for the conference. How big?</p>

<!-- more -->




<div class="textcenter">
    <h1 sytle="font-size: 1.8em">DOUGLAS EFFIN&#8217; CROCKFORD BIG</h1>
</div>




<div class="aligncenter caption" style="width: 400px;">
    <img src="https://lh5.googleusercontent.com/-UOw5RFBcFOE/UPGNH4Ocr4I/AAAAAAAADRY/ZUDjJZBQqyI/s400/crockford.jpg" style="width: 400px;">
    Douglas Effin&#8217; Crockford
</div>


<p>That&#8217;s right, the eminent JavaScript guru, developer of JSON and JSLint, author of the best programming book <strong>on any language ever</strong> - <a href="http://www.amazon.com/JavaScript-The-Good-Parts-ebook/dp/B0026OR2ZY/ref=sr_1_1?ie=UTF8&amp;qid=1358008037&amp;sr=8-1&amp;keywords=javascript+the+good+parts">JavaScript: The Good Parts</a> - is giving two talks at the conference. One is an hour long session titled <em>Programming Style and Your Brain</em>, and the other is during a regular 3-presenter session<sup>1</sup> titled <em>JavaScript, JSON, and Other Good Parts</em>.</p>

<p>Aside from being a great conference, this is also one of the most affordable conferences you&#8217;ll find. Registration before January 16th is only $125, and goes up to $165 after. That&#8217;s, like, 4 Starbucks visits and a movie popcorn. It is also in Raleigh NC, and there&#8217;s a really good chance you&#8217;ve never had a reason to go there before!<sup>2</sup></p>

<p>See you there!</p>

<p><sup>1</sup> <span class="small">That session also has a talk by me on HTML5. The idea that I&#8217;m giving a presentation in the same session as Crockford makes me simultaneously beam with pride and  want to change my underwear, with the latter gaining the upper hand as the conference approaches.</span></p>

<p><sup>2</sup> <span class="small">Particularly in February. Bring a coat.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Quality of Life Dashboard is Live]]></title>
    <link href="http://fuzzytolerance.info/blog/quality-of-life-dashboard-is-live/"/>
    <updated>2013-01-08T19:44:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/quality-of-life-dashboard-is-live</id>
    <content type="html"><![CDATA[<p><a href="http://maps.co.mecklenburg.nc.us/qoldashboard">It is alive! ALIVE!</a></p>

<p><img class="aligncenter" src="https://lh5.googleusercontent.com/-Mc0TrvWxy1c/UOy-vL-s5YI/AAAAAAAADQk/2VZkOqAvfHQ/s800/qoldlives.png"></p>

<p>&#8230;which isn&#8217;t terribly exciting, seeing how as it hasn&#8217;t changed a whole lot in months. But there data is there now and the beta label is off, so that&#8217;s something. Feel free to <a href="https://github.com/tobinbradley/Mecklenburg-County-Quality-of-Life-Dashboard">grab the code on GitHub</a>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Use CSS pseudo-class to change another element's styling]]></title>
    <link href="http://fuzzytolerance.info/blog/use-css-pseudo-class-to-change-another-elements-styling/"/>
    <updated>2013-01-07T19:30:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/use-css-pseudo-class-to-change-another-elements-styling</id>
    <content type="html"><![CDATA[<p>If you hover near the image header on this site, another image will pop up on top of it. I thought that would be a neat effect, but I would normally do something like this with a jQuery <code>$("#id").hover()</code> type of thing, and this site is probably the only site I&#8217;ve done in years that doesn&#8217;t load jQuery. jQuery is small and generally everybody has the Google CDN version cached, but I didn&#8217;t want to load jQuery just for what is really styling.</p>

<p>Looking for a plain-old JavaScript way to do it, I stumbled onto how to do it in pure CSS.</p>

<!-- more -->


<p>As it turns out, a CSS pseudo-class is able to effect the styling of descendant (<code>li a</code>) and adjacent (<code>li > a</code> or <code>li + a</code>) selectors. That&#8217;s kind of awesome. The structure of the image header is:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;logo-image&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>       <span class="nt">&lt;img</span> <span class="na">src=</span><span class="s">&quot;/images/logo.png&quot;</span> <span class="na">width=</span><span class="s">&quot;122&quot;</span> <span class="na">height=</span><span class="s">&quot;122&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>       <span class="nt">&lt;img</span> <span class="na">src=</span><span class="s">&quot;/images/quote.png&quot;</span> <span class="na">width=</span><span class="s">&quot;112&quot;</span> <span class="na">height=</span><span class="s">&quot;28&quot;</span> <span class="na">id=</span><span class="s">&quot;logo-quote&quot;</span><span class="nt">&gt;</span>
</span><span class='line'><span class="nt">&lt;/div&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>I made the outer div <code>:hover</code> pseudo-class change the visibility of the quote, which is otherwise hidden.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><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>
</pre></td><td class='code'><pre><code class='css'><span class='line'><span class="nc">.logo-image</span><span class="nd">:hover</span> <span class="nf">#logo-quote</span> <span class="p">{</span>
</span><span class='line'>    <span class="k">display</span><span class="o">:</span> <span class="k">inline</span><span class="o">-</span><span class="k">block</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="nf">#logo-quote</span> <span class="p">{</span>
</span><span class='line'>    <span class="k">position</span><span class="o">:</span> <span class="k">absolute</span><span class="p">;</span>
</span><span class='line'>    <span class="k">top</span><span class="o">:</span> <span class="m">20px</span><span class="p">;</span>
</span><span class='line'>    <span class="k">left</span><span class="o">:</span> <span class="m">50</span><span class="o">%</span><span class="p">;</span>
</span><span class='line'>    <span class="k">display</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>One downer here - there doesn&#8217;t appear to be a way to apply a CSS transition to the display property of an element. It just pops on, which is kinda ugly. To get it to fade in and out, you can modify the element&#8217;s opacity rather than its display property.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><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 class='css'><span class='line'><span class="nc">.logo-image</span><span class="nd">:hover</span> <span class="nf">#logo-quote</span> <span class="p">{</span>
</span><span class='line'>    <span class="k">opacity</span><span class="o">:</span> <span class="m">1</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="nf">#logo-quote</span> <span class="p">{</span>
</span><span class='line'>    <span class="k">position</span><span class="o">:</span> <span class="k">absolute</span><span class="p">;</span>
</span><span class='line'>    <span class="k">top</span><span class="o">:</span> <span class="m">20px</span><span class="p">;</span>
</span><span class='line'>    <span class="k">left</span><span class="o">:</span> <span class="m">50</span><span class="o">%</span><span class="p">;</span>
</span><span class='line'>    <span class="k">opacity</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span>
</span><span class='line'>    <span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">transition</span><span class="o">:</span> <span class="k">opacity</span> <span class="m">0.30s</span> <span class="n">ease</span><span class="o">-</span><span class="n">in</span><span class="o">-</span><span class="n">out</span><span class="p">;</span>
</span><span class='line'>    <span class="o">-</span><span class="n">moz</span><span class="o">-</span><span class="n">transition</span><span class="o">:</span> <span class="k">opacity</span> <span class="m">0.30s</span> <span class="n">ease</span><span class="o">-</span><span class="n">in</span><span class="o">-</span><span class="n">out</span><span class="p">;</span>
</span><span class='line'>    <span class="o">-</span><span class="n">ms</span><span class="o">-</span><span class="n">transition</span><span class="o">:</span> <span class="k">opacity</span> <span class="m">0.30s</span> <span class="n">ease</span><span class="o">-</span><span class="n">in</span><span class="o">-</span><span class="n">out</span><span class="p">;</span>
</span><span class='line'>    <span class="o">-</span><span class="n">o</span><span class="o">-</span><span class="n">transition</span><span class="o">:</span> <span class="k">opacity</span> <span class="m">0.30s</span> <span class="n">ease</span><span class="o">-</span><span class="n">in</span><span class="o">-</span><span class="n">out</span><span class="p">;</span>
</span><span class='line'>    <span class="n">transition</span><span class="o">:</span> <span class="k">opacity</span> <span class="m">0.30s</span> <span class="n">ease</span><span class="o">-</span><span class="n">in</span><span class="o">-</span><span class="n">out</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Now that I know how to do that, there are quite a few things I&#8217;ve built over the years that I could have done just with CSS rather than by leveraging JavaScript. The next time a similar problem approaches, I&#8217;ll be able to take a different approach.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fuzzy Tolerance Octopress Theme on Github]]></title>
    <link href="http://fuzzytolerance.info/blog/fuzzy-tolerance-octopress-theme-on-github/"/>
    <updated>2013-01-07T16:09:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/fuzzy-tolerance-octopress-theme-on-github</id>
    <content type="html"><![CDATA[<p>Ah, that&#8217;s better. This theme is still a work in progress, but you can get it <a href="https://github.com/tobinbradley/fuzzy-tolerance-octopress-theme">here</a>. It isn&#8217;t really a customizable theme per say (read: you probably don&#8217;t want to use it), but feel free to pilfer should you find anything useful.</p>

<!-- more -->


<p>It&#8217;s my usual minimal-style layout, with the header on the side (responsively moves to the top), and I got to fiddle about with an icon font for the first time, which was very nearly fun. Here are a couple more tips if you are considering moving to Octopress:</p>

<h3>Get Rid of Paging/Previous/Next</h3>

<p>One of the bummers with Jekyll/Octopress is that the default paging system you find on blogs - that previous/next post and paging stuff - means you have to essentially <code>rsync</code> your entire site every time you make a post. For me that&#8217;s ~600 files over a slow sftp connection.</p>

<p>Well&#8230;that&#8217;s bullshit. I took all of the paging links out. This blog isn&#8217;t a diary - one thing doesn&#8217;t naturally lead to the next. As a result, when I make a new post I only need to upload it and replace the main index.html, the archives index.html, the sitemap.xml and atom.xml. Much quicker.</p>

<h3>Cleaning Up <code>[code]</code> Stuff from Legacy Wordpress Plugins</h3>

<p>I had a lot of this crap floating around. I managed to automate cleaning most of this with my pal <code>sed</code>.</p>

<figure class='code'><div class="highlight"><table><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 class=''><span class='line'>#!/bin/sh
</span><span class='line'>sed -i 's/\[css\]/``` css/g' *.md;
</span><span class='line'>sed -i 's/\[\/css\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[javascript\]/``` javascript/g' *.md;
</span><span class='line'>sed -i 's/\[\/javascript\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[html\]/``` html/g' *.md;
</span><span class='line'>sed -i 's/\[\/html\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[python\]/``` python/g' *.md;
</span><span class='line'>sed -i 's/\[\/python\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[php\]/``` php/g' *.md;
</span><span class='line'>sed -i 's/\[\/php\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[sql\]/``` sql/g' *.md;
</span><span class='line'>sed -i 's/\[\/sql\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[sourcecode\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[\/sourcecode\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[crayon language="javascript"\]/``` javascript/g' *.md;
</span><span class='line'>sed -i 's/\[\/crayon\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[bash\]/```/g' *.md;
</span><span class='line'>sed -i 's/\[\/bash\]/```/g' *.md;</span></code></pre></td></tr></table></div></figure>


<h3>Eliminating a Bunch of 404&#8217;s</h3>

<p>On my Wordpress blog I had posts going to /, like http://fuzzytolerance.info/post-1. Octopress wants to stick that in a /blog folder, and I tend to agree with it - I don&#8217;t want 500+ folders littering up root. But I don&#8217;t want all of the old links to 404, tossing my tiny bit of Google Juice into the wind. Here I had to dip deeper into mod_rewrite than I generally like, but it works.</p>

<figure class='code'><div class="highlight"><table><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 class=''><span class='line'>RewriteEngine On
</span><span class='line'>RewriteBase /
</span><span class='line'>
</span><span class='line'># do not do anything for already existing stuff
</span><span class='line'>RewriteCond %{REQUEST_FILENAME} -f [OR]
</span><span class='line'>RewriteCond %{REQUEST_FILENAME} -l [OR]
</span><span class='line'>RewriteCond %{REQUEST_FILENAME} -d
</span><span class='line'>RewriteRule .+ - [L]
</span><span class='line'>
</span><span class='line'># check if the files exist in /blog, if so go there
</span><span class='line'>RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -f [OR]
</span><span class='line'>RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -l [OR]
</span><span class='line'>RewriteCond %{DOCUMENT_ROOT}/blog/%{REQUEST_URI} -d
</span><span class='line'>RewriteRule .+ blog%{REQUEST_URI} [L]</span></code></pre></td></tr></table></div></figure>


<p>Basically:</p>

<ol>
<li>Check to see if the file/directory exists. If it does, bugger off.</li>
<li>If it didn&#8217;t exist - like maybe it&#8217;s a link to the old wordpress http://fuzzytolerance.info/post-1, check and see if it exists at http://fuzzytolerance.info/blog/post-1. If it does, go there and bugger off.</li>
<li>If check 1 and 2 fail, it falls back to the default 404. And bugger off.</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Moving to Octopress]]></title>
    <link href="http://fuzzytolerance.info/blog/moving-to-octopress/"/>
    <updated>2012-12-31T14:50:00-05:00</updated>
    <id>http://fuzzytolerance.info/blog/moving-to-octopress</id>
    <content type="html"><![CDATA[<p><em>Behold!</em> Fuzzy Tolerance has moved from Wordpress to <a href="https://github.com/mojombo/jekyll">Jekyll</a>/<a href="http://octopress.org/">Octopress</a>.</p>

<p>Jekyll is the engine behind <a href="http://pages.github.com/">Github Pages</a> and is a static-site generator. That&#8217;s right - no PHP, .NET, Python, RoR, etc. - plain old HTML. You set up a HTML/CSS/JavaScript template, write your content in HTML or <a href="http://en.wikipedia.org/wiki/Markdown">Markdown</a>, and then generate your whole site. Rsync up to your server, Bob&#8217;s your uncle. No databases or server-side content required. Octopress is a blogging framework that sits on top of Jekyll and adds a lot of convenience.</p>

<!-- more -->


<p>I have been pondering moving this blog to Jekyll ever since I read <a href="http://developmentseed.org/blog/2012/07/27/build-cms-free-websites/">this post</a> from Development Seed. Right now it is using the default Octopress template, which is really nice and fully responsive, but it will soon be replaced with a (uglier) version of my own creation. There will probably be some bugs I need to smooth out here and there as well.</p>

<p>I really like Octopress so far. Writing posts in Sublime Text 2 in Markdown is kind of awesome, and being straight HTML it&#8217;s crazy quick. I thought I&#8217;d do a quick Wordpress to Octopress post to capture a few tricks before I forget them entirely.</p>

<h3>Converting Wordpress Posts</h3>

<p>There are <a href="https://github.com/mojombo/jekyll/wiki/blog-migrations">a number of ways</a> to get from Wordpress to Jekyll. I found a lot of posts that recommended <a href="https://github.com/thomasf/exitwp">Exitwp</a>, but I found that method ate iframes to video content. I ended up going with Jekyll&#8217;s built-in Wordpress export file converter:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>ruby -rubygems -e 'require "jekyll/migrators/wordpressdotcom"; Jekyll::WordpressDotCom.process("wordpress.xml")'</span></code></pre></td></tr></table></div></figure>


<h3>Fix Links</h3>

<p>If you have to fix a bunch of links, let me introduce you to my friend <code>sed</code>. <code>sed</code> is one of those freaky commands that doesn&#8217;t appear to run in normal space-time. I had it process 500+ text files, and I swear it was done before I pressed the enter key.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sed -i 's/oldurl.com/newurl.com/g' *.md</span></code></pre></td></tr></table></div></figure>


<h3>Set comments: true</h3>

<p>The conversion process left all of my posts with comments off (or more specifically no comment yaml). Say hi to <code>sed</code> again. This sticks comments: true on the second line of every markdown file.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sed -i '2icomments: true' *.md</span></code></pre></td></tr></table></div></figure>


<h3>ZSH Problems</h3>

<p>As it turns on, zsh doesn&#8217;t like some rake commands. To fix that, drop this in ~/.zshrc:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>alias rake="noglob rake"</span></code></pre></td></tr></table></div></figure>


<h3>Captions</h3>

<p>This was the only real pain in the ass. Wordpress adds a funky [caption blah blah] thing to captioned images, and I couldn&#8217;t figure out a great way to filter those out and convert them. This is the only thing I had to edit by hand.</p>
]]></content>
  </entry>
  
</feed>
