Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
<?php
use Blackprism\Nothing\HydratorCallable;
public function executeSomeQuery()
{
$this->createQueryBuilder()
->select('id', 'name', 'last_updated')
->from('user');
@alborq
alborq / DocumentationNormalizer.php
Last active July 21, 2020 11:14
API-Platform Use JWT Token to auth, Add JWT in documentation | Api-platofrm, JWT, PHP, Documentation, Security, Swagger
<?php
namespace AppBundle\Documentation;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
* Class DocumentationNormalizer
* @package AppBundle\Documentation
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'capifony_symfony2'
load 'app/config/deploy'
@alborq
alborq / srm.php
Last active February 9, 2016 18:42
<?php
$mapperConfiguration = new MapperConfiguration();
static class MapperCallableHelper{
protected static $attributName = "";
protected static $setterCallable = function(Mapper $mapper, $object, $value){
$method = 'set'.ucfirst(self::$attributName);
$object->$method($value);
@alborq
alborq / CodingGame.php
Created September 20, 2015 19:04
Gist for codingame, PHP dump for error output.
/**
* Envoi un var_dump dans la sortie erreur
* @param mixed $var
*/
function dump($var){
ob_start();
var_dump($var);
$result = ob_get_clean();
fwrite(STDERR,$result);
}
@alborq
alborq / MenuBuilder.php
Created July 24, 2015 14:12
KNPMenuBuilder, WIth Event how to order element => solution
<?php
namespace xxxx\Menu;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use xxx\Event\ConfigureMenuEvent;
class MenuBuilder extends ContainerAware
<?php
namespace Shadow\WowBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function testAction()
{
{% for item in appliControle %}
{% set htmlFile = "" %}
{% set isPerime = false %}
{% for file in item.DataFileNeeded %}
{% set htmlFile = htmlFile~ "<li>" %}
{% set htmlFile = htmlFile~ file.name %}
{% if file.lastUpdate.date|date('Y-m-d') == "now"|date('Y-m-d') %}
{% set htmlFile = htmlFile~ '<span class="uk-badge uk-badge-success uk-float-right">Récent</span>' %}
{% elseif file.lastUpdate.date|date('Y-m-d') < "now"|date_modify('-2 Day')|date('Y-m-d') %}
{% set htmlFile = htmlFile~ '<span class="uk-badge uk-badge-danger uk-float-right">Périmé</span>' %}
SELECT
*
FROM AppliControle AS ac
INNER JOIN applicontrole_controlinterne AS aci ON aci.applicontrole_id = ac.id
INNER JOIN ControlInterne AS ci ON aci.controlinterne_id = ci.id
INNER JOIN Task AS t ON ci.task_id = t.id
INNER JOIN (
SELECT
aci2.applicontrole_id AS id,
max(t2.date) as recent