Skip to content

Instantly share code, notes, and snippets.

@mtrovo
Last active July 26, 2016 16:55
Show Gist options
  • Save mtrovo/c43240f39611874ec41eb36cd61f9ade to your computer and use it in GitHub Desktop.
Save mtrovo/c43240f39611874ec41eb36cd61f9ade to your computer and use it in GitHub Desktop.
<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