Skip to content

Instantly share code, notes, and snippets.

@f2r
f2r / README.md
Last active December 17, 2021 09:23

Exercice PHP

Objectif:

Vous devez réaliser une commande en PHP qui prend en paramètre, un fichier CSV et génère un JSON.

Lors d'un live coding sur Twitch (https://www.twitch.tv/fredbouchery), je prendrai tout ou partie des codes réalisés pour les commenter et donner mon avis sur la réalisation qui me plait le plus. En fonction du nombre de réponses, je ferai peut-être plusieurs live.

Pour m'envoyer vos réalisations, contactez moi en DM sur twitter (https://twitter.com/fredbouchery/) avant le mercredi 22 avril 2020 à minuit.

@tarciozemel
tarciozemel / slugify.js
Created January 22, 2018 17:17 — forked from eek/slugify.js
Vanilla JavaScript Slugify + Accent removal - Just another JavaScript Slugifier with an extra line for Accent Removal
function slugify(text) {
return text.toString().toLowerCase().trim()
.normalize('NFD') // separate accent from letter
.replace(/[\u0300-\u036f]/g, '') // remove all separated accents
.replace(/\s+/g, '-') // replace spaces with -
.replace(/&/g, '-and-') // replace & with 'and'
.replace(/[^\w\-]+/g, '') // remove all non-word chars
.replace(/\-\-+/g, '-') // replace multiple '-' with single '-'
}
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 23, 2024 22:24
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@webron
webron / Instructions.md
Last active February 11, 2021 14:06
Load multiple resources to swagger-ui - work by @ponelat

Steps to follow:

  1. Create a new global SwaggerUi object, make sure to give the global variable a new name (in this case, swaggerUi2 - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L59-L84.
  2. Assign a new URL - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L60 - in this case, we use the same pet store URL, but just change the value to the swagger.json you want to display.
  3. Provide a unique dom_id - in this case we went with swagger-ui-container2 - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L61
  4. Load the new SwaggerUi object - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L103
  5. Add a <div> to display it. In it, make sure the id is set to the dom_id set in step 3, and that the class is swagger-ui-wrap so that the CSS is applied - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L135

You can repeat the steps above as many times as needed, just make sure to provide a unique `dom_i

@vojtabiberle
vojtabiberle / dsn_ultimate_regex.php
Last active November 5, 2023 03:52
DSN ultimate regex parser
<?php
define ('DSN_REGEX', '/^((?P<driver>\w+):\/\/)?((?P<user>\w+)?(:(?P<password>\w+))?@)?((?P<adapter>\w+):)?((host=(?P<host>[\w-\.]+))|(unix_socket=(?P<socket_file>[\w\/\.]+)))(:(?P<port>\d+))?((;dbname=|\/)(?P<database>[\w\-]+))?$/Uim');
@damienalexandre
damienalexandre / ProfilerController.php
Created July 5, 2015 15:10
Adding a checkbox on the translation panel + custom save controller
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ProfilerController extends Controller
ZF2 Documentation State of Art
------------------------------
Authentication (ok)
Barcode (ok)
Cache (to fix)
Captcha (ok)
Code (to be completed)
Config (ok)
Console (to be completed)
@Ocramius
Ocramius / BasicDicContainer.php
Created July 20, 2012 17:02
DIC container 101 in PHP
<?php
class B {
protected $c;
public function __construct(C $c) {
$this->c = $c;
}
}
class C {}
<?php
define('ZF2_PATH', realpath(__DIR__ . '/../vendor/ZendFramework/library'));
@abhishektomar
abhishektomar / graphite_statsd
Created June 26, 2012 05:36
Debian Squeeze Graphite and Stats_D installation.
## Debian Repository -
--> /etc/apt/sources.list
====>
deb http://ftp.us.debian.org/debian squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
deb http://ftp.us.debian.org/debian squeeze-updates main contrib non-free