Skip to content

Instantly share code, notes, and snippets.

View chalasr's full-sized avatar

Robin Chalas chalasr

View GitHub Profile
@chalasr
chalasr / simple-git-branching-model.md
Last active October 15, 2023 11:44 — forked from jbenet/simple-git-branching-model.md
a simple git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@chalasr
chalasr / EnhancedRepository.php
Last active September 26, 2023 00:59
Implements a custom EntityRepository using Factory in Symfony2.6+
<?php
namespace App\Util\Doctrine\Repository;
use App\Util\Doctrine\Entity\AbstractEntity;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
@chalasr
chalasr / abstract.md
Last active May 29, 2023 13:14
Getting the full power of Dependency Injection in Symfony 6.3

Getting ready for Symfony 7

2 years ago Symfony 6.0 was released. A lot has happened since then, paving the way for Symfony 7 is just around the corner, this workshop will introduce you to the most important changes that it ships after 2 years of work. of Symfony 6. important features and changes that have been shipped Let's features of the dependency injection container. You will also learn how to prepare a Symfony 4 app for version 5, to be released next November. EventDispatcher, Security, Cache, etc - many important components have been improved, which means some part of them have been deprecated, and replaced by updated interface.

Long gone are the days when Dependency Injection in Symfony was only about injecting the entire container everywhere. Now we write services that depend on what they really need, That's is what Dependency Injection is. a powerful yet complex pattern with the Inversion Of Control principle belonfs Symfony implements in a flexible

@chalasr
chalasr / oss-news.md
Last active November 27, 2022 18:03
Update on my OSS work - November 25, 2022

Hey sponsors!

Here is a quick update regarding what my OSS work has been focused on lately:

  • Symfony is smoothly integrating more modern (standard) authentication flows in core, especially OpenIDConnect. I've helped making the first step in Symfony 6.2: Adding a generic RFC6750-compliant Bearer Access Token authenticator (symfony/symfony#46428).
  • Next steps: Now helping someone contributing a built-in OIDC authenticator (symfony/symfony#48285), also a CAS authenticator (symfony/symfony#48276).
  • Also on the Security topic: I gave a talk at SymfonyCon in DisneyLand Paris about GNAP - The future of OAuth. Once the protocol goes stable, an integration will come into Symfony as well (WIP from me). It was my biggest conference so far :)
  • I started contributing to some Golang OSS, mostly to push forward a recent feature from HTTP that aims to improve application performances: [HTTP 103 Early Hints responses](https://www.fastly.com/blog/beyond-server-p
@chalasr
chalasr / ContainerAwareVersion.php
Created June 9, 2016 13:34
DoctrineMigration - Container-aware migration with EntityManager example
<?php
namespace Application\Migrations;
use AppBundle\Entity\Foo;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@chalasr
chalasr / ApplicationPersonneBundle:CRUD:list.html.twig
Last active March 24, 2022 11:23
Autocompletion AJAX for SonataAdminBundle $datagridMapper filters
{% extends 'SonataAdminBundle:CRUD:base_list.html.twig' %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
$(document).ready(function(){
var MIN_LENGTH = 3;
var datalistFirst = $('<ul class="select2-results autoResults" role="listbox" id="datalist_filter_firstname_value"></ul>');
var datalistName = $('<ul class="select2-results autoResults" role="listbox" id="datalist_filter_name_value"></ul>');
$('#filter_name_value').after(datalistName);
@chalasr
chalasr / jekyll_gist_tag.rb
Last active April 8, 2021 10:45 — forked from imathis/gist_tag.rb
Embed gists in markdown files of a jekyll application by creating a custom Liquid tag
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@chalasr
chalasr / UnixTimestampDateConversion.php
Last active March 10, 2021 04:50
Integer values for date claims using lcobucci/jwt v4
<?php declare(strict_types=1);
namespace App\JWT\Encoding;
use Lcobucci\JWT\ClaimsFormatter;
use Lcobucci\JWT\Token\RegisteredClaims;
class UnixTimestampDateConversion implements ClaimsFormatter
{
public function formatClaims(array $claims): array
@chalasr
chalasr / bootstrap.sh
Created April 29, 2020 13:09 — forked from keo/bootstrap.sh
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@chalasr
chalasr / LoginAuthenticationHandler.php
Last active January 11, 2020 11:23
FOSUserBundle Login Authentication Success Handler example.
<?php
namespace AppBundle\EventListener;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;