Skip to content

Instantly share code, notes, and snippets.

View simodima's full-sized avatar

Simone Di Maulo simodima

View GitHub Profile
openapi: 3.0.0
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
<?php
$productListing = new CircuitBreaker(
10,
function($searchKey) {
// $result is given from the api call
return $result;
}
);
<?php
/**
* We're using a message bus, this is
* the fetch-car message handler.
*/
class FetchCarMessageHandler
{
public function handle(Message $msg)
{
<?php
class CircuitBreaker
{
private $maxFailures;
private $service;
private $redisClient;
public function __construct(int $maxFailures, callable $service)
{
<?php
/**
* Assume that we're using a message bus which is able to
* retry failed messages with a custom retry delay.
*/
class FetchCarMessageHandler
{
public function handle(Message $msg)
{

(standup)

Ieri

Oggi

Blocking

Improvements

<?php
public function getAllIds()
{
$expr = $this->_em->getExpressionBuilder();
$rsm = new ResultSetMapping();
$rsm->addScalarResult('id', 'id');
$result = $this->_em->createNativeQuery('
SELECT u.id as id FROM users u
This file has been truncated, but you can view the full file.
{
"posts": [
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
},
{
"userId": 1,
@simodima
simodima / Iterator.php
Created June 25, 2016 15:28
PHP iterable interfaces
<?php
interface Iterator extends Traversable
{
abstract public mixed current ( void )
abstract public scalar key ( void )
abstract public void next ( void )
abstract public void rewind ( void )
abstract public boolean valid ( void )
}
> const strategies = {
first: () => {},
second: () => {},
undefined: () => 'default'
};
> const obj0 = { type: 'first' };
> const obj1 = { };