(async () => {
await new Promise(resolve => setTimeout(resolve, 500));
...
})();
Found on SO.
<アンダブロッブ />
(async () => {
await new Promise(resolve => setTimeout(resolve, 500));
...
})();
Found on SO.
This is a code snippet to keep unwanted visitors out while a site is under construction or being updated. The associative array helps to keep record of the identity of the user’s IP instead of just a collection of numbers with no semantic association. The $filter_ips value makes it easy to toggle the filtering on/off.
<?php // --- Filter vitsitor's IP address and bounce those not in the list. $bounce_url = '/maintenance.php'; $filter_ips = true; $allow_ips = array ( 'ORG: Firstname Lastname' => '00.00.00.00' ); if ( $filter_ips && !in_array ( $_SERVER[ 'REMOTE_ADDR' ], $allow_ips ) ) { header ( "location: $bounce_url" ); exit (); } ?>
It’s also helpful to output the user’s IP address on your bounce page so user’s trying to gain access can easily copy/paste their IP to send to you:
<?php echo $_SERVER[ 'REMOTE_ADDR' ]; ?>
This is a handy way to output a complex object or nested array with PHP while retaining the visual structured indentation:
echo '<pre>' . print_r ( $complexobject, true ) . '</pre>';
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html>
Use this snippet to add drop shadows to elements for Mozilla, Webkit, and browsers that support CSS3:
-moz-box-shadow: 1px 2px 3px #666; -webkit-box-shadow: 1px 2px 3px #666; box-shadow: 1px 2px 3px #666; /* box-shadow: X Y blur hex; */
Use this CSS to apply rounded corners to Mozilla, Webkit, and browsers that support CSS3:
-moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px;