Skip to content

Instantly share code, notes, and snippets.

Avatar

Randall Degges rdegges

View GitHub Profile
@rdegges
rdegges / app.js
Created Jul 21, 2017
Crypto Compare created hook.
View app.js
let app = new Vue({
// ...
created: function() {
this.getCoinData();
}
});
@rdegges
rdegges / app.js
Created Jul 21, 2017
Crypto Compare getCoinImage
View app.js
getCoinImage: function(symbol) {
return CRYPTOCOMPARE_API_URI + this.coinData[symbol].ImageUrl;
}
@rdegges
rdegges / app.js
Created Jul 21, 2017
Crypto Compare getCoinData
View app.js
getCoinData: function() {
let self = this;
axios.get(CRYPTOCOMPARE_API_URI + "/api/data/coinlist")
.then((resp) => {
this.coinData = resp.data.Data;
this.getCoins();
})
.catch((err) => {
this.getCoins();
@rdegges
rdegges / app.js
Last active Jul 21, 2017
Crypto Compare getCoins
View app.js
getCoins: function() {
let self = this;
axios.get(COINMARKETCAP_API_URI + "/v1/ticker/?limit=10")
.then((resp) => {
this.coins = resp.data;
})
.catch((err) => {
console.error(err);
});
@rdegges
rdegges / app.js
Created Jul 21, 2017
Crypto Compare Vue app.
View app.js
/**
* Our Vue.js application.
*
* This manages the entire front-end website.
*/
// The API we're using for grabbing metadata about each cryptocurrency
// (including logo images). The service can be found at:
// https://www.cryptocompare.com/api/
let CRYPTOCOMPARE_API_URI = "https://www.cryptocompare.com";
@rdegges
rdegges / cryptocompare-api-example.sh
Created Jul 21, 2017
Crypto Compare API example.
View cryptocompare-api-example.sh
$ curl https://www.cryptocompare.com/api/data/coinlist
{
...
"Data": {
"AVT": {
"Id": "138642",
"Url": "/coins/avt/overview",
"ImageUrl": "/media/1383599/avt.png",
"Name": "AVT",
"CoinName": "AventCoin",
@rdegges
rdegges / example.sh
Created Jul 21, 2017
coinmarketcap API example
View example.sh
$ curl https://api.coinmarketcap.com/v1/ticker/?limit=10
[
{
"id": "bitcoin",
"name": "Bitcoin",
"symbol": "BTC",
"rank": "1",
"price_usd": "2747.54",
"price_btc": "1.0",
"24h_volume_usd": "2242640000.0",
@rdegges
rdegges / styles.css
Created Jul 20, 2017
Crypto Compare basic styles.
View styles.css
// /static/css/style.css
h1 {
text-align: center;
}
td img {
width: 25px;
}
@rdegges
rdegges / index.html
Created Jul 20, 2017
Crypto Compare blank table.
View index.html
<div id="app">
<table class="table table-hover">
<thead>
<tr>
<td>Rank</td>
<td>Name</td>
<td>Symbol</td>
<td>Price (USD)</td>
<td>1H</td>
<td>1D</td>
@rdegges
rdegges / index.html
Created Jul 20, 2017
Crypto Compare Template
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CryptoCompare</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://bootswatch.com/simplex/bootstrap.min.css">