<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>RubyBlocks.se - Home</title>
  <id>tag:www.rubyblocks.se,2010:mephisto/</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://www.rubyblocks.se/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.rubyblocks.se/" rel="alternate" type="text/html"/>
  <updated>2010-01-29T23:30:32Z</updated>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2010-01-28:136</id>
    <published>2010-01-28T14:28:00Z</published>
    <updated>2010-01-29T23:30:32Z</updated>
    <category term="controller"/>
    <category term="rails"/>
    <category term="rspec"/>
    <category term="testing"/>
    <link href="http://www.rubyblocks.se/2010/1/28/testing-an-abstract-controller-like-applicationcontroller" rel="alternate" type="text/html"/>
    <title>Testing an abstract controller (like ApplicationController)</title>
<content type="html">
            &lt;p&gt;This is one way to test before_filters in your ApplicationController or other abstract controllers. Make sure you don&#8217;t miss the &#8220;after&#8221; part!&lt;/p&gt;


	&lt;p&gt;One thing to keep in mind though is that re-loading the routes can take some serious time (6 seconds in the app Im working on). I&#8217;d like to find a better way of testing this.&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
&lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;dirname&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;__FILE__&lt;/span&gt;) &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;/../../spec_helper&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

describe &lt;span class=&quot;Variable&quot;&gt;ApplicationController&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;

  &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;TestController&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;ApplicationController&lt;/span&gt;
    &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;index&lt;/span&gt;
    &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

  controller_name &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;test&lt;/span&gt;

  before &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;each&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;Support&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Routing&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Routes&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;draw&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;Variable&quot;&gt;map&lt;/span&gt;| 
      map.&lt;span class=&quot;Entity&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;test&lt;/span&gt;
    &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

  after &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;all&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;Entity&quot;&gt;load&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;RAILS_ROOT&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;/config/routes.rb&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

  it &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;should do something&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
    get &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;index&lt;/span&gt;
&lt;span class=&quot;Comment&quot;&gt;    &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; assert stuff&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-05-21:133</id>
    <published>2009-05-21T12:43:00Z</published>
    <updated>2009-05-21T13:03:19Z</updated>
    <category term="http"/>
    <category term="mp3"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.rubyblocks.se/2009/5/21/how-to-check-if-a-file-exists-on-a-remote-server-head-request" rel="alternate" type="text/html"/>
    <title>How to check if a file exists on a remote server (HEAD request)</title>
<content type="html">
            &lt;p&gt;Here is some code to check if a file exists on a remote server by using a &lt;span class=&quot;caps&quot;&gt;HEAD&lt;/span&gt; request. It can optionally check if the content type is what you expected (if you for example want to only allow &#8220;audio/mpeg&#8221; links). Note that this particular implementation only works with http urls.&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
&lt;span class=&quot;Keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;net/http&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;exists?&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;file&lt;/span&gt;)
  &lt;span class=&quot;Keyword&quot;&gt;begin&lt;/span&gt;
&lt;span class=&quot;Comment&quot;&gt;    &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Support for both good and bad URI's&lt;/span&gt;
    uri &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;URI&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;parse&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;URI&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;escape&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;URI&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;unescape&lt;/span&gt;(file)))
    response &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;
     &lt;span class=&quot;Support&quot;&gt;Net&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;HTTP&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;start&lt;/span&gt;(uri.&lt;span class=&quot;Entity&quot;&gt;host&lt;/span&gt;, uri.&lt;span class=&quot;Entity&quot;&gt;port&lt;/span&gt;) {|&lt;span class=&quot;Variable&quot;&gt;http&lt;/span&gt;|
       response &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; http.&lt;span class=&quot;Entity&quot;&gt;head&lt;/span&gt;(uri.&lt;span class=&quot;Entity&quot;&gt;path&lt;/span&gt;)
     }
&lt;span class=&quot;Comment&quot;&gt;     &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; .. response.content_type == &amp;quot;audio/mpeg&amp;quot;&lt;/span&gt;
     response.&lt;span class=&quot;Entity&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;200&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;rescue&lt;/span&gt;
    &lt;span class=&quot;Constant&quot;&gt;false&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

puts &lt;span class=&quot;Entity&quot;&gt;exists?&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;http://djspike.se/files/albums/6/31/DJ_SPIKE%20-%20Tight%20(demo).mp3&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;

	&lt;p&gt;I also found a plugin with similar goals but that actually downloads the entire target file instead of only getting the header (not a good idea when dealing with media files):
&lt;a href=&quot;http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/&quot;&gt;http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-05-20:132</id>
    <published>2009-05-20T07:56:00Z</published>
    <updated>2009-05-20T08:03:55Z</updated>
    <category term="globalize"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.rubyblocks.se/2009/5/20/how-to-disable-globalize-s-activerecord-logging" rel="alternate" type="text/html"/>
    <title>How to disable Globalize's ActiveRecord logging</title>
<content type="html">
            Here is how you disable the sometimes excessive logging that Globalize does:
&lt;pre class=&quot;blackboard&quot;&gt;
&lt;span class=&quot;Comment&quot;&gt;&lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Disables Globalize's ActiveRecord logging&lt;/span&gt;
&lt;span class=&quot;Keyword&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;Globalize&lt;/span&gt;
 &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;DbViewTranslator&lt;/span&gt;
   &lt;span class=&quot;Keyword&quot;&gt;alias_method&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;orig_fetch_view_translation&lt;/span&gt;, &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;fetch_view_translation&lt;/span&gt;   
   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;fetch_view_translation&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;key&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; language&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; idx&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; namespace &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;,&lt;/span&gt; original_caller &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;nil&lt;/span&gt;&lt;/span&gt;)
     &lt;span class=&quot;Support&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;Entity&quot;&gt;Base&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;silence&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
       &lt;span class=&quot;Entity&quot;&gt;orig_fetch_view_translation&lt;/span&gt;(key, language, idx, namespace, original_caller)
     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
 &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;

	&lt;p&gt;This tip is originally from &lt;a href=&quot;http://www.artweb-design.de/2007/9/16/disable-globalize-viewtranslation-sql-logging&quot;&gt;http://www.artweb-design.de/2007/9/16/disable-globalize-viewtranslation-sql-logging&lt;/a&gt;, but I had to adapt it a bit to work with my globalize version.&lt;/p&gt;


	&lt;p&gt;If this does not work with your version of globalize, then just check how it&#8217;s implemented in &#8220;lib/globalize/localization/db_view_translator.rb&#8221; and adapt the patch.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-05-19:131</id>
    <published>2009-05-19T06:43:00Z</published>
    <updated>2009-05-19T06:51:17Z</updated>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="rubyee"/>
    <category term="specs"/>
    <link href="http://www.rubyblocks.se/2009/5/19/using-ruby-ee-in-development" rel="alternate" type="text/html"/>
    <title>Using Ruby EE in development</title>
<content type="html">
            &lt;p&gt;It&#8217;s common knowledge that using Ruby Enterprise Edition on your server is a good idea, but how many of us use it on our development boxes?&lt;/p&gt;


	&lt;p&gt;I recently started using &lt;a href=&quot;http://www.rubyenterpriseedition.com/download.html&quot;&gt;Ruby EE&lt;/a&gt; in my development environment and it has decreased the time it takes to run my specs with about 20% as compared to Ruby 1.8.6.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-05-15:129</id>
    <published>2009-05-15T08:52:00Z</published>
    <updated>2009-05-15T09:04:44Z</updated>
    <category term="leopard"/>
    <category term="macosx"/>
    <category term="mysql"/>
    <category term="rails"/>
    <link href="http://www.rubyblocks.se/2009/5/15/installing-mysql-and-the-mysql-gem-on-mac-os-x-leopard" rel="alternate" type="text/html"/>
    <title>Installing mysql and the mysql gem on Mac OS X Leopard</title>
<content type="html">
            &lt;p&gt;I had some trouble getting the mysql gem to work in Leopard on my new macbook and it turned out that I had installed the 64bit version of mysql and even though the mysql gem compiles against that, it does not work.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;To begin with I got alerted to this by the warning message:&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;DEPRECATION WARNING&lt;/span&gt;: You&#8217;re using the Ruby-based MySQL library that ships with Rails&#8230;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;The kinds of errors you might see when using the 64 bit version of mysql is:&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;LoadError: Failed to lookup Init function /usr/lib/ruby-ee/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;How to install a version that works:&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;1) Get the 32 bit x86 version from &lt;a href=&quot;http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg&quot;&gt;http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg&lt;/a&gt; and install.&lt;/p&gt;


	&lt;p&gt;3) Make sure you got it installed propertly (open a terminal and type mysql -v).&lt;/p&gt;


	&lt;p&gt;4) &lt;pre class=&quot;blackboard&quot;&gt;env &lt;span class=&quot;Variable&quot;&gt;ARCHFLAGS&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;-arch i386&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; sudo gem install mysql &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;
