Skip to content

Instantly share code, notes, and snippets.

View MaximStrutinskiy's full-sized avatar
✍️
Open to new offers.

Maxim Strutinskiy MaximStrutinskiy

✍️
Open to new offers.
View GitHub Profile
<?php
namespace DesignPatterns\Creational\AbstractFactory;
/**
* In this case, the abstract factory is a contract for creating some components
* for the web. There are two ways of rendering text: HTML and JSON
*/
abstract class AbstractFactory
{
@MaximStrutinskiy
MaximStrutinskiy / BulkInsert.php
Last active October 10, 2017 12:31
Doctrine Bulk Inserts
<?php
foreach ($nominals as $nominal) {
for ($i = 1; $i <= $nominal['code_count']; $i++) {
$code = new Code();
$code->setShop($shop);
$code->setCode($this->GenerateData($codeLength, $codeType, $codePrefix));
$code->setPincode($this->GenerateData($pincodeLength, $pincodeType));
$code->setCodeLiveCikle($codeLiveCikle);
$code->setMinDateActivity($minDateActivity);
1) download php source from official site (example: wget -O php-5.3.29.tar.gz http://us.php.net/get/php-5.3.29.tar.gz/from/this/mirror)
2) extract to you folder (extract php-X-X-X.tar.gz to your folder)
3) cd to folder (move to php folder)
4) ./configure --with-apxs2=/usr/bin/apxs (add your custome configuration)
./configure --with-apxs2=/usr/bin/apxs --cache-file=/home/andersen/php-5.3.29 --with-config-file-path=/home/andersen/php-5.3.29/etc --with-config-file-scan-dir=/home/andersen/php-5.3.29/var/db --disable-all --enable-phar --enable-session --enable-short-tags --enable-tokenizer --with-pcre-regex --with-zlib=/usr --enable-pdo --enable-cli --enable-opcache --enable-dom --enable-libxml --enable-simplexml --enable-xml --enable-xmlreader --enable-xmlwriter --with-xsl --with-libxml-dir=/usr --enable-soap --enable-session --with-iconv --enable-hash --enable-debug --enable-bcmath --with-bz2=/usr --enable-calendar --enable-ctype --enable-dom --enable-fileinfo --with-libdir=lib/x86_64-linux-gnu --with-mysql=m
@MaximStrutinskiy
MaximStrutinskiy / Change .bashrc file
Last active December 4, 2017 12:19
Change php version in Ubuntu(16.04) console.
1)
echo "alias php='/usr/bin/< youre php version php7.1>'" >> ~/.bashrc && source ~/.bashrc
restart computer
2)(https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/)
$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart
$ sudo update-alternatives --set php /usr/bin/php7.1
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
https://askubuntu.com/questions/831262/how-to-install-pgadmin-4-in-desktop-mode-on-ubuntu
<?php
namespace MainBundle\Controller\Customer;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Class SitemapController
<?php
$site = "https://api.telegram.org/bot".$token;
$params = [
'chat_id' => '@'.$chanelId,
'text' => $text,
'parse_mode' => $parse_mode,
];
$options = array(
<?php
foreach ($content['result'] as $item) {
$i++;
$category = new Category();
$category->setCategoryID($item['categoryID']);
$category->setParentID($item['parentID']);
$category->setRealcat($item['realcat']);
$category->setName($item['name']);
$app['orm.em']->persist($category);
@MaximStrutinskiy
MaximStrutinskiy / links
Last active August 22, 2018 10:33
FOSUser Bundle OAuth