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

Magento 2 0.42.0-beta1 is available since a few days. In order to test it right away, we will see how to install a running demo in 5 minutes sharp thanks to Docker. If you don't know Docker, please report to our previous tutorial.

We will even go further and give you the choice between two types of setup:

  • a read-only discovery mode running instance of Magento 2 in order to discover the new admin interface and click
  • a developer mode, in order to have a development environnement and start playing with the brand new technical features of Magento 2.

Disclaimer : We assume you have a running and fonctionnal Docker on your computer.

<?php
class Identity
{
private $role;
public function __construct($role)
{
$this->role = $role;
}
@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": [
{
<?php
$data = [
[1,2],
[1,2,3],
[1,2,3,4]
];
$callbackTest = new CallbackFilterIterator(new ArrayIterator($data), function (&$current) {
$current['test'] = 'test';
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
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
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;
#!/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
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
# 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