Skip to content

Instantly share code, notes, and snippets.

View MushuLeDragon's full-sized avatar
🐉
On Fire

MushuLeDragon MushuLeDragon

🐉
On Fire
View GitHub Profile
@MushuLeDragon
MushuLeDragon / AjaxInputResearchController.php
Created June 4, 2021 09:00
JS / Ajax research for input suggestion
<?php
class ClassController extends Controller
{
public function list_professions(Request $request)
{
$em = $this->container->get('doctrine')->getManager();
$type = $request->request->get('type');
$profession_libelle = $request->request->get('profession_libelle');
# Deny access to filenames starting with dot(.)
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>
@MushuLeDragon
MushuLeDragon / AbstractMigrationCommand.php
Last active March 17, 2021 11:19 — forked from jmsche/AbstractMigrationCommand.php
Proxy commands for Doctrine Migrations bundle with multiple entity managers.
<?php
declare(strict_types=1);
namespace App\Command\Migration;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager;
use Doctrine\Migrations\Configuration\Migration\YamlFile;
use Doctrine\Migrations\DependencyFactory;
@MushuLeDragon
MushuLeDragon / NativeAutoload.php
Created January 21, 2021 14:01
Autoloading with native PHP
<?php
// Ce fichier se trouve au chemin src/NativeAutoload.php
namespace App;
class NativeAutoload {
}
<?php
namespace Src\App;
class ObjectConverterClass
{
/**
* Convert Array to Object class
*
* @param array $array
<?php
namespace Src\App;
class ReplaceArrayKeyWhitoutChangingOrder
{
/**
* Function that replace an array key without changing the order of all keys
*
* @param array $array
{
"meta": {
"theme": "kendall"
},
"basics": {
"name": "Loïc Thiaw-Wing-Kaï",
"label": "Symfony Backend developer",
"picture": "https://media.licdn.com/dms/image/C4E03AQGf04QjKzIBVg/profile-displayphoto-shrink_200_200/0/1516887922413?e=1678924800&v=beta&t=0wfK98iP3h9xwWFryTUkTMxNpt5rcoivulbUq0KuAtE",
"email": "[email protected]",
"phone": "+33 616416280",
@MushuLeDragon
MushuLeDragon / GitHubPages.sh
Last active August 19, 2020 13:14
Way to publish subfolder on Github Pages
# Commands to set a subfolder on Github Pages instead ROOT
# Inspired from
# - https://gist.github.com/cobyism/4730490
# And
# - https://stackoverflow.com/a/36782614/7998119
# Command to publish on Remote
git subtree push --prefix build_folder origin gh-pages
# Command to update the branch after a commit
git push origin `git subtree split --prefix build_folder master`:gh-pages --force
@MushuLeDragon
MushuLeDragon / sql_import.php
Created March 16, 2020 09:19 — forked from b4oshany/sql_import.php
PHP PDO sql file import.
<?php
namespace libs\mysql;
class PDODbImporter{
private static $keywords = array(
'ALTER', 'CREATE', 'DELETE', 'DROP', 'INSERT',
'REPLACE', 'SELECT', 'SET', 'TRUNCATE', 'UPDATE', 'USE',
'DELIMITER', 'END'
);
@MushuLeDragon
MushuLeDragon / git-update-a-fork.md
Last active February 11, 2020 10:50 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream