Skip to content

Instantly share code, notes, and snippets.

View franzose's full-sized avatar

Yan Ivanov franzose

View GitHub Profile
franzose / 01_repository.php
Created April 7, 2021 02:13
Query objects
View 01_repository.php
class SomeEntityRepository extends EntityRepository
public function findThis()
// method body
public function findThat()
franzose / ga_reporting.php
Last active August 15, 2021 18:11
Google Analytics Reporting API usage example
View ga_reporting.php
// composer require google/apiclient
require __DIR__ . '/vendor/autoload.php';
// This is the file obtained from Google during the service account creation process
// see these links:
// 1.
// 2.
View MakeCoolStuff.php
class MakeCoolStuff extends AbstractController
public function __construct(
EntityManagerInterface $manager,
YourFunkyService $service
) {
$this->manager = $manager;
$this->service = $service;
View ClassLoader.php
// YourVendor/YourPackage/Behat/Legacy/ClassLoader.php
namespace YourVendor\YourPackage\Behat\Legacy;
use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
try {
require_once 'path/to/vendor/symfony/class-loader/ClassLoader.php';
franzose / maintenance.php
Created January 21, 2018 03:04
Maintenance Mode try
View maintenance.php
public function onKernelRequest(GetResponseEvent $event)
if (!$event->isMasterRequest()) {
if ($this->isMaintenanceMode() && !$this->isUserAdmin()) {
franzose / reference.yml
Created April 23, 2017 00:12 — forked from mnapoli/reference.yml
Doctrine YAML configuration reference
View reference.yml
# Inspired from
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
franzose / jade-to-laravel-blade-mixins.jade
Last active December 30, 2019 22:05
Jade -> Laravel Blade mixins
View jade-to-laravel-blade-mixins.jade
//- As you may know, Laravel 5 provides the Elixir to compile assets with no pain.
These mixins is for those of you who want to use Jade power combined with that of Laravel Blade.
The syntax mimic Blade statements, however identation differs in some cases.
- var newline = "\r\n"
- var loopIterator = '$iterator'
//- @extends mixin
Example: +extends('layouts/master')
Compiled: @extends('layouts/master')
franzose / epiceditor-reflowing.js
Created May 17, 2014 00:49
EpicEditor reflowing
View epiceditor-reflowing.js
// Here's an example of using EpicEditor with something like Twitter Bootstrap tabs.
// Thing is that EpicEditor doesn't calculate its dimensions properly when it is nested in a hidden container.
// So, we just need to call 'reflow' method of the EpicEditor. Here is the simple solution:
// Tab link that's clicked
$('a[data-toggle="tab"]').on('', function (e) {
// EpicEditor instance recalculates its dimensions.
franzose / routes.php
Created March 21, 2014 02:16
Laravel routes and locales made simple (@barryvdh solution)
View routes.php
$languages = array('nl','fr');
$locale = Request::segment(1);
if(in_array($locale, $languages))
$locale = null;