&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;with&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;mysql&lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;config&lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;usr&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;/&lt;/span&gt;&lt;/span&gt;local&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;mysql&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;bin&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;mysql_config
&lt;/pre&gt;&lt;/p&gt;


	&lt;p&gt;5) Done :)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-04-03:118</id>
    <published>2009-04-03T16:11:00Z</published>
    <updated>2009-04-03T16:12:36Z</updated>
    <category term="cruisecontrol"/>
    <category term="ruby"/>
    <category term="telldus"/>
    <link href="http://www.rubyblocks.se/2009/4/3/script-to-show-cruisecontrol-status-with-lava-lamps" rel="alternate" type="text/html"/>
    <title>Script to show CruiseControl status with lava lamps</title>
<content type="html">
            &lt;br /&gt;
&lt;p&gt;
We've been using this script at work to show the build status using lava lamps =).
&lt;/p&gt;
&lt;p&gt;
To control the lamps we use a &lt;a href=&quot;http://www.telldus.se/products/show_product.php?name=TS001&quot;&gt;TellStick&lt;/a&gt; which is a transmitter that plugs into USB and lets us control wireless remote switches.
&lt;/p&gt;

&lt;a href=&quot;http://gist.github.com/89810&quot;&gt;http://gist.github.com/89810&lt;/a&gt;:

          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-01-20:104</id>
    <published>2009-01-20T17:18:00Z</published>
    <updated>2009-01-20T17:29:39Z</updated>
    <category term="aasm"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="statemachine"/>
    <link href="http://www.rubyblocks.se/2009/1/20/acts-as-state-machine-not-saving-to-the-database" rel="alternate" type="text/html"/>
    <title>Acts as state machine not saving to the database?</title>
<content type="html">
            &lt;p&gt;Just wasted a bit of time figuring out why my tests ran just fine, while trying to enter a state when actually using the app failed. Turns out that because I do not touch the database in my state machine specs I had no chance of discovering that I had written &#8220;&lt;strong&gt;aasm_event :foo! do&lt;/strong&gt;&#8221; instead of &#8220;&lt;strong&gt;aasm_event :foo do&lt;/strong&gt;&#8221; (see that extra &#8220;&lt;strong&gt;!&lt;/strong&gt;&#8221;?)... D&#8217;oh. Hope this can be of help to anyone else that accidentally adds an ! to a aasm_event :).&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2009-01-15:103</id>
    <published>2009-01-15T17:12:00Z</published>
    <updated>2009-01-15T17:21:43Z</updated>
    <category term="cruisecontrol"/>
    <category term="integration"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.rubyblocks.se/2009/1/15/increasing-the-maximum-build-log-size-for-cruisecontrol-rb" rel="alternate" type="text/html"/>
    <title>Increasing the maximum build log size for CruiseControl.rb</title>
<content type="html">
            &lt;p&gt;I used the following to allow logs larger than 100KB in CruiseControl.rb:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
&lt;span class=&quot;Comment&quot;&gt; &lt;span class=&quot;Comment&quot;&gt;#&lt;/span&gt; Number of times more logging than the default &lt;/span&gt;
 &lt;span class=&quot;Variable&quot;&gt;MORE_LOGGING&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;5&lt;/span&gt;

 &lt;span class=&quot;Support&quot;&gt;Build&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;class_eval&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;

   &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;contents_for_display&lt;/span&gt;(&lt;span class=&quot;Variable&quot;&gt;file&lt;/span&gt;)
     &lt;span class=&quot;Keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;file?&lt;/span&gt;(file) &lt;span class=&quot;Keyword&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;readable?&lt;/span&gt;(file)
     &lt;span class=&quot;Keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;size&lt;/span&gt;(file) &lt;span class=&quot;Keyword&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;1024&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;MORE_LOGGING&lt;/span&gt;
       &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;read&lt;/span&gt;(file)
     &lt;span class=&quot;Keyword&quot;&gt;else&lt;/span&gt;
       contents &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;read&lt;/span&gt;(file, &lt;span class=&quot;Constant&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;MORE_LOGGING&lt;/span&gt;)
       &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;#{&lt;/span&gt;file&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt; is over &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;MORE_LOGGING&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt; kbytes - too big to&lt;/span&gt;
&lt;span class=&quot;String&quot;&gt;        display in the dashboard, output is truncated&lt;span class=&quot;Constant&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;#{&lt;/span&gt;contents&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
     &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
   &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

 &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-12-18:102</id>
    <published>2008-12-18T13:02:00Z</published>
    <updated>2008-12-19T10:17:50Z</updated>
    <category term="ruby"/>
    <category term="stderr"/>
    <link href="http://www.rubyblocks.se/2008/12/18/temporaraly-disable-kernel-warn-stderr" rel="alternate" type="text/html"/>
    <title>Temporaraly disable Kernel.warn (stderr)</title>
<content type="html">
            &lt;p&gt;If you call some code that print warnings to stderr (like Kernel.warn) that can be safetly ignored, you can use this trick to temporaraly turn off stderr:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
  &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;stderr&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;open&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;/dev/null&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;w&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
  code_that_prints_to_stderr
  &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;stderr&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;STDERR&lt;/span&gt;
&lt;/pre&gt;

	&lt;p&gt;Or you cound wrap it in a block:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
  &lt;span class=&quot;Keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;Entity&quot;&gt;disable_warnings&lt;/span&gt;
    &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;stderr&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;open&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;/dev/null&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;w&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
    &lt;span class=&quot;Keyword&quot;&gt;yield&lt;/span&gt;
    &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;$&lt;/span&gt;stderr&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;STDERR&lt;/span&gt;
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;

  disable_warnings &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
    code_that_prints_to_stderr
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;
Just learned that if you&#8217;re in the context of a rails app you can do:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
  silence_warnings &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
    code_that_prints_to_stderr
  &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-10-29:14</id>
    <published>2008-10-29T16:27:00Z</published>
    <updated>2008-10-29T16:31:30Z</updated>
    <category term="controller"/>
    <category term="filter_parameter_logging"/>
    <category term="logging"/>
    <category term="rails"/>
    <category term="rspec"/>
    <category term="ruby"/>
    <category term="security"/>
    <link href="http://www.rubyblocks.se/2008/10/29/testing-filter_parameter_logging-using-rspec" rel="alternate" type="text/html"/>
    <title>Testing filter_parameter_logging using RSpec</title>
<content type="html">
            &lt;p&gt;One way of speccing parameter filtering.&lt;/p&gt;


Controller:
&lt;pre class=&quot;blackboard&quot;&gt;
    &lt;span class=&quot;Support&quot;&gt;filter_parameter_logging&lt;/span&gt; &lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;password&lt;/span&gt;
&lt;/pre&gt;

Spec:
&lt;pre class=&quot;blackboard&quot;&gt;
    it &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;should filter password&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;Support&quot;&gt;before_filter&lt;/span&gt;, &lt;span class=&quot;Support&quot;&gt;after_filter&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; {}, {}
      &lt;span class=&quot;Support&quot;&gt;before_filter&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;user&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; { &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;username&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;=&amp;gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;foo&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;password&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;=&amp;gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;bar&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; }
      &lt;span class=&quot;Support&quot;&gt;after_filter&lt;/span&gt;[&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;user&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; { &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;username&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;=&amp;gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;foo&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;password&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;=&amp;gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;[FILTERED]&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt; }      
      controller.&lt;span class=&quot;Entity&quot;&gt;filter_parameters&lt;/span&gt;(&lt;span class=&quot;Support&quot;&gt;before_filter&lt;/span&gt;).&lt;span class=&quot;Entity&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;Support&quot;&gt;after_filter&lt;/span&gt;
    &lt;span class=&quot;Keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-10-20:13</id>
    <published>2008-10-20T08:08:00Z</published>
    <updated>2008-10-20T08:14:37Z</updated>
    <category term="dates"/>
    <category term="javascript"/>
    <category term="jquery"/>
    <category term="localization"/>
    <category term="rails"/>
    <link href="http://www.rubyblocks.se/2008/10/20/localized-dates-with-jquery" rel="alternate" type="text/html"/>
    <title>Localized dates in rails using JQuery</title>
<content type="html">
            &lt;p&gt;A little snipplet for localizing dates clientside with some unobtrusive javascript. Please note that this does result in different outputs in different browsers. I&#8217;ve used a regexp to remove the time difference (ex. &lt;span class=&quot;caps&quot;&gt;GMT&lt;/span&gt;+2000) to give it a cleaner look.&lt;/p&gt;


On the server side simply print the date:
&lt;pre class=&quot;blackboard&quot;&gt;
   &lt;span class=&quot;Keyword&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;Keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;date&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class=&quot;Keyword&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;%=&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;&lt;span class=&quot;Variable&quot;&gt;@&lt;/span&gt;user&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;created_at&lt;/span&gt; &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;%&amp;gt;&lt;/span&gt;&amp;lt;/div&lt;span class=&quot;String&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

Then in your javascript (for example application.js), do something like this:
&lt;pre class=&quot;blackboard&quot;&gt;
    jQuery.&lt;span class=&quot;Entity&quot;&gt;each&lt;/span&gt;($(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;.date&lt;span class=&quot;String&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;), &lt;span class=&quot;Entity&quot;&gt;function&lt;/span&gt;() {        
      var new_date &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;Date&lt;/span&gt;(&lt;span class=&quot;Support&quot;&gt;Date&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;parse&lt;/span&gt;($(this).&lt;span class=&quot;Entity&quot;&gt;text&lt;/span&gt;())).&lt;span class=&quot;Entity&quot;&gt;toLocaleString&lt;/span&gt;();
      new_date &lt;span class=&quot;Keyword&quot;&gt;=&lt;/span&gt; new_date.&lt;span class=&quot;Entity&quot;&gt;replace&lt;/span&gt;(&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;GMT|UTC&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;[&lt;/span&gt;+-&lt;span class=&quot;String&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;{&lt;/span&gt;4&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;|&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;{&lt;/span&gt;2&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt;:&lt;span class=&quot;Constant&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;{&lt;/span&gt;2&lt;span class=&quot;String&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;|&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;\(&lt;/span&gt;.+&lt;span class=&quot;Constant&quot;&gt;\)&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;/&lt;/span&gt;&lt;/span&gt;gi, &lt;span class=&quot;String&quot;&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;String&quot;&gt;'&lt;/span&gt;&lt;/span&gt;);
      $(this).&lt;span class=&quot;Entity&quot;&gt;text&lt;/span&gt;(new_date);
    });
&lt;/pre&gt;

	&lt;p&gt;I have verified that this works in Firefox, Opera, Safari, Chrome and &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-08-12:12</id>
    <published>2008-08-12T11:13:00Z</published>
    <updated>2008-08-12T11:17:26Z</updated>
    <category term="exceptions"/>
    <category term="hoptoad"/>
    <category term="merb"/>
    <category term="ruby"/>
    <link href="http://www.rubyblocks.se/2008/8/12/merb-client-for-hoptoad" rel="alternate" type="text/html"/>
    <title>Merb client for hoptoad</title>
<content type="html">
            &lt;p&gt;I&#8217;ve written a basic merb client for &lt;a href=&quot;http://www.hoptoadapp.com/&quot;&gt;hoptoad&lt;/a&gt; (an online exception logger), you can find it at:
&lt;a href=&quot;http://github.com/joakimk/hoptoad_notifier_merb&quot;&gt;http://github.com/joakimk/hoptoad_notifier_merb&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-08-01:11</id>
    <published>2008-08-01T08:06:00Z</published>
    <updated>2008-09-03T07:36:07Z</updated>
    <category term="git"/>
    <category term="macosx"/>
    <link href="http://www.rubyblocks.se/2008/8/1/installing-gitnub" rel="alternate" type="text/html"/>
    <title>Installing GitNub</title>
<content type="html">
            &lt;p&gt;A script to install the &lt;a href=&quot;http://github.com/Caged/gitnub/wikis&quot;&gt;GitNub&lt;/a&gt; utility (MacOSX Leopard).&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Had some problems when I reinstalled this version but it seems that they have fixed it in the latest version.&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
wget http&lt;span class=&quot;Constant&quot;&gt;&lt;span class=&quot;Constant&quot;&gt;:&lt;/span&gt;/&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;s3.&lt;span class=&quot;Entity&quot;&gt;amazonaws&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;caged&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;releases&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;GitNub_0&lt;/span&gt;.&lt;span class=&quot;Constant&quot;&gt;9.0&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;zip&lt;/span&gt;
unzip &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;o &lt;span class=&quot;Variable&quot;&gt;GitNub_0&lt;/span&gt;.&lt;span class=&quot;Constant&quot;&gt;9.0&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;zip&lt;/span&gt;
cd &lt;span class=&quot;Variable&quot;&gt;GitNub&lt;/span&gt;
sudo cp &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;r &lt;span class=&quot;Support&quot;&gt;GitNub&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;Applications&lt;/span&gt;
sudo cp nub &lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;usr&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;local&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;bin
cd ..
rm &lt;span class=&quot;Keyword&quot;&gt;-&lt;/span&gt;rf &lt;span class=&quot;Variable&quot;&gt;GitNub&lt;/span&gt; &lt;span class=&quot;Variable&quot;&gt;GitNub_0&lt;/span&gt;.&lt;span class=&quot;Constant&quot;&gt;9.0&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;zip&lt;/span&gt;
sudo &lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;Library&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;Frameworks&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Support&quot;&gt;Ruby&lt;/span&gt;.&lt;span class=&quot;Entity&quot;&gt;framework&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Variable&quot;&gt;Versions&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;Constant&quot;&gt;1.8&lt;/span&gt;&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;usr&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;bin&lt;span class=&quot;Keyword&quot;&gt;/&lt;/span&gt;gem install open4
&lt;/pre&gt;

	&lt;p&gt;Added the special install line for open4 because of issues others had with it (10810 errors)...&lt;/p&gt;


	&lt;p&gt;To open a repo, just type &#8216;nub&#8217; in a git repo.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-06-29:10</id>
    <published>2008-06-29T12:31:00Z</published>
    <updated>2008-06-29T12:38:28Z</updated>
    <category term="controller"/>
    <category term="rails"/>
    <category term="rspec"/>
    <category term="specs"/>
    <link href="http://www.rubyblocks.se/2008/6/29/rspec-controller-specs-gotcha" rel="alternate" type="text/html"/>
    <title>RSpec controller specs gotcha...</title>
<content type="html">
            &lt;p&gt;Another little tip. If you&#8217;re using an IP-based check for access (for example an before_filter in application.rb), the controller specs will fail (silently) to do anything for the &#8216;get&#8217;, &#8216;put&#8217;, &#8216;update&#8217;, ... unless you include &#8216;0.0.0.0&#8217; as a valid ip.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.rubyblocks.se/">
    <author>
      <name>joakimk</name>
    </author>
    <id>tag:www.rubyblocks.se,2008-06-29:9</id>
    <published>2008-06-29T10:04:00Z</published>
    <updated>2008-06-29T10:10:44Z</updated>
    <category term="linux"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="sqlite3"/>
    <category term="ubuntu"/>
    <link href="http://www.rubyblocks.se/2008/6/29/sqlite3-problem-on-ubuntu" rel="alternate" type="text/html"/>
    <title>SQLite3 problem on Ubuntu</title>
<content type="html">
            &lt;p&gt;If you install the &#8220;sqlite3-ruby&#8221; gem and it prints something like this:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.2.2
1 gem installed
Installing ri documentation for sqlite3-ruby-1.2.2...
Installing RDoc documentation for sqlite3-ruby-1.2.2...
&lt;/pre&gt;

	&lt;p&gt;And when you try to use it in your rails application you get an error like this:&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
rake aborted!
no such file to load -- sqlite3/database

(See full trace by running task with --trace)
&lt;/pre&gt;

	&lt;p&gt;You&#8217;re probably missing the libsqlite3-ruby package.&lt;/p&gt;


&lt;pre class=&quot;blackboard&quot;&gt;
sudo apt-get install libsqlite3-ruby
&lt;/pre&gt;
          </content>  </entry>
</feed>
