Skip to content

Instantly share code, notes, and snippets.

@v2keener
Created December 24, 2017 17:38
Show Gist options
  • Select an option

  • Save v2keener/5b4edf6b679fb3d094a1382623ba1b15 to your computer and use it in GitHub Desktop.

Select an option

Save v2keener/5b4edf6b679fb3d094a1382623ba1b15 to your computer and use it in GitHub Desktop.
Simple Bit // source https://jsbin.com/celofaf/1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Simple Bit</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div style="font-family:Calibri, Arial, sans-serif">
<div>
The point of this app is that you think of something
you want to know, any yes or no question. The more
detailed you can imagine it in your mind, the better.<br /><br />
It's basically like a binary Magic 8-ball (which I
believe is trademarked). It's named after "Bit" in
the movie, Tron.
</div>
<div>&nbsp;</div>
<div>Imagine you just asked a question&hellip;<br /><br /></div>
</div>
<div id="a" style="padding-left:1em;font-family:Consolas, serif"></div>
<div><br /><br />
<button onclick="out(); return false;">Next</button></div>
<script id="jsbin-javascript">
var out = function(){
var rand = Math.random();
$('#a').html("The answer to whatever you asked"
+ " is: "
+ (rand >= 0.5 ? "Yes" : "No")
+ " ("
+ rand.toString().substring(0, 5)
+ ")");
};
out();
</script>
<script id="jsbin-source-javascript" type="text/javascript">var out = function(){
var rand = Math.random();
$('#a').html("The answer to whatever you asked"
+ " is: "
+ (rand >= 0.5 ? "Yes" : "No")
+ " ("
+ rand.toString().substring(0, 5)
+ ")");
};
out();</script></body>
</html>
var out = function(){
var rand = Math.random();
$('#a').html("The answer to whatever you asked"
+ " is: "
+ (rand >= 0.5 ? "Yes" : "No")
+ " ("
+ rand.toString().substring(0, 5)
+ ")");
};
out();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment