Skip to content

Instantly share code, notes, and snippets.

View guillemcanal's full-sized avatar

Guillem CANAL guillemcanal

View GitHub Profile
@guillemcanal
guillemcanal / composer.json
Last active December 31, 2015 07:59
ServiceLayer with event dispatching
{
"name": "starfleet/voyager",
"authors": [
{
"name": "Guillem CANAL",
"email": "nobody@nowhere.tld"
}
],
"require": {
"symfony/event-dispatcher": "~2.4"
* {padding: 0; margin:0; color: #444}
#main {
position : absolute;
top:5px;
left:5px;
right:5px;
bottom:5px;
border:1px solid #E5E5E5;
padding: 5px;
overflow-y:auto;
@guillemcanal
guillemcanal / README.md
Last active April 9, 2016 11:22
RAML 1.0 Contract first example

RAML 1.0 contract first example

RAML 1.0 is coming our way, and the new features it provide may allow us to use it as a contract for our APIs.

Using types and annotationTypes, we can, for example, describe a controller that will be resolved for each of our methods.

Here is an example:

@guillemcanal
guillemcanal / docker-alpine-iconv.md
Created August 9, 2016 13:03
Build the PHP 5 iconv extension from source for Alpine

Build PHP5 iconv extension from source for Alpine

If you plan to use iconv() to transliterate string in you PHP project, please, take this:

FROM alpine:3.4

RUN apk add --update php5-cli wget build-base php5-dev autoconf re2c libtool \
@guillemcanal
guillemcanal / run.sh
Created August 31, 2016 10:14
docker run apache from api plateform
#!/bin/bash
##
# Detect the ownership of the webroot
# and run apache as that user.
#
main() {
# Docker for Mac requires a special handling, see https://docs.docker.com/docker-for-mac/osxfs/#/ownership
if [[ -n $(mount -t fuse.osxfs | grep /app) ]]; then
chown -R www-data:www-data /app 2> /dev/null
@guillemcanal
guillemcanal / Dockerfile
Created December 19, 2016 17:05
PHP 7.1 Optimized
FROM alpine:3.4
ENV PHPIZE_DEPS="autoconf file g++ gcc libc-dev make pkgconf re2c" \
PHP_INI_DIR="/usr/local/etc/php" \
PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
PHP_CPPFLAGS="$PHP_CFLAGS" \
PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" \
GPG_KEYS="A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0" \
PHP_VERSION="7.1.0" \
PHP_URL="https://secure.php.net/get/php-7.1.0.tar.xz/from/this/mirror" \
@guillemcanal
guillemcanal / docker-clean.sh
Created June 22, 2017 08:50
Clean old docker containers
docker ps --filter "status=exited" | grep 'ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
@guillemcanal
guillemcanal / show.sh
Created July 24, 2017 16:33
Show required PHP extensions
composer show -t | grep -o "\-\-ext-.\+" | sort | uniq | cut -d- -f3-
@guillemcanal
guillemcanal / dnsmasq-regex.rb
Created July 29, 2017 13:45 — forked from chriseldredge/dnsmasq-regex.rb
Homebrew Formula for installing dnsmasq with regex patch from Jan Seiffert See: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q2/007124.html
require 'formula'
class DnsmasqRegex < Formula
homepage 'http://www.thekelleys.org.uk/dnsmasq/doc.html'
url 'http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.66.tar.gz'
sha256 '36232fa23d1a8efc6f84a29da5ff829c2aa40df857b9116a9320ea37b651a982'
option 'with-idn', 'Compile with IDN support'
depends_on "libidn" if build.include? 'with-idn'
@guillemcanal
guillemcanal / jenkins-pipeline-parallel.groovy
Last active October 7, 2020 12:40
Jenkins Parallel Nodes execution
def nodeSpecs(List specs, Closure callback) {
def nodes = [:]
for (item in specs) {
def spec = item
nodes["Spec ${spec}"] = { callback.call(spec) }
}
return nodes
}