- install https://getcomposer.org/
cd
to script directory- execute
composer install
- run script
php tempo-async.php
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
#!/usr/bin/env php | |
<?php | |
/** | |
* https://gist.github.com/Gemorroj/be72bb393f5de423f0404a43dedbddda | |
* | |
* Create file `bin/anti-terrorism` | |
* Add to composer.json like this: | |
``` | |
"scripts": { | |
"post-install-cmd": [ |
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
<?php | |
$arr = [10, 1, 3, 2, 4, 7, 6, 11]; | |
$out = qsort($arr); | |
// $out = bsort($arr); | |
// $out = msort($arr); | |
print_r([$arr, $out]); | |
// quick sort | |
function qsort(array $array): array { |
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
<?php | |
// @see https://www.php.net/manual/ru/function.pcntl-fork.php#115855 | |
function forkProcess(array $processes, callable $callback, int $memorySizePerProcess = 1024) | |
{ | |
$l = \count($processes); | |
$sharedMemoryMonitor = \shmop_open(\ftok(__FILE__, \chr(0)), 'c', 0644, $l); | |
$sharedMemoryIds = []; | |
for ($i = 1; $i <= $l; $i++) { |
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
{ | |
"isLoggedInUser": false, | |
"components": { | |
"login": { | |
"isLoading": false, | |
"error": null | |
}, | |
"grid_posts": { | |
"isLoading": false, | |
"error": null, |
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
<?php | |
namespace Litipk\BigNumbers; | |
class Decimal | |
{ | |
public static function fromInteger(int $intValue): Decimal // notify IDE Decimal object | |
{ | |
self::paramsValidation($intValue, null); | |
return new static((string)$intValue, 0); // use static (not self). Price object, not Decimal |
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
<?php | |
$client = new SoapClient(__DIR__ . '/test.wsdl', array( | |
'trace' => true, | |
'exceptions' => true, | |
'cache_wsdl' => WSDL_CACHE_NONE, | |
)); | |
$client->receiveEDIMessages(); | |
echo $client->__getLastResponse(); |
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
<?php | |
namespace SoftClub\Butb2Bundle\Command; | |
use SoftClub\Butb2Bundle\Service\SoapClient; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Filesystem\Filesystem; | |
use Symfony\Component\Process\ProcessBuilder; |
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
-- scheme | |
CREATE TABLE `ticks` ( | |
`id` int(10) UNSIGNED NOT NULL, | |
`symbol` varchar(255) NOT NULL, | |
`date` date NOT NULL, | |
`value` decimal(3,2) NOT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
INSERT INTO `ticks` (`id`, `symbol`, `date`, `value`) VALUES | |
(1, 'EURUSD', '2014-01-10', '1.34'), |