Skip to content

Instantly share code, notes, and snippets.

@pH-7
Last active October 20, 2025 22:07
Show Gist options
  • Select an option

  • Save pH-7/823feb6c9d4f2def8b93e9143adb373d to your computer and use it in GitHub Desktop.

Select an option

Save pH-7/823feb6c9d4f2def8b93e9143adb373d to your computer and use it in GitHub Desktop.
TextExpander compatible snippet that instantly gives the current live exchange rate displayed on your screen. AUD to EUR currency conversion. You can easily change to any other currency by changing "AUD" and "EUR" or using TextExpander fill-in fields. https://PierreHenry.dev
try {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.exchangerate-api.com/v4/latest/AUD', false);
xhr.send();
var data = JSON.parse(xhr.responseText);
var eurRate = data.rates.EUR;
var amount = 1;
var converted = (amount * eurRate).toFixed(2);
amount + " AUD = " + converted + " EUR (Rate " + eurRate.toFixed(4) + ")";
} catch (error) {
"Exchange rate unavailable. Check Internet connection";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment