Skip to content

Instantly share code, notes, and snippets.

View andersonamuller's full-sized avatar

Anderson Müller andersonamuller

  • Amsterdam, The Netherlands
View GitHub Profile
@andersonamuller
andersonamuller / bin > drun
Created July 30, 2016 22:41 — forked from jakzal/bin > drun
Docker with Symfony, RabbitMQ, Nginx
#!/bin/bash
set -e
set -u
set -o pipefail
COMMAND=${1:-"help"}
MACHINE_NAME=myapp
DENV=${DENV:-"dev"}
@andersonamuller
andersonamuller / entity-mapper-via-dynamic-proxy-object.php
Created February 15, 2016 19:28 — forked from ralphschindler/entity-mapper-via-dynamic-proxy-object.php
The "No-framework ORM tool for generating proxies capable of strategically mapping data into clean POPO entities without bleeding concerns or doesn't require a tool to write generated code to disk in under 100 lines of code" prototype. </runon-and-exhale>
<?php
namespace EntityMapperFramework {
class EntityMapper {
public function __construct() {
stream_wrapper_register('dynamicproxygenerator', __NAMESPACE__ . '\DynamicProxyGeneratorStream');
}
public function createProxy($entity) {
$class = get_class($entity);
@andersonamuller
andersonamuller / gist:f2774962b71f91babd29
Created December 23, 2015 20:26 — forked from gregoryyoung/gist:a3e69ed58ae066b91f1b
Event Sourcing as 3 functions.
f(events) -> state
match f(state, event) -> state
f(state, command) -> events
@andersonamuller
andersonamuller / GetEventStore_Projections_API.txt
Created October 5, 2015 22:32 — forked from rmacdonaldsmith/GetEventStore_Projections_API.txt
James Nugent gave me this list of java script functions that are available in the projections module of event store. The guys at GetEventStore will be providing a complete set of API docs, but this is really for my reference until then.
fromAll()
fromStream(‘streamName’)
fromStreams([‘stream1’, ‘stream2’])
fromStreamOfStreams(‘streamName’)
fromCategory(‘categoryName’)
foreachStream()
(selectino)
matching:
whenAny( // function(s, e) )
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
@andersonamuller
andersonamuller / Dockerfile
Created October 23, 2014 22:47
Phalcon Dockerfile
FROM ubuntu:14.04
# Install PHP5-FPM
RUN \
apt-get update && \
apt-get install -y \
vim \
curl \
wget \
build-essential && \
apt-get install -y \
<?php
namespace Laravel\Doctrine;
use Doctrine\Common\Proxy\Proxy;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Persistence\ObjectManager;
class Serializer {
<?php
class Category extends Phalcon\Mvc\Model
{
public $id;
public $lft;
public $rgt;
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
#!/bin/bash
# fail fast
set -e
PHP5_FCGI_PATH=/usr/lib/cgi-bin/php5-fpm
PHP5_FCGI_SOCKET=/var/run/php5-fpm.sock
# Make sure the multiverse is enabled
IS_MULTIVERSE_ENABLED=`cat /etc/apt/sources.list | grep -v "^#" | grep multiverse | wc -l`