Skip to content

Instantly share code, notes, and snippets.

View atlance's full-sized avatar

Anton Stepanov atlance

  • Saint Petersburg
View GitHub Profile
@atlance
atlance / gist:7af0356d5bd4926797307cd83d16ece6
Created December 25, 2021 01:16 — forked from Neolot/gist:3964380
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('Сидит %d котик', 'Сидят %d котика', 'Сидит %d котиков');
function declOfNum($number, $titles)
@atlance
atlance / connect_bluetooth_headphones.sh
Created October 1, 2021 23:25 — forked from egelev/connect_bluetooth_headphones.sh
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
<?php
declare(strict_types=1);
namespace App\DomainModel\Project\UseCase\Edit\Add\Team;
use App\Bus\Project\UseCase\Edit\Add\Editor\Command as EditorMessage;
use App\Bus\Project\UseCase\Edit\Add\Observer\Command as ObserverMessage;
use App\DomainModel\AuthAssignment\Entity\AuthAssignment;
use App\DomainModel\AuthAssignment\Entity\AuthAssignmentRepository;
/api/v2/academy/block/recommendations             -> /api/v2/academy/profile/dashboard/block/recommendations
/api/v2/analytics-document/block/recommendations  -> /api/v2/analytics-document/profile/dashboard/block/recommendations
/api/v2/news/block/recommendations                -> /api/v2/news/profile/dashboard/block/recommendations
/api/v2/news/expert-opinion/list                  -> /api/v2/news/profile/dashboard/experts-opinions
/api/v2/event/announcements                       -> /api/v2/event/profile/dashboard/announcements
/api/v2/project/block/recommendations/initiatives -> /api/v2/project/profile/dashboard/block/recommendations/initiatives
/api/v2/project/block/recommendations             -> /api/v2/project/profile/dashboard/block/recommendations
/api/v2/project/tab/for-current-user              -> /api/v2/project/profile/tab/my-projects/all
                                                     /api/v2/project/profile/tab/my-projects/author
@atlance
atlance / support for route name_prefix.md
Last active August 10, 2020 16:40
Phpstorm plugin symfony fix support routing
  1. точно в этой последовательности выполняем в терминале:
# hda-verb /dev/snd/hwC0D0 0x20 0x500 0x1b
# hda-verb /dev/snd/hwC0D0 0x20 0x477 0x4a4b
# hda-verb /dev/snd/hwC0D0 0x20 0x500 0xf
# hda-verb /dev/snd/hwC0D0 0x20 0x477 0x74
  1. Что бы это исправление сделать постоянным пишем скрипт для systemd - выполняется при загрузке.
@atlance
atlance / myservice
Created February 19, 2020 10:13 — forked from bramus/myservice
Running a PHP script as a service/daemon using `start-stop-daemon`
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
@atlance
atlance / 60-jetbrains.conf
Created December 10, 2019 07:48 — forked from bittner/60-jetbrains.conf
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@atlance
atlance / HotsiteListener.php
Created November 7, 2019 16:01 — forked from raphox/HotsiteListener.php
Symfony script to create dynamic routes to hotsite or subdomains #php #subdomain #routes #dynamic
<?php
namespace Acme\HotsiteBundle\EventListener;
use Acme\HotsiteBundle\Controller\HotsiteSignedController;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\RedirectResponse;