Skip to content

Instantly share code, notes, and snippets.

View mcustiel's full-sized avatar
🧉

Mariano Custiel mcustiel

🧉
  • Hamburg, Deutschland
View GitHub Profile
@mcustiel
mcustiel / vendor-init.bat
Created January 11, 2016 12:15
Cmder: Auto start ssh-agent on first login to cmder.
tasklist /FI "IMAGENAME eq ssh-agent.exe" 2>NUL | grep 'ssh-agent.exe' >NUL
@if "%ERRORLEVEL%"=="0" (
echo ssh-agent is running
call %CMDER_ROOT%\vendor\call.cmd
) else (
ssh-agent | grep -v echo | sed -e "s/^/@set /" | sed -e "s/;.*$//" - > %CMDER_ROOT%\vendor\call.cmd
call %CMDER_ROOT%\vendor\call.cmd
ssh-add %USERPROFILE%\.ssh\ppk\id_rsa :: Add private keys here
)
@mcustiel
mcustiel / Builder.java
Last active February 9, 2016 15:29
Design patterns examples for knowledge sharing session
public class StreetMap {
private final Point origin;
private final Point destination;
private final Color waterColor;
private final Color landColor;
private final Color highTrafficColor;
private final Color mediumTrafficColor;
private final Color lowTrafficColor;
@mcustiel
mcustiel / Dockerfile
Created August 5, 2016 14:40
Basic composer support in docker
FROM php:5.6.24-fpm
RUN apt-get update && apt-get -y install git gzip wget libgcrypt11-dev zlib1g-dev zip bzip2
RUN apt-get -y install libbz2-dev
RUN docker-php-ext-install zip bz2
RUN cd /usr/local/bin && echo '<?php file_put_contents("composer.phar", file_get_contents("https://getcomposer.org/composer.phar")); ' | php
RUN cd /usr/local/bin && echo '#!/bin/bash\nDIR=$(dirname $0)\nphp $DIR/composer.phar "$@"' > composer && chmod +x composer
@mcustiel
mcustiel / .bashrc
Created October 19, 2016 11:53
Start ssh agent if it is not running
# If ssh-agent is not running, start it and add all keys
LINES=$(ps aux | grep ssh-agent | wc -l)
PPKDIR=~/.ssh/keys
PATTERN="\\.pub$"
if [ "2" -gt $LINES ] ; then
ssh-agent -s > ~/.ssh-env-vars
. ~/.ssh-env-vars
for key in $(ls $PPKDIR) ; do
@mcustiel
mcustiel / MyFpdi.php
Last active December 13, 2017 12:21
Fpdi extensions from the internet
<?php
namespace Mcustiel\Tests;
use setasign\Fpdi\Fpdi;
class MyFpdi extends Fpdi
{
const NEW_LINE = "\n";
const CARRIAGE_RETURN = "\r";
const SPACE = ' ';
@mcustiel
mcustiel / namespace.js
Last active December 11, 2017 09:19
Learning proper JS
var mcustiel = mcustiel || {
isNamespace: function () {
return true;
},
Namespace: (function (root) {
function NamespaceConstructor (root) {
var isNamespace = function (object) {
return object.isNamespace && object.isNamespace()
},
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
@mcustiel
mcustiel / checklist.md
Last active July 13, 2021 14:56
Code reviews checklist

1 - Tests are written for the changes

2 - Covers annotation

3 - Naming

  1. Classes
  2. Methods
  3. Properties
  4. Variables
  5. Constants
  6. Namespaces

4 - Constants are available instead of magic values

@mcustiel
mcustiel / gcommit
Last active July 13, 2021 13:31
Useful scripts
#!/bin/bash
MESSAGE=$1
# Idiot filter
if [ "$MESSAGE" = "-m" ]; then
MESSAGE=$2
fi
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
@mcustiel
mcustiel / IntegrationDbSuitesListener.php
Created May 27, 2019 12:22
PHPUnit listener for to run migrations on symfony
<?php
namespace AppBundle\Tests\Repository\PHPUnit;
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
use Exception;
use PHPUnit_Framework_BaseTestListener;
use PHPUnit_Framework_Test;
use PHPUnit_Framework_TestSuite;