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
@MaximStrutinskiy
MaximStrutinskiy / macro.html.twig
Last active December 3, 2018 19:40
Twig macro - [time ~ 2.8s]
{% import _self as recursive_category_macro %}
{% macro recursive_category(category, recursive_category_macro) %}
<li>
<h4>{{ category.nameRu }}</h4>
{% if category.SChildren|length %}
<ul>
{% for child in category.SChildren %}
{{ recursive_category_macro.recursive_category(child, recursive_category_macro) }}
@MaximStrutinskiy
MaximStrutinskiy / domain
Last active September 13, 2018 22:17
Nginx config with reverse proxy + ssl(https)
server {
listen 80 ;
listen [::]:80;
server_name newstore.com.ua www.newstore.com.ua;
return 301 https://www.$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443;
@MaximStrutinskiy
MaximStrutinskiy / links
Last active August 22, 2018 10:33
FOSUser Bundle OAuth
<?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);
<?php
$site = "https://api.telegram.org/bot".$token;
$params = [
'chat_id' => '@'.$chanelId,
'text' => $text,
'parse_mode' => $parse_mode,
];
$options = array(
<?php
namespace MainBundle\Controller\Customer;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Class SitemapController
https://askubuntu.com/questions/831262/how-to-install-pgadmin-4-in-desktop-mode-on-ubuntu
# ~/.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
@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
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