Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
Yay

Ludovic Fleury ludofleury

🐼
Yay
View GitHub Profile
@ludofleury
ludofleury / MysqlContext.php
Last active Mar 20, 2020
A Behat Context with a hook to kill the Mysql connections
View MysqlContext.php
<?php
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Behat\Symfony2Extension\Context\KernelDictionary;
use Behat\MinkExtension\Context\MinkContext;
class MysqlContext extends MinkContext implements KernelAwareInterface
{
use KernelDictionary;
View gist:cd91e6f193a04c11d52dfb15a6117978
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
View gist:1078d527f9eb747667e2b0751186e20c
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH:/Users/ludo/Library/Python/3.7/bin
# Path to your oh-my-zsh installation.
export ZSH="/Users/ludo/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
# CASE_SENSITIVE="true"
# HYPHEN_INSENSITIVE="true"
@ludofleury
ludofleury / A-result.txt
Created Jan 31, 2012
PHP get_class vs ReflectionObject vs ReflectionClass
View A-result.txt
This was a quick & dirty benchmark (for my own needs) to compare the method to get a class name in PHP
-ReflectionObject->getName();
-get_class();
-ReflectionClass->getName();
It was performed on my local machine : MacBookPro with PHP 5.3.6
You will find the result below and the code used for the 3 tests.
ReflectionObject
Memory : 750040
View git-impact.sh
#!/bin/bash
# use newline as separator
IFS=$'\n'
for author in $(git log --all --format='%cN' | sort -u); do
echo $author;
git log --all --author="$author" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "++ %s\n-- %s\n= %s\n", add, subs, loc }' -
done
@ludofleury
ludofleury / docker-compose.yml
Created Oct 31, 2018
Docker Compose shared host based named volume with ${PWD} variant for mac
View docker-compose.yml
version: "3.0"
services:
composer:
image: composer/composer
working_dir: /var/app
volumes:
- project:/var/app
- ./var/composer:/composer
volumes:
@ludofleury
ludofleury / documented-endpoints
Created May 4, 2015
twitter RESt Public API inconsistencies
View documented-endpoints
account/remove_profile_banner
account/settings
account/settings
account/update_delivery_device
account/update_profile
account/update_profile_background_image
account/update_profile_banner
account/update_profile_image
account/verify_credentials
application/rate_limit_status
View CountrySpec.php
<?php
public function it_is_initializable()
{
$this->beConstructedWith('FR');
$this->shouldHaveType(Country::class);
}
public function its_constructor_requires_a_valid_country_isocode()
{
View single-connection-driver.php
<?php
namespace Playbloom\Tests;
use Doctrine\DBAL\Driver\PDOMySql\Driver;
class MysqlDriver extends Driver
{
private static $connection;
View simple.php
<?php
$myCountry = // your api call ....
echo '<html><head></head><body>'
echo $myCountry;
echo '</body>';
You can’t perform that action at this time.