Skip to content

Instantly share code, notes, and snippets.

@workmad3
Last active April 18, 2016 16:41
Show Gist options
  • Save workmad3/03caeae0ecfc38adb2ddf66ee830271e to your computer and use it in GitHub Desktop.
Save workmad3/03caeae0ecfc38adb2ddf66ee830271e to your computer and use it in GitHub Desktop.
ary.sort do |left, right|
IMPORTANT = %w(X Y)
if IMPORTANT.include?(left) && IMPORTANT.include?(right)
IMPORTANT.index(left) <=> IMPORTANT.index(right)
elsif IMPORTANT.include?(left)
1
elsif IMPORTANT.include?(right)
-1
else
left <=> right
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment