<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Tue, 29 May 2012 10:55:23 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Blog</title><link>http://www.puppysound.com/blog/</link><description></description><lastBuildDate>Wed, 22 Jun 2011 15:30:25 +0000</lastBuildDate><copyright></copyright><language>en-US</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>Refactoring Rails With sed -- Class Method Renaming</title><dc:creator>[Your Name Here]</dc:creator><pubDate>Mon, 28 Mar 2011 22:12:27 +0000</pubDate><link>http://www.puppysound.com/blog/2011/3/28/refactoring-rails-with-sed-class-method-renaming.html</link><guid isPermaLink="false">755804:8865884:10976234</guid><description><![CDATA[<p>Something that you'll ocassionally hear from new Rails developers (especially if they are coming from an IDE-centric world) is that they miss having refactoring tools. Well, it's never going to be as easy to automate refactoring in a dynamic language as it is in a static language. All of that compile time info in static languages is very useful for refactoring and in Ruby we just don't have that to work from. That said, as terminal dwellers there is a lot of power that we can gain from leveraging UNIX tools. Here is one way in which I have learned to take advantage of BASH and sed, to rename a class method in a rails app. Here I am renaming a class method called 'omc_data_service' to 'service'. I'm all about pulling this stuff off as one liners right in the terminal. It seems a bit crazy at first, but after you do it a few times you can come up with something like this in about 20 seconds.</p>
<p>&nbsp;</p>
<p><script src="https://gist.github.com/891426.js?file=rename.sh"></script></p>
<p>&nbsp;</p>
<p>It's pretty straight forward really</p>
<p>&nbsp;</p>
<p><script src="https://gist.github.com/891761.js?file=snip1.sh"></script></p>
<p>&nbsp;This is just saying "Loop over all the Ruby files starting from the current dir and recursing"</p>
<p>&nbsp;</p>
<div></div>
<p><script src="https://gist.github.com/891763.js?file=snip2.sh"></script></p>
<p>&nbsp;Print the file name</p>
<div></div>
<p><span class="pun"><br /> <script src="https://gist.github.com/891764.js?file=snip3.sh"></script></span></p>
<p><span class="pun">This is the real logic. Sed is a line based editor that we are using here to make a regex substitution. <br />The "-i" flag means "Do the subsititution inline, rather than to stdout". <br />The "-e" flag means "the following string is a sed expression". <br />The first regex "/[:.]omc_data_service/" is saying "Only apply this to lines that contain the method name". This is only needed because we don't want sed to rewrite lines when there is no change made. Without the first regex the result would be the same, except every file would have it's 'last modified' date changed. <br />Anyway, we are looking for either a starting '.' for calling and declaring the class method, or a starting ':' for when we are passing the method name as a symbol to Flexmock. The '\([:.]\)' means, "Remember if it started with a '.' or ':'". The "\1" says "Since you rememebered if it had a '.' or ':', put that here". Finally the "/g" takes care of all occurances on a line rather than just the first.</span></p>
<p><span class="pun"><br />Hope this was helpful.<br /><br />&nbsp;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-10976234.xml</wfw:commentRss></item><item><title>iOS development with Vim</title><dc:creator>[Your Name Here]</dc:creator><pubDate>Wed, 26 Jan 2011 00:12:52 +0000</pubDate><link>http://www.puppysound.com/blog/2011/1/25/ios-development-with-vim.html</link><guid isPermaLink="false">755804:8865884:10224707</guid><description><![CDATA[<p>I've seen a few amazing developers (including <a href="http://eraserhead.net/">http://eraserhead.net/</a>) who feel that they work more productively in standard UNIX text editors than they do in XCode. Despite my recent flirtation&nbsp;with Emacs :) , I'm fairly effiecent in using Vim for non Objective-C coding work, but I've never really considered using it for iOS. It all changed however after seeing <a href="http://blog.extracheese.org/">Gary Bernhardt</a>'s talk at <a href="http://www.codemash.org/">CodeMash</a>.&nbsp;<br /><br />Gary showed some great examples of how he has streamlined his workflow and made himself into a lightning fast TDD monster. I asked what he would do if he was an iOS developer and his response was that he wouldn't invest the time to create this workflow for iOS unless he had enough work lined up to make it worth it. Well, he may not spent much time with Objective-C, but its likely I'll put in a couple thousand hours with it this year. With that in mind, I have decided that I'll be spending the remainder of the time before there is an official update to XCode in Vim.<br /><br />The main thing that I was jealous of in Gary's presentation was the Red/Green bar at the bottom (indicating passing or failing tests) and the speed with which he could run them. So, thats the first thing I stole :) NOTE: I also modifed the ruby section of code below from something <a href="http://navel-labs.com/">Navel-Labs </a>shared with me.<br /><br />End result is that by typing ",t" I can run my current test bundle and see output like below. It doesn't happen quite as fast as Gary's examples, but it is much faster than working with the Build Result window in XCode.<br /><br /><span class="full-image-inline ssNonEditable"><span><img style="width: 300px;" src="http://www.puppysound.com/storage/Screen%20shot%202011-01-25%20at%207.35.17%20PM.png?__SQUARESPACE_CACHEVERSION=1296002332612" alt="" /></span></span><span class="full-image-inline ssNonEditable"><span><img style="width: 300px;" src="http://www.puppysound.com/storage/Screen shot 2011-01-25 at 7.35.53 PM.png?__SQUARESPACE_CACHEVERSION=1296002295749" alt="" /></span></span>&nbsp;</p>
<p>&nbsp;</p>
<p>Here's how I'm doing it:</p>
<p>&nbsp;</p>
<p>When I start working on a new test I map the key right in my vim session&nbsp;</p>
<p><script src="https://gist.github.com/796017.js?file=map.vim"></script></p>
<p>This is in my .vimrc</p>
<p><script src="https://gist.github.com/796016.js?file=testrunner.vim"></script><script src="https://gist.github.com/796015.js?file=testrunner.sh"></script><script src="https://gist.github.com/796018.js?file=testrunner.rb"></script></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-10224707.xml</wfw:commentRss></item><item><title>The Objective-C Koans</title><dc:creator>[Your Name Here]</dc:creator><pubDate>Fri, 24 Dec 2010 00:37:15 +0000</pubDate><link>http://www.puppysound.com/blog/2010/12/23/the-objective-c-koans.html</link><guid isPermaLink="false">755804:8865884:9817977</guid><description><![CDATA[<p>Part of what makes unit testing so engrained into the Ruby culture is that many people begin learning the language through TDD. The&nbsp;<a href="http://rubykoans.com/">Ruby Koans</a>&nbsp;of course deserve much of the credit for that. I hope to bring this same mentality to Objective-C. Today I began working on a port of the Koans using the testing framework <a href="http://www.kiwi-lib.info/">Kiwi</a>. As a tease, checkout my reworking of about_asserts.rb. Obviously this example teaches you more about the testing framework than Obj-C. I hope that the Objective-C community will want to pitch in and make this a reality. The project is available on <a href="https://github.com/joecannatti/Objective-C-Koans">Github.</a>

<script src="https://gist.github.com/753748.js"> </script>

</p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9817977.xml</wfw:commentRss></item><item><title>Beginner's LISP — PART 2</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Wed, 18 Aug 2010 23:45:37 +0000</pubDate><link>http://www.puppysound.com/blog/2010/8/18/beginners-lisp-part-2.html</link><guid isPermaLink="false">755804:8865884:9774466</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774466.xml</wfw:commentRss></item><item><title>Polyglot Stall</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Tue, 13 Jul 2010 18:51:56 +0000</pubDate><link>http://www.puppysound.com/blog/2010/7/13/polyglot-stall.html</link><guid isPermaLink="false">755804:8865884:9774467</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774467.xml</wfw:commentRss></item><item><title>Resizing images with Ruby and RMagick</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Mon, 17 May 2010 21:17:20 +0000</pubDate><link>http://www.puppysound.com/blog/2010/5/17/resizing-images-with-ruby-and-rmagick.html</link><guid isPermaLink="false">755804:8865884:9774476</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774476.xml</wfw:commentRss></item><item><title>The cool stuff about Lisp for those of us with day jobs -- PART 1: Writing Your Own Addition Operator in Scheme</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Mon, 10 May 2010 22:16:46 +0000</pubDate><link>http://www.puppysound.com/blog/2010/5/10/the-cool-stuff-about-lisp-for-those-of-us-with-day-jobs-part.html</link><guid isPermaLink="false">755804:8865884:9774477</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774477.xml</wfw:commentRss></item><item><title>It's about the user!</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Fri, 09 Apr 2010 23:58:15 +0000</pubDate><link>http://www.puppysound.com/blog/2010/4/9/its-about-the-user.html</link><guid isPermaLink="false">755804:8865884:9774478</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774478.xml</wfw:commentRss></item><item><title>Replacing Unix or Windows line endings with Ruby</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Thu, 18 Mar 2010 21:40:47 +0000</pubDate><link>http://www.puppysound.com/blog/2010/3/18/replacing-unix-or-windows-line-endings-with-ruby.html</link><guid isPermaLink="false">755804:8865884:9774479</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774479.xml</wfw:commentRss></item><item><title>HTML is the new cursive</title><category>General</category><dc:creator>[Your Name Here]</dc:creator><pubDate>Tue, 16 Mar 2010 22:51:20 +0000</pubDate><link>http://www.puppysound.com/blog/2010/3/16/html-is-the-new-cursive.html</link><guid isPermaLink="false">755804:8865884:9774480</guid><description><![CDATA[<p></p>]]></description><wfw:commentRss>http://www.puppysound.com/blog/rss-comments-entry-9774480.xml</wfw:commentRss></item></channel></rss>
