Skip to content

Instantly share code, notes, and snippets.

@danomanion
Created March 13, 2018 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danomanion/6051ed7748cd10b2a8429259470c14d6 to your computer and use it in GitHub Desktop.
Save danomanion/6051ed7748cd10b2a8429259470c14d6 to your computer and use it in GitHub Desktop.
Quote Machine
<section class="jumbotron text-center">
<div class="container">
<h1 class="jumbotron-heading">Random Quotes</h1>
<p class="lead text-muted"><blockquote>
<p id="quote"></p>
<footer>
— <cite id="author"></cite>
</footer>
</blockquote></p>
<p>
<a href="#" class="btn btn-primary" onclick="getAndShowQuote(getRandomInt(qoutes.length))">Quote Me!</a>
<!-- <a href="#" class="twitter-share-button" onclick="tweetIt()">Tweet</a> -->
</p>
</div>
</section>
const qoutes = [
{
author: "Willy Wonka",
quote:
"Don't forget what happened to the man who suddenly got everything he always wanted ... he lived happily ever after!",
url: "https://www.youtube.com/watch?v=AnrT7fOuMPk"
},
{
author: "Ramit Sethi",
quote:
"There is a differnce between process and results."
},
{
author: "Les Brown",
quote:
"Do what is easy and your life will be hard. Do what is hard and your life will become easy."
},
{
author: "Lucille Ball",
quote:
"I'd rather regret the things I've done than regret the things I haven't done."
},
{
author: "Chinese Proverb",
quote:
"The best time to plant a tree was 20 years ago. The next best time is now."
},
{
author: "Leonardo da Vinci",
quote: "The greatest deception men suffer is from their own opinions."
},
{
author: "Albert Einstein",
quote:
"Try not to become a man of success, but rather try to become a man of value."
},
{
author: "Zig Ziglar",
quote:
"If you help enough people get what they want, you will get what you want."
},
{
author: "Steve Jobs",
quote:
"Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes because the people who are crazy enough to think that they can change the world, are the ones who do."
},
{
author: "Warren Miller",
quote:
"Don't take life too seriously, because you can't come out of it alive."
},
{
author: "Albert Eistein",
quote: "Everything should be as simple as possible, but no simpler."
},
{
author: "Len",
quote:
"And of course you can't become if you only say what you would have done."
},
{
author: "Dan Peńa",
quote: "Show me your friends, I’ll show you your future."
},
{
author: "Alan Watts",
quote:
"There are only two kinds of people. Those who believe that they are a victim of the world and those who understand that they are the world."
},
{
author: "Brian Eno",
quote:
"One of the important things about the synthesizer was that it came without any baggage. A piano comes with a whole history of music...when you play an instrument that does not have any such historical background you are designing sound basically. You're designing a new instrument. That's what a synthesizer is essentially. It's a constantly unfinished instrument. You finish it when you tweak it, and play around with it, and decide how to use it. You can combine a number of cultural references into one new thing."
}
];
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
function getAndShowQuote(randomNumber) {
document.getElementById("author").innerHTML = qoutes[randomNumber].author;
document.getElementById("quote").innerHTML = qoutes[randomNumber].quote;
}
// Load first quote
getAndShowQuote(getRandomInt(qoutes.length));
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment