Last active
July 26, 2016 16:55
-
-
Save mtrovo/c43240f39611874ec41eb36cd61f9ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<img src="http://dogr.io/wow/suchreactive/muchintegrations/verywebscale/datgooddata.png" /> | |
<script src="https://www.gstatic.com/firebasejs/3.2.0/firebase.js"></script> | |
<script> | |
var img = document.getElementsByTagName("img")[0]; | |
Object.values = obj => Object.keys(obj).map(key => obj[key]); | |
// Initialize Firebase | |
var config = { | |
apiKey: "AIzaSyDWXUtdcIG5N-XKk1TAXPn5xOLaUMuwHUQ", | |
authDomain: "doge-a3878.firebaseapp.com", | |
databaseURL: "https://doge-a3878.firebaseio.com", | |
storageBucket: "doge-a3878.appspot.com", | |
}; | |
firebase.initializeApp(config); | |
var db = firebase.database(); | |
db.ref('msgs').on('value', function(snapshot) { | |
var val = Object.values(snapshot.val()); | |
console.log(val); | |
img.src = "http://dogr.io/" + val.join('/') + '.png'; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment