Skip to content

Instantly share code, notes, and snippets.

@daronspence
Last active August 5, 2016 12:48
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 daronspence/de97f15d22c1ebd94d563118714c1370 to your computer and use it in GitHub Desktop.
Save daronspence/de97f15d22c1ebd94d563118714c1370 to your computer and use it in GitHub Desktop.
Calculate Meh.com Total
// Run this is the JS console of your Browser.
// jQuery must be loaded
// https://meh.com/orders
var total = 0;
$('span.summary').each(function() {
// Get the QTY and Purchase Price
var nums = $(this).text().match(/\d+\.\d+|\d+\b|\d+(?=\w)/g);
// Multiply QTY by Purchase Price
total += parseInt(nums[0],10)*parseInt(nums[nums.length - 1],10);
});
alert("Your Meh habit has cost you $" + total + " so far");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment