Search   Feed   Browse   Add
Feed items 1 - 4 of 4 for July 2008

loopkid

sad songs make me happy

ruby 1.9 utf-8 mostly works - July 7, 2008

I was curious to see how far the implementation of utf-8 in Ruby 1.9 has developed. First we assign a pure Ascii string and check it&8217;s encoding. >> a = "Restaurant" => "Restaurant" >> a.encoding => <Encoding:US-ASCII> Okay, nothing spectacular so far. Next we take a Unicode string. >> b = "Caf" => "Caf" >> b.encoding => <Encoding:UTF-8> Looking great, now let&8217;s work with that string. >> b.each_byte byte puts...
http://loopkid.net/articles/2008/07/07/ruby-1-9-utf-8-mostly-works

predefined character classes in grep - July 6, 2008

Many regex implementations have &8220;macros&8221; for various character classes. In Perl, for example, d matches any digit (0-9) and w matches any &8220;word character&8221; (a-zA-Z0-9_). Grep uses a slightly different notation for the same thing: :digit: for digits and :alnum: for alphanumeric characters. (BSD) Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their names are self explanatory, and they are :alnum:, :alpha:,...
http://loopkid.net/articles/2008/07/06/predefined-character-classes-in-grep

the dust bunnies are my only friends - July 3, 2008

Isobel Campbell saved him from the loneliness in his empty apartment.
http://loopkid.net/articles/2008/07/03/the-dust-bunnies-are-my-only-friends

conciseness vs. readability - July 1, 2008

To print the contents of all files passed as arguments or in case of no arguments print the contents of stdin you could write puts ARGF but isn&8217;t if ARGV.empty puts $stdin.readlines else ARGV.each do filename puts File.readlines(filename) end end much more readable
http://loopkid.net/articles/2008/07/01/conciseness-vs-readability
Available Archives
- June (6 items)
- July (4 items)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact