Skip to content

Instantly share code, notes, and snippets.

View KaiCMueller's full-sized avatar

Kai Müller KaiCMueller

View GitHub Profile
@KaiCMueller
KaiCMueller / services.yaml
Last active June 18, 2018 12:36
Symfony Framework: Using methods and constants in service parameters
services:
My\Custom\Service:
class: My\Custom\Service
arguments:
- "@=service('My\\\\Custom\\\\Config').getCustomString()"
- !php/const My\Custom\ServiceConstants::MY_CONSTANT
- "@=container.hasParameter('some_param') ? parameter('some_param') : 'default_value'"
@KaiCMueller
KaiCMueller / AdminController.php
Last active April 2, 2018 11:49
Add template parameters in EasyAdmin
<?php
namespace App\Controller;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController;
/**
* General controller for administrating all entities
*/
class AdminController extends BaseAdminController
// global array
array = new Array();
Selenium.prototype.doStoreCellValue = function(variableName,cellPosition)
{
var xy = cellPosition.split(",");
var x = xy[0] - 1;
var y = xy[1] - 1;
var value = array[x][y];
storedVars[variableName] = value;
@KaiCMueller
KaiCMueller / array_merge_recursive_distinct.php
Created November 9, 2017 10:12
Merging two multi dimensional arrays, overwriting existing values
<?php
/**
* array_merge_recursive does indeed merge arrays, but it converts values with duplicate
* keys to arrays rather than overwriting the value in the first array with the duplicate
* value in the second array, as array_merge does. I.e., with array_merge_recursive,
* this happens (documented behavior):
*
* array_merge_recursive(array('key' => 'org value'), array('key' => 'new value'));
* => array('key' => array('org value', 'new value'));