Skip to content

Instantly share code, notes, and snippets.

View gimler's full-sized avatar

Gordon Franke gimler

View GitHub Profile
@gimler
gimler / Select2.php
Created January 9, 2020 08:35 — forked from tortuetorche/Select2.php
Select2 v3.5 helpers for the WebDriver module of Codeception 2.1 (WIP)
<?php
namespace Helper;
// Select2 helpers for the jQuery based replacement for select boxes.
// See: http://select2.github.io/select2
// Author: Tortue Torche <tortuetorche@spam.me>
// License: MIT
//
// Installation:
// * Put this file in your 'tests/_support/Helper' directory
@gimler
gimler / tests_check_filename_match_class.sh
Created July 4, 2018 20:20
Simple bash script to find files where the class name not match the file name
find tests -name '*Test.php' -exec sh -c 'FILEPATH={}; FILE=${FILEPATH##*/}; FILEBASE=${FILE%.php}; if ! grep -q $FILEBASE $FILEPATH; then echo $FILEPATH \($FILEBASE\); fi' \;
<?php
namespace WSL\BaseBundle\Util\Helper;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
/**
* Description of ACL
$ export VAGRANT_LOG=debug; vagrant up ubuntu
INFO global: Vagrant version: 1.3.5
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/box/plugin.rb
INFO manager: Registered plugin: box command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/destroy/plugin.rb
INFO manager: Registered plugin: destroy command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/halt/plugin.rb
INFO manager: Registered plugin: halt command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/help/plugin.rb
INFO manager: Registered plugin: help command

We are testing a simple controller from imaginable MVC framework.

<?php
class UserController extends AbtractController {

    public function show($id)
    {
        $user = $this->db->find('users',$id);
        if (!$user) return $this->render404('User not found');
@gimler
gimler / memcached
Created October 6, 2010 07:39 — forked from jonhiggs/memcached
#! /bin/bash
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: memcached - Memory caching daemon
@gimler
gimler / symfony1_find_missing_translation_strings.php
Created August 10, 2010 11:46
Find mising translations string for all or a given language in a symfony1 i18n folder.
<?php
$pathToTranslationXMLFiles = 'lib/symfony/plugins/sfDoctrinePlugin/i18n';
// config null for all languages or a specific language e.g. de or fr
$myLang = null;
if (isset($argv[1]))
{
$myLang = $argv[1];
echo 'Use '.$myLang . PHP_EOL;