On 13 Aug 2010, at 14:03, laurent laffont wrote: > On Fri, Aug 13, 2010 at 12:55 PM, Stéphane Ducasse > <[email protected]> wrote: > send them the code for pharo :) > > > Kata for better code ? (sorry German) > > |md5 url| > md5 := MD5 new hashStream: (ReadStream on: '[email protected]'). > url := String streamContents: [:aStream| > aStream > nextPutAll: 'http://www.gravatar.com/avatar/'. > md5 do: [:aByte| > > aStream nextPutAll: aByte hex asLowercase]]. > (ImageMorph fromStream: > (url asUrl retrieveContents contentStream)) openInWorld. > > Laurent
I really like code that speaks for itself, like this example ! Great, Laurent. It can even be written shorter, like this: | md5 url | md5 := MD5 hashMessage: '[email protected]'. url := ('http://www.gravatar.com/avatar/', md5 hex) asUrl. (ImageMorph fromStream: url retrieveContents contentStream) openInWorld. Sven _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
