Skip to content

Instantly share code, notes, and snippets.

View alle's full-sized avatar

Alessandro Frangioni alle

View GitHub Profile
@alle
alle / install-kohana.sh
Created October 18, 2011 09:25 — forked from sebacruz/install-kohana.sh
A script to install the Kohana PHP Framework
#!/bin/sh
# have submodules been added?
MODS=0
# Github base URL
GITHUB="https://github.com"
# Default branch
DEFAULT_BRANCH="3.0/master"
@alle
alle / config.js
Created December 6, 2013 09:14
changing directive template with decorator (for ng-YouTubeAPI.js), like http://angular-tips.com/blog/2013/09/experiment-decorating-directives/
app.config(function($provide) {
$provide.decorator('ytPlaytoDirective', function($delegate) {
var directive = $delegate[0];
directive.template = '<h5>{{ title }}, {{ viewCount }}</h5>';
return $delegate;
});
});
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Mongo Auth driver. Adapted from Kohana_Auth_ORM.
*/
class Auth_Mongo extends Auth {
/**
* Checks if a session is active.
*
* @param string role name
@alle
alle / CommandMiddleware.php
Created March 17, 2018 16:27 — forked from oqq/CommandMiddleware.php
simple command middleware implementation using prooph components
<?php
declare(strict_types = 1);
namespace Acme\Middleware;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Prooph\Common\Messaging\MessageFactory;
use Prooph\Psr7Middleware\MetadataGatherer;
@alle
alle / ProcessManagerPlugin.php
Created March 17, 2018 16:27 — forked from oqq/ProcessManagerPlugin.php
prooph event bus process manager plugin
<?php
declare(strict_types=1);
namespace Prooph\ServiceBus\Plugin;
use Prooph\Common\Event\ActionEvent;
use Prooph\ServiceBus\CommandBus;
use Prooph\ServiceBus\EventBus;
use Prooph\ServiceBus\MessageBus;
@alle
alle / gist:bd2cd3b13284ff918a286e0236c40bc7
Created December 25, 2018 20:48 — forked from kunicmarko20/gist:9b21253ea86a49c94e3fba4b1de5fb54
PHPStorm code template for getters without `get` prefix and first letter decapitalized
#if (${TYPE_HINT} == "mixed")
/**
* @return ${TYPE_HINT}
*/
#end
public ${STATIC} function ${FIELD_NAME}()#if(${RETURN_TYPE}): ${RETURN_TYPE}#end
{
#if (${STATIC} == "static")
return self::$${FIELD_NAME};
#else
<?php
declare(strict_types=1);
namespace Funct\Ion\Microsite\Base\ReadModel\MicrositeCollections;
use Prooph\EventStore\Projection\AbstractReadModel;
use RuntimeException;
final class CombinedReadModel extends AbstractReadModel
<?php
class LockService
{
public function tryAcquireLocationLock(
LocationLock $lock,
IdInterface $owner,
?DateTimeImmutable $expirationDate
): bool {
try {
<?php
declare(strict_types=1);
namespace Funct\Ion\Common\Library\Cqrs\ServiceBus;
use JsonSerializable;
use Prooph\Common\Messaging\Message;
final class IdentityCausationData implements JsonSerializable
@alle
alle / composer-outdated.sh
Created February 22, 2019 18:38 — forked from Jean85/composer-outdated.sh
How to check in CI if any Composer dependency can be upgraded, using a committed file as a way to ignore upgrades blocked by external factors.
#!/usr/bin/env bash
for package in `composer outdated | awk '{ print $1":"$4 }'`;
do
echo "New version: $package" > outdated-status.txt
composer why-not $package > outdated-status.txt
echo "----------" > outdated-status.txt
done
if [ -z $(git status --porcelain) ];