Skip to content

Instantly share code, notes, and snippets.


Yan Ivanov franzose

View GitHub Profile
franzose / ga_reporting.php
Last active Aug 15, 2021
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 01_repository.php
class SomeEntityRepository extends EntityRepository
public function findThis()
// method body
public function findThat()
franzose / jade-to-laravel-blade-mixins.jade
Last active Dec 30, 2019
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')
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 Jan 21, 2018
Maintenance Mode try
View maintenance.php
public function onKernelRequest(GetResponseEvent $event)
if (!$event->isMasterRequest()) {
if ($this->isMaintenanceMode() && !$this->isUserAdmin()) {
franzose / reference.yml
Created Apr 23, 2017 — 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 / gist:6837241
Created Oct 5, 2013
in app/routes.php
View gist:6837241
// everything's creating fine. Positions and closure table, all's fine.
$Test = Test::create(array());
$child1 = $Test->appendChild(Test::make(), 0, true);
$child2 = $Test->appendChild(Test::make(), 1, true);
$child3 = $Test->appendChild(Test::make(), 2, true);
$child4 = $Test->appendChild(Test::make(), 3, true);
// this returns ids of $Test, $child1, $child2 and $child3...
franzose / gist:6836910
Created Oct 5, 2013
`$page = Page::make();` instead of `$page = new Page()`; Then we can set proper position...
View gist:6836910
public static function make(array $attributes = array())
$model = new static();
// Workaround to set the position
if ( ! isset($attributes[static::POSITION]))
// We set depth to 0 because newly created model
// via 'create' method has no default closure table
// attributes and is inserted as a root node