Created
July 1, 2020 13:29
-
-
Save OskarSigvardsson/a838185f2615c1c4c811e18deb457dc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Order</title> | |
<style type="text/css"> | |
body { | |
margin: 40px auto; | |
max-width: 650px; | |
line-height: 1.6; | |
font-size: 18px; | |
color: #444; | |
padding: 0 10px; | |
font-family: Futura, Gill Sans, sans-serif; | |
} | |
h1 { | |
margin-left:40px; | |
line-height:1.2 | |
} | |
hr { | |
margin: 30px; | |
color: #FFF; | |
} | |
.card { | |
box-shadow: 0px 0px 18px -3px #8E8E8E; | |
padding: 10px 40px 20px 40px; | |
} | |
.card-text { | |
margin-left: 40px; | |
margin-right: 40px; | |
font-family: Monaco, Consolas, Courier New; | |
} | |
li { | |
padding-left: 5px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="card"> | |
<hr/> | |
<h1>Scrum order</h1> | |
<hr/> | |
<div class="card-text"> | |
<!-- Embedded PHP right in HTML! --> | |
Today's date is <?php echo date("Y-m-d") ?> and today's scrum order is as follows: | |
<ol> | |
<?php | |
// interestingly, if you don't have the & there before the variable, | |
// it passes the array by copy! Don't know any other language besides | |
// C++ that would do that. | |
function shuffle_array(&$items) { | |
// php has a "shuffle" function built in, but you can't seed it, so | |
// here's the glorious return of the Knuth shuffle | |
for ($i = 0; $i < count($items) - 1; $i++) { | |
// I have no idea how scoping works in PHP, these may very well | |
// be globals... | |
$j = mt_rand($i, count($items) - 1); | |
// There's some fancy way to do an inline swap in PHP, but i | |
// don't know how to do it | |
$tmp = $items[$i]; | |
$items[$i] = $items[$j]; | |
$items[$j] = $tmp; | |
} | |
} | |
$people = [ | |
"Oskar", | |
"András", | |
"Kim", | |
"JW", | |
"Martin", | |
"August", | |
"Staffan", | |
"Lars", | |
"Mattias" | |
]; | |
// seed is todays date as an integer, like "20200514" | |
$seed = date("Ymd"); | |
mt_srand($seed); | |
shuffle_array($people); | |
foreach($people as $person) { | |
echo "<li>$person</li>\n"; | |
} | |
?> | |
</ol> | |
</div> | |
<hr/> | |
</div> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment