<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Labuschin's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 16:43:11 GMT</pubDate>
    <description>DZone Snippets: Labuschin's Code Snippets</description>
    <item>
      <title>Create strings for SEO-friendly URLs</title>
      <link>http://snippets.dzone.com/posts/show/4579</link>
      <description>this method returns string, which is perfect for SEO-friendly URLs. &lt;br /&gt;&lt;br /&gt;features: &lt;br /&gt;- converts every improper character to a hyphen&lt;br /&gt;- returns a lowercase string&lt;br /&gt;&lt;br /&gt;I POSTED AN EVEN BETTER METHOD ON MY BLOG: http://tinyurl.com/2vurbq&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def create_callname (title)&lt;br /&gt;	title.downcase.gsub(/[^a-z0-9]+/i, '-')&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:53:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4579</guid>
      <author>labuschin (Martin Labuschin)</author>
    </item>
    <item>
      <title>Elegant way of shorten a text string</title>
      <link>http://snippets.dzone.com/posts/show/4578</link>
      <description>this method shortens a plain text string down to complete words contained in given scope (count)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def shorten (string, count = 30)&lt;br /&gt;	if string.length &gt;= count &lt;br /&gt;		shortened = string[0, count]&lt;br /&gt;		splitted = shortened.split(/\s/)&lt;br /&gt;		words = splitted.length&lt;br /&gt;		splitted[0, words-1].join(" ") + ' ...'&lt;br /&gt;	else &lt;br /&gt;		string&lt;br /&gt;	end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:47:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4578</guid>
      <author>labuschin (Martin Labuschin)</author>
    </item>
    <item>
      <title>automate linking to Twitter users</title>
      <link>http://snippets.dzone.com/posts/show/4577</link>
      <description>this method searches for @some_user in a string (txt) and links found matches to the twitter-page of some_user&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def link_twitter_user(txt)&lt;br /&gt;	if match = txt.match(/.*?(@)((?:[a-z][a-z]+))(:|\s)/i)&lt;br /&gt;		user = match[2]&lt;br /&gt;		txt.gsub!(user, '&lt;a href="http://twitter.com/' + user + '"&gt;' + user + '&lt;/a&gt;')&lt;br /&gt;	end&lt;br /&gt;	txt&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:36:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4577</guid>
      <author>labuschin (Martin Labuschin)</author>
    </item>
  </channel>
</rss>
