Skip to content

Instantly share code, notes, and snippets.

@jmolivas
jmolivas / FeatureContext.php
Last active December 12, 2015 07:08
Behat Mink check vs click
/**
* @When /^I click "([^"]*)"$/
*/
public function iClick($selector)
{
$element = $this->getSession()->getPage()->findField($selector);
$element->click();
}
@jmolivas
jmolivas / dbfixture
Last active December 14, 2015 07:29
Alias to drop & create DB, create Schema & load fixtures, using symfony console
alias dbfixture='app/console doctrine:database:drop --force && app/console doctrine:database:create && app/console doctrine:schema:create && app/console doctrine:fixtures:load'
@jmolivas
jmolivas / MAMP Alias
Created March 19, 2013 22:00
MAMP alias
alias php='/Applications/MAMP/bin/php/php5.4.4/bin/php'
alias mysqldump='/Applications/MAMP/Library/bin/mysqldump'
alias mysql='/Applications/MAMP/Library/bin/mysql'
@jmolivas
jmolivas / FormUtil.php
Created March 27, 2013 22:03
get error messages from Form element symfony 2.0
<?php
namespace Company\YourBundle\Util;
/**
* FormUtil
*
* This class was created to add Form resusable functions
*
*/
@jmolivas
jmolivas / rock-en-espanol
Last active December 16, 2015 15:09
Lista de Discos de rock en español
* Draco - Vagabundo - http://grooveshark.com/#!/playlist/Robi+Draco+Rosa+Vagabundo/79364927
* Zurdok - Hombre Sintetizador - http://grooveshark.com/#!/album/Hombre+Sintetizador/3691185
* Soda Stereo - Dynamo - http://grooveshark.com/#!/album/Dynamo/365534
* Bunbuy - Radical Sonora - http://grooveshark.com/#!/album/Radical+Sonora/468139
* Azul Violeta - Minimulti - http://grooveshark.com/#!/album/Mini+Multi/364989
@jmolivas
jmolivas / readonly.module
Last active December 18, 2015 01:48
First attempt to add readonly attribute to entity fields using after_build callback
<?php
/**
* Implements hook_form_alter().
*/
function readonly_form_alter(&$form, &$form_state, $form_id) {
// TODO set form using UI
$readonly_field_form_id = 'ENTITY_NAME_node_form';
// TODO set fields using UI
$readonly_fields = array('FIELD_NAME_FOO','FIELD_NAME_BAR');
@jmolivas
jmolivas / readonly.module
Last active December 18, 2015 01:49
Second attempt to add readonly attribute to entity fields using a Field Widget for textfields
<?php
/**
* Implements hook_field_widget_info()
*/
function readonly_field_widget_info(){
return array(
'readonly_textfield' => array(
'label' => t('Text field (Read Only)'),
'field types' => array('text'),
Feature: Authenticate users
In order to access restricted areas of the system
As a user
I need to be able to sign into the system
Scenario: Sign in user
And I am on "/signin"
When I fill in "E-mail Address" with "user@example.org"
And I fill in "Password" with "passw0rd"
And I press "Sign in"
@jmolivas
jmolivas / drupal-8-links.md
Last active December 19, 2015 19:09
Drupal 8 links & resources Drupal 8 Updates, Module Development & Upgrade Drupal 8 Desarrollo y Actualizacion de Módulos
@jmolivas
jmolivas / .bash_profile
Created September 27, 2013 17:11
partial .bash_profile
# Display git branch
function parse_git_branch {
[ -d .git ] || return 1
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi