<?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 Terpstraservice page  - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/service/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>Natural Language Date Service update</title>
		<link>http://brettterpstra.com/natural-language-date-service-update/</link>
		<comments>http://brettterpstra.com/natural-language-date-service-update/#comments</comments>
		<pubDate>Sat, 05 May 2012 21:08:36 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[automator]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[natural language]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3964</guid>
		<description><![CDATA[<p>I made a small update to the natural language date Service that I put together a while back. I wanted it to handle input formats like “+3″ to get a date for 3 days from right now, and to handle adding times to the output if there’s a time-like string in the input. Now you can use, for example: date&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/natural-language-date-service-update/">Natural Language Date Service update</a></p>]]></description>
			<content:encoded><![CDATA[<p>I made a small update to the natural language date Service that I put together <a href="http://brettterpstra.com/os-x-service-for-natural-language-dates/">a while back</a>. I wanted it to handle input formats like “+3″ to get a date for 3 days from right now, and to handle adding times to the output if there’s a time-like string in the input.</p>

<p>Now you can use, for example:</p>

<ul>
<li><code>date +5</code></li>
<li><code>long +21</code></li>
<li><code>short tomorrow 2pm</code></li>
<li><code>date thurs 3:15pm</code></li>
</ul>

<p>Just a couple of tweaks because I found I needed them. The download has been updated (see bottom of post), and we’ll call it version 1.1.</p>

<p><em>p.s.</em> I know I’ve been a little quiet on the blog lately, I’ve had my head buried in too many projects. Marked has some fantastic new features, though, including MarsEdit and VoodooPad support, as well as the ability to accept an entire folder as input and always preview the most recently-edited text file. The latter is perfect for nvALT and Jekyll blogs. Lots of writing to do for other projects, too, so there may be some more dead air. I’m not gone, I’m just making stuff.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Convert Date - Natural Language Date Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)">Convert Date — Natural Language Date Service</a> — A System Service which takes selected text and parses it into a standard date format, using keywords at the beginning to define which format to use. <a href="http://brettterpstra.com/?p=2539">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/os-x-service-for-natural-language-dates/' rel='bookmark' title='OS X Service for natural language dates'>OS X Service for natural language dates</a></li>
<li><a href='http://brettterpstra.com/natural-language-date-conversion-for-textmate/' rel='bookmark' title='Natural language date conversion for TextMate'>Natural language date conversion for TextMate</a></li>
<li><a href='http://brettterpstra.com/natural-language-dates-for-textexpander/' rel='bookmark' title='Natural language dates for TextExpander'>Natural language dates for TextExpander</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/natural-language-date-service-update/">Natural Language Date Service update</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/natural-language-date-service-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sparkup System Service, HTML shorthand everywhere</title>
		<link>http://brettterpstra.com/sparkup-system-service-html-shorthand-everywhere/</link>
		<comments>http://brettterpstra.com/sparkup-system-service-html-shorthand-everywhere/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 17:00:14 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[systemservice]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3846</guid>
		<description><![CDATA[<p>I’m shocked that this hasn’t been done before. I’m sure it has, really, but my searches didn’t turn anything up… Many web devs/designers are familiar with Zen Coding, a little tool available for many text editors which turns shorthand strings into full HTML, among a lot of other nifty tricks. A derivation called Sparkup came out a couple of years&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/sparkup-system-service-html-shorthand-everywhere/">Sparkup System Service, HTML shorthand everywhere</a></p>]]></description>
			<content:encoded><![CDATA[<p>I’m shocked that this hasn’t been done before. I’m <em>sure</em> it has, really, but my searches didn’t turn anything up…</p>

<p>Many web devs/designers are familiar with <a href="https://code.google.com/p/zen-coding/">Zen Coding</a>, a little tool available for many text editors which turns shorthand strings into full HTML, among a lot of other nifty tricks. A derivation called <a href="https://github.com/rstacruz/sparkup">Sparkup</a> came out a <a href="http://brettterpstra.com/quick-link-sparkup-rocks-my-world-a-little/">couple of years back</a>. It added the ability to backtrack up the hierarchy from within the shorthand snippet, which I found to be amazingly useful.</p>

<p>So this all started when I made a keybinding yesterday which turns selected text into a paired HTML tag and allows attributes, so <code>div id="heythere"</code> converts to <code>&lt;div id="heythere"&gt;&lt;/div&gt;</code> when I type Control-&lt; (TextMate style). That’s available on the <a href="http://github.com/ttscoff/KeyBindings">KeyBindings github repo</a>, if you’re interested. I showed the KeyBinding to <a href="http://jdbartlett.com/archive/">Joe Bartlett</a> and the first thing he asked was whether it could do what Zen Coding does. Rabbit hole.</p>

<p>It wouldn’t happen as a keybinding, but it could work as a System Service. No use reinventing the wheel, so I spent a while playing with getting Zen Coding to fit before I remembered Sparkup. Sparkup’s features are pretty minimal compared to the huge toolset that Zen has become, and as such it fits in one file with no dependencies. Perfect for a Service.</p>

<p>I packaged it up and am posting it here. Totally not my work:</p>

<blockquote>
  <p>Sparkup is written by Rico Sta. Cruz and is released under the MIT license.</p>
  
  <p>This project is inspired by Zen Coding of Vadim Makeev. The Zen HTML syntax is forward-compatible with Sparkup (anything that Zen HTML can parse, Sparkup can too).</p>
</blockquote>

<p>Download the System Service version below. To use it, unzip and add the .workflow file to <code>~/Library/Services</code>. Then, open up System Preferences and go to the keyboard shortcuts tab. Select System Services, find it in the panel on the right and click the “Add Shortcut” button that appears when you hover over the right side of its row in the list. Give it a keyboard shortcut you’ll remember. I used Ctrl-, because that’s what it’s bound to in Espresso. Muscle memory.</p>

<p>Now you can type out a shorthand string, select it and hit your shortcut key to watch it blossom into full HTML. Like a code flower. There are quite a few of examples on the <a href="https://github.com/rstacruz/sparkup">Sparkup</a> page, so I’m not going to break down the syntax here. Basically:</p>

<pre><code>div.prettyneat#really&gt;ul&gt;li.item$*2&lt;ol&gt;li*2{ordered list item}+p.last
</code></pre>

<p>becomes:</p>

<pre><code>&lt;div class="prettyneat" id="really"&gt;
    &lt;ul&gt;
        &lt;li class="item1"&gt;&lt;/li&gt;
        &lt;li class="item2"&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;ol&gt;
        &lt;li&gt;ordered list item&lt;/li&gt;
        &lt;li&gt;ordered list item&lt;/li&gt;
        &lt;p class="last"&gt;&lt;/p&gt;
    &lt;/ol&gt;
&lt;/div&gt;
</code></pre>

<p>Note that, unlike Zen Coding, you can use “&lt;” to traverse back up the tree. You can also use linebreaks and indentations on longer strings if it helps you keep things straight. Useful when you’re laying out an entire document structure in one string:</p>

<pre><code>div.prettyneat#really&gt;
p.first{content}
+p*2
+ul&gt;
    li.item$*6&gt;a[href=#]
&lt;&lt;ol&gt;
    li*3{ordered list item}
+p.last
</code></pre>

<p>Also, “html:5″ will give you a full HTML5 document with UTF-8 meta, head and body, and additional elements appended with “&gt;” will go inside the body section. Very handy to have when you’re outside of your usual HTML editor.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/Sparkup.zip?9d7bd4" title="Download Sparkup System Service (76)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Sparkup System Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/Sparkup.zip?9d7bd4" title="Download Sparkup System Service (76)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/Sparkup.zip?9d7bd4" title="Download Sparkup System Service (76)">Sparkup System Service</a> — Sparkup (https://github.com/rstacruz/sparkup) as an OS X System Service. <a href="http://brettterpstra.com/?p=3846">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/quick-link-sparkup-rocks-my-world-a-little/' rel='bookmark' title='Quick Link: Sparkup rocks my world a little'>Quick Link: Sparkup rocks my world a little</a></li>
<li><a href='http://brettterpstra.com/testing-from-vim/' rel='bookmark' title='Testing from Vim'>Testing from Vim</a></li>
<li><a href='http://brettterpstra.com/quick-tip-mindmanager-to-clean-html/' rel='bookmark' title='Quick Tip: MindManager to (clean) HTML'>Quick Tip: MindManager to (clean) HTML</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/sparkup-system-service-html-shorthand-everywhere/">Sparkup System Service, HTML shorthand everywhere</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/sparkup-system-service-html-shorthand-everywhere/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dropbox Collection Service fixed</title>
		<link>http://brettterpstra.com/dropbox-collection-service-fixed/</link>
		<comments>http://brettterpstra.com/dropbox-collection-service-fixed/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 14:57:09 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[systemservice]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3785</guid>
		<description><![CDATA[<p>For those who downloaded the original “Create Dropbox Collection” service and experienced errors, a new version has been posted (all download links updated). The issue was that if the files were in the root of the Public folder, it was trying to find a sub-path that wasn’t there. All patched up. Related posts: A Service for sharing Dropbox link collections Dropbox&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/dropbox-collection-service-fixed/">Dropbox Collection Service fixed</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/03/dropboxserviceicon.png?9d7bd4" alt="" title="dropboxserviceicon" width="250" height="227" class="alignright size-full wp-image-3786" />For those who downloaded the original <a href="http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/">“Create Dropbox Collection”</a> service and experienced errors, a new version has been posted (all download links updated). The issue was that if the files were in the root of the Public folder, it was trying to find a sub-path that wasn’t there. All patched up.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2012/03/dropboxserviceicon.png?9d7bd4" alt="download image for Create Dropbox Collection" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)">Create Dropbox Collection</a> — An OS X System Service for creating an HTML file with lists of links to files in your public Dropbox folder. <a href="http://brettterpstra.com/?p=3769">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/' rel='bookmark' title='A Service for sharing Dropbox link collections'>A Service for sharing Dropbox link collections</a></li>
<li><a href='http://brettterpstra.com/dropbox-and-seamless-mutli-mac-computing/' rel='bookmark' title='Dropbox and seamless mutli-Mac computing?'>Dropbox and seamless mutli-Mac computing?</a></li>
<li><a href='http://brettterpstra.com/system-service-clip-to-day-one/' rel='bookmark' title='System Service: Clip to Day One'>System Service: Clip to Day One</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/dropbox-collection-service-fixed/">Dropbox Collection Service fixed</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/dropbox-collection-service-fixed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Service for sharing Dropbox link collections</title>
		<link>http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/</link>
		<comments>http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 13:56:27 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[systemservice]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3769</guid>
		<description><![CDATA[<p>I wrote this Service a while ago for a friend who kept all of his mockups in Dropbox folders to share. He shared the public links to a group of people who didn’t all use Dropbox, so he’d spend a fair amount of time grabbing links and pasting them into emails. I made this to save him some time, but&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/">A Service for sharing Dropbox link collections</a></p>]]></description>
			<content:encoded><![CDATA[<p>I wrote this Service a while ago for a friend who kept all of his mockups in Dropbox folders to share. He shared the public links to a group of people who didn’t all use Dropbox, so he’d spend a fair amount of time grabbing links and pasting them into emails. I made this to save him some time, but thought it might help a few of you out, too.</p>

<p>It takes a selection of files in your Dropbox public folder and creates a web page with links to each, as well as a button for opening them all in tabs. It doesn’t move them to Dropbox for you, it just makes the links once they’re there and in your public folder (or any subfolder of it). Once it’s run, there’s a dated HTML file in the root public folder that you can send a public link to.</p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/03/DropboxCollectionEditID.jpg?9d7bd4" alt="Dropbox Collection Edit ID" title="Dropbox Collection Edit ID" width="251" height="173" class="alignright size-full wp-image-3771" />You only need to configure your Dropbox ID, which you can find as a string of numbers in any public url (the long version) that you create. Open up the Service in Automator and edit the very first line. After that, it’s good to go. The style of the page is in a compressed format, not to obscure it, just to keep things optimized. If you want to edit it, either replace the <code>&lt;style&gt;</code> section, or run the chunk of text through a CSS formatter and get the pretty version.</p>

<p>To install, just drop it into <code>~/Library/Services</code> or double click the file and let it install itself. It will show up in your Services menu when you right click after selecting some files. The final output looks like this, and works with as many files as you want to share at once:</p>

<p><img style=' display: block; margin-right: auto; margin-left: auto;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/03/DropboxCollectionOutput.jpg?9d7bd4" alt="Create Dropbox Collection output" title="DropboxCollectionOutput" width="650" height="234" class="aligncenter size-full wp-image-3770" /></p>

<p>If your workflow involves sharing collections of files where just sharing a Dropbox folder is inconvenient or not an option, I hope this saves you some time!</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2012/03/dropboxserviceicon.png?9d7bd4" alt="download image for Create Dropbox Collection" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/CreateDropboxCollection1.1.zip?9d7bd4" title="Download Create Dropbox Collection (331)">Create Dropbox Collection</a> — An OS X System Service for creating an HTML file with lists of links to files in your public Dropbox folder. <a href="http://brettterpstra.com/?p=3769">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/dropbox-collection-service-fixed/' rel='bookmark' title='Dropbox Collection Service fixed'>Dropbox Collection Service fixed</a></li>
<li><a href='http://brettterpstra.com/dropbox-and-seamless-mutli-mac-computing/' rel='bookmark' title='Dropbox and seamless mutli-Mac computing?'>Dropbox and seamless mutli-Mac computing?</a></li>
<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>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/">A Service for sharing Dropbox link collections</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/a-service-for-sharing-dropbox-link-collections/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Markdown Service Tools get blockquotes, self-links and more</title>
		<link>http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/</link>
		<comments>http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 04:33:54 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[markdownservices]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3697</guid>
		<description><![CDATA[<p>I needed some relaxing regular expression fun tonight, so I’ve updated a couple of services in the Markdown Service Tools and made some small additions. The main new feature is for handling blockquotes, and there are two versions of the Service. I’m providing some brief explanations after the jump, but feel free to skip to the Markdown Service Tools page&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/">Markdown Service Tools get blockquotes, self-links and more</a></p>]]></description>
			<content:encoded><![CDATA[<p>I needed some relaxing regular expression fun tonight, so I’ve updated a couple of services in the Markdown Service Tools and made some small additions. The main new feature is for handling blockquotes, and there are two versions of the Service. I’m providing some brief explanations after the jump, but feel free to skip to the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools page</a> and just check the <a href="http://brettterpstra.com/project/markdown-service-tools/#changelog">changelog</a>.</p>

<p><span id="more-3697"></span></p>

<h3>Block quoting</h3>

<p>The first of the blockquoting tools, “Blockquote Selection,” just adds a “&gt;” and a space before every line in the selection which contains text. It preserves existing indentation and is best for quoting single paragraphs quickly or for large chunks with code blocks and other indented text you want to keep that way.</p>

<p>The second version, “Convert Indents to Quote Levels,” is for turning hierarchically-indented text (using tabs, not spaces) into nested blockquotes in Markdown format. In essence, it swaps tabs for <code>&gt;</code>‘s. You can turn a conversation like this:</p>

<pre><code>Ut enim ad minima veniam, quis nostrum 

    exercitationem ullam corporis 

        suscipit laboriosam, nisi ut aliquid ex ea 

            commodi consequatur? 

        Quis autem vel eum iure reprehenderit qui in ea 

voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
</code></pre>

<p>into this:</p>

<pre><code>&gt; Ut enim ad minima veniam, quis nostrum

&gt;&gt; exercitationem ullam corporis

&gt;&gt;&gt; suscipit laboriosam, nisi ut aliquid ex ea

&gt;&gt;&gt;&gt; commodi consequatur?

&gt;&gt;&gt; Quis autem vel eum iure reprehenderit qui in ea

&gt; voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
</code></pre>

<p>Which previews/converts as something like:</p>

<p><img src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/02/indented_blockquotes.jpg?9d7bd4" alt="Indented blockquotes" height="215" width="450" ></p>

<h3>Self-linking URLs</h3>

<p>The other big feature, and probably the one that took me the most time this evening, is a service for converting standalone URLs into hyperlinks. If a URL isn’t part of an HTML or Markdown (reference or inline) link, it gets turned into a Markdown-style self-link, which will preview/convert as a hyperlink with the URL itself as the text. This is done by surrounding the URL with angle brackets (<code>&lt;http://yourlink.com&gt;</code>).</p>

<p>This service will ignore anything in an href attribute, anything preceded by ”](“ (assumed to be an inline link), anything on a line that starts with a reference (<code>[title]: ...</code>) and any links that are already “self-linked.” It looks for common punctuation marks at the end of a link and removes them from the conversion (comma, period, etc.). It also does its best to recognize when a paired character (parenthesis, brackets, quotes) exists at the beginning and end of the link so they can be separated from the url without brutally removing every occurence from the link (thus breaking any wikipedia link, et al)<sup id="fnref:lookbehind"><a href="#fn:lookbehind" rel="footnote">1</a></sup>.</p>

<p>The Service currently only looks for http, https and ftp links. If you have another use case I should consider, let me know.</p>

<h3>Unwrap Paragraphs updated</h3>

<p>The <a href="http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/">Unwrap Paragraphs</a> service I added the other day has had a small dose of “smart” added to it. It won’t mess with your code blocks or other specially-formatted text now, and should do a much better job of concatenating words that were hyphenated when the text was hard-wrapped to begin with. Let me know how it goes, I’m definitely looking to improve this one. All of them, really, so don’t be shy with the feedback.</p>

<h3>Download</h3>

<p>You can grab the whole pack of Services and read up on the rest of the included tools on the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a> project page. There’s a readme included in the download (and I just updated it and the documentation) with the full contents of that page, so feel free to download directly below and browse that on your own.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Markdown Service Tools" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)">Markdown Service Tools</a> — Markdown Service Tools is a collection of OS X Services to make creating Markdown-formatted text that much easier. Services work in any Cocoa based application. (Updated to no longer swear at you when converting HTML to Markdown.) <a href="http://brettterpstra.com/code/markdown-service-tools/">More Info</a></p></div>

<div class="footnotes">
<hr />
<ol>

<li id="fn:lookbehind">
<p>This took a lot of bending over backward because I need it to support Ruby 1.8 (default on your OS X machine), and Ruby 1.8 doesn’t support <a href="http://www.perlmonks.org/?node_id=518444">negative lookbehinds</a> in regular expressions. I apologize for the inelegance of the code. When 1.9+ becomes standard on Macs, I might update it to be much prettier. <a href="#fnref:lookbehind" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-service-tools-1-3/' rel='bookmark' title='Markdown Service Tools 1.3'>Markdown Service Tools 1.3</a></li>
<li><a href='http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/' rel='bookmark' title='Some Chrome love for the Markdown Service Tools'>Some Chrome love for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/' rel='bookmark' title='Unwrap Paragraphs for the Markdown Service Tools'>Unwrap Paragraphs for the Markdown Service Tools</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/markdown-service-tools-get-blockquotes-self-links-and-more/">Markdown Service Tools get blockquotes, self-links and more</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unwrap Paragraphs for the Markdown Service Tools</title>
		<link>http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/</link>
		<comments>http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 15:38:43 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[markdownservices]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[System Service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3656</guid>
		<description><![CDATA[<p>Inspired by a Twitter request this morning, I’ve updated the Markdown Service Tools to version 1.3.1 to include an experimental version of a new service: Unwrap Paragraphs. Opposite from the “Preserve line breaks” service, this one will look for consecutive lines and merge them together into one paragraph. It handles hyphenated words and won’t mess up em/en dashes in Markdown&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/">Unwrap Paragraphs for the Markdown Service Tools</a></p>]]></description>
			<content:encoded><![CDATA[<p>Inspired by a Twitter request this morning, I’ve updated the Markdown Service Tools to version 1.3.1 to include an experimental version of a new service: Unwrap Paragraphs.</p>

<p>Opposite from the “Preserve line breaks” service, this one will look for consecutive lines and merge them together into one paragraph. It handles hyphenated words and won’t mess up em/en dashes in Markdown style (<code>--</code> or <code>---</code>). If there’s a newline between two lines, it assumes it’s a new paragraph and treats it as such.</p>

<p><strong>Note:</strong> this <em>does</em> currently unwrap list items and code blocks as well. It should be used selectively on paragraph text. I’ll eventually put in the time to come up with a regular expression that will avoid this.</p>

<p>Version 1.3.1 is available on the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools project page</a>. Somebody <a href="https://twitter.com/lucianofuentes/status/169379718062288896">owes me a box of Aussie Tim Tams</a>.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/' rel='bookmark' title='Markdown Service Tools get blockquotes, self-links and more'>Markdown Service Tools get blockquotes, self-links and more</a></li>
<li><a href='http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/' rel='bookmark' title='Some Chrome love for the Markdown Service Tools'>Some Chrome love for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/markdown-service-tools-1-3/' rel='bookmark' title='Markdown Service Tools 1.3'>Markdown Service Tools 1.3</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/unwrap-paragraphs-for-the-markdown-service-tools/">Unwrap Paragraphs for the Markdown Service Tools</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Markdown Service Tools 1.3</title>
		<link>http://brettterpstra.com/markdown-service-tools-1-3/</link>
		<comments>http://brettterpstra.com/markdown-service-tools-1-3/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 21:00:50 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[markdownservices]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3651</guid>
		<description><![CDATA[<p>I updated the Markdown Service Tools today to include some recently-developed services and some revisions to existing services. Notably, Force Line Breaks has become Preserve Line Breaks, a slightly more elegant service for getting github-style linebreaks in your documents. If you have a block of text with hard returns in it… this is a line this is a line following&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/markdown-service-tools-1-3/">Markdown Service Tools 1.3</a></p>]]></description>
			<content:encoded><![CDATA[<p>I updated the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a> today to include some recently-developed services and some revisions to existing services.</p>

<p>Notably, <strong>Force Line Breaks</strong> has become <strong>Preserve Line Breaks</strong>, a slightly more elegant service for getting github-style linebreaks in your documents. If you have a block of text with hard returns in it…</p>

<pre><code>this is a line
this is a line following a hard return
</code></pre>

<p>(Multi)Markdown will generally concatenate those into a single paragraph. This service looks for these and adds the two spaces at the end of the line required to convert it into a <code>&lt;br&gt;</code> and preserve your formatting.</p>

<p><strong>Lucky Link</strong> is now <strong>Auto-link web search</strong>, the same idea but it functions a little better. Select some text and run it to get a Markdown link to the top result from a web search for that text.</p>

<p>There are a couple of inclusions, such as cleanup scripts for tables and lists, and minor revisions for other commands. Download it from the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Services project page</a>.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/' rel='bookmark' title='Markdown Service Tools get blockquotes, self-links and more'>Markdown Service Tools get blockquotes, self-links and more</a></li>
<li><a href='http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/' rel='bookmark' title='Some Chrome love for the Markdown Service Tools'>Some Chrome love for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/' rel='bookmark' title='Unwrap Paragraphs for the Markdown Service Tools'>Unwrap Paragraphs for the Markdown Service Tools</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/markdown-service-tools-1-3/">Markdown Service Tools 1.3</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/markdown-service-tools-1-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Service for writing MultiMarkdown footnotes inline</title>
		<link>http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline/</link>
		<comments>http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 16:52:39 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[multimarkdown]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3576</guid>
		<description><![CDATA[<p>This post should have been titled “What happens to my mornings.” I get a lot of one-off requests for scripts and tips on how to handle tasks specific to people’s workflow or writing style. I generally keep myself pretty busy, so I usually reply with a quick idea or thought and leave it up to them to run with it.&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline/">A Service for writing MultiMarkdown footnotes inline</a></p>]]></description>
			<content:encoded><![CDATA[<p>This post should have been titled “What happens to my mornings.”</p>

<p>I get a lot of one-off requests for scripts and tips on how to handle tasks specific to people’s workflow or writing style. I generally keep myself pretty busy, so I usually reply with a quick idea or thought and leave it up to them to run with it. <a href="http://havecamerawilltravel.com/">David Coleman</a> emailed me this morning, though, with a request that struck me as an interesting enough idea to whip up a script before work.</p>

<p>What David wanted to do was take the idea behind my “Inline Links to References” command in the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a> and do something similar for footnotes, allowing him to write footnotes inline in a paragraph and have them converted before processing with MultiMarkdown. It’s not such a chore to skip a few lines and drop in the footnote syntax that this should be part of the spec, but it <em>is</em> something I would find handy in several situations. So…</p>

<p><span id="more-3576"></span></p>

<p>The format I picked uses a syntax like this to denote a footnote:</p>

<pre><code>This is the regular text(*This is the footnote*), and you can drop the footnote in at any point.
</code></pre>

<p>The Service can handle footnotes inside of lines, at the end of lines, spanning multiple lines with breaks (creates paragraphs) and does fine with Markdown <em>within</em> the footnote. One nice thing about this syntax is that–if you’re previewing as you write–it italicizes the output to differentiate it until you’ve used the service to move it out of the main text.</p>

<p>Multi-line footnotes need to begin at the end of a line of text, and just use double-newlines to separate paragraphs within the footnote, e.g.:</p>

<pre><code>...the end of the paragraph. (*This is a footnote

which is going to span

more than one line*)
</code></pre>

<p>Here’s the script, also available as a Service download at the end of the post.</p>

<p><strong>Update:</strong> I just added a fix (in code below and the Service download) for making sure that footnote reference titles aren’t duplicated if you have existing MultiMarkdown-formatted footnotes in the document.</p>


<div class="wp_syntax"><div class="code"><pre class="ruby"><span class="co1">#!/usr/bin/env ruby</span>
&nbsp;
<span class="kw1">def</span> e_sh<span class="br0">&#40;</span>str<span class="br0">&#41;</span>
	str.<span class="me1">to_s</span>.<span class="kw3">gsub</span><span class="br0">&#40;</span><span class="sy0">/</span><span class="br0">&#40;</span>?=<span class="br0">&#91;</span>^a<span class="sy0">-</span>zA<span class="sy0">-</span>Z0<span class="sy0">-</span><span class="nu0">9</span>_.\<span class="sy0">/</span>\<span class="sy0">-</span>\x7F<span class="sy0">-</span>\xFF\n<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">/</span>n, <span class="st0">'<span class="es0">\\</span>'</span><span class="br0">&#41;</span>
<span class="kw1">end</span>
&nbsp;
input = STDIN.<span class="me1">read</span>
&nbsp;
footnotes = input.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span>\<span class="br0">&#40;</span>\<span class="sy0">*</span><span class="br0">&#40;</span>.<span class="sy0">*</span>?<span class="br0">&#41;</span>\<span class="sy0">*</span>\<span class="br0">&#41;</span><span class="sy0">/</span>m<span class="br0">&#41;</span>
existing = input.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span>^\<span class="br0">&#91;</span>\^fn<span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span>\<span class="br0">&#93;</span>: <span class="sy0">/</span>i<span class="br0">&#41;</span>
counter = existing.<span class="me1">empty</span>? ? <span class="nu0">1</span> : existing.<span class="me1">uniq</span>.<span class="me1">sort</span><span class="br0">&#91;</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">join</span>.<span class="me1">to_i</span> <span class="sy0">+</span> <span class="nu0">1</span>
&nbsp;
output = <span class="br0">&#91;</span><span class="br0">&#93;</span>
footnotes.<span class="me1">each</span> <span class="br0">&#123;</span><span class="sy0">|</span>note<span class="sy0">|</span> 
	output <span class="sy0">&lt;&lt;</span> <span class="br0">&#123;</span><span class="st0">'orig'</span> <span class="sy0">=&gt;</span> note<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>, <span class="st0">'title'</span> <span class="sy0">=&gt;</span> <span class="st0">&quot;fn#{counter}&quot;</span>, <span class="st0">'footnote'</span> <span class="sy0">=&gt;</span> note<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="br0">&#125;</span>
	counter <span class="sy0">+</span>= <span class="nu0">1</span>
<span class="br0">&#125;</span>
&nbsp;
o = <span class="br0">&#91;</span><span class="br0">&#93;</span>
output.<span class="me1">each_with_index</span> <span class="br0">&#123;</span> <span class="sy0">|</span>x,i<span class="sy0">|</span> 
	o.<span class="me1">push</span><span class="br0">&#40;</span><span class="st0">&quot;[^#{x['title']}]: #{x['footnote'].gsub(/<span class="es0">\n</span><span class="es0">\n</span>(<span class="es0">\s</span>*.)/,&quot;</span>\n\n\t\\<span class="nu0">1</span><span class="st0">&quot;)}&quot;</span><span class="br0">&#41;</span>
	input.<span class="kw3">gsub!</span><span class="br0">&#40;</span><span class="sy0">/</span>\<span class="br0">&#40;</span>\<span class="sy0">*</span><span class="co1">#{e_sh x['orig']}\*\)/m,&quot;[^#{x['title']}]&quot;)</span>
<span class="br0">&#125;</span>
<span class="kw3">puts</span> input.<span class="me1">strip</span> <span class="sy0">+</span> <span class="st0">&quot;<span class="es0">\n</span><span class="es0">\n</span>#{o.join(&quot;</span>\n\n<span class="st0">&quot;)}<span class="es0">\n</span>&quot;</span></pre></div></div>


<p>I’m in San Francisco for an AOL Tech code jam right now, so I don’t have a lot of time to thoroughly test this. Please let me know about any bugs that need fixing.</p>

<p>If you’re in San Francisco and like coffee or beer, hit me up <a href="http://twitter.com/ttscoff">on Twitter</a>. If you’re here for Macworld, then you’d better be at my <a href="http://www.macworldiworld.com/techtalks/thursday-overview/thursday-agenda/#903">“40 Tips in 40 Minutes”</a> talk with David Sparks and Merlin Mann on Thursday!</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/ConvertInlineFootnotesService1.21.zip?9d7bd4" title="Download Convert Inline Footnotes Service (107)"><img src="http://brettterpstra.com/wp-content/plugins/download-monitor/page-addon/thumbnail.gif?9d7bd4" alt="download image for Convert Inline Footnotes Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/ConvertInlineFootnotesService1.21.zip?9d7bd4" title="Download Convert Inline Footnotes Service (107)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/ConvertInlineFootnotesService1.21.zip?9d7bd4" title="Download Convert Inline Footnotes Service (107)">Convert Inline Footnotes Service</a> — Convert inline footnotes in ‘(*Footnote to be created*)‘ format to MultiMarkdown footnotes. <a href="http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/' rel='bookmark' title='Unwrap Paragraphs for the Markdown Service Tools'>Unwrap Paragraphs for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/' rel='bookmark' title='A better System Service for Evernote clipping — with MultiMarkdown'>A better System Service for Evernote clipping — with MultiMarkdown</a></li>
<li><a href='http://brettterpstra.com/natural-language-date-service-update/' rel='bookmark' title='Natural Language Date Service update'>Natural Language Date Service update</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-service-for-writing-multimarkdown-footnotes-inline/">A Service for writing MultiMarkdown footnotes inline</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>System Service: Clip to Day One</title>
		<link>http://brettterpstra.com/system-service-clip-to-day-one/</link>
		<comments>http://brettterpstra.com/system-service-clip-to-day-one/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 22:53:25 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[dayone]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3555</guid>
		<description><![CDATA[<p>I’m enjoying logging with Day One right now, and getting geeky with it. To that end, I put this project together during the few breaks I’ve had over the last couple of days leading up to the new Engadget live blog launch today1. The result is a practical proof of concept in the form of a System Service for clipping&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/system-service-clip-to-day-one/">System Service: Clip to Day One</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/01/dayoneautomator.jpg?9d7bd4" alt="" title="dayoneautomator" width="250" height="243" class="alignright size-full wp-image-3556" />I’m enjoying logging with <a href="http://dayoneapp.com/">Day One</a> right now, and <a href="http://brettterpstra.com/logging-with-day-one-geek-style/">getting geeky with it</a>. To that end, I put this project together during the few breaks I’ve had over the last couple of days leading up to the new <a href="http://www.engadget.com/">Engadget</a> live blog launch today<sup id="fnref:lb"><a href="#fn:lb" rel="footnote">1</a></sup>. The result is a practical proof of concept in the form of a System Service for clipping any text to Day One. I figured that this could actually be really handy for more people than just me, so here it is.</p>

<p><span id="more-3555"></span></p>

<p>Dayone uses a very simple XML format in separate files to store your entries. It’s easy to replicate the structure using a script, allowing you to directly generating your own Day One entries from any part of your workflow. I’m bypassing the <code>dayone</code> CLI and dropping the updates in directly for added flexibility. Don’t get me wrong, I absolutely <em>love</em> that Day One comes with a CLI, I just wanted to experiment around it.</p>

<p>I’m using the new iCloud support for sync, and this Service is built to work with that folder structure by default. The version below (and in the download) looks in “~/Library/Mobile Documents/” (where iCloud stores documents) for a folder containing the word “dayoneapp.” I don’t know offhand what the bizarre names of the folders indicate, but they differ between accounts, so we have to grep out the matching folder. Assuming your Journal is called Journal_dayone (default) and you’re using iCloud, you shouldn’t have to edit anything. If it doesn’t work, run this in Terminal and copy the resulting path into the “dayonepath” variable:</p>

<pre><code>find ~/Library/Mobile\ Documents/ -name "Journal_dayone"
</code></pre>

<p>If you’re using Dropbox, you’ll just need to make a minor alteration to the “dayonepath” variable. Delete the line starting with “dayonedir” and hardcode the Unix (POSIX) path to the “entries” folder, located directly inside of the Journal.dayone bundle in your Dropbox root folder. It will most likely be <code>/Users/[yourusername]/Dropbox/Journal.dayone/entries/</code> if you haven’t changed any defaults in Dropbox or Day One.</p>

<p>The service itself is available for download at the end of the post, or you can take the script below and home-roll your own in Automator. It should work out of the box, no need for ruby gems or symlinked CLIs.</p>

<p>The only configuration you <em>may</em> want to edit is the “starred” variable. This defaults to off because Services aren’t interactive and you probably don’t want to star <em>every</em> entry you clip. If you <em>do</em>, though, just change “starred = false” to “starred = true” and it will make your calendar look like a planetarium.</p>

<p>The Service will use <code>/usr/bin/textutil</code> to strip out any rich text artifacts. I’m not certain this is necessary, but I found that when clipping rich text I would lose all of my line breaks and indents. This seems to solve it. The script also looks for text with hard breaks and handles them Github-style, preserving breaks using Markdown line break syntax.</p>

<p>If you have <a href="http://growl.info">Growl</a> running, you’ll get a notification. To be polite, it checks for Growl before attempting any notifications. The check can be slow sometimes, though, so you may want to either remove the check if you always have Growl running, or remove the whole Growl section at the end if you don’t.</p>

<h3>The script:</h3>

<p>Here’s the script. The same script can be found in the Service download at the end by opening the .workflow file in Automator. You can easily customize/edit from there, so this is posted just for reference.</p>


<div class="wp_syntax"><div class="code"><pre class="ruby">require 'time'
require 'erb'
&nbsp;
def e_sh(str)
	str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, &quot;'\n'&quot;).sub(/^$/, &quot;''&quot;)
end
&nbsp;
input = STDIN.read
entrytext = %x{echo #{e_sh input}|textutil -stdin -convert txt -stdout}
entrytext.gsub!(/\n([^\n])/,&quot;    \n\\1&quot;)
uuid = %x{uuidgen}.gsub(/-/,'').strip
datestamp = Time.now.utc.iso8601
starred = false
&nbsp;
dayonedir = %x{ls ~/Library/Mobile\\ Documents/|grep dayoneapp}.strip
dayonepath = &quot;~/Library/Mobile\ Documents/#{dayonedir}/Documents/Journal_dayone/entries/&quot;
&nbsp;
template = ERB.new &lt;&lt;-XMLTEMPLATE
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
	&lt;key&gt;Creation Date&lt;/key&gt;
	&lt;date&gt;<span class="sy0">&lt;%</span>= datestamp <span class="sy0">%&gt;</span>&lt;/date&gt;
	&lt;key&gt;Entry Text&lt;/key&gt;
	&lt;string&gt;&lt;![CDATA[<span class="sy0">&lt;%</span>= entrytext <span class="sy0">%&gt;</span>]]&gt;&lt;/string&gt;
	&lt;key&gt;Starred&lt;/key&gt;
	&lt;<span class="sy0">&lt;%</span>= starred <span class="sy0">%&gt;</span>/&gt;
	&lt;key&gt;UUID&lt;/key&gt;
	&lt;string&gt;<span class="sy0">&lt;%</span>= uuid <span class="sy0">%&gt;</span>&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
XMLTEMPLATE
&nbsp;
fh = File.new(File.expand_path(dayonepath+uuid+&quot;.doentry&quot;),'w+')
fh.puts template.result(binding)
fh.close
&nbsp;
growl_running = %x{osascript -e 'tell application &quot;system events&quot; to return (count of (every process whose bundle identifier is &quot;com.Growl.GrowlHelperApp&quot;)) &gt; 0'}
&nbsp;
if growl_running
  %x{osascript -e 'tell application id &quot;com.Growl.GrowlHelperApp&quot; to register as application &quot;Clip to Day One&quot; all notifications {&quot;Clip Complete&quot;} default notifications {&quot;Clip Complete&quot;} icon of application &quot;Day One&quot;'}
  %x{osascript -e 'tell application id &quot;com.Growl.GrowlHelperApp&quot; to notify with name &quot;Clip Complete&quot; title &quot;Log to Day One&quot; description &quot;Clipped to Day One&quot; application name &quot;Clip to Day One&quot;'}
end</pre></div></div>


<p><strong>Side note:</strong> I mentioned to <a href="https://twitter.com/#!/brianstucki">@brianstucki</a> that this Service might contain the necessary ingredients for an Evernote-to-Day-One solution, but I’ve realized it’s really only the last part of the equation. What you’d probably want to do with most RTF/text notes is export HTML, extract the “created on” meta and parse it into the correct date format, then pipe the rest of the contents through markdownify_cli.php, passing the result to <code>dayone new</code>. Then you’ll have nice, Markdown versions of your notes from Evernote, preserving much of the formatting. I tested this, and it works pretty flawlessly for text notes.</p>

<h3>Download</h3>

<p>For complete instructions on installing the service (and adding a keyboard shortcut for it), see the how-to <a href="http://brettterpstra.com/howtos/install-an-os-x-system-service/">posted here</a>.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/ClipToDayOne.service.zip?9d7bd4" title="Download Clip to Day One Service (288)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2012/01/dayoneautomator.jpg?9d7bd4" alt="download image for Clip to Day One Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/ClipToDayOne.service.zip?9d7bd4" title="Download Clip to Day One Service (288)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/ClipToDayOne.service.zip?9d7bd4" title="Download Clip to Day One Service (288)">Clip to Day One Service</a> — A System Service to clip any text to a Day One journal entry. <a href="http://brettterpstra.com/system-service-clip-to-day-one/">More Info</a></p></div>

<div class="footnotes">
<hr />
<ol>

<li id="fn:lb">
<p>If you missed it, you missed out, but it’s going to get even better. You’ll have a ton of opportunities in the next couple of months  to check out what is almost certainly–and it’s not just me saying this–the best tool available for live blogging events. <em>I’m so excited, I just can’t hide it…</em> <a href="#fnref:lb" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/quick-tip-quickly-clear-stuck-growl-notifications/' rel='bookmark' title='Quick Tip: Quickly clear stuck Growl notifications'>Quick Tip: Quickly clear stuck Growl notifications</a></li>
<li><a href='http://brettterpstra.com/clear-sticky-growl-notifications-with-a-keyboard-shortcut/' rel='bookmark' title='Clear sticky Growl notifications with a keyboard shortcut'>Clear sticky Growl notifications with a keyboard shortcut</a></li>
<li><a href='http://brettterpstra.com/a-system-service-for-to-url-shortening/' rel='bookmark' title='A System Service for to. url shortening'>A System Service for to. url shortening</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/system-service-clip-to-day-one/">System Service: Clip to Day One</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/system-service-clip-to-day-one/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Auto-convert your inline Markdown links to references</title>
		<link>http://brettterpstra.com/auto-convert-your-inline-markdown-links-to-references/</link>
		<comments>http://brettterpstra.com/auto-convert-your-inline-markdown-links-to-references/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 19:14:55 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[markdownservices]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2663</guid>
		<description><![CDATA[<p>Update: found a little bug (well, stupid mistake) in the HTML to Clipboard command. Download version is now 1.2.1, update if you grabbed 1.2. I’ve posted two more updates to the Markdown Service Tools. The first change is a fix for UTF-8 characters in the HTML to Clipboard Service I introduced yesterday. I had no idea that pbcopy didn’t like&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/auto-convert-your-inline-markdown-links-to-references/">Auto-convert your inline Markdown links to references</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> found a little bug (well, stupid mistake) in the HTML to Clipboard command. Download version is now 1.2.1, update if you grabbed 1.2.</p>

<p>I’ve posted two more updates to the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a>. The first change is a fix for UTF-8 characters in the <strong>HTML to Clipboard</strong> Service I introduced yesterday. I had no idea that <code>pbcopy</code> didn’t like UTF-8 by default. I found <a href="http://hints.macworld.com/article.php?story=20081231012753422">a solution at Mac OS X Hints</a> which seems to be working. I updated the Service in the main download, let me know if it still has trouble with any UTF-8/16 characters.</p>

<p>Secondly, I added a Service that allows you to select an entire document’s text and convert any inline links to reference-style links, with the references sorted and neatly placed at the end of the document. It’s pretty smart about maintaining existing reference links, creating titles, recognizing multiple instances of links, etc., but I can’t account for everyone’s writing style. If you have a reasonable suggestion for improvements (or find any bugs, which is likely), do drop me a line and let me know.</p>

<p>Visit the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools project page</a> for full info and download.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-service-tools-get-blockquotes-self-links-and-more/' rel='bookmark' title='Markdown Service Tools get blockquotes, self-links and more'>Markdown Service Tools get blockquotes, self-links and more</a></li>
<li><a href='http://brettterpstra.com/a-service-for-writing-multimarkdown-footnotes-inline/' rel='bookmark' title='A Service for writing MultiMarkdown footnotes inline'>A Service for writing MultiMarkdown footnotes inline</a></li>
<li><a href='http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/' rel='bookmark' title='Some Chrome love for the Markdown Service Tools'>Some Chrome love for the Markdown Service Tools</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/auto-convert-your-inline-markdown-links-to-references/">Auto-convert your inline Markdown links to references</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/auto-convert-your-inline-markdown-links-to-references/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>An average morning</title>
		<link>http://brettterpstra.com/an-average-morning/</link>
		<comments>http://brettterpstra.com/an-average-morning/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 17:00:34 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2622</guid>
		<description><![CDATA[<p>I was looking at some numbers on a web page. A wide variety of fairly large numbers. The web page didn’t provide any kind of average for the numbers, and I was curious. Curious, of course, meant writing a script to solve the problem. Yes, I could have copied the numbers out, punched them into a calculator one by one,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/an-average-morning/">An average morning</a></p>]]></description>
			<content:encoded><![CDATA[<p>I was looking at some numbers on a web page. A wide variety of fairly large numbers. The web page didn’t provide any kind of average for the numbers, and I was curious. Curious, of course, meant writing a script to solve the problem. Yes, I could have copied the numbers out, punched them into a calculator one by one, or opened up Numbers and pasted them into cells… bah. I wanted to be able to copy text with all kinds of other junk in it and just get the average of all the values in contained quickly and easily (even if that meant wasting twice as much time up front).</p>

<p>I wrote the basic script in Ruby to run as a TextMate command:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby">input = STDIN.<span class="me1">read</span>
&nbsp;
<span class="co1"># Quick function to add commas to long values</span>
<span class="kw1">def</span> add_commas<span class="br0">&#40;</span> number <span class="br0">&#41;</span>
  number.<span class="me1">to_s</span>.<span class="me1">reverse</span>.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span><span class="br0">&#40;</span>?:\d<span class="sy0">*</span>\.<span class="br0">&#41;</span>?\d<span class="br0">&#123;</span><span class="nu0">1</span>,<span class="nu0">3</span><span class="br0">&#125;</span><span class="sy0">-</span>?<span class="sy0">/</span><span class="br0">&#41;</span>.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">','</span><span class="br0">&#41;</span>.<span class="me1">reverse</span>
<span class="kw1">end</span>
&nbsp;
<span class="co1"># Scan for numbers in the text</span>
arr = input.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span>\.?\d<span class="br0">&#91;</span>\d,<span class="br0">&#93;</span><span class="sy0">+</span><span class="br0">&#40;</span>?:\.\d<span class="sy0">+</span><span class="br0">&#41;</span>?<span class="sy0">/</span><span class="br0">&#41;</span>.<span class="me1">map</span><span class="br0">&#123;</span><span class="sy0">|</span>line<span class="sy0">|</span>
  <span class="co1"># remove non-decimal characters from results and convert to float</span>
  line.<span class="kw3">gsub</span><span class="br0">&#40;</span><span class="sy0">/</span><span class="br0">&#91;</span>^\d\.<span class="br0">&#93;</span><span class="sy0">/</span>,<span class="st0">''</span><span class="br0">&#41;</span>.<span class="me1">to_f</span>
<span class="br0">&#125;</span>.<span class="me1">sort</span>
&nbsp;
<span class="kw3">print</span> input <span class="co1"># output the original text</span>
&nbsp;
<span class="co1"># if there were 2 or more numbers found, output the additional information</span>
<span class="kw3">print</span> <span class="st0">&quot;<span class="es0">\n</span> - Average of #{arr.size} numbers ranging from #{arr[0]} to #{arr[arr.size-1]}: &quot;</span> <span class="sy0">+</span> add_commas<span class="br0">&#40;</span>arr.<span class="me1">inject</span><span class="br0">&#40;</span><span class="nu0">0.0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="sy0">|</span>sum,el<span class="sy0">|</span> sum <span class="sy0">+</span> el <span class="br0">&#125;</span> <span class="sy0">/</span> arr.<span class="me1">size</span> <span class="br0">&#41;</span> <span class="kw1">unless</span> arr.<span class="me1">empty</span>? <span class="sy0">||</span> arr.<span class="me1">size</span> == <span class="nu0">1</span></pre></div></div>


<p>The script is simple enough that it should be easily adjustable to perform any kind of basic math on the array of numbers found in the text. The numbers don’t have to be in any order in the input; they can be listed vertically or horizontally or can just be scattered throughout text or messy table code. The regular expression should find them.</p>

<p>The TextMate command suited my needs just fine, but then I started thinking about sharing it. What format would make the most sense? A System Service that accepted text and appended a line with the average? A TextExpander snippet that ran on the clipboard? A LaunchBar action that worked with Instant Send or Copy/Paste? I couldn’t decide, and since the script was the only time-consuming part, I went ahead and made all of the above.</p>

<p><span id="more-2622"></span></p>

<p>The TextExpander snippet is now in the Tools group of my TextExpander projects. If you’re subscribed to that group via URL, your group already updated with the “Average numbers in clipboard” snippet. Otherwise, go ahead and <a href="http://brettterpstra.com/share/te-snippets/index.php?group=Tools&amp;prefix=,,">download it or set up a new subscription</a>.</p>

<p>The other two versions (and the script) are in the download below, and I threw in the original TextMate command, too. The LaunchBar action is actually a Script Bundle with the Ruby script packaged inside. If you’ve ever wondered how to reference a self-contained script in AppleScript, it’s a decent example. It installs to <code>~/Library/Application Support/LaunchBar/Actions</code>. The System Service is a standard Automator action using the script above, and installs to <code>~/Library/Services</code>.</p>

<p>Want to see a video of it? Really? Why? I’m in that semi-asleep state where I thought it would be easier to show what it does than explain it. Since I doubt anyone else really has a need for this script, the video is a tribute to my ability to waste time in the early morning.</p>


	<!-- Begin Video.js -->
	<video id="example_video_id_1847300835" class="video-js vjs-default-skin" width="600" height="338" poster="/share/video/average/averagePoster.jpg" controls preload="true" data-setup="{}">
		<source src="/share/video/average/average.mp4" type='video/mp4' />
		<source src="/share/video/average/average.webm" type='video/webm; codecs="vp8, vorbis"' />
		<source src="/share/video/average/average.ogv" type='video/ogg; codecs="theora, vorbis"' />
	</video>
	<!-- End Video.js -->


<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/AverageNumbers.zip?9d7bd4" title="Download Average Numbers in Selection (50)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2011/09/AverageIcon.png?9d7bd4" alt="download image for Average Numbers in Selection" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/AverageNumbers.zip?9d7bd4" title="Download Average Numbers in Selection (50)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/AverageNumbers.zip?9d7bd4" title="Download Average Numbers in Selection (50)">Average Numbers in Selection</a> — A Ruby script, an OS X System Service and a LaunchBar action for finding any numbers in a block of text and returning the average. Also see the <a href="http://brettterpstra.com/share/te-snippets/index.php?group=Tools">Tools group</a> of the TextExpander Tools for a snippet version. <a href="http://brettterpstra.com/an-average-morning/">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/geeklet-1-minute-average-cpu-load/' rel='bookmark' title='Geeklet: 1-minute average CPU load'>Geeklet: 1-minute average CPU load</a></li>
<li><a href='http://brettterpstra.com/marked-1-4-teaser/' rel='bookmark' title='Marked 1.4 Teaser'>Marked 1.4 Teaser</a></li>
<li><a href='http://brettterpstra.com/seriously-easy-html5-video-encoding/' rel='bookmark' title='Seriously easy HTML5 video encoding'>Seriously easy HTML5 video encoding</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/an-average-morning/">An average morning</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/an-average-morning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Chrome love for the Markdown Service Tools</title>
		<link>http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/</link>
		<comments>http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 21:23:21 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[System Service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2616</guid>
		<description><![CDATA[<p>The Markdown Service Tools–which already received one update today–just got a little bit of Chrome support. The “md — Links from Safari Tabs” now has a Chrome counterpart. At the time that I first wrote the Markdown Service Tools, Chrome didn’t support AppleScript well enough for this to be feasible, but opening up the AppleScript dictionary now reveals a full&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/">Some Chrome love for the Markdown Service Tools</a></p>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a>–which already received <a href="http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/">one update today</a>–just got a little bit of Chrome support. The “md — Links from Safari Tabs” now has a Chrome counterpart. At the time that I first wrote the Markdown Service Tools, Chrome didn’t support AppleScript well enough for this to be feasible, but opening up the AppleScript dictionary now reveals a full set of commands and objects. Nice to see.</p>

<p>I know there have been a lot of posts here today (at least compared to my average)… I’m on “vacation,” technically. I’m actually packing up boxes for a move to a new house over the next couple of days, and this is my OSHA break. I make no promises about keeping this rate of posting up!</p>

<p>Anyway, you can download the latest version of the Markdown Service Tools below, or <a href="http://brettterpstra.com/project/markdown-service-tools/">see the project page</a> for more information on all of the included services.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Markdown Service Tools" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/MarkdownServiceTools1.4.zip?9d7bd4" title="Download Markdown Service Tools (4273)">Markdown Service Tools</a> — Markdown Service Tools is a collection of OS X Services to make creating Markdown-formatted text that much easier. Services work in any Cocoa based application. (Updated to no longer swear at you when converting HTML to Markdown.) <a href="http://brettterpstra.com/code/markdown-service-tools/">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-service-tools-1-3/' rel='bookmark' title='Markdown Service Tools 1.3'>Markdown Service Tools 1.3</a></li>
<li><a href='http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/' rel='bookmark' title='Unwrap Paragraphs for the Markdown Service Tools'>Unwrap Paragraphs for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/' rel='bookmark' title='New Markdown Service tool: HTML to Clipboard'>New Markdown Service tool: HTML to Clipboard</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/some-chrome-love-for-the-markdown-service-tools/">Some Chrome love for the Markdown Service Tools</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Markdown Service tool: HTML to Clipboard</title>
		<link>http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/</link>
		<comments>http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 14:43:18 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[multimarkdown]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2600</guid>
		<description><![CDATA[<p>In response to a tweet from @gl3media, I’ve added a quick modification of the MultiMarkdown to HTML service to the Markdown Service Tools project page. It simply renders the selected text to HTML via MultiMarkdown 2 (Perl) and SmartyPants, putting the result on the clipboard and leaving the original text alone. I left it as the Perl version instead of&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/">New Markdown Service tool: HTML to Clipboard</a></p>]]></description>
			<content:encoded><![CDATA[<p>In response to a <a href="https://twitter.com/gl3media/status/109078575235334144">tweet from @gl3media</a>, I’ve added a quick modification of the MultiMarkdown to HTML service to the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a> project page. It simply renders the selected text to HTML via MultiMarkdown 2 (Perl) and SmartyPants, putting the result on the clipboard and leaving the original text alone.</p>

<p>I left it as the Perl version instead of the new PEG version because it was easier to embed, and allows me to force “snippet” rendering. Modify as you see fit, but this version makes a nice, neat package that does MultiMarkdown rendering without the need for any other installation. I thought others might find it useful, especially as an addition to Marked and nvALT capabilities, so here it is!</p>

<p>Download the service as part of the <a href="http://brettterpstra.com/project/markdown-service-tools/">Markdown Service Tools</a> package. See the how-to page on <a href="http://brettterpstra.com/howtos/install-an-os-x-system-service/">Installing System Services</a> if you have questions!</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/some-chrome-love-for-the-markdown-service-tools/' rel='bookmark' title='Some Chrome love for the Markdown Service Tools'>Some Chrome love for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/unwrap-paragraphs-for-the-markdown-service-tools/' rel='bookmark' title='Unwrap Paragraphs for the Markdown Service Tools'>Unwrap Paragraphs for the Markdown Service Tools</a></li>
<li><a href='http://brettterpstra.com/quick-tip-clean-up-your-multimarkdown-tables/' rel='bookmark' title='Quick Tip: clean up your MultiMarkdown tables'>Quick Tip: clean up your MultiMarkdown tables</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/new-markdown-service-tool-html-to-clipboard/">New Markdown Service tool: HTML to Clipboard</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OS X Service for natural language dates</title>
		<link>http://brettterpstra.com/os-x-service-for-natural-language-dates/</link>
		<comments>http://brettterpstra.com/os-x-service-for-natural-language-dates/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 15:00:09 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[automator]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[natural language]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2539</guid>
		<description><![CDATA[<p>Updated to 1.1 on 5/5/12, more info here. I knocked out a quick project before I got around to my first App Review, so I figured I’d go ahead and share it… A few people have requested a TextExpander set for dates. The problem is, getting the current date is easy with TextExpander variables, so that one’s not worth the&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/os-x-service-for-natural-language-dates/">OS X Service for natural language dates</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Updated to 1.1 on 5/5/12, <a href="http://brettterpstra.com/?p=3964">more info here</a>.</strong></p>

<p>I knocked out a quick project before I got around to my first App Review, so I figured I’d go ahead and share it…</p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/08/calendarservice.jpg?9d7bd4" alt="calendar illustration" title="calendar illustration" width="197" height="332" class="shadow alignright size-full wp-image-2540" />A few people have requested a TextExpander set for dates. The problem is, getting the current date is easy with TextExpander variables, so that one’s not worth the time to me. Anything else requires some scripting, and to be really flexible the set would need to include a very large array of snippets; more than I could possibly keep straight. It could be done with one snippet if you could use the Fill In dialog as an input to a shell script, but you can’t (are you listening Smile?).</p>

<p>Instead, I whipped up a System Service this morning that lets you use keywords and natural language date input to return the specified date in various formats. You type out something like <code>date next tuesday</code>, select the text and run the Service and it will give you back <code>8/23/11</code>. If there’s no matching keyword at the beginning, it will assume <code>%c</code> (<a href="http://us3.php.net/manual/en/function.strftime.php">strftime formatting</a>) and give you back <code>Tue Aug 23 12:00:00 2011</code>.</p>

<p>The keywords are:</p>

<dl>
<dt><strong>date</strong> = ‘%m/%d/%y’ (slashed date)</dt>
<dd>“date today” gives you “8/20/11″</dd>

<dt><strong>local</strong> = ‘%F’ (localized date)</dt>
<dd>“local today” gives you (well, me) “2011–8-20″</dd>

<dt><strong>short</strong> = ‘%a, %b %d, %Y’ (abbreviated full date)</dt>
<dd>“short today” gives you “Sat, Aug 20, 2011″</dd>

<dt><strong>long</strong> = ‘%A, %B %d, %Y’ (long full date)</dt>
<dd>“long today” gives you “Saturday, August 20, 2011″</dd>
</dl>

<p>The language you can use depends on whether or not you have the “chronic” rubygem installed. If you can install rubygems, go to Terminal and run <code>sudo gem install chronic</code>. If that fails, no worries, it will use PHP’s <code>strtotime</code> to parse your string. It has a slightly more limited vocabulary, but anything like “wednesday,” “yesterday” or “next friday” will work.</p>

<p>It installs like any other service, and you can set a keyboard shortcut for it in <strong>System Preferences -&gt; Keyboard -&gt; Keyboard Shortcuts -&gt; Services</strong>. Refer to my <a href="http://brettterpstra.com/howtos/install-an-os-x-system-service/">how-to on Installing System Services</a> for a step-by-step explanation. This service was written on Lion, but should work fine on Snow Leopard, too.</p>

<p>Feel free to extend the script with more keywords and formats. It’s not too technical, just open up the workflow in Automator and find the case block for the keywords (around line 52). Then, copy the <code>when 'long' then '%A, %B %d, %Y'</code> format and paste new lines (or edit existing ones) before the <code>end</code> statement, keyword first then format (again, <a href="http://us3.php.net/manual/en/function.strftime.php">see PHP’s documentation</a> for strftime). Both Chronic and <code>strtotime</code> accept times as well, so if you wanted to do something like <code>date friday 3pm</code>, you could add the format string for a time specification to an existing or new keyword.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Convert Date - Natural Language Date Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/ConvertDate1.1.zip?9d7bd4" title="Download Convert Date - Natural Language Date Service (248)">Convert Date — Natural Language Date Service</a> — A System Service which takes selected text and parses it into a standard date format, using keywords at the beginning to define which format to use. <a href="http://brettterpstra.com/?p=2539">More Info</a></p></div>

<p><strong>Update:</strong> If you’re looking for something similar in Python, Macdrifter has <a href="http://www.macdrifter.com/2011/08/natural-language-date-replacements/">posted an alternative version</a> which works with Keyboard Maestro. Check it out.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/natural-language-date-service-update/' rel='bookmark' title='Natural Language Date Service update'>Natural Language Date Service update</a></li>
<li><a href='http://brettterpstra.com/natural-language-dates-for-textexpander/' rel='bookmark' title='Natural language dates for TextExpander'>Natural language dates for TextExpander</a></li>
<li><a href='http://brettterpstra.com/natural-language-date-conversion-for-textmate/' rel='bookmark' title='Natural language date conversion for TextMate'>Natural language date conversion for TextMate</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/os-x-service-for-natural-language-dates/">OS X Service for natural language dates</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/os-x-service-for-natural-language-dates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prefixr OS X Service</title>
		<link>http://brettterpstra.com/prefixr-service/</link>
		<comments>http://brettterpstra.com/prefixr-service/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 03:21:27 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2483</guid>
		<description><![CDATA[<p>Just for giggles, and because Jeffrey Way was kind enough to provide a simple API for Prefixr, here’s a System Service that will turn your standard CSS3 properties into cross-browser, vendor-prefixed versions. You can select an entire stylesheet and it will send back the text with the necessary changes, or just run it on a single rule to have it&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/prefixr-service/">Prefixr OS X Service</a></p>]]></description>
			<content:encoded><![CDATA[<p>Just for giggles, and because Jeffrey Way was kind enough to provide a simple API for <a href="http://prefixr.com/index.php">Prefixr</a>, here’s a System Service that will turn your standard CSS3 properties into cross-browser, vendor-prefixed versions.</p>

<p>You can select an entire stylesheet and it will send back the text with the necessary changes, or just run it on a single rule to have it vendor-prefixed for you. It turns this:</p>


<div class="wp_syntax"><div class="code"><pre class="css">p <span class="br0">&#123;</span>
  transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
  box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> rgba<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span>.3<span class="br0">&#41;</span> <span class="sy0">;</span>
  <span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#333</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>


<p>into:</p>


<div class="wp_syntax"><div class="code"><pre class="css">p <span class="br0">&#123;</span>
	-webkit-transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
	-moz-transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
	-o-transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
	-ms-transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
	transition<span class="sy0">:</span> all .2s ease-in-out<span class="sy0">;</span>
&nbsp;
	-webkit-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> rgba<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span>.3<span class="br0">&#41;</span><span class="sy0">;</span>
	-moz-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> rgba<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span>.3<span class="br0">&#41;</span><span class="sy0">;</span>
	box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> rgba<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span>.3<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#333</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>


<p>Pretty handy. <a href="http://sass-lang.com/">Sass</a> can do this for you, and there are already plugins for TextMate, Vim, Espresso, Coda and more on Prefixr’s <a href="http://www.prefixr.com/api/usage/">API page</a>. Just thought I’d add one more to the pile.</p>

<p>Unzip it and drop it into <code>~/Library/Services</code>. Select some text containing CSS3 properties and right click on the selection, then look under “Services” for the Prefixer service. Run it and (assuming you have an internet connection), it’ll do some of the tedious parts of CSS3 for you.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/PrefixrService.zip?9d7bd4" title="Download Prefixr Service (332)"><img src="http://brettterpstra.com/wp-content/images/serviceicon.jpg?9d7bd4" alt="download image for Prefixr Service" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/PrefixrService.zip?9d7bd4" title="Download Prefixr Service (332)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/PrefixrService.zip?9d7bd4" title="Download Prefixr Service (332)">Prefixr Service</a> — Uses the Prefixr.com API to process your standard CSS3 properties into cross-browser, vendor-prefixed versions. <a href="">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/app-review-gradient/' rel='bookmark' title='App Review: Gradient'>App Review: Gradient</a></li>
<li><a href='http://brettterpstra.com/a-little-hootsuite-userstyling/' rel='bookmark' title='A little HootSuite userstyling'>A little HootSuite userstyling</a></li>
<li><a href='http://brettterpstra.com/fixing-gleebox/' rel='bookmark' title='Fixing Gleebox'>Fixing Gleebox</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/prefixr-service/">Prefixr OS X Service</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/prefixr-service/feed/</wfw:commentRss>
		<slash:comments>2</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 44/178 queries in 0.279 seconds using xcache
Object Caching 4438/4587 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-05-23 04:20:39 -->
