Skip to content

Instantly share code, notes, and snippets.

View imiroslavov's full-sized avatar

Iliya Miroslavov Iliev imiroslavov

  • Varna, Bulgaria
View GitHub Profile
@imiroslavov
imiroslavov / example.js
Last active January 5, 2017 16:23
Monkey-patching javascript functions
function function_name() {
console.log('function_name');
}
var original_function = function_name;
function_name = function() {
console.log('pre');
var result = original_function.apply(this, arguments);
@imiroslavov
imiroslavov / example.css
Created November 17, 2017 12:01
Vertical alight
.class {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@imiroslavov
imiroslavov / rabbitmq.txt
Created April 24, 2019 13:12 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
<?php
namespace App\EventListener;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
<?php
namespace App\Doctrine\ORM\Tools\Pagination;
use Doctrine\ORM\Tools\Pagination\Paginator as BasePaginator;
/**
* Class Paginator.
*/
class Paginator extends BasePaginator
function trim(string) {
return string.replace(/^\s+|\s+$/g, '');
}
function gen_uuid()
{
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff),
<?php
namespace App\Utils;
/**
* Class ClassAnalyzer.
*/
class ClassAnalyzer
{
/**
<?php
namespace App\Twig\Extension;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* Class JsonDecodeTwigExtension.
*/
@imiroslavov
imiroslavov / _Test_Repository.php
Last active October 10, 2019 07:38
Repository generator
<?php
namespace App\Repository;
use App\Entity\_Test_;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* Class _Test_Repository