Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


      ****       ***         ***       ***         ***        ****
      *  Copyright (C) 2016 Tyler Moeller. All rights reserved.  *
      *  All trademarks, product names, and logos on this site   *
      *  are the property of their respective owners.            *
      ****       ***         ***       ***         ***        ****

    Assignment Details:
      - Developed for the freeCodeCamp zipline project: Zipline: Build a Random Quote Machine
      - Details:

    Requirements for this assignment:
      - Build a random quote machine that emulates this:
      - Don't look at the source code of the project you are emulating
      - Users are able to click a button to get a new random quote
      - Bonus: Users are able to click a button to tweet the quote

    Assignment Completed. v1.0 9/24/2015:
      - Responsive deisgn using JavaScript, jQuery, HTML5, with Materialize + FontAwesome CSS libraries.
      - Random quote given on page load
      - Button to get a new random quote in the navbar and main page
      - Button to tweet quote with transition effects and tooltips to help show it's a button
          - twitter js widget to present modal dialog instead of separate tab/page in browser
          - Quotes are filtered so they can all fit whithin 140-char tweet limit
          - Classes, ids, and icons named carefully to prevent adblock issues
      - Button to view author on Wikipedia with transition effects and tooltips to help show it's a button
  <div class="container center">
    <div class="row">
      <h3 class="title">Random Quote Machine</h3>
    <div class="row main-content center">
      <div class="col s4 offset-s4">
        <div class="preloader-wrapper big active spinner" id="spinner">
          <div class="spinner-layer spinner-blue-only">
            <div class="circle-clipper left">
              <div class="circle"></div>
            <div class="gap-patch">
              <div class="circle"></div>
            <div class="circle-clipper right">
              <div class="circle"></div>
      <div class="col s8 offset-s2" id="content">
        <div class="flow-text">
          <p id="quote"></p>
          <p><i id="author"></i></p>
        <div class="row">
          <div class="tooltipped col s3 offset-s3" data-position="bottom" data-tooltip="View the author on Wikipedia!">
            <a id="wikiLink" target="_blank" rel="noopener noreferrer">
              <img class="authorWiki" src="">
          <div class="tooltipped col s3" data-position="bottom" data-tooltip="Tweet this quote!">
            <a id="tweetLink" target="_blank" rel="noopener noreferrer">
              <img class="shareQuote" src="">
    <a class="new-quote-btn btn blue-grey lighten-5 black-text" onclick="getQuote()">Generate another quote!</a>
<footer class="page-footer grey darken-4">
  <div class="container center">
    <div class="row grey-text">
      <p class="footer-text">Copyright &copy;
          document.write(new Date().getFullYear());
        Tyler Moeller. All rights reserved. Quotes retrieved from
        <a href="" target="_blank" rel="noopener noreferrer">Forismatic</a>. Developed for the freeCodeCamp Front-end Development Challenge:
        <a href="" target="_blank" rel="noopener noreferrer">
              Build a Random Quote Machine</a>.
    <div class="footer-logos row">
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-twitter"></i></a>
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-linkedin"></i></a>
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-github"></i></a>
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-fire"></i></a>
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-codepen"></i></a>
      <a href="" target="_blank" rel="noopener noreferrer"><i class="fa fa-wordpress"></i></a>
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>


                body {
  background-image: url(;
  color: white;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Roboto', sans-serif;

.container {
  max-width: 768px;
  min-width: 270px;

.title {
  margin-top: 5%;

@media (max-width: 600px) {
  .title {
    margin-top: .5em;

.main-content {
  font-size: 1.6em;
  min-height: 14em;

#spinner {
  margin: 2em auto;
  display: none;

.authorWiki, .shareQuote {
  border-radius: 12.5%;
  font-size: .6em;
  height: 3em;
  margin-top: 1em;

.authorWiki:hover, .shareQuote:hover {
  opacity: .8;
  box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);

.new-quote-btn, .new-quote-btn:hover {
  border: 1px solid #bdbdbd;
  box-shadow: 0 5px 0 #bdbdbd;
  font-weight: 500;
  margin-bottom: 5em;
  padding: 0 1em;
  user-select: none;

.new-quote-btn:active, .new-quote-btn:focus {
  border-style: none;
  box-shadow: 0 0 0 1px #bdbdbd inset,
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 1px 3px 1px rgba(0, 0, 0, .1);
  position: relative;
  top: 4px;

/* footer formatting */
main {
  flex: 1 0 auto;

.footer-text {
  font-size: 1em;
  margin: 0;

.footer-logos i {
  border: 1px solid #646464;
  border: 1px solid rgba(100, 100, 100, .3);
  border-radius: 25%;
  color: #646464;
  font-size: 1.1em;
  margin-right: .25em;
  padding: .4em;


                const toggleSpinner = () => $("#content, #spinner").toggle();

function quoteHandler(data) {
  const quoteText = data.quoteText.trim(),
    quoteAuthor = `~ ${data.quoteAuthor.trim() || "Anonymous"}`,
    quoteMachineUrl = document.referrer.split("?")[0],
    tweetText = encodeURIComponent(`${quoteText} ${quoteAuthor} ${quoteMachineUrl}`),
    tweetUrl = `https://\${tweetText}`, // '\t' bypasses adblock
    wikiUrl = `${quoteAuthor.replace(/\s/g, "_").replace("~", "")}`;

  // 280 character text limit, twitter shortens urls to 23 characters
  // if quote + url is longer than allowed, get a new quote
  const tweetLength = (tweetText.length - quoteMachineUrl.length) + 23;
  if (tweetLength > 280) {

  // Populate the HTML. setTimeout throttles requests to one quote per second
  setTimeout(() => {
    $("#tweetLink").attr("href", tweetUrl);
    $("#wikiLink").attr("href", wikiUrl);
      .tooltip({ delay: 50 })
      .click(() => $(".tooltipped").blur());
  }, 1000);

function error(err) {
  $("#author").html("~ Random Quote Machine");
  $("#quote").html(`Error: ${err.status} (${err.statusText}). Please try again later.`);

// Get a quote from the Forismatic API
function getQuote() {