<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/ruby</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Mon, 13 Feb 2012 23:17:17 GMT</pubDate>
<item>
<title>(Ruby) betadata.rb - bsrinivasan92</title>
<link>http://snipplr.com/view/62928/betadatarb/</link>
<description><![CDATA[ <p>ruby file</p> ]]></description>
<pubDate>Tue, 31 Jan 2012 12:26:01 GMT</pubDate>
<guid>http://snipplr.com/view/62928/betadatarb/</guid>
</item>
<item>
<title>(Ruby) Inventor class - bsrinivasan92</title>
<link>http://snipplr.com/view/62921/inventor-class/</link>
<description><![CDATA[ <p>class</p> ]]></description>
<pubDate>Tue, 31 Jan 2012 07:24:52 GMT</pubDate>
<guid>http://snipplr.com/view/62921/inventor-class/</guid>
</item>
<item>
<title>(Ruby) xml_creator.rb - bsrinivasan92</title>
<link>http://snipplr.com/view/62917/xmlcreatorrb/</link>
<description><![CDATA[ <p>xml creator</p> ]]></description>
<pubDate>Tue, 31 Jan 2012 05:01:21 GMT</pubDate>
<guid>http://snipplr.com/view/62917/xmlcreatorrb/</guid>
</item>
<item>
<title>(Ruby) split.rb - bsrinivasan92</title>
<link>http://snipplr.com/view/62915/splitrb/</link>
<description><![CDATA[ <p>split</p> ]]></description>
<pubDate>Tue, 31 Jan 2012 04:42:47 GMT</pubDate>
<guid>http://snipplr.com/view/62915/splitrb/</guid>
</item>
<item>
<title>(Ruby) Ruby: Search Spotify API - chrisaiv</title>
<link>http://snipplr.com/view/62785/ruby-search-spotify-api/</link>
<description><![CDATA[ <p>Simple test showing how to make a request to Spotify's API.</p> ]]></description>
<pubDate>Thu, 26 Jan 2012 10:04:01 GMT</pubDate>
<guid>http://snipplr.com/view/62785/ruby-search-spotify-api/</guid>
</item>
<item>
<title>(Ruby) Extract most common colors from an image - kellishaver</title>
<link>http://snipplr.com/view/62442/extract-most-common-colors-from-an-image/</link>
<description><![CDATA[ <p>Takes an image (path or url) and extracts the 7 most common colors and returns their hex values.</p> ]]></description>
<pubDate>Tue, 10 Jan 2012 10:27:12 GMT</pubDate>
<guid>http://snipplr.com/view/62442/extract-most-common-colors-from-an-image/</guid>
</item>
<item>
<title>(Ruby) Image Uploading in Ruby - kellishaver</title>
<link>http://snipplr.com/view/62410/image-uploading-in-ruby/</link>
<description><![CDATA[ <p>Checks to make sure the file is a valid image file, checks max file size, and directory write permissions, requires 'fileutils' gem.</p> ]]></description>
<pubDate>Mon, 09 Jan 2012 08:34:18 GMT</pubDate>
<guid>http://snipplr.com/view/62410/image-uploading-in-ruby/</guid>
</item>
<item>
<title>(Ruby) Function as Procedure in Method called on Hashes - ariellephan</title>
<link>http://snipplr.com/view/61875/function-as-procedure-in-method-called-on-hashes/</link>
<description><![CDATA[ <p>Learn Ruby the Hard Way</p> ]]></description>
<pubDate>Wed, 14 Dec 2011 09:40:41 GMT</pubDate>
<guid>http://snipplr.com/view/61875/function-as-procedure-in-method-called-on-hashes/</guid>
</item>
<item>
<title>(Ruby) Fetch remote JSON in Ruby - vestimir</title>
<link>http://snipplr.com/view/61726/fetch-remote-json-in-ruby/</link>
<description><![CDATA[ <p>An example method for fetching remote JSON data in Ruby.</p> ]]></description>
<pubDate>Wed, 07 Dec 2011 23:55:02 GMT</pubDate>
<guid>http://snipplr.com/view/61726/fetch-remote-json-in-ruby/</guid>
</item>
<item>
<title>(Ruby) Bulk insert in database - strato1986</title>
<link>http://snipplr.com/view/60878/bulk-insert-in-database/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 16 Nov 2011 12:14:28 GMT</pubDate>
<guid>http://snipplr.com/view/60878/bulk-insert-in-database/</guid>
</item>
<item>
<title>(Ruby) Ruby: Parsing Blackberry Download Reports - chrisaiv</title>
<link>http://snipplr.com/view/60688/ruby-parsing-blackberry-download-reports/</link>
<description><![CDATA[ <p>The Blackberry AppWorld portal allows you to schedule reports which are delivered as CSV.zip files. Although the CSV file offers a lot of detail about operating system and date of download, most of the time I just want to know which users downloaded the app from which countries.  So usually I choose "Country, then date", unpack the .zip and run this (verbose) ruby script.</p> ]]></description>
<pubDate>Thu, 10 Nov 2011 11:46:26 GMT</pubDate>
<guid>http://snipplr.com/view/60688/ruby-parsing-blackberry-download-reports/</guid>
</item>
<item>
<title>(Ruby) Finding strings in Files in Ruby - scruffpuff</title>
<link>http://snipplr.com/view/60592/finding-strings-in-files-in-ruby/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 07 Nov 2011 05:47:21 GMT</pubDate>
<guid>http://snipplr.com/view/60592/finding-strings-in-files-in-ruby/</guid>
</item>
<item>
<title>(Ruby) Singleton Pattern MacRuby - iloveitaly</title>
<link>http://snipplr.com/view/60462/singleton-pattern-macruby/</link>
<description><![CDATA[ <p>Works fine for MacRuby applications</p> ]]></description>
<pubDate>Wed, 02 Nov 2011 04:14:50 GMT</pubDate>
<guid>http://snipplr.com/view/60462/singleton-pattern-macruby/</guid>
</item>
<item>
<title>(Ruby) Ruby: SMPTE Converter - chrisaiv</title>
<link>http://snipplr.com/view/60327/ruby-smpte-converter/</link>
<description><![CDATA[ <p>If you need to do any sort of screen capturing using FFMPEG, you might need this one day</p> ]]></description>
<pubDate>Sat, 29 Oct 2011 03:09:28 GMT</pubDate>
<guid>http://snipplr.com/view/60327/ruby-smpte-converter/</guid>
</item>
<item>
<title>(Ruby) CPF and CNPJ validation classes using the Brazilian Government official algorithms - mabafu</title>
<link>http://snipplr.com/view/60227/cpf-and-cnpj-validation-classes-using-the-brazilian-government-official-algorithms/</link>
<description><![CDATA[ <p>#About#
CPF and CNPJ are self-validated codes generated by Brazilian government. Being the CPF used to identify persons and CNJP to enterprises, organizations and so on.

That said, I use to code the CPF/CNPJ algorithm when learning new programming languages. With Ruby, it got very clean and powerful because it's particular way to deal with "closures" (i.e. the ruby blocks, Procs and lambdas).


To use Cpf or Cnpj classes, just instantite the respective classes passing the numbers to be validated. CPF has 11 digits and CNPJ has 14. In both cases the last two digits are calculated based on the previous ones.

Module11 is the parent class of Cpf and Cnpj. You can use this class if you want to implement your own Module 11 validation algorithm. In this case, inherit from Module11  and initialize the new class with the proper parameters (i.e. input, formula, size, number_of_digits)</p> ]]></description>
<pubDate>Thu, 27 Oct 2011 03:06:50 GMT</pubDate>
<guid>http://snipplr.com/view/60227/cpf-and-cnpj-validation-classes-using-the-brazilian-government-official-algorithms/</guid>
</item>
<item>
<title>(Ruby) List an object's methods - arpit</title>
<link>http://snipplr.com/view/59670/list-an-objects-methods/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 12 Oct 2011 16:06:34 GMT</pubDate>
<guid>http://snipplr.com/view/59670/list-an-objects-methods/</guid>
</item>
<item>
<title>(Ruby) Calculate Standard Deviation in Ruby - vinotht</title>
<link>http://snipplr.com/view/58079/calculate-standard-deviation-in-ruby/</link>
<description><![CDATA[ <p>This below code is for calculate standard deviation in Ruby on Rails. Here the data set is given in a array. To know more about standard deviation calculations @ *[Standard Deviation Calculator](http://ncalculators.com/statistics/mean-standard-deviation-calculator.htm "Standard Deviation Calculator")*</p> ]]></description>
<pubDate>Mon, 22 Aug 2011 12:43:52 GMT</pubDate>
<guid>http://snipplr.com/view/58079/calculate-standard-deviation-in-ruby/</guid>
</item>
<item>
<title>(Ruby) Ruby CSV writing and reading example with quotes, line breaks and commas in the fields - m1b</title>
<link>http://snipplr.com/view/58018/ruby-csv-writing-and-reading-example-with-quotes-line-breaks-and-commas-in-the-fields/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 19 Aug 2011 05:51:04 GMT</pubDate>
<guid>http://snipplr.com/view/58018/ruby-csv-writing-and-reading-example-with-quotes-line-breaks-and-commas-in-the-fields/</guid>
</item>
<item>
<title>(Ruby) Ruby class and instance variables lifecycle across inheritance demo - m1b</title>
<link>http://snipplr.com/view/57956/ruby-class-and-instance-variables-lifecycle-across-inheritance-demo/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 18 Aug 2011 03:04:31 GMT</pubDate>
<guid>http://snipplr.com/view/57956/ruby-class-and-instance-variables-lifecycle-across-inheritance-demo/</guid>
</item>
<item>
<title>(Ruby) Search for remote gems from command line and view detailed results in textmate - inkdeep</title>
<link>http://snipplr.com/view/57642/search-for-remote-gems-from-command-line-and-view-detailed-results-in-textmate/</link>
<description><![CDATA[ <p>Do a remote search for all gems containing the word 'pdf' with detailed descriptions and view results in textmate
requires `rubygems-mate` gem</p> ]]></description>
<pubDate>Fri, 05 Aug 2011 05:13:04 GMT</pubDate>
<guid>http://snipplr.com/view/57642/search-for-remote-gems-from-command-line-and-view-detailed-results-in-textmate/</guid>
</item>
</channel>
</rss>
