Skip to content

Instantly share code, notes, and snippets.

View dariodiaz's full-sized avatar

Dario Diaz dariodiaz

View GitHub Profile
@dariodiaz
dariodiaz / gist:1990413
Created March 7, 2012 01:57
conf: conkyrc file
use_xft yes
background yes
xftfont verdana:size=8
alignment top_right
xftalpha 0.8
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
@dariodiaz
dariodiaz / commit_history
Created March 14, 2012 03:11
bash: git commit history
git reflog show | grep '}: commit' | nl | sort -nr | nl | sort -nr | cut --fields=1,3 | sed s/commit://g | sed -e 's/HEAD*@{[0-9]*}://g'
@dariodiaz
dariodiaz / webdriver_mobile_useragent.rb
Created April 3, 2012 23:45
webdriver: Mobile user agent
#------------------------------------------------------------------------------------------------------
# Define Caps
#------------------------------------------------------------------------------------------------------
profile = Selenium::WebDriver::Firefox::Profile.new
profile['general.useragent.override'] = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"
if platform.match(/Firefox/)
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:javascript_enabled => true, :firefox_profile=> profile)
end
@dariodiaz
dariodiaz / android_support
Created April 26, 2012 16:30 — forked from hugs/gist:2493103
selenium: How to Dynamically Add Android Support to Selenium Server at Runtime
How to Dynamically Add Android Support to Selenium Server at Runtime
----------------------------------------------------------------------------------
1) Launch Selenium Server:
----------------------------------------------------------------------------------
# In a terminal window, run this command:
$ java -jar selenium-server-standalone-2.21.0.jar
Apr 25, 2012 3:53:39 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
15:53:44.584 INFO - Java: Apple Inc. 20.6-b01-415
@dariodiaz
dariodiaz / behat-ci.sh
Created June 21, 2012 17:55 — forked from jakzal/behat-ci.sh
behat: Runs all Behat scenarios in a Symfony project on CI
#!/bin/sh
# ./bin/behat-ci.sh
project_dir=$(dirname $(readlink -f $0))"/.."
logs_path=${1:-"./build/logs/behat"}
reports_path=${2:-"./build/behat"}
cd $project_dir
@dariodiaz
dariodiaz / highlight_sel_element.py
Created July 13, 2012 12:16 — forked from marciomazza/highlight_sel_element.py
python: Highlights a Selenium Webdriver element
import time
def highlight(element):
"""Highlights (blinks) a Selenium Webdriver element"""
driver = element._parent
def apply_style(s):
driver.execute_script("arguments[0].setAttribute('style', arguments[1]);",
element, s)
original_style = element.get_attribute('style')
apply_style("background: yellow; border: 2px solid red;")
@dariodiaz
dariodiaz / autoload.php
Created July 24, 2012 16:28 — forked from everzet/autoload.php
php: app/autoload.php for Behat 2.4+ & Symfony2.1+
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
$loader = require __DIR__.'/../vendor/autoload.php';
} else {
$loader = new Composer\Autoload\ClassLoader();
$loader->register();
}
@dariodiaz
dariodiaz / apache_directives
Created August 9, 2012 11:28
bash: grep apache config directives
grep -ve ^\ *\#'\|'^$ /etc/apache2/apache2.conf
@dariodiaz
dariodiaz / dhx_combo_box.py
Created August 17, 2012 00:02 — forked from adamgoucher/dhx_combo_box.py
python: dhx_combo_box
import pytest
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import UnexpectedTagNameException
class ComboBox(object):
def __init__(self, webelement):
if webelement.tag_name.lower() != "div":
@dariodiaz
dariodiaz / samplepageobject.php
Created August 24, 2012 21:30 — forked from adamgoucher/samplepageobject.php
php: sample page object in php
<?php
namespace WebDriver;
require_once('dashboard.php');
require_once(dirname(__FILE__) . '/../../../PHPWebDriver/WebDriverWait.php');
class SauceLoginPage {
private $locators = array(
"username" => array("id", 'username'),
"password" => array("id", 'password'),