Skip to content

Instantly share code, notes, and snippets.

View alexandresalome's full-sized avatar

Alexandre Salomé alexandresalome

View GitHub Profile
<?
class Car
{
publc function __construct($id)
{
$this->id = $id;
}
/**
#!/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"
<?php
class CalcSteps
{
protected $calc;
protected $screen;
public function start()
{
$this->calc = new Calc();
@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
use Symfony\Component\HttpFoundation\Request as Response;
use Symfony\Component\HttpFoundation\Response as Request;
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.
@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');
@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 / 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 / gist:6658708
Created September 22, 2013 10:27
Reduce amount of logic in your templating: set business in your array definition, not in template body.
<ul class="nav navbar-nav">
{% set navbar_active = navbar_active|default(null) %}
{% set navbar_menu = navbar_menu|default([
{
'show': app.user and is_granted('ROLE_ADMIN'),
'active': navbar_active == 'design',
'label': 'Design',
'href': path('admin_design'),
},
{