Skip to content

Instantly share code, notes, and snippets.

Avatar

Beno!t POLASZEK bpolaszek

View GitHub Profile
@bpolaszek
bpolaszek / select-countries.html
Created Jul 17, 2020
Vanilla JS snippet to generate a SELECT country list from an API.
View select-countries.html
<select id="country" name="country">
<option/>
</select>
<script>
(async () => {
const response = await fetch('https://restcountries.eu/rest/v2/all?fields=alpha2Code;name');
const countries = await response.json();
const select = document.getElementById('country');
for (const country of countries) {
const option = document.createElement('option');
@bpolaszek
bpolaszek / bootstrap.php
Last active Jun 26, 2020
Symfony shortcuts for Pest
View bootstrap.php
<?php
# tests/bootstrap.php
declare(strict_types=1);
namespace App\Test;
use App\Kernel;
use Doctrine\DBAL\DriverManager;
use Doctrine\Migrations\MigratorConfiguration;
@bpolaszek
bpolaszek / debug-breakpoint.html
Created Jan 8, 2020
HTML snippet for breakpoint debugging / Bootstrap 4
View debug-breakpoint.html
<div class="d-inline-block d-sm-none">XS</div>
<div class="d-none d-sm-inline-block d-md-none">SM</div>
<div class="d-none d-md-inline-block d-lg-none">MD</div>
<div class="d-none d-lg-inline-block d-xl-none">LG</div>
<div class="d-none d-xl-inline-block">XL</div>
@bpolaszek
bpolaszek / API-Platform New Documentation Hierarchy.md
Last active Oct 7, 2019
New documentation hierarchy suggestion for Api-Platform 2.x.
View API-Platform New Documentation Hierarchy.md

API-Platform Documentation

Getting started

1. Introduction

Introduction, concepts, features, other resources

@bpolaszek
bpolaszek / check-environment-variables.php
Last active Nov 5, 2018
Check that all environment variables defined in your .env.dist are properly set.
View check-environment-variables.php
#!/usr/bin/env php
<?php
/**
* Checks that all environment variables are set before deploying.
*
* @author Beno!t POLASZEK - 2018
* @link https://gist.github.com/bpolaszek/559dbc341dec51303fc0dea8162cf735#gistcomment-2747882
*/
@bpolaszek
bpolaszek / CleanAssociationsTrait.php
Created Sep 24, 2015
Doctrine : Fix ManyToOne relationships when the value in database is 0 instead of NULL
View CleanAssociationsTrait.php
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Event\LifecycleEventArgs;
/**
* Trait CleanAssociationsTrait
*
* This trait is intended to fix the Doctrine ManyToOne relationships when the stored value in database is a 0 instead of NULL.
* Sometimes you plug Doctrine on an existing database without foreign key support.
You can’t perform that action at this time.