Skip to content

Instantly share code, notes, and snippets.

View darles's full-sized avatar

Darius darles

  • UAB Informacinių techologijų organizacija
  • Lithuania
View GitHub Profile
@darles
darles / BaseService.php
Created January 20, 2014 07:40
Situation: I have few entities (task, client, ...) most of them needs same functionality like search by id, create, save, delete. Firstly I created services for each of them, and all services looked same (with same methods). So know I tried to use parent service to optimize code duplication. Is this the right way to use parent services?
<?php
...
public function __construct(EntityManager $em, Paginator $paginator, EventDispatcherInterface $eventDispatcher, Router $router, $itemsPerPage)
{
$this->em = $em;
$this->paginator = $paginator;
$this->eventDispatcher = $eventDispatcher;
$this->router = $router;
$this->itemsPerPage = $itemsPerPage;
@darles
darles / QuickFileOpen.js
Created May 15, 2013 11:32
Tampermonkey plugin for quick open file in PhpStorm from Symfony 2 exception window using Remote call ( http://plugins.jetbrains.com/plugin?pr=phpStorm&pluginId=6027 )
// ==UserScript==
// @name Error handler for Symfony and PHPStorm
// @version 0.1
// @description Quickly open files in PhpStorm from Symfony error pages using Remote Call plugin.
// @match http://*/*
// @author darles
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// ==/UserScript==
var input = $('h1').html();
@darles
darles / layout.html.twig
Last active December 17, 2015 06:08
Quickly open file in PhpStorm from Symfony 2 exception window using Remote call ( http://plugins.jetbrains.com/plugin?pr=phpStorm&pluginId=6027 ) plugin and some JS. Put this layout.html.twig file to app/Resources/TwigBundle/views/ folder.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={{ _charset }}"/>
<meta name="robots" content="noindex,nofollow" />
<title>{% block title %}{% endblock %}</title>
<link href="{{ asset('bundles/framework/css/structure.css') }}" rel="stylesheet" type="text/css" media="all" />
<link href="{{ asset('bundles/framework/css/body.css') }}" rel="stylesheet" type="text/css" media="all" />
{% block head %}{% endblock %}
</head>