Skip to content

Instantly share code, notes, and snippets.

Avatar

Wonzbak wonzbak

  • Paris
View GitHub Profile
View MockHelper.php
<?php
declare(strict_types=1);
namespace Deezer\Legacy\Test\ActivationJourney;
use Prophecy\Prophet;
class MockHelper
{
@wonzbak
wonzbak / timeIt.php
Last active Jan 13, 2020
Get time elapse of a function
View timeIt.php
<?php
function timeIt(
callable $callable,
array $params = [],
int $maxLoop = 1000,
bool $returnValue = false
) {
$start = microtime(true);
View htaccess
# CORS
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Content-Type, Authorization"
Header always set Access-Control-Request-Methods "POST, GET, OPTIONS"
View unaccent.php
<?php
/**
* Unaccent a string
*
* An example string like ÀØėÿᾜὨζὅБю will be translated to AOeyIOzoBY.
* More complete than :
*
* strtr(
* (string)$str,
@wonzbak
wonzbak / mailer.php
Created Mar 16, 2018
Mailer High level class
View mailer.php
<?php
namespace Mail;
/**
* Class Mailer
*
* Class to send email.
*
*/
@wonzbak
wonzbak / release.sh
Last active Jun 5, 2017
bash script to prepare release with git
View release.sh
#!/bin/bash
CHANGELOG_FILENAME="CHANGELOG.rst"
LASTTAG=$(git tag| sort -V | tail -1)
echo "Last tag $LASTTAG"
TMPFILE=$(mktemp)
TODAY=$(date +%Y-%m-%d)
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div id="container">
@wonzbak
wonzbak / vimrc.minimal
Created Mar 6, 2017
Vim minimal config file
View vimrc.minimal
set shell=/bin/sh " fish friendly
"
" Base configuration from https://github.com/tpope/vim-sensible
"
if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
@wonzbak
wonzbak / log.sh
Created Feb 15, 2017
colorized logs
View log.sh
#!/usr/bin/env bash
# colorize log thanks to Radu Cotescu (https://radu.cotescu.com/coloured-log-outputs/)
TAIL=`which tail`
AWK=`which awk`
if [[ -z $TAIL ]]; then
echo -e "Cannot find tail executable.\n"
exit 1
fi
@wonzbak
wonzbak / Mailer.php
Last active Jan 4, 2017
Mailer Symfony 2/3
View Mailer.php
<?php
class Mailer
{
/** @var \Swift_Mailer */
private $mailer;
/** @var \Swift_Transport_AbstractSmtpTransport */
private $transport;
You can’t perform that action at this time.