Inspired by @veltman.
Last active
May 19, 2016 17:05
-
-
Save tophtucker/71b2711d245c98d56cc1f6899b260221 to your computer and use it in GitHub Desktop.
Mystery box
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
scrolling: yes |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
padding: 2em; | |
text-align: center; | |
} | |
</style> | |
<body> | |
<img src="box.jpg"> | |
</body> | |
<script> | |
var user = 'tophtucker'; | |
fetch('https://api.github.com/users/' + user + '/gists').then(function(response) { | |
return response.ok ? response.text() : Promise.reject(response.status); | |
}).then(function(text) { | |
var gists = JSON.parse(text); | |
window.location = 'http://bl.ocks.org/' + user + '/' + gists[Math.floor(Math.random() * gists.length)].id; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment