Skip to content

Instantly share code, notes, and snippets.

@shadoi
Created June 21, 2012 18:58
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 shadoi/2967808 to your computer and use it in GitHub Desktop.
Save shadoi/2967808 to your computer and use it in GitHub Desktop.
correct_order = [ 'g', 'c', 'b', 'e', 'f', 'd', 'b' ]
actual_order = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g' ]
actual_order.sort_by! {|x| correct_order.include?(x) ? correct_order.index(x) : actual_order.length}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment