Skip to content

Instantly share code, notes, and snippets.

@fdebijl
Last active February 21, 2018 20:30
Show Gist options
  • Save fdebijl/e9943b3e872271f8908060627b5a3807 to your computer and use it in GitHub Desktop.
Save fdebijl/e9943b3e872271f8908060627b5a3807 to your computer and use it in GitHub Desktop.
Flip-a-coin
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Flip a coin</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Inconsolata);
body {
font:50pt Inconsolata,sans-serif;
background:#f8f8f6;
margin:0;
width:100vw;
height:100vh;
display:flex;
justify-content:center;
align-items:center;
flex-flow: column nowrap;
}
html {
box-sizing:border-box
}
*,:after,:before{
box-sizing:inherit
}
button{
display:flex;
overflow:hidden;
margin:20px 0 0;
padding:25px;
cursor:pointer;
user-select:none;
text-decoration:none!important;
color:#FFF;
background:#3e3e3e;
border:0;
border-radius:4px;
font-size:13px;
font-weight:500;
line-height:1.3;
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
justify-content:center;
align-items:center;
box-shadow:2px 5px 10px #e4e4e4
}
</style>
<script>
window.onload = ReloadAdvice();
function ReloadAdvice() {
let RandomNumber = Math.random(); // chosen by fair dice roll
// guaranteed to be random
let TargetElement = document.getElementById("advies");
if (RandomNumber <= 0.5) {
TargetElement.innerHTML = "HODL";
} else {
TargetElement.innerHTML = "SELL";
}
};
</script>
</head>
<body>
<div id="advies"></div>
<button onClick="ReloadAdvice()">En nu?</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Flip a coin</title>
<style>@import url(https://fonts.googleapis.com/css?family=Inconsolata);body{font:50pt Inconsolata,sans-serif;background:#f8f8f6;margin:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;flex-flow: column nowrap;}html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}button{display:flex;overflow:hidden;margin:20px 0 0;padding:25px;cursor:pointer;user-select:none;text-decoration:none!important;color:#FFF;background:#3e3e3e;border:0;border-radius:4px;font-size:13px;font-weight:500;line-height:1.3;-webkit-appearance:none;-moz-appearance:none;appearance:none;justify-content:center;align-items:center;box-shadow:2px 5px 10px #e4e4e4}</style><script>function x(){document.getElementById("advies").innerHTML =.5<=Math.random()?"HODL":"SELL"};window.onload=x;</script>
</head>
<body>
<div id="advies"></div>
<button onClick="x()">En nu?</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment