Skip to content

Instantly share code, notes, and snippets.

@soyuka
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
<?php
declare(strict_types=1);
namespace App\Metadata;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
final class PropertyMetadataFactory implements PropertyMetadataFactoryInterface
@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 Acronymes.md

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
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
vedam / svelte-summit-2020-summary.md
Last active Sep 4, 2021
links and ressources from the svelte-summit-2020 talks
View svelte-summit-2020-summary.md

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
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
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;
@vincentchalamon
vincentchalamon / DocumentationNormalizer.php
Last active Oct 16, 2019
Add login, logout & forgot-password Swagger documentation
View DocumentationNormalizer.php
<?php
declare(strict_types=1);
namespace App\Serializer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
* @author Vincent Chalamon <vincentchalamon@gmail.com>
@whoisryosuke
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
soyuka / OperationPathResolver.php
Created May 15, 2018
Workflow bridge for api platform
View OperationPathResolver.php
<?php
declare(strict_types=1);
namespace ApiPlatform\Workflow\PathResolver;
use ApiPlatform\Core\PathResolver\OperationPathResolverInterface;
final class OperationPathResolver implements OperationPathResolverInterface
{