MirthLab2012-06-07T20:52:24-10:00http://blog.mirthlab.com/Mark QuezadaCopyright (c) 2007 - 2012 MirthLab LLCPow Update Brings Wildcard DNS Functionality For Any IP2012-06-07T20:41:51-10:00http://blog.mirthlab.com/2012/06/07/pow-update-brings-wildcard-dns-functionality-for-any-ip/<p><a href="http://pow.cx/">Pow</a> is an awesome “zero-configuration web server for Rails development
on OS X.” If you’re not using it, you should be. It makes managing different
Rails projects locally brain-dead simple.</p>
<p>With the latest update, 37signals has also launched <a href="http://xip.io/">xip.io</a>:</p>
<blockquote>
<p>Pow 0.4.0 has built-in support for xip.io, a free service from 37signals that
provides wildcard DNS for any IP address.</p>
<p>With xip.io you can access your Rails apps from devices on your local
network, like iPads, iPhones, Windows VMs, and other computers. No
configuration required.</p>
</blockquote>
<p>A great solution to a longstanding frustration. Check out the <a href="http://37signals.com/svn/posts/3191-announcing-pow-040-with-xipio-support">blog post</a>
for more info.</p>
Cleanly Retrying Blocks of Code After an Exception in Ruby2012-05-25T12:25:49-10:00http://blog.mirthlab.com/2012/05/25/cleanly-retrying-blocks-of-code-after-an-exception-in-ruby/<p>Recently, I had to write some Ruby code that would publish data to an API
endpoint. Sometimes this endpoint would fail due to bad network conditions so I
wanted to retry the request a few times before marking the attempt as failed.</p>
<p>Ruby has a very nice syntax for doing this sort of thing, but it wasn’t obvious
to me at first. Let’s walk through a contrived example and attempt to refactor
this method so that it automatically retries on an API failure:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
<span class="keyword">begin</span>
<span class="constant">DataLibrary</span>.publish(data)
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
logger.info <span class="string"><span class="delimiter">"</span><span class="content">Oh Noes!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>Without knowing any better, the naive ruby developer (me, in this case) might
add the ability to retry a failed request like so:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
<span class="comment"># retry up to 3 times</span>
<span class="integer">3</span>.times <span class="keyword">do</span>
<span class="keyword">begin</span>
<span class="constant">DataLibrary</span>.publish(data)
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">break</span> <span class="comment"># it worked, break out of the loop</span>
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
logger.info <span class="string"><span class="delimiter">"</span><span class="content">Oh Noes!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
<span class="keyword">end</span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>Hmm… this is starting to look pretty ugly right? Let’s try to clean it up a
bit by using some of the nicities of the ruby language.</p>
<p>The first thing we can do is use the <code>retry</code> keyword:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
tries = <span class="integer">3</span>
<span class="keyword">begin</span>
<span class="constant">DataLibrary</span>.publish(data)
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
tries -= <span class="integer">1</span>
<span class="keyword">if</span> tries > <span class="integer">0</span>
<span class="keyword">retry</span>
<span class="keyword">else</span>
logger.info <span class="string"><span class="delimiter">"</span><span class="content">Oh Noes!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
<span class="keyword">end</span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>We removed the awkward enclosing loop and replaced it with <code>retry</code>. It reads a
little better, but it’s actually more code than before. Another nice feature of
ruby is that <code>def</code> can be used in place of <code>begin</code> for a <code>rescue</code> block so we
can actually clean it up a bit more by removing the explicit <code>begin</code> call, like
so:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
tries ||= <span class="integer">3</span>
<span class="constant">DataLibrary</span>.publish(data)
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
tries -= <span class="integer">1</span>
<span class="keyword">if</span> tries > <span class="integer">0</span>
<span class="keyword">retry</span>
<span class="keyword">else</span>
logger.info <span class="string"><span class="delimiter">"</span><span class="content">Oh Noes!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>Much better. One thing to note here is that we changed <code>tries = 3</code> to <code>tries
||= 3</code> so that <code>tries</code> will only be set to <code>3</code> if it hasn’t already been set.
Otherwise we’d have an infinite loop when the block is retried and <code>tries</code> is
set to zero again.</p>
<p>We can still clean it up a bit more:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
tries ||= <span class="integer">3</span>
<span class="constant">DataLibrary</span>.publish(data)
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
<span class="keyword">if</span> (tries -= <span class="integer">1</span>) > <span class="integer">0</span>
<span class="keyword">retry</span>
<span class="keyword">else</span>
logger.info <span class="string"><span class="delimiter">"</span><span class="content">Oh Noes!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
<span class="keyword">else</span>
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>Here we’ve moved the implicit success call (<code>logger.info "success"</code>) to an
explicit <code>else</code> clause. This <code>else</code> clause is only triggered if a <code>rescue</code>
doesn’t happen. It can be thought of as “rescue, otherwise do this thing.”
Also, we’ve dropped <code>tries -= 1</code> directly into the <code>if</code> statement.</p>
<p>This is looking much better than our original attempt at adding retry on
failure. It’s clean, concise and easy to read.</p>
<p>If you only care about the success case, you could shorten it even further:</p>
<div><div class="CodeRay">
<div class="code"><pre><span class="keyword">def</span> <span class="function">publish_to_api</span>(data={})
tries ||= <span class="integer">3</span>
<span class="constant">DataLibrary</span>.publish(data)
<span class="keyword">rescue</span> <span class="constant">DataLibraryFailureException</span> => e
<span class="keyword">retry</span> <span class="keyword">unless</span> (tries -= <span class="integer">1</span>).zero?
<span class="keyword">else</span>
logger.info <span class="string"><span class="delimiter">"</span><span class="content">success!</span><span class="delimiter">"</span></span>
<span class="keyword">end</span>
</pre></div>
</div>
</div>
<p>There are a number of gems (<a href="https://github.com/kamui/retriable">retriable</a> for example) that attempt to
abstract this ruby idiom away into a cleaner DSL but they all seem a little
heavy-weight to me. I find the standard ruby way of doing this very flexible
and succinct. You can learn more about the <code>begin</code>, <code>rescue</code>, and <code>end</code> syntax
at the <a href="http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_exceptions.html">Pragmatic Programmer’s Guide</a>.</p>
Vim University2012-02-17T13:56:56-10:00http://blog.mirthlab.com/2012/02/17/vim-university/<p>I just stumbled across a fairly new site called <a href="http://vimuniversity.com/">Vim University</a>.
Like <a href="http://vimcasts.org/">Vimcasts</a> it looks like a good resource for Vim tips and
tricks.</p>
<p>What I <em>don’t</em> necessarily like is the old-standard <em>Learning Vim is
going to be horrible for a while but you’ve just got to grin and bear
it</em> advice given in the <a href="http://vimuniversity.com/samples/surviving-your-first-week-in-vim">Surviving Your First Week In Vim</a>
post:</p>
<blockquote>
<p>The first hundred vim commands you execute will be your most painful,
so get through them as quickly as possible. Don’t leave vim except in
for major emergencies.</p>
</blockquote>
<p>And:</p>
<blockquote>
<p>After just three weeks, most people are significantly faster than
they were in their old editor. Don’t put off learning this awesome
tool any longer.</p>
</blockquote>
<p>Like <a href="http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/">Yehuda Katz</a> this type of advice is exactly why I could
never jump into Vim. In the real world, you need to get stuff done and
three weeks is a really long time to be fighting with a new tool.
Inevitably I’d give up, frustrated and discouraged, and swear to never try
learning Vim again.</p>
<p>Eventually I <em>did</em> learn Vim, but for me the sticking point was when I
started using <a href="https://github.com/carlhuda/janus">Janus</a> which essentially makes Vim look and act
like TextMate out-of-the-box. Eventually I started exploring more of the
power that Vim has to offer, but I was able to get comfortable using Vim
as my everyday editor quickly and grow into using more powerful features
as time went on.</p>
Fountain: Markdown for Screenwriting2012-02-17T13:50:51-10:00http://blog.mirthlab.com/2012/02/17/fountain-markdown-for-screenwriting/<p><a href="http://fountain.io/">Fountain</a>:</p>
<blockquote>
<p>Fountain is a simple markup syntax for writing, editing and sharing
screenplays in plain, human-readable text. Fountain allows you to work
on your screenplay anywhere, on any computer or tablet, using any
software that edits text files.</p>
<p>Taking its cues from John Gruber’s Markdown, Fountain files are
eminently readable. When special syntax is required, it is
straightforward and intuitive.</p>
</blockquote>
<p>Though I’m no screenwriter, I could have used something like this while
working on a script for a friend’s Kickstarter campaign video.</p>
Understanding the Git Workflow2012-02-17T13:21:58-10:00http://blog.mirthlab.com/2012/02/17/understanding-the-git-workflow/<p>I’ve used several version control systems over the years: SVN,
Mercurial, Bazaar and even Perforce. (<em>Shudder.</em>) Usually I’d have to
learn whatever system was already in place before I was brought into a
project. For the most part I would only learn what was necessary to get
work done with the tool. More recently though, I’ve been using and
really digging into Git.</p>
<p>I came across Benjamin Sandofsky’s article <a href="http://sandofsky.com/blog/git-workflow.html">Understanding Git
Workflow</a> and it blew my mind a lil’ bit:</p>
<blockquote>
<p>In a perfect world, every change in your revision history is succinct
and stable. There are no checkpoint commits that create line noise.
There are no giant, 10,000 line commits. A clean history makes it easy
to revert changes or cherry-pick them between branches. A clean
history is easy to later inspect and analyze. However, maintaining a
clean history would mean waiting to check in changes until they’re
perfect.</p>
<p>[…]</p>
<p>Git is revolutionary because it gives you the best of both worlds. You
can regularly check in changes while prototyping a solution but
deliver a clean history when you’re finished. When this is your goal,
Git’s defaults make a lot more sense.</p>
</blockquote>
<p>I was intrigued because he very accurately describes the Git workflow I
use (and worse yet, the one <em>I’m used to</em>) and explains all its warts.
He then explains the new-to-me intended workflow:</p>
<blockquote>
<ol>
<li>Create a private branch off a public branch.</li>
<li>Regularly commit your work to this private branch.</li>
<li>Once your code is perfect, clean up its history.</li>
<li>Merge the cleaned-up branch back into the public branch.</li>
</ol>
</blockquote>
<p>It’s step 3 that I was missing. I guess coming from an SVN background,
rewriting history seems a bit taboo to me. He shows some great, practical examples
in the “Guidelines and Examples” section including how to use Git’s
powerful interactive rebase mode.</p>
Making Rounded Rectangles Look Great2012-02-17T13:16:35-10:00http://blog.mirthlab.com/2012/02/17/making-rounded-rectangles-look-great/<p>Mike Rundle on <a href="http://flyosity.com/design/making-rounded-rectangles-look-great.php">designing rounded rectangles</a>:</p>
<blockquote>
<p>If you really think about it, most interfaces (especially for iOS
apps) use tons of rounded rectangles in different shapes and sizes.
Long and skinny ones with lots of shine. Squarer, flatter ones with
some texture. Smaller, slightly inset ones with photos inside. The
list just keeps on going.</p>
</blockquote>
<p>He lists some great tips and even has some example Photoshop documents
to download and check out.</p>
iMessage Comes to the Mac2012-02-16T08:00:21-10:00http://blog.mirthlab.com/2012/02/16/imessage-comes-to-the-mac/<p>Along with the announcement of the next version of OS X (dubbed
<a href="http://www.macrumors.com/2012/02/16/apple-releases-first-developer-preview-of-os-x-mountain-lion-public-launch-in-late-summer/">Mountain Lion</a>) Apple has <a href="http://www.apple.com/macosx/mountain-lion/messages-beta/">posted a beta</a> of the
new Messages app that will replace iChat:</p>
<blockquote>
<ul>
<li>
<p>Send unlimited iMessages to any Mac, iPad, iPhone, or iPod touch.</p>
</li>
<li>
<p>Start an iMessage conversation on your Mac and continue it on your
iPad, iPhone, or iPod touch.</p>
</li>
<li>
<p>Send photos, videos, attachments, contacts, locations, and more.</p>
</li>
<li>
<p>Launch a FaceTime video call and bring the conversation
face-to-face.</p>
</li>
<li>
<p>Messages supports iMessage, AIM, Yahoo!, Google Talk, and Jabber
accounts.</p>
</li>
</ul>
</blockquote>
<p>I’ve been looking forward to this type of integration with the Mac since
iMessage was first announced.</p>
Zach Holman: Scaling GitHub2012-02-01T17:17:48-10:00http://blog.mirthlab.com/2012/02/01/zach-holman-scaling-github/<p>Zach Holman on <a href="http://zachholman.com/talk/scaling-github">Scaling GitHub</a>:</p>
<blockquote>
<p>A month after launching, GitHub hosted one thousand repositories.
Three years later, we host over three million. In the same time we’ve
gone from one thousand users to over a million.</p>
</blockquote>
<p>An interesting look at the technical and organizational
practices that GitHub uses to keep their team lean, happy and productive.</p>
Magnus: Ten One Design's New iPad Stand2012-02-01T16:49:08-10:00http://blog.mirthlab.com/2012/02/01/magnus-ten-one-designs-new-ipad-stand/<p><img src="/assets/2012/02/magnus-ipad-stand.jpg" alt="Magnus iPad Stand" /></p>
<p>I love the minimalist design of Ten One Design’s new <a href="http://www.tenonedesign.com/magnus.php">Magnus iPad stand</a>:</p>
<blockquote>
<p>Magnus is first machine-crafted from pure aluminum and then
hand-finished using the latest manufacturing techniques. After that,
customized magnets are installed into the base, and rubberized feet
are fitted to the bottom surface. </p>
</blockquote>
<p>Unfortunately it only supports landscape mode since it leverages the
iPad’s own built-in magnets.</p>
How To Work From Home Like You Mean It2012-01-13T14:46:27-10:00http://blog.mirthlab.com/2012/01/13/how-to-work-from-home-like-you-mean-it/<p><a href="http://www.fastcompany.com/1806307/how-to-work-from-home-like-you-mean-it">Kevin Purdy</a>:</p>
<blockquote>
<p>Dressing for work and “arriving” on time, eating lunch on a rigid
schedule, shaving, brushing, and so on seems pointless at first. But
not doing these basic preparations is the start of a steep,
Teflon-coated slope to all kinds of other transgressions. If you’re
not dressed well enough to greet the UPS delivery person, you’re
giving yourself license to hide. If you’re hiding, then you imagine
nobody can see Netflix open on your second monitor.</p>
</blockquote>
<p>Telecommuting sometimes feels like it’s equal parts blessing and curse.
On one hand you have total freedom. On the other hand, <em>you have total
freedom.</em></p>
<p>I had been working for myself for many years before taking an actual
office job. (You know, the kind you have to get up and drive to.) The
lack of freedom was a big shock at first but it taught me that often
productivity and structure go hand-in-hand. After leaving that job and
going back to working for myself I found that I craved a structured
schedule. Yes, it helps me be productive during work hours, but another
great — even if unanticipated — outcome is that it helps me
define boundaries for time I <em>shouldn’t</em> be working.</p>
Learn To Speak Vim2011-12-30T14:42:47-10:00http://blog.mirthlab.com/2011/12/30/learn-to-speak-vim/<p>I’m a relatively new convert to Vim having only made the switch from
TextMate about six months ago. <a href="http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/">This post by Yan
Pritzker</a>
would have likely saved me some trouble in those first frustrating
weeks:</p>
<blockquote>
<p>Using vim is like talking to your editor in ‘verb modifier object’ sentences, turned into acronyms</p>
<ul>
<li>learn some verbs: v (visual), c (change), d (delete), y (yank/copy). these are the most important. there are others</li>
<li>learn some modifiers: i (inside), a (around), t (till..finds a character), f (find..like till except including the char), / (search..find a string/regex)</li>
<li>learn some text objects: w (word), s (sentence) p (paragraph) b (block/parentheses), t (tag, works for html/xml) there are others</li>
</ul>
</blockquote>
<p>It’s a great primer if you’re considering making the switch. </p>
<p>Also, be sure to check out
<a href="https://github.com/carlhuda/janus/">Janus</a> if you’re looking to smooth
the transition to Vim from another editor (like TextMate). Janus is a
Vim distribution that includes some sensible default plugins and
key bindings so Vim won’t drive you crazy while you’re trying to get your
bearings.</p>
Moving to Jekyll2011-12-29T16:45:24-10:00http://blog.mirthlab.com/2011/12/29/moving-to-jekyll/<p>After battling with WordPress for years I finally decided to try <a href="http://jekyllrb.com/">Jekyll</a>. Like others who’ve made the switch, I grew tired of the poor performance, overly-complicated publishing system and constant need for management of WordPress. I found myself spending more time <em>fiddling</em> than <em>writing</em>.</p>
<p>When the <a href="http://www.google.com/#hl=en&safe=off&sclient=psy-ab&q=media+temple+johnnya+hack">JohnnyA WordPress Hack</a> hit Media Temple a little over a year ago, I tried to do some damage control and repair my blog. I thought I had wiped out the hack, but over the next few months it — or something like it — would continually reappear. Eventually, I realized that I had stopped writing altogether because I was tired of dealing with it. This blog has languished since then.</p>
<p>With the new year approaching I figured I’d start afresh with a new blogging platform. After looking at a few alternatives, I decided on Jekyll. Jekyll bills itself as “a simple, blog aware, static site generator” and it eliminates some of my major pain points with WordPress right out of the box:</p>
<ul>
<li>The generated site is just a bunch of static HTML files so it’s fast and secure.</li>
<li>Jekyll doesn’t need to be constantly updated with security patches since it’s not actually running code in production.</li>
<li>There’s no “content management” or “publishing system” to get in the way. Everything is stored as simple, editable text files.</li>
</ul>
<p>Additionally, I had a few requirements of my own that I wanted to meet with the migration to Jekyll:</p>
<ul>
<li>Use Vim (or any standard text editor) to write posts.</li>
<li>Use a Git-based workflow for managing posts and updating the blog.</li>
<li>Host it on Heroku (for free).</li>
<li>Use Compass and SASS for layout.</li>
<li>Be able to use syntax highlighting in posts (without javascript).</li>
<li>Be able to easily write from anywhere.</li>
</ul>
<p>Each of these items is a direct result of some pain point I experienced with WordPress. My goal was not just to move off of WordPress, but to really create a better work flow that would reduce friction and in turn encourage me to write more.</p>
<p>I’m still polishing some rough edges, but so far I like my setup. I’m planning some follow up posts that go into more specifics, but for now I’m just enjoying being off of WordPress.</p>
Installing iOS 5 Beta 1: Error Code 30022011-06-06T15:00:24-10:00http://blog.mirthlab.com/2011/06/06/installing-ios-5-beta-1-error-code-3002/<p>I was getting an Error 3002 when trying to update my iPhone 4 to use the new iOS 5 Beta. Although it doesn’t seem to say it anywhere, you need to use a Restore option to install it. (Instead of an update.)</p>
<p>Just be sure to do a backup first. You’ll be prompted to restore from an iTunes backup right on the device after the restore process is complete. Then you’ll be good to go with all of your existing data.</p>
<p>Happy Testing!</p>
Seth Godin on True Leadership2011-03-15T10:36:30-10:00http://blog.mirthlab.com/2011/03/15/seth-godin-on-true-leadership/<iframe src="http://player.vimeo.com/video/20290657" width="400" height="225" frameborder="0"></iframe>
<blockquote>
<p>Leadership means embracing the failure of your people if it leads to growth.</p>
</blockquote>
<p>There are so many great tidbits in <a href="http://vimeo.com/20290657">this video</a> that it’s hard to pick just one quote. A must-watch.</p>
iPhone OS 4.0.1 Signal Strength Display Change Graphics2010-07-15T11:12:22-10:00http://blog.mirthlab.com/2010/07/15/iphone-os-4-0-1-signal-strength-display-change-graphics/<p>Apple just released the iPhone 4.0.1 update that changes the way signal strength is displayed. The new graph looks pretty weird to me since it’s no longer linear. I made some quick graphics of the changes:</p>
<table>
<tr>
<th>Old display (Pre 4.0.1)</th>
<th>iOS 4.0.1</th>
</tr>
<tr>
<td><img src="/assets/2010/07/old_bars.png" /></td>
<td><img src="/assets/2010/07/new_bars.png" /></td>
</tr>
</table>
<p>To make the change easier to visualize, I did some combo graphics. The first is an overlay where the red represents the new bars and the second is an animation showing old and new states:</p>
<table>
<tr>
<th>Overlay</th>
<th>Animation</th>
</tr>
<tr>
<td><img src="/assets/2010/07/bar_delta.png" /></td>
<td><img src="/assets/2010/07/bar_animation.gif" /></td>
</tr>
</table>
<p>Apparently the bars themselves now also represent a more accurate depiction of signal strength. AnandTech has a <a href="http://www.anandtech.com/show/3821/iphone-4-redux-analyzing-apples-ios-41-signal-fix">detailed write up</a> of the changes. I’ve noticed that where I have normally gotten the full five bars at my office, I am now hovering around four, with the occasional 5. </p>
CSS3 PIE: CSS3 decorations for IE2010-07-13T12:03:10-10:00http://blog.mirthlab.com/2010/07/13/css3-pie-css3-decorations-for-ie/<p><a href="http://css3pie.com/">CSS3 PIE: CSS3 decorations for IE</a>:</p>
<blockquote>
<p>PIE makes Internet Explorer 6-8 capable of rendering several of the most useful CSS3 decoration features. […] PIE stands for Progressive Internet Explorer. It is an IE attached behavior which, when applied to an element, allows IE to recognize and display a number of CSS3 properties. </p>
</blockquote>
<p>Looks great. One of the most challenging aspects of web development has always been designing for the lowest common denominator of browser features. Tools like this help raise the bar for IE in a (mostly) hassle-free, consistent way.</p>
<blockquote>
<p>PIE currently has full or partial support for the following CSS3 features:</p>
<ul>
<li>border-radius</li>
<li>box-shadow</li>
<li>border-image</li>
<li>multiple background images</li>
<li>linear-gradient as background image</li>
</ul>
</blockquote>
Using the Mac OS X Color Picker as a Stand-Alone App2010-03-26T10:50:12-10:00http://blog.mirthlab.com/2010/03/26/using-the-mac-os-x-color-picker-as-a-stand-alone-app/<p>I’ve been looking for a good, simple, system-wide color picker. The built-in Mac OS X one is great, but it needs to be launched from within an existing application. Wouldn’t it be great to be able to use it as a standalone app? That’s exactly what <a href="http://zachwaugh.com/spotcolor/">Spot Color</a> does:</p>
<blockquote>
<p>Spot Color is a simple application that allows you to use the standard Mac OS X color picker as a stand-alone app. This allows you to quickly grab colors without having to be in an image editing app like Photoshop. Since it uses the built-in color picker, you can utilize the system wide color picker plugins and swatches.</p>
</blockquote>
<p>It’s just a simple application wrapper that launches the system-wide color picker. The same exact thing <a href="http://www.macosxhints.com/article.php?story=20060408050920158">can be done with Apple Script</a> but it was way to sluggish to launch and I found I just wouldn’t use it. Besides, Spot Color has a cute icon. And it’s fast and light-weight. (I tried a similar app by Matt Patenaude called simply “<a href="http://mattpatenaude.com/">Colors</a>”. But it felt a little chintzy.)</p>
<p>The reason this is so useful is that the built-in color picker on Mac OS X is extensible and there are some really great plugins available. These are the ones I use:</p>
<ul>
<li><a href="http://www.panic.com/~wade/picker/">Developer Color Picker</a>: Provides color definitions in a variety of developer-friendly formats including NSColor, UIColor, CGColor, Hex and RGB. Written by Wade Cosgrove of Panic, inc.</li>
<li><a href="http://wafflesoftware.net/hexpicker/">Hex Color Picker</a>: Displays the hex code for any color in a slightly different way than the above plugin. Very useful for web development. If you just need hex values, you can probably get away with just this plugin.</li>
<li><a href="http://lithoglyph.com/mondrianum/">Mondrianum 2</a>: Loads themes from the <a href="http://kuler.adobe.com/">Adobe Kuler</a> community.</li>
</ul>
<p>The <a href="http://github.com/zachwaugh/SpotColor">source code for Spot Color is on github</a> too, which is always nice.</p>
<p>I also sometimes combine this with <a href="http://en.wikipedia.org/wiki/DigitalColor_Meter">Digital Color Meter</a> (found in the Applications/Utilities/ folder on your Mac) since its zoom view makes it a little easier to pick colors from the screen. </p>
flashblockdetector: Javascript That Detects Flash Blocking Extensions2010-03-15T17:02:42-10:00http://blog.mirthlab.com/2010/03/15/flashblockdetector-javascript-that-detects-flash-blocking-extensions/<p>Mark Pilgrim just released this nifty little <a href="http://code.google.com/p/flashblockdetector/">flash block detector</a>:</p>
<blockquote>
<p>This is a pure-JavaScript library that detects whether Flash is blocked on the current page due to a Flash blocking extension. The current version can detect</p>
<ul>
<li>FlashBlock #1 for Chromium / Google Chrome (Windows/Mac/Linux)</li>
<li>FlashBlock #2 for Chromium / Google Chrome (Windows/Mac/Linux)</li>
<li>FlashBlock for Firefox (Windows/Mac/Linux)</li>
<li>ClickToFlash 1.5.x (Mac/Safari only)</li>
</ul>
</blockquote>
<p>Pretty cool, but there’s a small catch:</p>
<blockquote>
<p>If a Flash blocker is active, your callback function will be called almost immediately. If no Flash blocker is active, your callback function will be called after the 5 second timeout.</p>
</blockquote>
<p>(Via <a href="http://twitter.com/diveintomark/status/10430843379">Mark Pilgrim</a>.) </p>
HumbleFinance: Dynamic Charts with HTML5, Canvas, and Flotr for Prototype2010-03-12T11:47:19-10:00http://blog.mirthlab.com/2010/03/12/humblefinance-dynamic-charts-with-html5-canvas-and-flotr-for-prototype/<p><a href="http://www.humblesoftware.com/finance/index">HumbleFinance</a>:</p>
<blockquote>
<p>HumbleFinance is an HTML5 data visualization tool written as a demonstration of interactive graphing in HTML5. It is similar to the Flash tool on http://finance.google.com/. The tool itself is written entirely in JavaScript, using the Prototype and Flotr libraries. It can be used to display any two 2-D data sets of real numerical data which share an axis.</p>
</blockquote>
<p>Between this and <a href="http://g.raphaeljs.com/">gRaphaël</a> I’d say there’s a lot of potential for open technologies to be a real, viable alternative to Flash based charts very soon. </p>
jQuery Masonry2010-03-11T13:06:49-10:00http://blog.mirthlab.com/2010/03/11/jquery-masonry/<p><a href="http://desandro.com/resources/jquery-masonry/">jQuery Masonry</a>:</p>
<blockquote>
<p>Masonry is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Masonry arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.</p>
</blockquote>
<p>Came across this for the first time today. Reminds me a lot of the old <a href="http://suprb.com/apps/gridalicious/">Grid-a-licious</a> WordPress theme. Also, it’s hosted on GitHub so you can <a href="http://github.com/desandro/masonry">grab it there too</a>. </p>