Rename directories to lowercase 2

Using a single (and somewhat simple) shell line, you can rename any directory to its lowercase version. for i in *; do lcase=`echo $i | tr A-Z a-z`; if [ ! -d $lcase ]; then mv $i $lcase; fi; done; Viva el chell !...

ruby: url_to_constant 1

A small bit of ruby to get a constant from an URL: [ruby] require 'uri' def url_to_constant(url) return URI.parse(url).host.gsub(/^www\./, '').capitalize.gsub(/[^a-z][a-z]/i) { |m| m.gsub(/[^a-z]/, '').upcase }.constantize end Nothing exceptionnal here, just a pretext to post something....

Top tags