Skip to content

Instantly share code, notes, and snippets.

View haringsrob's full-sized avatar
🏠
Working from home

Harings Rob haringsrob

🏠
Working from home
View GitHub Profile
@haringsrob
haringsrob / DatabaseRefreshingTrait.php
Created September 19, 2019 09:05
Drupal specific database refreshing trait.
<?php
namespace OpenEuropa\Site\Tests\Behat\FeatureTraits;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Testwork\Hook\Scope\AfterSuiteScope;
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
use Drupal\Core\Database\Database;
/**
@haringsrob
haringsrob / DatabaseRefreshingTrait.php
Created September 18, 2019 07:06
Simple trait you can add to Behat feature context which creates a snapshot before running tests and restores it for every scenario ensuring a clean database.
<?php
namespace OpenEuropa\Site\Tests\Behat\FeatureTraits;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Testwork\Hook\Scope\AfterSuiteScope;
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
/**
* Trait DatabaseRefreshingTrait.
@haringsrob
haringsrob / DatabaseRefreshingTrait.php
Created September 18, 2019 07:06
Simple trait you can add to Behat feature context which creates a snapshot before running tests and restores it for every scenario ensuring a clean database.
<?php
namespace OpenEuropa\Site\Tests\Behat\FeatureTraits;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Testwork\Hook\Scope\AfterSuiteScope;
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
/**
* Trait DatabaseRefreshingTrait.
@haringsrob
haringsrob / init.nvim
Created November 4, 2018 16:58
VIM config for PHP/Drupal editing
" Leader key <SPACE>
let mapleader=" "
nnoremap <Space> <Nop>
call plug#begin('~/.config/nvim/plugged')
Plug 'phpactor/phpactor' , {'do': 'composer install', 'for': 'php'}
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'phpactor/ncm2-phpactor'
Plug 'ncm2/ncm2-ultisnips'
@haringsrob
haringsrob / .vimrc
Created March 1, 2017 16:20
NeoVim as php IDE - Single file setup
call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'c9s/phpunit.vim'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'kien/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'StanAngeloff/php.vim'
@haringsrob
haringsrob / localhost.aliases.drushrc.php
Last active March 1, 2017 16:22
Automatic drush alias generation based on directory
<?php
$root = "/home/rob/Sites/";
$allowed_dirs = [
'web',
'wwwroot',
'build',
];
foreach (new DirectoryIterator($root) as $main_dir) {
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#
# Set up permissions for VirtualHosts in ~/Sites
#
<Directory "/Users/rob/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
@haringsrob
haringsrob / EmailConvert.php
Created August 12, 2016 17:48
Convert Drupal 7 Email field to drupal 8 Processor
<?php
namespace Drupal\base\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
/**
* This plugin converts Drupal 7 email field to drupal 8