<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brett Terpstrautility page  - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/utility/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Tue, 22 May 2012 02:49:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A word about Magic Launch and nvALT</title>
		<link>http://brettterpstra.com/a-word-about-magic-launch-and-nvalt/</link>
		<comments>http://brettterpstra.com/a-word-about-magic-launch-and-nvalt/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 19:26:51 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3740</guid>
		<description><![CDATA[<p>Here’s a quick tip about two apps that I love: nvALT and Magic Launch. I’m not sure about the project status of Magic Launch, or how it will fare with Mountain Lion, but for now it’s one very useful app. This is more of a multi-tip than a review, but take it as you will. You probably know of nvALT,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-word-about-magic-launch-and-nvalt/">A word about Magic Launch and nvALT</a></p>]]></description>
			<content:encoded><![CDATA[<p>Here’s a quick tip about two apps that I love: <a href="http://brettterpstra.com/project/nvalt/">nvALT</a> and <a href="http://www.metakine.com/products/magiclaunch/">Magic Launch</a>. I’m not sure about the project status of Magic Launch, or how it will fare with Mountain Lion, but for now it’s one very useful app. This is more of a multi-tip than a review, but take it as you will.</p>

<p>You probably know of nvALT, so I’ll describe Magic Launch. Magic Launch overrides the default file handlers and processes them based on rules, allowing you to specify conditions under which to launch certain apps when certain filetypes are double-clicked. It’s really handy. For example, you can see my Markdown rules below.</p>

<p><img src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/03/markdown_magic_launch_rules.jpg?9d7bd4" alt="Markdown Magic Launch Rules" height="289" width="436" class="shadow aligncenter" style="width:436px;height:289px;margin:0 auto;  display: block; margin-right: auto; margin-left: auto;" ></p>

<p>Short files, like this post, are opened in <a href="http://bywordapp.com/">Byword</a> as the default app for the filetype. Longer files are opened in <a href="http://multimarkdown.com/">MultiMarkdown Composer</a>, which has a great table of contents feature for navigating while editing. Here’s where nvALT comes in: if the file is in my nvALT notes folder, it opens nvALT and jumps straight to that note. It’s a neat trick if you make use of your note files in ways other than just nvALT. From the command line, instead of <code>open -a nvALT filename.md</code> you can just <code>open filename.md</code> . Not a huge difference, but a nifty tool.</p>

<p>There are a lot more clever things you can do with Magic Launch. If you’ve ever been frustrated with dealing with UTI’s and what file opens what app, here’s a very easy solution. It’s relatively expensive for a utility ($20), so you’ll only be interested if the cost is equal to or greater than your frustration with assigning default applications.</p>

<p>Another useful app in the same vein is <a href="http://peeqsource.com/2011/rcdefault/">RCDefault</a>. This one handles all kinds of things, including UTIs and URL handlers. It’s free, and I use both Magic Launch and RCDefault. The primary reason <a href="http://www.metakine.com/products/magiclaunch/">Magic Launch</a> is superior for file handling is conditional rules, which RCDefault doesn’t have. The URL handling is great fun, though, and you can see all of the url handlers assigned by apps on your system. I bet you didn’t even know some of them were available. Have fun.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/quick-tip-running-nvalt-after-a-notational-velocity-update/' rel='bookmark' title='Quick tip: running nvALT after a Notational Velocity update'>Quick tip: running nvALT after a Notational Velocity update</a></li>
<li><a href='http://brettterpstra.com/nvalt-browser-extensions/' rel='bookmark' title='nvALT Browser Extensions'>nvALT Browser Extensions</a></li>
<li><a href='http://brettterpstra.com/ios-review-listary/' rel='bookmark' title='iOS app review: Listary'>iOS app review: Listary</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-word-about-magic-launch-and-nvalt/">A word about Magic Launch and nvALT</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/a-word-about-magic-launch-and-nvalt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A System Service for to. url shortening</title>
		<link>http://brettterpstra.com/a-system-service-for-to-url-shortening/</link>
		<comments>http://brettterpstra.com/a-system-service-for-to-url-shortening/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 02:03:48 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[snow leopard]]></category>
		<category><![CDATA[System Service]]></category>
		<category><![CDATA[url shortener]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=399</guid>
		<description><![CDATA[<p>I’m fascinated by http://to. It’s a url shortener with no TLD. Some browsers, and apparently some DNS setups, don’t like the urls it creates (they want a .com or .org or anything at the end), so it’s not exactly in heavy usage. Still, I wish they had an API. In lieu of that, here’s a quick Ruby script that will&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-system-service-for-to-url-shortening/">A System Service for to. url shortening</a></p>]]></description>
			<content:encoded><![CDATA[<p>I’m fascinated by <a href="http://to.">http://to</a>. It’s a url shortener with no <acronym title="Top Level Domain">TLD</acronym>. Some browsers, and apparently some DNS setups, don’t like the urls it creates (they want a .com or .org or <em>anything</em> at the end), so it’s not exactly in heavy usage. Still, I wish they had an API. In lieu of that, here’s a quick Ruby script that will run on a stock OS X install as a System Service. It’s so simple that I’m not even going to package it up… It’ll be a good chance to show the steps for creating your own utilities using <a href="http://macosautomation.com/services/index.html">Snow Leopard Services</a>:</p>

<ul>
<li>Open Automator and choose “Service” from the first menu.</li>
<li>Tell it that the service “receives text” in “any application”. </li>
<li>Drag the “Run Shell Script” action from the left side. </li>
<li>Set the Shell to Ruby</li>
<li>Paste in the code below (or something of your own, hopefully far more interesting)</li>
<li>Save it with an intuitive name</li>
<li>Use it.</li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="ruby"><span class="kw3">require</span> <span class="st0">'net/http'</span>
<span class="kw3">require</span> <span class="st0">'cgi'</span>
&nbsp;
input = STDIN.<span class="me1">read</span>
http = <span class="re2">Net::HTTP</span>.<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">'to.'</span><span class="br0">&#41;</span>
path = <span class="st0">'/'</span>
&nbsp;
data = <span class="st0">&quot;url=#{CGI.escape(input.strip)}&quot;</span>
headers = <span class="br0">&#123;</span><span class="st0">'Content-Type'</span> <span class="sy0">=&gt;</span> <span class="st0">'application/x-www-form-urlencoded'</span><span class="br0">&#125;</span>
&nbsp;
resp, data = http.<span class="me1">post</span><span class="br0">&#40;</span>path, data, headers<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">if</span> resp.<span class="me1">code</span>.<span class="me1">to_i</span> == <span class="nu0">200</span>
  <span class="kw3">print</span> data.<span class="kw3">split</span><span class="br0">&#40;</span><span class="sy0">/</span>value=<span class="st0">&quot;/)[1].split(/&quot;</span><span class="sy0">/</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>
<span class="kw1">else</span>
  <span class="kw3">print</span> input
<span class="kw1">end</span></pre></div></div>


<p>Basically, anything you can do to or with text or files using a major scripting language, you can make into a Snow Leopard service. Now that I’ve set the bar this low, I’d love to see what new Services everyone else is cooking up!</p>

<p><strong>Update:</strong> <del datetime="2010-04-29T03:34:55+00:00">Yeah, that didn’t work out so well. It works sometimes, but leaves url parameters in the shortened url half the time. I haven’t figured out why, but I’ll leave it up and see if someone can point out the error of my ways…</del><ins datetime="2010-04-29T03:34:55+00:00">Fixed it, just neglected to notice it needed a POST, not a GET</ins></p>

<p><strong>Update 2:</strong> Here, this one’s shorter and more useful :)</p>


<div class="wp_syntax"><div class="code"><pre class="ruby"><span class="kw3">require</span> <span class="st0">'open-uri'</span>
<span class="kw3">require</span> <span class="st0">'cgi'</span>
&nbsp;
input = STDIN.<span class="me1">read</span>
<span class="kw3">print</span> <span class="kw3">open</span><span class="br0">&#40;</span><span class="st0">&quot;http://is.gd/api.php?longurl=#{CGI.escape(input.strip)}&quot;</span><span class="br0">&#41;</span>.<span class="me1">read</span></pre></div></div>

<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/is-your-url-too-short-try-our-system-free/' rel='bookmark' title='Is your URL too short? Try our system, free!'>Is your URL too short? Try our system, free!</a></li>
<li><a href='http://brettterpstra.com/textexpander-bit-ly-with-authentication/' rel='bookmark' title='TextExpander: bit.ly with authentication'>TextExpander: bit.ly with authentication</a></li>
<li><a href='http://brettterpstra.com/textexpander-experiments/' rel='bookmark' title='TextExpander experiments'>TextExpander experiments</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-system-service-for-to-url-shortening/">A System Service for to. url shortening</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/a-system-service-for-to-url-shortening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 9/37 queries in 0.099 seconds using xcache
Object Caching 1090/1122 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-05-23 04:59:41 -->
