Last active
August 29, 2015 14:02
-
-
Save robertcdawson/bbcce232cbf703be0baf to your computer and use it in GitHub Desktop.
Bookmarklet to get calories burned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var getCalories=function(){var e=prompt("Enter (separated by spaces):\n- Sex\n- Age (yrs)\n- Weight (lbs)\n- Avg heart rate (rpm)\n- Workout time (min)");var t=e.split(" ");var n=t[0];var r=t[1];var i=t[2];var s=t[3];var o=t[4];var u=((r*.2017+i*.09036+s*.6309-55.0969)*(o/4.184)).toFixed(2);var a=((r*.074+i*.05741+s*.4472-20.4022)*(o/4.184)).toFixed(2);var f=n=="m"?u:a;return f};var setCalories=function(){alert("You burned "+getCalories()+" calories today!")}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment