This is a multi-part message in MIME format. ------ extPart_000_0080_01C17FCF.5324C100 Content-Type: text/plain; charset so-8859-1" Content-Transfer-Encoding: quoted-printable very nice!!! Mikkel ----- Original Message ----- From: Ralph Mason To: ruby-talk ML Sent: Saturday, December 08, 2001 6:10 AM Subject: [ruby-talk:27897] Dictionary.com speeder upper Here is a little script I did to make dictionary.com more useful for me. I think others may find it useful. Note: the HTML formatting it uses sucks Ralph require "net/http" if ARGV.size == 0 puts "Usage: dictionary term" exit end a = Net::HTTP.get("www.dictionary.com","/cgi-bin/dict.pl?term=#{ARGV[0]}") if ( a=~/No entry found for/ ) puts "No entry found for '#{ARGV[0]}' - Suggestions:\n\n" while $' =~/<a href="\/cgi-bin\/dict.pl\?term=\w+">(\w+)/ puts $1 end else while a =~ /<!-- resultItemStart -->/ $' =~ /<!-- resultItemEnd -->/ a=$' puts $`.gsub(/<.*?>/m){ |i| case i when "<b>" "" when "</b>" "\n" when "<p>" "" else "" end } end end ------ extPart_000_0080_01C17FCF.5324C100 Content-Type: text/html; charset so-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=iso-8859-1" http-equiv=Content-Type> <META content="MSHTML 5.00.3315.2870" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>very nice!!!</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Mikkel</FONT></DIV> <BLOCKQUOTE style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A href="mailto:ralph.mason / telogis.com" title=ralph.mason / telogis.com>Ralph Mason</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A href="mailto:ruby-talk / ruby-lang.org" title=ruby-talk / ruby-lang.org>ruby-talk ML</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, December 08, 2001 6:10 AM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> [ruby-talk:27897] Dictionary.com speeder upper</DIV> <DIV><BR></DIV> <DIV><FONT face=Arial size=2>Here is a little script I did to make ictionary.com more useful for me.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I think others may find it useful. Note: the HTML formatting it uses sucks</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Ralph</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>require "net/http"</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>if ARGV.size == 0 <BR> puts "Usage: dictionary term"<BR> exit<BR>end</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>a = Net::HTTP.get("<A href='http://www.dictionary.com","/cgi-bin/dict.pl?term=#{ARGV[0'>www.dictionary.com","/cgi-bin/dict.pl?term=#{ARGV[0</A>]}")</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>if ( a=~/No entry found for/ ) <BR> puts "No entry found for '#{ARGV[0]}' - Suggestions:\n\n"<BR> <BR> while $' =~/<a href="\/cgi-bin\/dict.pl\?term=\w+">(\w+)/<BR> puts $1<BR> end<BR>else<BR> while a =~ /<!-- resultItemStart ->/<BR> $' =~ /<!-- resultItemEnd -->/<BR> a=$'</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2> puts $`.gsub(/<.*?>/m){ |i| <BR> case i<BR> when "<b>"<BR> ""<BR> when "</b>"<BR> "\n"<BR> when "<p>"<BR> ""<BR> else<BR> ""<BR> end<BR> }<BR> end<BR>end<BR></FONT></DIV></BLOCKQUOTE></BODY></HTML> ------ extPart_000_0080_01C17FCF.5324C100--