Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cupcake score.rb
# Generic - White Sugar 1/2 Cup
# Generic - All-Purpose Flour (Cup), 1.75 cup
# 365 - Baking Powder, Aluminum-Free, 2.4 g (1/8 tsp)
# Baking soda, 0.5 tsp
# Spices - Cinnamon, ground, 0.5 tsp
# Diamond Crystal - Kosher Salt No Iodide, 0.5 tsp (0.7 g)
# Honey, 0.5 cup
# Butter - Unsalted, 0.5 cup
# 2 Eggs Large
# Trader Joes - Greek Style Honey Yogurt, 0.3 container (8 oz)
# 365 - Vanilla Extract, Organic, 0.5 tsp (4g)
# Butter - Unsalted, 0.5 cup
# Honey, 0.66 tbsp
# Trader Joes - Greek Style Honey Yogurt, 0.19 container (8 oz)
# Generic - Red Russian Kale, 1.5 cup (67g)
# Generic - Pure Vegetable Oil, 1 tbsp
# Generic - Ground Cinnamon, 0.25 tbsp
# Granulated Sugar, 0.75 rounded teaspoon
item = {
"name" => "Stef's Honey Kale Yogurt Cupcakes (Cupcake Project)",
"url" => "http://www.cupcakeproject.com/2011/12/cupcakes-are-vegetables-congress-says.html",
"serving_weight_grams" => 70*16, # estimate
"calories" => 3848,
"saturated_fat" => (117+3.2+0.9+0.35), # butter+egg+canola+flour
"sugars" => 267,
"sodium" => 1623,
"dietary_fiber" => (5.95+3.9), # flour+kale
"protein" => 46,
}
puts compute_score(item) # => 50/100 using modified Oxford nutrient profile model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.