Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iigmir/ecc87f353982bd9949872536d86ee606 to your computer and use it in GitHub Desktop.
Save iigmir/ecc87f353982bd9949872536d86ee606 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>All work and no play makes Jack a dull boy</title>
</head>
<body>
<h1>All work and no play makes Jack a dull boy</h1>
<article id="all-work-and-no-play-makes-jack-a-dull-boy">
<?php
// All work and no play makes Jack a dull boy
function allworkandnoplaymakesjackadullboy($all, $work) {
for ($i=0; $i < $work; $i++) {
echo("<p style='text-align: center;'>$all</p>");
}
}
$all = "All work and no play makes Jack a dull boy";
$work = strlen($all);
allworkandnoplaymakesjackadullboy($all, $work);
?>
</article>
<script>
const allworkandnoplaymakesjackadullboy = () => {
const all = "allworkandnoplaymakesjackadullboy";
const work = all.split("");
const jack = document.querySelector("#all-work-and-no-play-makes-jack-a-dull-boy");
const makes = (and) => {
const no = document.createElement("span");
no.style.position = "absolute";
no.style.top = Math.ceil( Math.random() * 100 ) + "%";
no.style.left = Math.ceil( Math.random() * 100 ) + "%";
no.textContent = and;
jack.appendChild(no);
};
work.forEach( makes );
};
for (let index = 0; index < 4; index++) {
allworkandnoplaymakesjackadullboy();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment