Skip to content

Instantly share code, notes, and snippets.

@robertcdawson
Last active August 29, 2015 14:02
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 robertcdawson/bbcce232cbf703be0baf to your computer and use it in GitHub Desktop.
Save robertcdawson/bbcce232cbf703be0baf to your computer and use it in GitHub Desktop.
Bookmarklet to get calories burned
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