Last active
December 11, 2015 03:48
-
-
Save MarkyC/4539940 to your computer and use it in GitHub Desktop.
showing my example formatting for: http://www.reddit.com/r/programming/comments/16k7hm/the_exceptional_beauty_of_doom_3s_source_code/c7x6y2g
This file contains hidden or 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
| <?php | |
| // create empty cells to populate table | |
| // create 1 row for every half hour of the day (48 rows) | |
| $time = mktime(0, 0, 0, 1, 1); | |
| for ($i = 0; $i < 86400; $i += 1800) { // 1800 = half hour, 86400 = one day | |
| echo "<tr "; | |
| if ($i < 25200) { | |
| // initially hide before 7am | |
| echo "class=\"initiallyHiddenTop\" "; | |
| } else if ($i > 79200) { | |
| // initially hide after 10pm | |
| echo "class=\"initiallyHiddenBottom\" "; | |
| } else if ($i == 25200) { | |
| // output show more header (at 7am) | |
| echo "onClick=\"unHideTop()\"><th class=\"show-more\" id=\"show-more-top\" " . | |
| "style=\"text-align:center\" colspan=\"8\">" . | |
| "<i class=\"icon-double-angle-up\"></i> Show More " . | |
| "<i class=\"icon-double-angle-up\"></i></th></tr>"; | |
| continue; | |
| } else if ($i == 79200) { | |
| // output show more header (at 10pm) | |
| echo "onClick=\"unHideBottom()\"><th class=\"show-more\" id=\"show-more-bottom\" " . | |
| "style=\"text-align:center\" colspan=\"8\">" . | |
| "<i class=\"icon-double-angle-down\"></i> Show More " . | |
| "<i class=\"icon-double-angle-down\"></i></th></tr>"; | |
| continue; | |
| } | |
| printf('><th style="text-align:right">%1$s</th>', | |
| date('g:i a', $time + $i)); | |
| for ($j = 0; $j < 7; $j++) { | |
| echo "<td class=\"empty-cell\" onMouseOver=\"showAddClass(this)\"></td>"; | |
| } | |
| echo "</tr>"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment