Skip to content

Instantly share code, notes, and snippets.

@rdixon22
Last active March 14, 2021 04:14
Show Gist options
  • Save rdixon22/1570fecb07744081e69bc6cd5ae1930c to your computer and use it in GitHub Desktop.
Save rdixon22/1570fecb07744081e69bc6cd5ae1930c to your computer and use it in GitHub Desktop.
Here's a simple web page template to use for testing an artblocks.io project. It generates a random hash and token ID each time the page reloads. It assumes a p5.js project (pulling that from a CDN to limit dependencies). Your project code goes in myproject.js.
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// Generates a random hash and token id each time you reload, in the following format
//let tokenData = {"hash":"0xd9134c11cd5ed9798ea0811364d63bd850c69c5d13383c9983ade39847e9ea86","tokenId":"99000000"};
function genTokenData(projectNum)
{
let data = {};
let hash = "0x";
for (var i = 0; i < 64; i++)
{
hash += Math.floor(Math.random() * 16).toString(16);
}
data.hash = hash;
data.tokenId = projectNum * 1000000 + Math.floor(Math.random() * 1000);
return data;
}
let tokenData = genTokenData(99);
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Project by Me - ArtBlocks.io</title>
<style type="text/css">body {
margin: 0;
padding: 0;
}
canvas {
padding: 0;
margin: auto;
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}</style>
<script src="https://cdn.jsdelivr.net/npm/p5@1.2.0/lib/p5.js"></script>
</head>
<body>
<div id="sktch" style="display: block;">
<script src="myproject.js"></script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment