Skip to content

Adds better code example #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,25 @@ <h3><a id="developers" href="#developers">Don’t think, just strip</a></h3>
<p>Here is a sample PHP function for developers:</p>

<pre><code>&lt;?php
function is_naked_day($d) {
$start = date('U', mktime(-14, 0, 0, 04, $d, date('Y')));
$end = date('U', mktime(36, 0, 0, 04, $d, date('Y')));
$z = date('Z') * -1;
$now = time() + $z;
if ( $now &gt;= $start &amp;&amp; $now &lt;= $end ) {
return true;
}
return false;
function isNakedDay()
{
$now = new \DateTime('now', new \DateTimeZone('UTC'));
$start = new \DateTime('00:00, April 9', new \DateTimeZone('+14:00'));
$end = new \DateTime('23:59:59.999999, April 9', new \DateTimeZone('-12:00'));

return $now &gt;= $start && $now &lt;= $end;
}
?&gt;</code></pre>

<p>Use it like this:</p>

<pre><code>&lt;head&gt;
&lt;?php
if ( is_naked_day(9) ) {
echo '&lt;!-- Naked Day has no styles --&gt;';
} else {
echo '&lt;link rel="stylesheet" href="styles.css" /&gt;';
}
?&gt;
&lt;?php if(isNakedDay()) : ?&gt;
&lt;!-- Naked Day has no styles --&gt;
&lt;?php else: ?&gt;
&lt;link rel="stylesheet" href="styles.css" /&gt;
&lt;?php endif; ?&gt;
&lt;/head&gt;</code></pre>

Expand Down