Jan 272009
 

As is, this code will create an array of arrays – Directories with the same 6 first characters will be grouped in the same sub-array. I am using this for log directories, name format 20081125 for instance – you can just replace the logic to be whatever you need, of course.

dirs = []
Dir['*'].each do |item|
  if File.directory?(item)
    if dirs.empty?
      dirs << [item]
      next
    end
    inserted = false
    dirs.each_with_index do |list_of_folders, index|
      if list_of_folders[0].to_s[0..5] == item[0..5]
        dirs[index] << item
        inserted = true
      end
    end
    dirs << [item] if !inserted
  end
end
Jan 272009
 

Tonight we had training on stances. It came about more or less accidentally – proper stances are -hard- !! But I am now flexible enough hip-wise to get there.. Now to train my leg muscles, mostly the quads, to follow suit…