Skip to content

Instantly share code, notes, and snippets.

soyuka / PropertyMetadataFactory.php
Created Feb 18, 2021
API Platform use the Model namespace for the API and the Entity namespace for doctrine
View PropertyMetadataFactory.php
namespace App\Metadata;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
final class PropertyMetadataFactory implements PropertyMetadataFactoryInterface
GregoireHebert /
Last active Feb 17, 2021
How to create a login experience from the admin with API Platform 2.6

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

Liste d'acronymes utilisés dans la programmation

Acronyme Définition
POO / OOP programmation orientée objet / object-oriented-programming
Les principes SOLID :
• SRP Single Responsibility Principle
• OCP Open/Closed principle
• LSP Liskov Substitution Principle (un acronyme féministe, du nom de la mathématicienne Barbara Liskov !)
Pierstoval / Makefile
Last active Mar 2, 2021
"Check requirements" command for your Makefile
View Makefile
# Use it like this:
# $ printf $(_TITLE) "Something in green" "The message"
# This will output something like this:
# [Something in green] The message
# (of course, with proper colors)
_TITLE := "\033[32m[%s]\033[0m %s\n" # Green text
vedam /
Last active Sep 4, 2021
links and ressources from the svelte-summit-2020 talks

You'll find the talks here

Morgan Williams @mrgnw

The Zen of Svelte

Approaching frontend as a backend developer, Svelte feels surprisingly pythonic. Let's take a quick look at what's familiar, what's foreign, and how to explore the gap.

versedi / webpack.config.js
Last active Sep 6, 2021
Webpack Encore + Sass + MiniCSSExtractPlugin + PurgeCSS + OptimizeCss + Babel + Typescript
View webpack.config.js
/* eslint-disable no-useless-escape */
const Encore = require('@symfony/webpack-encore');
const TerserPlugin = require('terser-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const HtmlCriticalWebpackPlugin = require('html-critical-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const PurgeCssPlugin = require('purgecss-webpack-plugin');
const WebpackBar = require('webpackbar');
const path = require('path');
GregoireHebert / ApiResourcesConvertConfigurationCommand.php
Last active Mar 6, 2019
Transform ApiResource configuration to XML
View ApiResourcesConvertConfigurationCommand.php
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;
vincentchalamon / DocumentationNormalizer.php
Last active Oct 16, 2019
Add login, logout & forgot-password Swagger documentation
View DocumentationNormalizer.php
namespace App\Serializer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
* @author Vincent Chalamon <>
whoisryosuke / nextjs-hoc-authorization.js
Created Jun 26, 2018
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
View nextjs-hoc-authorization.js
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
soyuka / OperationPathResolver.php
Created May 15, 2018
Workflow bridge for api platform
View OperationPathResolver.php
namespace ApiPlatform\Workflow\PathResolver;
use ApiPlatform\Core\PathResolver\OperationPathResolverInterface;
final class OperationPathResolver implements OperationPathResolverInterface