Skip to content

Instantly share code, notes, and snippets.

View jeroenvdgulik's full-sized avatar

Jeroen v.d. Gulik jeroenvdgulik

View GitHub Profile
@jeroenvdgulik
jeroenvdgulik / mirror_gitlab.md
Last active November 2, 2017 10:53
Mirroring your Gitlab (Omnibus) to an external Gitlab

Mirroring your Gitlab (Omnibus) to an external Gitlab

To make the example clearer we will use gitlab.local as our local server and gitlab.external as our gitlab where we want to push/mirror to

Step 1.

We need to create an ssh key so we can connect to the external Gitlab

ssh-keygen -t 
@jeroenvdgulik
jeroenvdgulik / gist:2722655e98a3ecd3d7b26ae65200c65a
Created February 22, 2017 12:18
Setting up php-cs-fixer in PHPStorm
Setup PHP CS Fixer in PHPStorm by adding an external tool and setting the options on the bottom as follows
```
Program: php-cs-fixer
Parameters: fix $FileDir$/$FileName$ --config $ProjectFileDir$/.php_cs
Working directory: $ProjectFileDir$
```
# Install GD
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
docker-php-ext-install gd
@jeroenvdgulik
jeroenvdgulik / 1_bootstrap.php
Last active February 18, 2017 12:10
"Solving" the issue of Symfony 3.x and PHPUnit 6.x (obviously this is a hack until they fix it properly)
<?php
// create a file in /tests/bootstrap.php at the root of your symfony project
$loader = require(__DIR__ . '/../app/autoload.php'); // or whatever path your autoload.php is in
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
}
return $loader;
@jeroenvdgulik
jeroenvdgulik / os-release.md
Last active October 26, 2016 11:43
Vagrant not working with Ubuntu 12.04 and Ansible > 1.8

If you ever encounter this error:

Vagrant attempted to execute the capability 'configure_networks'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
find . -type d -name \* -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;
@jeroenvdgulik
jeroenvdgulik / Repository.php
Last active June 3, 2016 12:47
How to create a Repository as a Service with optional dependancies in Symfony3
<?php
namespace Foo\SomeBundle\Repository;
use Foo\SomeBundle\Dependency;
use Doctrine\ORM\EntityRepository;
class SomeRepository extends EntityRepository implements SomeContract
{
/**
* @var Dependency
@jeroenvdgulik
jeroenvdgulik / Talklist.md
Last active December 17, 2023 19:04
My mostly incomplete list of memorable talks that should probably be required material

The list is now hosted on a repository so you can PR -> https://github.com/jeroenvdgulik/awesome-talks/blob/master/README.md

The list

<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->name('*.php')
->in(__DIR__.'/src')
;
return Symfony\CS\Config\Config::create()
->fixers(array(
@jeroenvdgulik
jeroenvdgulik / Show_current_branch_in.php
Last active November 10, 2023 09:07
Output the current branch in your PHP application
<?php
# Git branch output in PHP
exec('git symbolic-ref HEAD', $output);
$branch = end(explode('/', $output[0])));