Skip to content

Instantly share code, notes, and snippets.

View alexandresalome's full-sized avatar

Alexandre Salomé alexandresalome

View GitHub Profile
@alexandresalome
alexandresalome / normalizer.php
Created October 4, 2012 22:10
Normalizer for Doctrine entities
<?php
namespace Gitonomy\Bundle\CoreBundle\Serializer\Normalizer;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
class EntitiesNormalizer implements NormalizerInterface, DenormalizerInterface
{
@alexandresalome
alexandresalome / do.sh
Created September 28, 2012 12:50
generate self-signed SSL certificate
# Generate a private key
openssl genrsa -des3 -out server.key.org 1024
# Generate a CSR: Certificate Signing Request
openssl req -new -key server.key.org -out server.csr
# Remove password from key
openssl rsa -in server.key.org -out server.key
# Generate a self-signed certificate
@alexandresalome
alexandresalome / test.php
Created September 24, 2012 21:58
gitlib sample
<?php require_once __DIR__.'/vendor/autoload.php';
/** gitlib: http://gitonomy.com/doc/gitlib/master/ */
$repo = Gitonomy\Git\Admin::init('/tmp/test', false);
$repo->run('remote', array('add', 'origin', 'https://github.com/gitonomy/gitlib.git'));
$repo->run('fetch', array('--all'));
$wc = $repo->getWorkingCopy();
$wc->checkout('master');
alex@alex-laptop: composer update
Updating dependencies
Your requirements could not be solved to an installable set of packages.
Problems:
- Problem caused by:
- Package "behat/mink-bundle-9999999-dev" contains the rule behat/mink-bundle requires behat/mink ([>= 1.3.2.0, < 1.4.0.0-dev]). Any of these packages satisfy the dependency: behat/mink-1.3.3.0, behat/mink-1.3.2.0, behat/mink-1.3.4.0.
- -behat/mink-1.4.0.0|-behat/mink-1.3.3.0
- -behat/mink-1.4.0.0|-behat/mink-1.3.4.0
- Package "behat/mink-selenium2-driver-9999999-dev" contains the rule behat/mink-selenium2-driver requires behat/mink ([>= 1.4.0.0, < 1.5.0.0-dev]). Any of these packages satisfy the dependency: behat/mink-1.4.0.0, behat/mink-1.4.0.0.
<?php
use Symfony\Component\HttpFoundation\Request as Response;
use Symfony\Component\HttpFoundation\Response as Request;
@alexandresalome
alexandresalome / bad_steps_proposition.php
Created June 7, 2011 19:48 — forked from everzet/bad_steps_proposition.php
Explaining why classes are not possible in Behat as step definitions
<?php
/*
You can't use classes like this to define steps by the simple reason:
in Behat and Cucumber, step definitions and test contexts ARE two
splitted logical elements, not one. Different step definitions
can be used together in different scenarios and each scenario will
have it's own context (environment) object. That's the main logical
idea behind Behat - define step once - use it everywhere.
<?php
class CalcSteps
{
protected $calc;
protected $screen;
public function start()
{
$this->calc = new Calc();
#!/bin/bash
#
# Synchronization script for a project.
#
# This script will synchronize with production environment
#
[ "$1" = "go" ] && DryRun="" || DryRun="--dry-run"
[ "$1" = "go" ] && DeleteCommand="rm -rf" || DeleteCommand="ls"
<?
class Car
{
publc function __construct($id)
{
$this->id = $id;
}
/**