Skip to content

Instantly share code, notes, and snippets.

View alexmanno's full-sized avatar

Alessandro Manno alexmanno

View GitHub Profile
#!/bin/bash
DOCKER_RUNNER_COMMAND='docker run --rm -v $(pwd):/app -w /app --net=host -it'
alias dps="docker ps"
alias dpsq="docker ps -q"
alias ds="docker stop"
alias dsq="docker ps -q | xargs docker stop"
# PHP7
<?php
if ( $preventivo->getAnagrafica()
&& $preventivo->getAnagrafica()->getDatiDomicilioRichiedente()
&& $preventivo->getAnagrafica()->getDatiDomicilioRichiedente()->getLuogo()
&& $preventivo->getAnagrafica()->getDatiDomicilioRichiedente()->getLuogo()->getComune()
&& $preventivo->getAnagrafica()->getDatiDomicilioRichiedente()->getLuogo()->getComune()->getProvincia()
&& $preventivo->getAnagrafica()->getDatiDomicilioRichiedente()->getLuogo()->getComune()->getProvincia()->getRegione()
) {
// succedono cose
#!/bin/bash
dockerip()
{
docker inspect "$1" | jq -r ".[0].NetworkSettings.Networks.bridge.IPAddress"
}
dockerips()
{
for container in `docker ps --format "{{.Names}}"`; do
@alexmanno
alexmanno / docker-aliases.sh
Created August 31, 2018 14:09
Bash aliases that use docker images.
#!/bin/sh
DOCKER_RUNNER_COMMAND='docker run --rm -v $(pwd):/app -w /app --net=host -it'
# PHP7
alias php="$DOCKER_RUNNER_COMMAND php:7.2-cli php"
# Composer
alias composer="$DOCKER_RUNNER_COMMAND composer"
@alexmanno
alexmanno / .gitlab-ci.yml
Created January 11, 2018 16:24
Simple SmokeTest on Gitlab Pipeline
image: ubuntu:latest
variables:
SMOKE_TEST_HOST: http://example.org
SMOKE_TEST_URI: /
SMOKE_TEST_EXPECTED_STATUS_CODE: 200
stages:
- smoke_test
@alexmanno
alexmanno / LasagnaBesciamella.php
Last active October 29, 2017 12:51
How to explain Lasagna to Developers
<?php
use Lasagna;
/**
* OOP version of lasagna.php
*/
class LasagnaBesciamella extends Lasagna
{
private function getLayer(): array
<?php
/**
* @param array $datiAggiuntivi
*
* @return array
*/
protected function formatDatiAggiuntivi(array $datiAggiuntivi)
{
$newDatiAggiuntivi = [];
@alexmanno
alexmanno / composer-php-version.sh
Last active May 12, 2017 07:59
Show all dependency's php version
#!/usr/bin/env bash
DEPS=`composer show | cut -d" " -f1`
for DEP in $DEPS; do
composer show $DEP | egrep "^php\ "
done
@alexmanno
alexmanno / CronManagerCommand.php
Created March 13, 2017 16:39
Questo Command per symfony serve per evitare che un cron lanci più volte lo stesso processo anche se già running.
class CronManagerCommand extends ContainerAwareCommand
{
const CRON_PREFIX = 'cron:commands:';
const DEFAULT_TTL = 60 * 60;
/** @var \Redis */
protected $redis;
/**
* {@inheritdoc}