<?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>Girl with Computer &#187; Ruby</title>
	<atom:link href="http://www.girlwithcomputer.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.girlwithcomputer.com</link>
	<description>== exactly that.</description>
	<lastBuildDate>Sun, 18 Sep 2011 22:47:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Sinatra Project</title>
		<link>http://www.girlwithcomputer.com/sinatra/</link>
		<comments>http://www.girlwithcomputer.com/sinatra/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 03:54:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://www.girlwithcomputer.com/sinatra/</guid>
		<description><![CDATA[I lovelovelove Sinatra. (SinatraRB.com) I created a very simple app (the fortune cookie generator I mentioned in an earlier post) to play with styling/views, get and post requests, and the very bare bones workings of Sinatra. I absolutely love how pure and simple it is. The structuring is a bit confusing at first, but the [...]]]></description>
			<content:encoded><![CDATA[<p>I lovelovelove Sinatra. (SinatraRB.com) I created a very simple app (the fortune cookie generator I mentioned in an earlier post) to play with styling/views, get and post requests, and the very bare bones workings of Sinatra. I absolutely love how pure and simple it is. The structuring is a bit confusing at first, but the Sinatra Peepcode video helped me a lot on this: <a href="http://peepcode.com/products/sinatra">http://peepcode.com/products/sinatra</a></p>
<p> In the Peepcode video, they make a Sinatra app in one file, and then break it down from there into separate files. It&#8217;s good to see how everything CAN fit in one file. This is how I learned CSS, actually&#8211; by putting my styles in with the rest of my website. Once I realized you put the CSS in a separate file, I had a mini epiphany: sometimes it&#8217;s best to put things together before you take them apart. Then you can truly appreciate the fragmentation of a given application and truly understand the purpose of breaking things up for simplicity&#8217;s sake. Seeing this helped me understand a lot about Sinatra, and even shed some light for me on why Rails is the way it is, as well. </p>
<p>So, dundundun: I made this: <a href="http://fortunefinder.heroku.com">http://fortunefinder.heroku.com </a></p>
<p>Don&#8217;t judge my poor styling and wacky coloration. <img src='http://www.girlwithcomputer.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  This really was just a silly little experiment to play with the basic features of Sinatra. Now that I understand the basics, I&#8217;m moving on to another project confidently. I&#8217;ll still probably tweak this one a little, too. Just for fun.</p>
<p>You can check out the code on github at <a href="http://github.com/ashumz/fortunefinder">http://github.com/ashumz/fortunefinder</a> Nothing special, but might help a Sinatra newbie get a feel for the basic set up of a simple app.</p>
<p><script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><br />
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11489803-1");
pageTracker._trackPageview();
} catch(err) {}</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.girlwithcomputer.com/sinatra/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Defining Useful Methods in Ruby: Adding a rand method to the Array Class</title>
		<link>http://www.girlwithcomputer.com/defining-useful-methods-in-ruby/</link>
		<comments>http://www.girlwithcomputer.com/defining-useful-methods-in-ruby/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 02:07:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.girlwithcomputer.com/defining-useful-methods-in-ruby/</guid>
		<description><![CDATA[The &#8216;rand&#8217; method in Ruby is a method of the Kernel class that generate a random float between 0 and 1 (and thus will always round down to 0 when converting to an int.) Being a new Ruby developer, I decided to make an array and try to pull a random element like so:
@name=%w[bob, judy, [...]]]></description>
			<content:encoded><![CDATA[<p>The &#8216;rand&#8217; method in Ruby is a method of the Kernel class that generate a random float between 0 and 1 (and thus will always round down to 0 when converting to an int.) Being a new Ruby developer, I decided to make an array and try to pull a random element like so:</p>
<p><em>@name=%w[bob, judy, don, john]<br />
@get_random_name = @name[rand]<br />
</em><br />
But this will always return &#8216;bob&#8217;, the 0th element of the array. </p>
<p>Instead, to pull a random element from an array (of any length), you need:</p>
<p><em>@get_random_name= @name[rand(@name.length)]</em></p>
<p>But that&#8217;s icky and unRubyish, and Ruby really SHOULD have a rand method for the Array class, shouldn&#8217;t it? So let&#8217;s make one, because we can! <img src='http://www.girlwithcomputer.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code>class Array<br />
  def rand<br />
    self[super(self.length)]<br />
  end<br />
end<br />
</code></p>
<p>@name.rand will now return a random element from the array. Awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.girlwithcomputer.com/defining-useful-methods-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sinatra: The answer to my Ruby GUI problem</title>
		<link>http://www.girlwithcomputer.com/ruby-to-gui-or-not-to-gui/</link>
		<comments>http://www.girlwithcomputer.com/ruby-to-gui-or-not-to-gui/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:00:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Sinatra]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ruby gui]]></category>

		<guid isPermaLink="false">http://www.girlwithcomputer.com/ruby-to-gui-or-not-to-gui/</guid>
		<description><![CDATA[Ruby and GUI&#8217;s have been on the forefront of my brain lately because I&#8217;ve been playing around with fun ways to program with Ruby. I am honestly bored of command line programs, and for good reason: the command line isn&#8217;t pretty enough for me. Since I&#8217;ve had problems installing Shoes and Hackety Hack on my [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby and GUI&#8217;s have been on the forefront of my brain lately because I&#8217;ve been playing around with fun ways to program with Ruby. I am honestly bored of command line programs, and for good reason: the command line isn&#8217;t pretty enough for me. Since I&#8217;ve had problems installing Shoes and Hackety Hack on my version of Ubuntu, I asked one of my friends who uses Ruby frequently if there were other GUI options. There are options, but he referred to them as a bit of a mess to implement and pointed out that javascript and the web make for better uses of, what I would call, &#8220;fun Ruby.&#8221; Better yet, when you program for the web, everyone can use your program without worrying about what platform they are on. </p>
<p>So, I gave this a little thought. I started getting jealous and even a little frustrated at Python programmers and their connectedness with GUI&#8217;s and their pride in Python&#8217;s support for GUI&#8217;s. Apparently, Ruby has similar support, but it&#8217;s not nearly as widely embraced amongst Rubyists as it is in the Python community. (True? False? opinions?) Admittedly, I think I should have just learned visual basic and got my GUI fix 10 years ago. (I don&#8217;t particularly want to learn Python, and there are issues with it&#8217;s syntax that have turned me off pretty heavily.)</p>
<p>So, I have decided that the best course of action, given my new fixation on Sinatra, is to begin a jquery/javascript and Ruby project. Although I&#8217;ve been making websites for about 10 years, they have generally been informative, usually static, very low level applications of HTML, CSS, and bits and pieces of PHP. I have used javascript for fun little menus now and again, but honestly I&#8217;m a total copy/paster when it comes to js. I started recently on some javascript tutorials, but was then quickly reprimanded: SKIP TO JQUERY, says everyone. Unless you really wanna become a pro in javascript, it sounds like jquery is a nice shortcut to the overwhelming syntax (especially coming from Ruby!) and implementations of javascript. I can&#8217;t quite figure out a consistency of why and how something does what in javascript. But, if I can figure out what I want the code to do, I&#8217;m pretty sure I can figure out how to use jquery to get the job done. We&#8217;ll see.</p>
<p>I am going to begin working on a blog that is purely in javascript, using jquery, and also uses Sinatra. I&#8217;m going to use sqlite for the DB. Did I mention I have very little experience with DB&#8217;s, too? <img src='http://www.girlwithcomputer.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Okay, this project, honestly, seems a little over my head to me right now. But once complete, I think I will have experience with all of these pieces I need to make a pretty, fun, and useful application. Something every programmer craves&#8211; right?! <img src='http://www.girlwithcomputer.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Updates to follow. Thanks to <a href="http://juliocapote.com">Julio</a> for helping me come up with the idea on how to practice messing with all of the components I&#8217;m craving: Ruby, Sinatra, Javascript/Jquery, Sqlite, ERB, CSS&#8230; wee! This brings up another point about how multilingual and implementation exposure at the early stages of learning a programming language can be so incredibly integral to understanding how to best utilize a programming language like Ruby&#8230; but that&#8217;s for another post! Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.girlwithcomputer.com/ruby-to-gui-or-not-to-gui/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

