Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Probably somewhere sipping a beer

Grégoire Hébert GregoireHebert

:octocat:
Probably somewhere sipping a beer
View GitHub Profile
@GregoireHebert
GregoireHebert / API-Platform-2.6-admin-login.md
Last active Feb 17, 2021
How to create a login experience from the admin with API Platform 2.6
View API-Platform-2.6-admin-login.md

Creating a login experience from the Admin with API Platform 2.6

You can use whatever authentication mode you want, but for the sake of the demonstration let's use JWT.

I'll grab a freshly downloaded api-platform distribution.

from the php container :

	composer require jwt-auth
	apk add openssl
View A hack for showing LaTeX formulas in GitHub markdown.md

Problem

A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.

Investigation

@GregoireHebert
GregoireHebert / Greeting.php
Created Apr 7, 2020
API-Platform calculated fields
View Greeting.php
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
@GregoireHebert
GregoireHebert / niceClock.html
Last active May 17, 2019
A digital clock made of analog clocks
View niceClock.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
* {
margin: 0;
padding: 0;
border: 0;
}
@GregoireHebert
GregoireHebert / ApiResourcesConvertConfigurationCommand.php
Last active Mar 6, 2019
Transform ApiResource configuration to XML
View ApiResourcesConvertConfigurationCommand.php
<?php
declare(strict_types=1);
namespace App\Command;
use App\Command\DataTransformers\XmlTransformer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
View pong.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Pong">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pong</title>
<style type="text/css">
canvas { background-color: black; }
@GregoireHebert
GregoireHebert / lissajous.html
Last active May 16, 2019
Table des courbes de Lissajous
View lissajous.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Table de courbes de Lissajous">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Table de courbes de Lissajous</title>
<style type="text/css">
body { background-color: black; }
</style>
@GregoireHebert
GregoireHebert / fougere.html
Last active Nov 21, 2018
La fougère de Barnsley
View fougere.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="la fougère de Barnsley">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fougère de Barnsley</title>
</head>
<body>
<canvas id="fougere" width="600" height="600"></canvas>
View DotenvUpdater
#!/usr/bin/env php
<?php
declare(strict_types=1);
foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
if (file_exists($file)) {
require $file; break;
}
}
@GregoireHebert
GregoireHebert / recap.txt
Created Nov 5, 2015
Récapitulatif du script de création de projet
View recap.txt
Cet outil va réaliser les opérations suivantes :
1) Création d'un répertoire http
2) Ajout d'un virtualhost
3) Création d'un nouveau projet sur GITLAB
4) Initialiser le dépôt
5) Configurer le déploiement automatique
6) Déployer le projet une première fois