Skip to content

Instantly share code, notes, and snippets.

Frédéric Hardy mageekguy

View GitHub Profile
View gist:3c5b7dce206f6fcdd7fd72f05bee8f28
Scénario:
Étant donné qu'un message nommé "message 1" utilise le template réservé et contient "foo"
Et qu'un message nommé "message 2" utilise le template réservé et contient "bar"
Lorsqu'on demande le remplacement des messages avec les messages suivants :
| name | duration | months | days | weekdays | minutes | hours | order | priority | <= is it possible to have french column names?
| baz | 30 | * | * | * | * | * | 0 | no |
| qux | 55 | * | * | * | * | * | 0 | no |
Alors il doit exister 2 messages
View blou.php
<?php
namespace foo;
class message
{
}
namespace ubermuda;
@mageekguy
mageekguy / stderr.php
Created Dec 8, 2017
Testing write of data to STDERR with atoum
View stderr.php
<?php namespace estvoyage\ticTacToe\tests\units\output\cli;
require __DIR__ . '/../../../runner.php';
use estvoyage\ticTacToe\tests\units;
use mock\estvoyage\ticTacToe as mockOfTicTacToe;
class stderr extends units\test
{
private
@mageekguy
mageekguy / __call_pcre.php
Created Jul 20, 2017
Dynamic method call using PCRE and match naming
View __call_pcre.php
<?php
class foo
{
function findAllAgentsBy()
{
var_dump(__METHOD__, func_get_args());
}
function findOneAgentBy()
View Sample 1 (mutable Placement).java
// Game
public class Game {
private final Grid grid;
private final PlacementError placementError;
private Mark playingMark;
public Game(PlacementError placementError) {
grid = new Grid();
playingMark = Mark.x();
@mageekguy
mageekguy / configure.stdout
Created Jun 8, 2017
Error generated by `./configure` with PHP 7.1.5 on OS X 10.12.5
View configure.stdout
> './configure' '--prefix=/usr/local/Cellar/php56/5.6.24' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.6' '--with-config-file-path=/usr/local/etc/php/5.6' '--with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d' '--mandir=/usr/local/Cellar/php56/5.6.24/share/man' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-mbregex' '--enable-mbstring' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-iconv-dir=/usr' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos=/usr' '--with-libedit' '--with-mhash' '--with-ndbm=/usr' '--with-png-dir=/usr/local/opt/libpng' '--with-xmlrpc' '--with-zlib=/usr' '--with-readline=/usr/local/opt/readline' '--without-gmp' '--without-snmp' '--with-libxml-dir=/usr
View gist:d71e784ef046e0342d52cc5d5b6d8bd2
# php --version
PHP 7.0.12 (cli) (built: Nov 3 2016 12:54:26) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
# php -a
php > var_dump((PHP_INT_MAX + 1) > PHP_INT_MAX);
bool(false)
php > var_dump((PHP_INT_MAX + 1) < PHP_INT_MAX);
bool(false)
php > var_dump((PHP_INT_MAX + 1) == PHP_INT_MAX);
@mageekguy
mageekguy / test.php
Last active Feb 14, 2017
Tips to automatically generate a class which extends from tested class with atoum
View test.php
<?php
namespace estvoyage\risingsun\tests\units;
use
mageekguy\atoum\mock
;
class test extends \atoum
{
@mageekguy
mageekguy / adn.php
Created Feb 25, 2016
Just a dna processor written in 30 minutes in the train for my friend Gerald.
View adn.php
<?php
interface base
{
function adnFormaterIs(adnFormater $formater);
}
interface baseRecipient
{
function baseIs(base $base);
View eastIterator.php
<?php
interface consumer
{
function dataHasName(data $data, name $name);
}
interface aggregator
{
function recipientOfDataConsumerIs(consumer $consumer, recipient $recipient);
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.