Skip to content

Instantly share code, notes, and snippets.

@Daronspence Daronspence/mehTotal.js
Last active Aug 5, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.