Category Archives: Ruby
Ruby Create Dictionary.html from double colon files
This takes a text file of the form below and creates an html dictionary version with a TOC : Ambiguous Genitalia Overview:: Four major defects can cause gender confusion in the neonate: 1) female pseudohermaphroditism or adrenogentital syndrome, 2) male … Continue reading
Ruby Code Samples
Table of Contents: Tag cloud in ruby Excel in ruby How to find files /filetypes in Ruby Ruby Word Unscrambler Ruby converter for xml quiz files to Quizmaker Program Create a Histogram in Ruby Clean out old files with Ruby … Continue reading
Ruby Web Search
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 require ‘net/http’ require ‘rexml/document’ # Web search for "finance" url = ‘http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=cls31415o&query=finance&results=40′ # get the XML data as a string … Continue reading
Ruby interval between dates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 class Date def distance_to(end_date) years = end_date.year – year months = end_date.month – month days = end_date.day – day … Continue reading
Ruby Print hash values
1 2 3 4 5 6 7 h={1=>"bob", 2=>"joe", 3=>"herb"} # m = h.keys n = h.values n.each do |n| puts n puts end
Ruby CSV sum by column
1 2 3 4 5 6 7 8 9 10 11 # This takes csv data, and identifies it by column header (bob), sums the x column, and then adds a column with x/sum x require ‘rubygems’ require ‘fastercsv’ … Continue reading