Skip to content

Instantly share code, notes, and snippets.

diff:
empty: 'maintenant'
ago:
year: 'il y a 1 an|il y a %count% ans'
month: 'il y a 1 mois|il y a %count% mois'
day: 'il y a 1 jour|il y a %count% jours'
hour: 'il y a 1 heure|il y a %count% heures'
minute: 'il y a 1 minute|il y a %count% minutes'
second: 'il y a 1 seconde|il y a %count% secondes'
in:
@wpottier
wpottier / config.yml
Created June 23, 2017 08:59
fosRestBundle config
jms_serializer:
enable_short_alias: false
metadata:
auto_detection: true
handlers:
datetime:
default_format: 'c'
default_timezone: 'UTC'
fos_rest:
@wpottier
wpottier / OracleFrench.php
Last active June 22, 2017 13:45
French DB driver for uncommon localized oracle database
<?php
// src/GTLocation/Formation/AppBundle/Doctrine/Driver/OracleFrench.php
namespace GTLocation\Formation\AppBundle\Doctrine\Driver;
use Doctrine\DBAL\Driver\OCI8\Driver;
class OracleFrench extends Driver
{
/**
@wpottier
wpottier / .gitconfig
Last active February 1, 2017 17:01
Git conf
[color]
ui = auto
[push]
default = upstream
[core]
pager = cat
editor = subl -n -w
whitespace = -trailing-space
excludesfile = ~/.gitignore_global
autocrlf = input
@wpottier
wpottier / private.pem
Created December 9, 2016 14:38
JWT Demo
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,1AF324026B92AFF32ED0460C623AE824
BOrQ0CAY+CQ8UlQc0fbE8pLUpCNy36pS95IFzqXImx2614Ir2j9U09WOoIipdHe3
A53PVLZ7wlSeOK3mJaMhOtpwTda9LFkRJIEGynqu2ZL6nH79oHjYU9r5StgvNsDQ
ZcrhHxaQ9yeR6/Afs+iPU/pTwZziSwW2IdSf/WHJU3ydUu+DpydBDLiyRRtU6LJv
DBuAqDjGJHmNlrnRcbrkdk2Tr7oSLkQBybC+Oy+A953EaYqsR3Dp+EtCcxRWEKDm
kfvXNJRlGNo4Wpns7hG62wEw3lUggrgawkNhBZKNGqTptJ1BIbftY5Pcmj92it5L
bQZDJ99MI5zaYbcTsN9zjAT0a1ZWoWX2tC4kKfIIWoGbyOvuPIdC9cnTAzaLiyf6
@wpottier
wpottier / app-unified.php
Created December 8, 2016 10:40
Symfony unified front controller
<?php
use Symfony\Component\HttpFoundation\Request;
umask(0000);
if (!isset($_SERVER['APPLICATION_ENV'])) {
$_SERVER['APPLICATION_ENV'] = 'prod';
}
@wpottier
wpottier / sample.vcl
Last active August 1, 2016 14:11
sample.vcl
sub vcl_recv {
if (req.http.host ~ "bebe9\.com") {
set req.http.x-redir = "http://www.bebe9.com" + req.url;
return(synth(850, "Moved permanently"));
}
}
sub vcl_synth {
if (resp.status == 850) {
set resp.http.Location = req.http.x-redir;
sub vcl_recv {
if (client.ip != "127.0.0.1" && std.port(server.ip) == 80 && req.http.host ~ "^(?i)example.com") {
set req.http.x-redir = "https://" + req.http.host + req.url;
return(synth(850, "Moved permanently"));
}
}
sub vcl_synth {
if (resp.status == 850) {
set resp.http.Location = req.http.x-redir;
/**
* Replaces accentuated chars (and a few others) with their ASCII base char.
*
* @see Behat Transliterator
*
* @param string $string String to unaccent
*
* @return string Unaccented string
*/
public static function unaccent($string)
@wpottier
wpottier / jail.local
Created June 17, 2016 09:02
Fail2ban -> slack
# ban & send a notification on slack
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
slack[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s", sendername="%(sendername)s"]
# Choose default action. To change, just override value of 'action' with the
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
# globally (section [DEFAULT]) or per specific section
action = %(action_with_slack_notification)s