<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>beautiful simple things - Home</title>
  <id>tag:www.beautifulsimplethings.com,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  <link href="http://www.beautifulsimplethings.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.beautifulsimplethings.com/" rel="alternate" type="text/html"/>
  <updated>2008-05-20T00:02:45Z</updated>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-05-20:39</id>
    <published>2008-05-20T00:01:00Z</published>
    <updated>2008-05-20T00:02:45Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/5/20/script-to-find-and-replace-a-string-in-all-files-and-subdirectories-using-shell-programming" rel="alternate" type="text/html"/>
    <title>script to find and replace a string in all files and subdirectories using shell programming</title>
<content type="html">
            &lt;pre&gt;
#!/bin/sh

if [ $# -ne 2 ]; then
        echo 1&gt;&amp;2 Usage: $0 [string to replace] [replacement]
        exit 127
fi

for file in $(find . -type f | grep -v .svn | grep -v .jpg | grep -v .gif | grep -v .tmp | grep -v .zip 
| grep -v .png | grep -v .ttf | grep -v .psd | grep -v tempfile.tmp)
do
        sed -e &quot;s/$1/$2/g&quot; $file &gt; /tmp/tempfile.tmp
        mv /tmp/tempfile.tmp $file
done
for file in $(find . | grep -v .svn | grep tempfile.tmp)
do
        rm $file
done
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-02-02:37</id>
    <published>2008-02-02T01:39:00Z</published>
    <updated>2008-02-02T01:41:20Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/2/2/fast-date-values-for-fixtures" rel="alternate" type="text/html"/>
    <title>fast date values for fixtures</title>
<content type="html">
            &lt;p&gt;one of my annoyances while porting to rails 2 &#8230; and edge has to do with fixtures.  they&#8217;ve decided to use the rathole plugin . . . but alas i was using the fixture_references plugin, and it seems they do not play nicely together.  however, one thing i have learned is that i can do this:&lt;/p&gt;


&lt;pre&gt;
 3.weeks.ago.to_s(:db)
=&amp;gt; &quot;2008-01-11 17:38:26&quot; 
&amp;gt;&amp;gt; (Time.now + 3.weeks).to_s(:db)
=&amp;gt; &quot;2008-02-22 17:38:42&quot; 
&amp;gt;&amp;gt; 
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-01-29:34</id>
    <published>2008-01-29T21:48:00Z</published>
    <updated>2008-01-29T21:49:42Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/1/29/unitialized-constant-passthrough-exception-in-rails-2" rel="alternate" type="text/html"/>
    <title>unitialized constant PASSTHROUGH exception in rails 2</title>
<content type="html">
            You need to upgrade to ruby 1.8.6 . . .
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-01-09:33</id>
    <published>2008-01-09T18:44:00Z</published>
    <updated>2008-01-09T19:18:43Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/1/9/hacking-irb-and-console-for-ruby-and-rails" rel="alternate" type="text/html"/>
    <title>hacking irb and console for ruby and rails</title>
<content type="html">
            Two things you need for your console.  Imagine the following&lt;br /&gt;
&lt;br /&gt;
./script/console&lt;br /&gt;
&gt;&gt; helper.users_path&lt;br /&gt;
&quot;/users&quot;&lt;br /&gt;
(then highlight and copy to clipboard the following code.)&lt;br /&gt;
&gt;&gt; pastie&lt;br /&gt;
(browser opens to a pastie URL of the code you just copied to the clipboard&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
I also recommend installing &lt;a href=&quot;http://pablotron.org/software/wirble/&quot;&gt;wirble &lt;/a&gt; so you can have history in your console as well. ( sudo gem install wirble )&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
To get these helpful commands going in your irb or console session just add the following to your ~/.irbrc file.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;
# load rubygems and wirble
require 'net/http'
require 'rubygems' rescue nil
require 'wirble'

# load wirble
Wirble.init
Wirble.colorize

def Object.method_added(method)
  return super(method) unless method == :helper
  (class&amp;lt;&amp;lt;self;self;end).send(:remove_method, :method_added)

  def helper(*helper_names)
    returning $helper_proxy ||= Object.new do |helper|
      helper_names.each { |h| helper.extend &quot;#{h}_helper&quot;.classify.constantize }
    end
  end

  helper.instance_variable_set(&quot;@controller&quot;, ActionController::Integration::Session.new)

  def helper.method_missing(method, *args, &amp;block)
    @controller.send(method, *args, &amp;block) if @controller &amp;&amp; method.to_s =~ /_path$|_url$/
  end

  helper :application rescue nil
end if ENV['RAILS_ENV']

def pastie
  url = URI.parse(&quot;http://pastie.caboo.se/pastes/create&quot;)
  parameters = {}
  IO.popen('pbpaste') do |clipboard|
    parameters[&quot;paste[body]&quot;] = clipboard.read
  end
  parameters[&quot;paste_parser&quot;] = &quot;ruby&quot;
  parameters[&quot;paste[authorization]&quot;] = &quot;burger&quot;
  pastie_url = Net::HTTP.post_form(url, parameters).body.match(/href=&quot;([^\&quot;]+)&quot;/)[1]
  IO.popen('pbcopy', 'w+') do |clipboard|
    clipboard.write(pastie_url)
  end
  pastie_url
  system(&quot;open &quot; + pastie_url)
end
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-11:27</id>
    <published>2007-12-11T19:01:00Z</published>
    <updated>2007-12-11T19:04:03Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/11/testing-your-tests-in-rails" rel="alternate" type="text/html"/>
    <title>testing your tests in rails</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle&quot;&gt;actually modifies your tests to verify what you&#8217;re testing&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-06:21</id>
    <published>2007-12-06T02:15:00Z</published>
    <updated>2008-02-02T01:39:31Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/6/rails-inserts-heinous-html-sometimes" rel="alternate" type="text/html"/>
    <title>rails inserts heinous html sometimes</title>
<content type="html">
            Using button_to in rails inserts unnecessary div tags into your html and i recommend using the following override code in your application helper.
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;
&amp;nbsp;&amp;nbsp;def button_to(value, link, options={}) &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if not options.empty? &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return super(value, link, options)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return &quot;&amp;lt;input type=\&quot;button\&quot; value=\&quot;#{value}\&quot; onclick=\&quot;location.href='#{url_for(link)}'\&quot;/&amp;gt;&quot; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;end&lt;br /&gt;
&lt;/b&gt;

&lt;br /&gt;
&lt;br /&gt;
That way you get clean return values like &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input value=&quot;Submit&quot; onclick=&quot;http://yoururl.com&quot; /&amp;gt;

&lt;br /&gt;  &lt;br /&gt;
rather than getting: &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;
&amp;lt;div&amp;gt;
&amp;lt;form method=&quot;post&quot; action=&quot;http://yoururl.com&quot; class=&quot;button-to&quot;&amp;gt;&amp;lt;div&amp;gt;&amp;lt;input type=&quot;submit&quot; value=&quot;Publish it&quot; /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;br /&gt;
However this doesn't solve the method post problem
&lt;br /&gt;  &lt;br /&gt;
&lt;br /&gt;  &lt;br /&gt;
&lt;br /&gt;  &lt;br /&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-04:20</id>
    <published>2007-12-04T02:54:00Z</published>
    <updated>2008-01-07T22:17:40Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/4/controller-partials-in-rails" rel="alternate" type="text/html"/>
    <title>Controller Partials in rails</title>
<content type="html">
            I've noticed lately that I reuse a lot of code between controllers, in some cases entire methods.  What if you could do something like 
&lt;b&gt;&lt;br /&gt;def comment_posted&lt;br /&gt;&amp;nbsp; &amp;nbsp;&lt;i&gt;&amp;lt;%= render :controller_partial =&gt; 'common/blog_posted' %&gt; 
&lt;/i&gt;&lt;br /&gt;end&lt;/b&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-08-26:15</id>
    <published>2007-08-26T00:43:00Z</published>
    <updated>2007-08-26T00:49:28Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/8/26/mac-os-x-usb-guru" rel="alternate" type="text/html"/>
    <title>Mac OS X USB guru</title>
<content type="html">
            I'm trying to connect our *new* USB keyboard to an OS X machine and I want to gather the raw input data from it.  I've got USB Prober going, but it doesn't look like I can ascertain raw input from that program alone, and frankly, I need help.  If anyone is interested in seeing our new keyboard, and helping out with the driver software I'd love to cut you in on the action.  I have plenty to worry about besides driver software - including but not limited to: finding some investors/and or just selling the thing.  Starting on the User facing application, and creating some marketing buzz around the new product.  Would love to hear if anyone is interested in coming in on this for a percentage.   contact me at matt@beautifulsimplethings.com   . I can give you more details about the new keyboard.
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-04-21:1</id>
    <published>2007-04-21T19:16:00Z</published>
    <updated>2007-05-03T17:42:01Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/4/21/welcome-to-bst" rel="alternate" type="text/html"/>
    <title>Welcome to BST</title>
<content type="html">
            We are Beautiful Simple Things.  We beautify, simplify, and innovate new consumer electronics. We make playing Games more fun, and working with computers a beautiful thing.  Currently, we are in the process of prototyping our first product.  Let's just say, it's a BeaST, and we are very excited.
          </content>  </entry>
</feed>
