Skip to content

Instantly share code, notes, and snippets.

@cbednarski
Last active October 13, 2015 04:27
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 cbednarski/4138965 to your computer and use it in GitHub Desktop.
Save cbednarski/4138965 to your computer and use it in GitHub Desktop.
javascript code to convert AWS hour rates to monthly rates (put it in a bookmarklet)
rates = jQuery(".rate");
for(i in rates) {
rate = rates[i].innerHTML;
if(rate){
matches = rate.match(/\$([\d.]+) per hour/i);
if(matches instanceof Array) {
rates[i].innerHTML = "$"+ Math.ceil(parseFloat(matches[1])*100*(365/12)*24)/100 + " per month";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment