<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: ruby code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 23:03:18 GMT</pubDate>
    <description>DZone Snippets: ruby code</description>
    <item>
      <title>Deploying on a passenger / mod_rails host with capistrano</title>
      <link>http://snippets.dzone.com/posts/show/5466</link>
      <description>// add this to deploy.rb&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;namespace :mod_rails do&lt;br /&gt;  desc &lt;&lt;-DESC&lt;br /&gt;  Restart the application altering tmp/restart.txt for mod_rails.&lt;br /&gt;  DESC&lt;br /&gt;  task :restart, :roles =&gt; :app do&lt;br /&gt;    run "touch  #{release_path}/tmp/restart.txt"&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;namespace :deploy do&lt;br /&gt;  %w(start restart).each { |name| task name, :roles =&gt; :app do mod_rails.restart end }&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 06 May 2008 05:25:13 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5466</guid>
      <author>jerome ()</author>
    </item>
    <item>
      <title>Initial caps with ruby on rails</title>
      <link>http://snippets.dzone.com/posts/show/4972</link>
      <description>&lt;code&gt;&lt;br /&gt;class String&lt;br /&gt;  # unicode_str.initial_caps =&gt; new_str&lt;br /&gt;  # returns a copy of a string with initial capitals&lt;br /&gt;  # "Jules-&#201;douard".initial_caps =&gt; "J.&#201;."&lt;br /&gt;  def initial_caps&lt;br /&gt;    self.tr('-', ' ').split(' ').map { |word| word.chars.first.upcase.to_s + "." }.join&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 10 Jan 2008 12:41:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4972</guid>
      <author>jerome ()</author>
    </item>
    <item>
      <title>A SEO-compliant slug for your titles</title>
      <link>http://snippets.dzone.com/posts/show/4948</link>
      <description>&lt;code&gt;&lt;br /&gt;# This instance method can handle any latin string&lt;br /&gt;&lt;br /&gt;require 'unicode'&lt;br /&gt;&lt;br /&gt;class String&lt;br /&gt;  def to_slug&lt;br /&gt;    str = Unicode.normalize_KD(self).gsub(/[^\x00-\x7F]/n,'')&lt;br /&gt;    str = str.gsub(/\W+/, '-').gsub(/^-+/,'').gsub(/-+$/,'').downcase&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 05 Jan 2008 10:03:43 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4948</guid>
      <author>jerome ()</author>
    </item>
  </channel>
</rss>
