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
mysql> CREATE TABLE `timetest` (`datetime` DATETIME DEFAULT 0, `timestamp` TIMESTAMP DEFAULT 0); | |
Query OK, 0 rows affected (0,29 sec) | |
mysql> DESCRIBE `timetest`; | |
+-----------+-----------+------+-----+---------------------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+-----------+-----------+------+-----+---------------------+-------+ | |
| datetime | datetime | YES | | 0000-00-00 00:00:00 | | | |
| timestamp | timestamp | NO | | 0000-00-00 00:00:00 | | | |
+-----------+-----------+------+-----+---------------------+-------+ |
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 | |
$list = $_pdo->getAll('SELECT s1.`id` `id` FROM cat_section s1 | |
LEFT JOIN cat_section s2 ON s1.`parent_id` = s2.`id` | |
WHERE s1.`parent_id` <> 0 AND s2.`id` IS NULL', [], \PDO::FETCH_COLUMN); | |
$iter = function($sid) | |
use(&$iter, $_pdo) | |
{ | |
foreach($_pdo->getAll('SELECT s1.`id` `id` FROM cat_section s1 |
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 | |
ob_start(); | |
phpinfo(~(2+64)); | |
print str_ireplace('.e {background', '.e {white-space: nowrap; background', ob_get_clean()); |
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 | |
/** Smarty template wrapper | |
* | |
* @version $Id: Smarty.php 674 2017-07-10 23:47:11Z anrdaemon $ | |
*/ | |
namespace AnrDaemon\CcWeb\Wrappers; | |
use | |
AnrDaemon\CcWeb\Interfaces; |
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 | |
$nf = new \NumberFormatter("ru_RU", \NumberFormatter::CURRENCY); | |
$cs = ini_get('default_charset'); | |
$formatter = function($price, $currency = 'RUB') | |
use($nf, $cs) | |
{ | |
return iconv('UTF-8', "$cs//IGNORE", $nf->formatCurrency($price, $currency)); | |
}; |
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 | |
/** Universal stackable classloader. | |
* | |
* @version SVN: $Id: classloader.php 739 2018-03-03 19:05:12Z anrdaemon $ | |
*/ | |
namespace AnrDaemon; | |
return call_user_func(function(){ | |
$nsl = strlen(__NAMESPACE__); |
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 | |
require_once __DIR__.'/../vendor/autoload.php'; | |
$loop = React\EventLoop\Factory::create(); | |
$factory = new React\Datagram\Factory($loop); | |
function serverHandler(React\Datagram\Socket $server) { | |
$server->on('message', 'messageHandler'); |
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
<?xml version="1.0" encoding='UTF-8'?> | |
<!DOCTYPE hrc PUBLIC | |
"-//Cail Lomecb//DTD Colorer HRC take5//EN" | |
"http://colorer.sf.net/2003/hrc.dtd" | |
> | |
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd" | |
> |
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 | |
function get_new_image_name($dir, $id, $limit_num = PHP_INT_MAX) | |
{ | |
$cache = []; | |
foreach(glob($dir . sprintf('/%02u-*.*', $id), GLOB_MARK) as $name) | |
{ | |
if(is_dir($name)) | |
{ | |
continue; | |
} |
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
__set_prompt() | |
{ | |
test "$PS_ORIG" || PS_ORIG="$PS1" | |
test "$PC_ORIG" || eval "PC_ORIG='$PROMPT_COMMAND'" | |
PROMPT_COMMAND=__bash_prompt | |
}; readonly -f __set_prompt | |
__bash_prompt() | |
{ | |
local ERRORLEVEL=$? | |
if [ $ERRORLEVEL != 0 ]; then |