Skip to content

Instantly share code, notes, and snippets.

@jakzal
jakzal / keybase.md
Created June 12, 2018 17:09
keybase.md

Keybase proof

I hereby claim:

  • I am jakzal on github.
  • I am jakubzalas (https://keybase.io/jakubzalas) on keybase.
  • I have a public key ASDymt67mEWq_8pwxEXefRL4POa25z_680ovmggZWKTKHQo

To claim this, I am signing this object:

@jakzal
jakzal / DataSet.php
Created June 12, 2018 09:18
Execute your markdown specs
<?php
declare(strict_types=1);
namespace Zalas\Test\MarkdownSpec;
class DataSet implements \IteratorAggregate
{
/**
* @var array
*/
@jakzal
jakzal / war.sc
Last active May 14, 2018 07:51
War Card Game in Scala
sealed trait Suit
sealed case class Hearts() extends Suit {
override def toString = "♡"
}
sealed case class Diamonds() extends Suit {
override def toString = "♢"
}
sealed case class Clubs() extends Suit {
override def toString = "♧"
}
@jakzal
jakzal / SymfonyKernel.php
Created March 2, 2018 14:25
Replacement for Symfony's KernelTestCase
<?php
declare(strict_types=1);
namespace Zalas\PHPUnit\Injector\Symfony\TestCase;
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\HttpKernel\KernelInterface;
/**
* Mimics the behaviour of Symfony's KernelTestCase.
@jakzal
jakzal / flat_map.php
Last active July 28, 2021 16:16
Flat map in PHP
<?php
function flat_map(callable $callback, array $collection) {
return array_merge([], ...array_map($callback, $collection));
};
@jakzal
jakzal / ExampleTest.php
Last active September 23, 2020 12:23
Set global variables with PHPUnit test method annotations
<?php
declare(strict_types=1);
namespace Zalas\Tests;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
@jakzal
jakzal / QueueScraperTest.php
Last active September 28, 2022 14:55
RabbitMQ integration test
<?php
namespace Zalas\Infrastructure\Scraper;
use OldSound\RabbitMqBundle\RabbitMq\Consumer;
use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
use PhpAmqpLib\Connection\AbstractConnection;
use PhpAmqpLib\Connection\AMQPLazyConnection;
use PhpAmqpLib\Exception\AMQPTimeoutException;
import scala.collection.JavaConverters._
object Solution {
case class Tree(var x: Int, var l: Tree, var r: Tree)
def solution(t: Tree): Int = {
count(0, t)
}
def count(previousTurn: Int, t: Tree): Int = {
@jakzal
jakzal / bin > drun
Last active March 31, 2020 08:29
Docker with Symfony, RabbitMQ, Nginx
#!/bin/bash
set -e
set -u
set -o pipefail
COMMAND=${1:-"help"}
MACHINE_NAME=myapp
DENV=${DENV:-"dev"}
@jakzal
jakzal / .dockerignore
Last active August 14, 2016 12:05
dockerize
.git/