<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cylence, Inc. &#187; Sinatra</title>
	<atom:link href="http://blog.cylence.com/category/sinatra/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cylence.com</link>
	<description>Elegance in Technology</description>
	<lastBuildDate>Wed, 16 Mar 2011 20:16:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Listing Social Networks in Ruby</title>
		<link>http://blog.cylence.com/2010/06/25/listing-social-networks-in-ruby/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=listing-social-networks-in-ruby</link>
		<comments>http://blog.cylence.com/2010/06/25/listing-social-networks-in-ruby/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 06:03:04 +0000</pubDate>
		<dc:creator>Ryan Cross</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://blog.cylence.com/?p=150</guid>
		<description><![CDATA[I spent a little time tonight working on The Enclave's new member page. The site overall is the most beautiful thing in the world, but I have been using it as an excuse to plan more with Sinatra. Tonight, I found the need to provide a way for our members to list their social networks [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a little time tonight working on <a href="http://enclavecoop.com">The Enclave's</a> new <a href="http://enclavecoop.com/members">member page</a>.  The site overall is the most beautiful thing in the world, but I have been using it as an excuse to plan more with <a href="http://www.sinatrarb.com/">Sinatra</a>.</p>
<p>Tonight, I found the need to provide a way for our members to list their social networks should they choose to do so.  The obvious way was to add a list of anchor tags.  I found this to be rather distasteful.  I mean, we are dealing with Ruby here, right?  So, I started by considering what I wanted the UI code to look like.  Would do I want to have to work with on a weekly basis.  I came up with the following:</p>
<p><script src="http://gist.github.com/453831.js"></script></p>
<p>This would allow me to add as many usernames and networks as I desired.  Perfect!  So I began to work on the code that would make this function as intended.  I came up with the following:</p>
<p><script src="http://gist.github.com/453827.js"></script></p>
<p>So, basically, I list all of the networks I want to use.  This list not only includes the URL (and a place holder for the username), but any prefix or suffix for the displayed username for which I might find a need (i.e.: Twitter's "@" in "@slant")  Next, the script iterates through my list, catching each network as it does so.  Each time the script reaches a network, it proceeds through each username in the list, building an appropriate anchor tag for each one.</p>
<p><script src="http://gist.github.com/453837.js"></script></p>
<p>In the end, you have a beautiful categorized list of usernames, each linking to their respective page.</p>
<div class="wp_syntax">
<div class="code">linkedin: <a href="http://www.linkedin.com/in/ryanlcross">ryanlcross</a> | facebook: <a href="http://www.facebook.com/rcross">rcross</a> | twitter: <a href="http://twitter.com/slant">@slant</a>, <a href="http://twitter.com/cylenceweb">@cylenceweb</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cylence.com/2010/06/25/listing-social-networks-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

