Skip to content

Instantly share code, notes, and snippets.

View tristanbes's full-sized avatar

Tristan Bessoussa tristanbes

View GitHub Profile
@devster
devster / php_setget.sublime-snippet
Last active August 29, 2015 13:55
PHP setter/getter snippet for sublime text
<snippet>
<content><![CDATA[
/**
* Set ${1:property}
*
* @param ${2:type} \$$1
*
* @return ${3:Type}
*/
public function set${1/^([a-z])/\u$1/g}(\$$1)
@gggeek
gggeek / BasePage.php
Last active August 29, 2015 14:10
Injecting Symfony services into Behat PageObjects
namespace Kaliop\AProject\PageObjects\Pages;
use SensioLabs\Behat\PageObjectExtension\PageObject\Page;
use Behat\Mink\Session;
use SensioLabs\Behat\PageObjectExtension\PageObject\Factory;
abstract class BasePage extends Page
{
protected $aService;
@tentacode
tentacode / ScreenshotContext.php
Created February 6, 2015 13:33
After a Behat javascript scenario fails, taking a screenshot then sending it to wsend as an anonymous user. (could be improved, juste a POC really)
<?php
namespace Context;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\Mink\Driver\Selenium2Driver;
class ScreenshotContext extends RawMinkContext
{
@KuiKui
KuiKui / pre-commit.sh
Last active May 26, 2016 10:23 — forked from JJK801/pre-commit.sh
Git Pre-Commit hook for coding standards validation
#!/bin/bash
#--------------------------------------------------------------------------------------------------
# WARNING : due to a 'git stash save -u' command, check your .gitignore file before using this hook
# -> http://blog.icefusion.co.uk/git-stash-can-delete-ignored-files-git-stash-u/
#--------------------------------------------------------------------------------------------------
binary="coke"
file=".coke"
files=""
@dbu
dbu / README.md
Last active October 2, 2018 11:57
Convert NelmioApiDocBundle annotations to Swagger PHP

A Symfony command to convert from NelmioApiDocBundle annotations to Swagger-PHP annotations.

This code is provided as is. Make sure to have your code committed to version control before running the command. Check if things work out and if not, use version control to reset the automated changes and fix the command.

@havvg
havvg / wizard.html.twig
Created March 15, 2012 10:41
Symfony2 Form CollectionType remove
{% extends '::base.html.twig' %}
{% from 'MopaBootstrapBundle::icons.html.twig' import icon %}
{% macro widget_prototype(widget, remove_text) %}
{% from 'MopaBootstrapBundle::icons.html.twig' import icon %}
{% if widget.get('prototype') %}
{% set form = widget.get('prototype') %}
{% set name = widget.get('prototype').get('name') %}
@ckelner
ckelner / README.md
Last active October 5, 2020 17:08
Using the Datadog Ansible integration with Ansible Tower

Datadog and Ansible Tower

This doc explains the nuances of using the Datadog Ansible Integration with Ansible Tower.

Ansible Setup

In a directory of your choosing, run the following commands:

  • vagrant init ansible/tower
  • vagrant up --provider virtualbox
  • vagrant ssh
@DirtyF
DirtyF / README.md
Last active April 11, 2021 17:24
Setup Jekyll on macOS with brew and rbenv - See https://jekyllrb.com/docs/installation/macos/

First, make sure you have command line tools installed:

xcode-select --install

Then open Terminal.app and type:

curl https://gist.githubusercontent.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3/raw/fbc736fa1b50bd637929a315e6803df306c8bc8e/setup-rbenv.sh | bash
@havvg
havvg / DateRange.php
Last active October 24, 2021 10:33
Symfony2: poor man's date_range form type
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Model;
use DateTime;
class DateRange
{
/**
* @var DateTime
@webmozart
webmozart / array-validation-error-mapping.php
Last active June 25, 2023 23:30
A little experiment: Validating (potentially multi-leveled) arrays with the Symfony2 Validator component and returning the errors in the same data structure as the validated array by using the Symfony2 PropertyAccess component.
<?php
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Constraints\Required;