Skip to content

Instantly share code, notes, and snippets.

@TristanWiley
Last active November 16, 2017 16:08
Show Gist options
  • Save TristanWiley/b49989a02a42970729ab8c863c4309ec to your computer and use it in GitHub Desktop.
Save TristanWiley/b49989a02a42970729ab8c863c4309ec to your computer and use it in GitHub Desktop.
A script to tell me how much Moes/Guac and Roll I've eaten. Run on CBord's GET summary page. Select "meals". https://get.cbord.com/myubcard/full/history.php
var resturants = [];
var totals = {};
$('.scrollContent tr').each(function( index ) {
var resturant = $(this).find(".activity_details").text();
if(resturant == "XML Interface - Meal Plan Sele") return;
if(totals[resturant]){
totals[resturant]++;
}else{
totals[resturant] = 1;
}
});
console.log("You've been to Moes a total of " + totals["Moes"] + " times");
console.log("You've been to Guac and Roll a total of " + totals["Guac & Roll"] + " times");
console.log("That's a total of " + (totals["Moes"] + totals["Guac & Roll"]) + " meals of Mexican Food.");
console.log("You've spent " + Object.values(totals).reduce((a,b) => a+b, 0) + " meal swipes.");
console.log("Here's all your totals");
console.log(totals);
@TristanWiley
Copy link
Author

As of Nov 16. This is the output.

You've been to Moes a total of 34 times
You've been to Guac and Roll a total of 24 times
That's a total of 58 meals of Mexican Food.
You've spent 153 meal swipes.
Here's all your totals
Capen Cafe: 5
Crossroads: 17
Governors Dining Hall: 2
Guac & Roll: 24
Jamba Juice: 12
Moes: 34
Perks: 28
Putnams: 24
Sizzles: 1
Sushi: 2
Tiffin Room: 3
Tim Hortons SU: 1

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