Skip to content

Instantly share code, notes, and snippets.

@cn007b
cn007b / index.php
Created August 3, 2018 14:31
Namespace Dependency Injection - index.php
<?php
require_once __DIR__ . '/vendor/autoload.php';
$eu = new VISA\EuropeanUnion();
$result = $eu->approve();
var_export($result);
@cn007b
cn007b / EuropeanUnion.php
Last active August 3, 2018 14:31
Namespace Dependency Injection - src/Infrastructure/VISA/Free/EuropeanUnion.php
<?php
namespace VISA;
use Domain\Interfaces\VISA\EuropeanUnion as VISAInterface;
class EuropeanUnion implements VISAInterface
{
public function approve(): string
{
@cn007b
cn007b / EuropeanUnion.php
Last active August 3, 2018 14:31
Namespace Dependency Injection - src/Infrastructure/VISA/Review/EuropeanUnion.php
<?php
namespace VISA;
use Domain\Interfaces\VISA\EuropeanUnion as VISAInterface;
class EuropeanUnion implements VISAInterface
{
public function approve(): string
{
@cn007b
cn007b / composer.json
Last active August 3, 2018 14:33
Namespace Dependency Injection - composer.json #1
{
"autoload": {
"psr-4": {
"Domain\\": "src/Domain",
"VISA\\": "src/Infrastructure/VISA/Review"
}
}
}
@cn007b
cn007b / composer.json
Created August 3, 2018 14:33
Namespace Dependency Injection - composer.json #2
{
"autoload": {
"psr-4": {
"Domain\\": "src/Domain",
"VISA\\": "src/Infrastructure/VISA/Free"
}
}
}
@cn007b
cn007b / EuropeanUnion.php
Last active August 3, 2018 14:34
Namespace Dependency Injection - src/Domain/Interfaces/VISA/EuropeanUnion.php
<?php
namespace Domain\Interfaces\VISA;
interface EuropeanUnion
{
public function approve() : string;
}
@cn007b
cn007b / index.php
Last active August 3, 2018 19:14
Benchmarking ElasticSearch vendors for PHP - index.php
<?php
/**
* PHP benchmarking ElasticSearch vendors.
*
* README:
*
* This is a simple example which provides different options
* how to receive data from ElasticSearch into PHP.
* In this test, we have simple `type` inside ElasticSearch `index` which contains 1K records,
* @see https://github.com/cn007b/my/blob/master/ed/php/examples/elasticsearch/comparison/import.sh
@cn007b
cn007b / composer.json
Created August 3, 2018 19:14
Benchmarking ElasticSearch vendors for PHP - composer.json
{
"require": {
"ruflin/elastica": "^5.1",
"elasticsearch/elasticsearch": "^5.1"
}
}
@cn007b
cn007b / import.sh
Created August 3, 2018 19:15
Benchmarking ElasticSearch vendors for PHP - import.sh
#!/bin/bash
curl -s -XPUT http://localhost:9200/somecorp -d '{
"mappings": {
"employee": {
"properties": {
"id": {
"type": "integer"
},
"first_name": {
@cn007b
cn007b / expectedResult.md
Created August 14, 2018 08:36
PostgreSQL vs MongoDB - expected result
396, 4d509b2bc497b54455aac7e4863ce7dac3e1c898, NonMattis.avi
396, 4d509b2bc497b54455aac7e4863ce7dac3e1c898, VenenatisTurpis.xls
395, 65864917b1548aa1b4520a5a40511dc4e4e4af12, AmetErosSuspendisse.tiff
395, 65864917b1548aa1b4520a5a40511dc4e4e4af12, PlateaDictumst.gif
394, b738398a474808da2a9c9c0e00abecabba22acd4, AFeugiatEt.xls
394, b738398a474808da2a9c9c0e00abecabba22acd4, Amet.mp3
394, b738398a474808da2a9c9c0e00abecabba22acd4, At.avi
394, b738398a474808da2a9c9c0e00abecabba22acd4, AtVelit.png
394, b738398a474808da2a9c9c0e00abecabba22acd4, CondimentumId.xls