Skip to content

Instantly share code, notes, and snippets.

@samwgoldman
Created October 4, 2012 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samwgoldman/3831925 to your computer and use it in GitHub Desktop.
Save samwgoldman/3831925 to your computer and use it in GitHub Desktop.
gary bernhardt challenge
x = "some file name.with dots.html.markdown"
x.split(".").reverse.inject([x, []]) do |(file, exts), part|
if part =~ /\s/ || part == file
break [file, exts]
else
[file.chomp(".#{part}"), exts.push(part)]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment