Skip to content

Instantly share code, notes, and snippets.

@tamalw
Created October 7, 2019 23:31
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 tamalw/05b23032b218ebe14782b494aaed342c to your computer and use it in GitHub Desktop.
Save tamalw/05b23032b218ebe14782b494aaed342c to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'json'
p = JSON.parse(URI.parse('http://files.olo.com/pizzas.json').read).map { |p| p['toppings'].sort.join(', ') }.flatten
puts p.uniq.map { |c| [c, p.count(c)]}.sort { |a,b| b[1] <=> a[1] }[0...20].map.with_index { |t,i| "#{i+1}. #{t[0]}: #{t[1]}" }.join("\n")
@tamalw
Copy link
Author

tamalw commented Oct 7, 2019

  1. pepperoni: 4616
  2. mozzarella cheese: 1014
  3. four cheese: 956
  4. bacon: 732
  5. beef: 623
  6. sausage: 402
  7. italian sausage: 361
  8. chicken: 229
  9. four cheese, pepperoni: 203
  10. ham: 165
  11. mushrooms: 159
  12. mozzarella cheese, pepperoni: 155
  13. beef, pepperoni: 122
  14. bacon, pepperoni: 121
  15. black olives: 117
  16. alredo sauce: 101
  17. pepperoni, sausage: 96
  18. cheddar cheese: 95
  19. italian sausage, pepperoni: 85
  20. pineapple: 79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment