Created
February 10, 2015 14:36
-
-
Save workmad3/415547a5a573e1cb453a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source = ["NewsArticle", "NewsArticle", "NewsArticle", "NewsArticle", "Event", "Event", "Tweet", "Tweet", "Event"] | |
sorted = [] | |
%w(NewsArticle Event Tweet).cycle do |current_type| | |
sorted << source.delete_at(source.index(current_type)) if source.include?(current_type) | |
break if source.empty? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment