Skip to content

Instantly share code, notes, and snippets.

View alexandr-parkhomenko's full-sized avatar

Oleksandr Parkhomenko alexandr-parkhomenko

  • ORO, Inc
  • Kyiv, Ukraine
View GitHub Profile
Usage: /home/travis/.phpenv/versions/7.0/bin/php-config [OPTION]
Options:
--prefix [/home/travis/.phpenv/versions/7.0.8]
--includes [-I/home/travis/.phpenv/versions/7.0.8/include/php -I/home/travis/.phpenv/versions/7.0.8/include/php/main -I/home/travis/.phpenv/versions/7.0.8/include/php/TSRM -I/home/travis/.phpenv/versions/7.0.8/include/php/Zend -I/home/travis/.phpenv/versions/7.0.8/include/php/ext -I/home/travis/.phpenv/versions/7.0.8/include/php/ext/date/lib]
--ldflags [ -L/usr/lib/x86_64-linux-gnu]
--libs [-lcrypt -lc-client -lz -lexslt -ltidy -lresolv -lcrypt -lreadline -lncurses -lpq -lrt -lpq -lmcrypt -lltdl -lstdc++ -lcrypt -lpam -lgmp -lpng -lz -ljpeg -lcurl -lbz2 -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lssl -lcrypto -lfreetype -lz -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -ldl -lm -licui18n -licuuc -licudata -ldl -lm -licuio -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml
<?php
require_once __DIR__.'/app/autoload.php';
// Path to composer autoload, if phpunit installed locally, than it should be present in from 1st autoloader
include_once '~/.composer/vendor/autoload.php';
$configuration = \PHPUnit_Util_Configuration::getInstance(__DIR__.'/phpunit.xml.dist');
$testSuite = $configuration->getTestSuiteConfiguration('functional');
$i = 0;
foreach ($testSuite->getIterator() as $testSuite) {
# Extension package to add on Ubuntu 14.04
sudo apt-get install libxml2-dev libbz2-dev libmcrypt-dev libreadline-dev libxslt1-dev autoconf -y
# Extension package to add on Ubuntu 18.04
sudo apt-get install libssl-dev
# Extension package to add on Ubuntu 20.04
sudo apt install -y pkg-config libssl-dev libsqlite3-dev libbz2-dev libxml2-dev libcurl4-openssl-dev libonig-dev libpq-dev libreadline-dev libxslt1-dev libzip-dev libsodium-dev libwebp-dev
# +apxs2
sudo apt-get install apache2-dev -y
From ubuntu:15.10
RUN date
RUN apt-get update && apt-get install -y git curl
# MySQL
RUN echo mysql-server mysql-server/root_password password 1 | debconf-set-selections; \
echo mysql-server mysql-server/root_password_again password 1 | debconf-set-selections;
RUN apt-get -y install mysql-server
#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
As the manual says, "If two members compare as equal, their order in the sorted array is undefined." This means that the sort used is not "stable" and may change the order of elements that compare equal.
Sometimes you really do need a stable sort. For example, if you sort a list by one field, then sort it again by another field, but don't want to lose the ordering from the previous field. In that case it is better to use usort with a comparison function that takes both fields into account, but if you can't do that then use the function below. It is a merge sort, which is guaranteed O(n*log(n)) complexity, which means it stays reasonably fast even when you use larger lists (unlike bubblesort and insertion sort, which are O(n^2)).
<?php
function mergesort(&$array, $cmp_function = 'strcmp') {
// Arrays of size < 2 require no action.
if (count($array) < 2) return;
// Split the array in half
$halfway = count($array) / 2;
From debian:latest
RUN sudo apt-get update && sudo apt-get install git -y git
Run cd ~ && git clone https://github.com/kasparsd/php-7-debian.git && cd php-7-debian && ./build.sh && ./install.sh
From webdevops/php-nginx:debian-8-php7
RUN apt-get update
RUN echo 'export PATH=~/.composer/vendor/bin:$PATH' >> ~/.bashrc
RUN composer global require phpunit/phpunit
RUN apt-get install php7.0-xdebug && echo 'export PHP_IDE_CONFIG="serverName=php-7-0"' >> ~/.bashrc
<?php
$data = [
[1,2],
[1,2,3],
[1,2,3,4]
];
$callbackTest = new CallbackFilterIterator(new ArrayIterator($data), function (&$current) {
$current['test'] = 'test';
@alexandr-parkhomenko
alexandr-parkhomenko / gist:057205e23e4ef488a51840bef701d127
Created April 6, 2016 18:11
phpunit 5.2.10 ( worked configuration )
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "9b108527f3ad3b4db01e29a400510a2a",
"content-hash": "60647350c76a68f902fb57c380c2c361",
"packages": [
{