Skip to content

Instantly share code, notes, and snippets.

View morozov's full-sized avatar

Sergei Morozov morozov

View GitHub Profile
<?php
/**
* @requires function non_existing_function
* @see http://phpunit.de/manual/3.7/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.requires.tables.api
*/
class RequiresTest extends PHPUnit_Framework_TestCase
{
public static function setUpBeforeClass()
{
@morozov
morozov / proxy.php
Created June 11, 2014 13:02
Proxy Switcher decorator for Guzzle loader
<?php
use Guzzle\Http\ClientInterface;
use Valera\Loader\LoaderInterface;
use Valera\Resource;
use Valera\Loader\Result;
class ProxySwitcher implements LoaderInterface
{
/**

Keybase proof

I hereby claim:

  • I am morozov on github.
  • I am morozov (https://keybase.io/morozov) on keybase.
  • I have a public key whose fingerprint is 4786 8D56 20FC 7279 A9C7 E74B 0D74 4A7E 0F05 9119

To claim this, I am signing this object:

Verifying that +morozov is my Bitcoin username. You can send me #bitcoin here: https://onename.io/morozov
var data = [
{
"timestamp": 1436450162,
"temperature": 23
}
];
var mgData = data.map(function (point) {
return {
date: new Date(point.timestamp * 1000),
@morozov
morozov / compiler.end_context.php
Created November 6, 2015 00:02
Kind of automatic escaping in Smarty
<?php
function smarty_compiler_end_context($_, Smarty_Compiler $compiler)
{
array_shift($compiler->default_modifiers);
}
@morozov
morozov / master.php
Last active December 17, 2015 18:49
Trying to setup communication by means of STDIO
<?php
function start_worker($id)
{
printf("starting worker: %s\n", $id);
$proc = proc_open(
'php worker.php ' . $id,
array(
array('pipe', 'r'),
array('pipe', 'w'),
@morozov
morozov / benchmark.p
Last active December 27, 2015 05:59
SugarCRM on HHVM Benchmarking
# output as png image
set terminal png size 1280,800
set output "benchmark.png"
set title "SugarCRM Benchmarking"
# y-axis grid
set grid y
# x-axis label
<?php
/*
CREATE TABLE DB2_TEST
(
ID smallint DEFAULT 0
)
*/
$dsn = 'HOSTNAME=localhost;UID=db2inst1;PWD=Passw0rd;DATABASE=test';
$ './configure' '--cache-file=/home/morozov/.phpbrew/cache/config.cache' '--prefix=/home/morozov/.phpbrew/php/php-7.2.0' '--with-config-file-path=/home/morozov/.phpbrew/php/php-7.2.0/etc' '--with-config-file-scan-dir=/home/morozov/.phpbrew/php/php-7.2.0/var/db' '--disable-all' '--enable-session' '--enable-short-tags' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-opcache' '--enable-fpm' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-iconv' '--with-gd=shared' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-soap' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mb