<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Joe Martinez</title>
 <link href="http://www.jrmiii.com/atom.xml" rel="self"/>
 <link href="http://www.jrmiii.com/"/>
 <updated>2009-03-10T13:41:35-07:00</updated>
 <id>http://www.jrmiii.com/</id>
 <author>
   <name>Joe Martinez</name>
   <email>jrm02t+atom@gmail.com</email>
 </author>

 
 <entry>
   <title>Learning Vim The Pragmatic Way</title>
   <link href="http://www.jrmiii.com/2009/03/06/learning-vim-the-pragmatic-way.html"/>
   <updated>2009-03-06T00:00:00-08:00</updated>
   <id>http://www.jrmiii.com/2009/03/06/learning-vim-the-pragmatic-way</id>
   <content type="html">&lt;p&gt;Due to popular inexorability, I&amp;#8217;m learning to use the &amp;#8220;Vim&amp;#8221; text editor(specifically &lt;a href="http://code.google.com/p/macvim/"&gt;MacVim&lt;/a&gt;). &lt;br /&gt;
Having recently finished &lt;a href="http://www.amazon.com/gp/product/1934356050?ie=UTF8&amp;amp;tag=joemart-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1934356050"&gt;Pragmatic Thinking &amp;amp; Learning&lt;/a&gt;, I decided to follow one of the suggestions and mind map this new information.&lt;/p&gt;
&lt;p&gt;The mind map turned out pretty good. This one includes the basic commands, which I&amp;#8217;ll update with the more advanced stuff as I learn it. I made a large version to hang next to my screen. Here&amp;#8217;s a preview:&lt;/p&gt;
&lt;p&gt;&lt;img src="/attachments/Vim.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You can download the full version as a &lt;span class="caps"&gt;PDF&lt;/span&gt; &lt;a href="/attachments/Vim.pdf"&gt;here&lt;/a&gt;. Also, if you want, you can work on this mind map some more by importing &lt;a href="/attachments/Vim.opml"&gt;the &lt;span class="caps"&gt;OPML&lt;/span&gt;&lt;/a&gt; for it into whatever software you use.&lt;/p&gt;
&lt;p&gt;PS: Yes, I wrote this post in Vim :)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Super Easy Search For Jekyll Powered Sites</title>
   <link href="http://www.jrmiii.com/2009/03/03/super-easy-sidebar-search-for-jekyll-powered-sites.html"/>
   <updated>2009-03-03T00:00:00-08:00</updated>
   <id>http://www.jrmiii.com/2009/03/03/super-easy-sidebar-search-for-jekyll-powered-sites</id>
   <content type="html">&lt;p&gt;Site search is one of the most important missing features when moving your blog off of a blog engine to a static site. I&amp;#8217;m using &lt;a href="http://http://github.com/mojombo/jekyll/"&gt;Jekyll&lt;/a&gt; to churn out the pages for this site, but wanted back my missing search.&lt;/p&gt;
&lt;h3&gt;This post brought to you courtesy of the Google Search &lt;span class="caps"&gt;AJAX&lt;/span&gt; &lt;span class="caps"&gt;API&lt;/span&gt;&amp;#8230;&lt;/h3&gt;
&lt;p&gt;As it turns out, I need only to drop in the &lt;span class="caps"&gt;AJAX&lt;/span&gt; powered Google search and it just works. Here&amp;#8217;s how.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;First, head on over to &lt;a href="http://code.google.com/apis/ajaxsearch/signup.html"&gt;Google Code&lt;/a&gt; and get an &lt;span class="caps"&gt;API&lt;/span&gt; key.&lt;/li&gt;
	&lt;li&gt;Then, make yourself an include file named google_ajax_search.html (create the _includes directory in the root of your Jekyll project if you don&amp;#8217;t have one).&lt;/li&gt;
	&lt;li&gt;Next, add this code to the file you just created and substitute your api key and url:&lt;br /&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://www.google.com/jsapi?key=your_api_key&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;language=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Javascript&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  
  &lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;search&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;OnLoad&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Create a search control&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;searchControl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SearchControl&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    
    &lt;span class="c"&gt;// Add in a WebSearch&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;webSearch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WebSearch&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    
    &lt;span class="c"&gt;// Restrict our search to pages from this site&lt;/span&gt;
    &lt;span class="nx"&gt;webSearch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setSiteRestriction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;your site url&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    
    &lt;span class="c"&gt;// Add the searcher to the SearchControl&lt;/span&gt;
    &lt;span class="nx"&gt;searchControl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addSearcher&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;webSearch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    
    &lt;span class="c"&gt;// tell the searcher to draw itself and tell it where to attach&lt;/span&gt;
    &lt;span class="nx"&gt;searchControl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;draw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;search&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setOnLoadCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;OnLoad&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Now, create a div in your layout, with id=&amp;#8220;search&amp;#8221; where you&amp;#8217;d like the search box to appear.&lt;/li&gt;
	&lt;li&gt;Lastly, include your google_ajax_search in the &amp;lt;head&amp;gt; of your layout.&lt;/li&gt;
&lt;/ol&gt;</content>
 </entry>
 
 <entry>
   <title>How I Use Screen</title>
   <link href="http://www.jrmiii.com/2009/02/20/how-i-use-screen.html"/>
   <updated>2009-02-20T00:00:00-08:00</updated>
   <id>http://www.jrmiii.com/2009/02/20/how-i-use-screen</id>
   <content type="html">&lt;p&gt;&lt;a href="http://www.gnu.org/software/screen/"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; Screen&lt;/a&gt; is described a &lt;em&gt;&amp;#8220;a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.&amp;#8221;&lt;/em&gt;&lt;/p&gt;
&lt;div style="float:right;"&gt;&lt;img src="http://img.skitch.com/20090221-8wdgkyrfgtfpw67bn6761gpp4y.png" title="GNU Screen" alt="GNU Screen" /&gt;&lt;/div&gt;
&lt;p&gt;What this means in plain english is, screen is a whole lot of awesome. Special thanks to &lt;a href="http://www.twitter.com/voxdolo"&gt;@voxdolo&lt;/a&gt; for getting me hooked.&lt;/p&gt;
&lt;p&gt;Screen essentially lets you run multiple command line based apps, scripts, or prompts from a single terminal and then detach and resume that session whenever you like. This is super useful when you ssh into remote machines and you need to run a script, monitor a log, and just poke around all at the same time. However, it has other applications that motivate me to have it running all the time, instead of just a plain ol&amp;#8217; shell. (I use bash by the  way)&lt;/p&gt;
&lt;p&gt;First off, screen uses an command character to access it&amp;#8217;s commands, by default ctrl-a. However, I type in dvorak layout, mostly on my mbp which has no control key on the right side, making ctrl-a super difficult to press in a hurry. So I changed it to ctrl-h. You can remap any of the bindings in screen however you like.&lt;/p&gt;
&lt;h3&gt;Using screen in a single context&lt;/h3&gt;
&lt;p&gt;I know most folks who use screen like to create separate screenrc&amp;#8217;s depending on what they need open. That works like this: &lt;br /&gt;
I&amp;#8217;ve got my default, &amp;#8216;all the time&amp;#8217; settings in ~/.screenrc and per context settings in ~/.screen/foo. So let&amp;#8217;s assume I&amp;#8217;m going to be doing some rails work &amp;#8211; I&amp;#8217;d startup screens with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;  screen -c ~/.screen/rails
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;#8217;d fire off a server, autotest, console, and prompt &amp;#8211; all ready to go from whatever project dir I was in. The config file for that looks like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;  &lt;span class="nb"&gt;source&lt;/span&gt; ../.screenrc
  
  screen -t svr ./script/server
  screen -t con ./script/console
  screen -t at autotest --rails
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Using screen while context switching&lt;/h3&gt;
&lt;p&gt;Contrary to this, quite a bit of the time I&amp;#8217;m flying through one off tasks and switching contexts too much for this approach to be productive. In that case I start screen in my home directory and rely on its ability to bind any command to a key. Using these bindings coupled with a utility that lets you jump around really quickly(I use &lt;a href="http://github.com/rupa/j/"&gt;j&lt;/a&gt;) allows you to terminal your way around all your chores. Some of my bindings look like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;  &lt;span class="nb"&gt;bind &lt;/span&gt;S screen -t svr ./script/server
  &lt;span class="nb"&gt;bind &lt;/span&gt;C screen -t con ./script/console
  &lt;span class="nb"&gt;bind &lt;/span&gt;T screen -t &lt;span class="nb"&gt;test &lt;/span&gt;rake
  &lt;span class="nb"&gt;bind &lt;/span&gt;P screen -t cucumber ./features
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Why not just use tabs in Terminal.app or something?&lt;/h3&gt;
&lt;p&gt;Well, because of many of the other great features like splitting, monitoring, capturing output and others. I&amp;#8217;m not going to cover them now, as they&amp;#8217;re outside the scope of this article, but I encourage you to give screen a try.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>I've moved to Jekyll...</title>
   <link href="http://www.jrmiii.com/2009/02/18/made-the-move-to-jekyll.html"/>
   <updated>2009-02-18T00:00:00-08:00</updated>
   <id>http://www.jrmiii.com/2009/02/18/made-the-move-to-jekyll</id>
   <content type="html">&lt;p&gt;So I&amp;#8217;ve made the move to &lt;a href="http://github.com/mojombo/jekyll/"&gt;Jekyll&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t mean physically(unfortunately). I&amp;#8217;ve moved this blog to static pages on &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt; powered by the Jekyll static site generator.&lt;/p&gt;
&lt;p&gt;When I saw a project on GitHub titled Jekyll, it caught my eye. My grandparents had a beach house on Jekyll Island in GA where I spent many summers. So, I checked it out and am quite impressed. Its author, &lt;a href="http://github.com/mojombo"&gt;mojombo&lt;/a&gt; makes a great point about how blogs are currently setup backwards.&lt;/p&gt;
&lt;p&gt;Jekyll lets you author your posts in Textile, Markdown or plain &lt;span class="caps"&gt;HTML&lt;/span&gt; and cranks out the &lt;span class="caps"&gt;HTML&lt;/span&gt; for the entire site for you. It will even generate the xml feeds for you.&lt;/p&gt;
&lt;p&gt;The only thing that&amp;#8217;s generally dynamic content on a blog are the comments, but with services like &lt;a href="http://disqus.com/home/"&gt;Disqus&lt;/a&gt; you can transparently host them off-site.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll probably hack on Jekyll a bit in the next few days to add &lt;span class="caps"&gt;HAML&lt;/span&gt; support which is noticeably missing, but other than that &amp;#8211; it&amp;#8217;s great!&lt;/p&gt;
&lt;p&gt;PS: Since most of the old content is dated and irrelevant anyway &amp;#8211; I&amp;#8217;m not going to bother moving it over.&lt;/p&gt;</content>
 </entry>
 
 
</feed>