Skip to content

Instantly share code, notes, and snippets.

@rendezfoo
Last active August 30, 2017 16:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rendezfoo/a47870ad04e0c43cd80e3567666ae8c6 to your computer and use it in GitHub Desktop.
Save rendezfoo/a47870ad04e0c43cd80e3567666ae8c6 to your computer and use it in GitHub Desktop.
BTC ticker on your Apple TouchBar
on replace_chars(this_text, search_string, replacement_string)
if this_text contains the search_string then
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
end if
return this_text
end replace_chars
set stockValue to do shell script "curl -s 'https://api.coinmarketcap.com/v1/ticker/bitcoin/' | grep 'price_usd'"
set stockValue to replace_chars(stockValue, " \"price_usd\": \"", "")
set stockValue to replace_chars(stockValue, "\",", "")
return "" & "$" & stockValue
@adamphan
Copy link

Thank you.
How can I change the Currency from USD to BTC?
For example ETH/BTC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment