Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabricio Henrique fadonascimento

View GitHub Profile
View gist:6e489b1a4c923bad89c4b6f96712aa78
class FeatureContext extends MinkContext {
/**
* @Given /^I wait for css element "([^"]+)" to (appear|disappear)$/
*/
public function iWaitForCssElement($element, $appear)
{
$xpath = $this->getSession()->getSelectorsHandler()->selectorToXpath('css', $element);
$this->waitForXpath($xpath, $appear == 'appear');
}
View gist:39d338c011ebf2911dc12ca5d6b94530
use Behat\Mink\Driver\Selenium2Driver;
use Behat\Behat\Hook\Scope\AfterStepScope;
/**
* @When /^I take a screnshoot "([^"]*)"$/
*/
public function takeScreenShotAfterFailedStep($filePath)
{
View gist:0dbf82f5a81d77ef6b83
(function($) {
var o = $({});
$.subscribe2 = function() {
o.on.apply(o, arguments);
};
$.unsubscribe2 = function() {
o.off.apply(o, arguments);
View gist:d85b11af71f0d47c1194
public function getUrl($image,$options){
$url = Configure::read('webroot_url').'/img/myimg/empty.jpg';
if($this->validate($image,$options)){
/*configurar uma variavel global para pegar url padrão do site neste arquivo*/
$url = 'http://'.$this->s3defaults['cloud_front'].$image['alias'].'/'.$image[$image['alias'].'_id'].'/'.(isset($options['rel'])?$options['rel'].'-':'').$image['name'];
}
return $url;
}
@fadonascimento
fadonascimento / HtmlHelper::image()
Created Aug 28, 2014
Verifica se existe a Imagem pelo HtmlHelper
View HtmlHelper::image()
/**
* Verificar se a imagem existi
* caso ela exista retorna para o helper do html
* se ela não existir retorna false para não exibir a div sem imagem
*
*/
public function image($path, $options = array())
{
$realPatch = ROOT . DS . APP_DIR . DS . WEBROOT_DIR . 'img' . DS . join(DS,explode('/',$path));
You can’t perform that action at this time.