Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@daluu
daluu / CartItemObjectsExampleCodeSnippets.java
Last active August 29, 2015 14:06
Selenium page object model to model cart items as objects for testing code snippet examples
// snippet written for and relates to:
// http://autumnator.wordpress.com/2014/09/23/selenium-page-objects-beyond-pages-like-a-cart-object/
/**
* Cart item implementation as a data structure
* containing a related set of WebElements to work with
*
* These cart items reside in and can be extracted from
* shopping cart page object to then be worked with.
**/
@daluu
daluu / Silk4JLibaryNotes1.txt
Created February 13, 2012 05:12
Silk4JLibrary design notes 1 for Robot Framework
The following are some notes on how to develop a Silk4J-based test library for Robot Framework to use the Borland Silk GUI automation tool/library.
Suggest use Silk4J GUI element/object location inline object model (identify object & execute automation all in one line of code):
desktop.<controlType>find("/windowHandleType[@caption='window title']//controlType[@automationId='idName']").commandName();
At the control type descriptor for automation ID, the automation ID is only the required first array index to locating the object/element. As I recall, there can be optional second index after it that further describes the object/element, but I forget it's syntax, but it goes like such of course:
...//controlType[@automationId='idName'][some other identification here]").commandName();
@daluu
daluu / JSONView Dark Theme.css
Created October 9, 2015 23:21 — forked from timnew/JSONView Dark Theme.css
This is a dark theme for JSONView chrome extension
body {
white-space: pre;
font-family: consolas;
color: white;
background: black;
}
.property {
color: orange;
font-weight: bold;
@daluu
daluu / autosmsDbg.php
Created July 14, 2013 23:33
For debugging jQueryMobile with PHP
<?php
if (!empty($_POST)){
$sentFlag = TRUE;
$smsResponse = "Something sent";
}else{
$sentFlag = FALSE;
$smsResponse = "Nothing sent.";
}
//get carrier list w/ CURL & establish session
$tuCurl = curl_init();
@daluu
daluu / FileDownloader.php
Created August 23, 2012 05:51
PHP example for file downloader with Selenium
<?
/**
* This creates the cookie header string for curl to send when making requests.
* It includes the (PHP) session ID among possibly a few other cookies. This is
* not for use with curl's built-in cookie JAR (CURLOPT_COOKIEJAR) and file
* handling (CURLOPT_COOKIEFILE) options. This is using the curl header
* (CURLOPT_COOKIE) with value of "name1=value1; name2=value2..."
* See http://hasin.me/2007/04/18/cookiejar-in-curl-it-sucks/ and
* http://en.wikipedia.org/wiki/HTTP_cookie for more details.
*
@daluu
daluu / SafariDriverAlertWorkaroundExample.java
Created September 30, 2013 02:53
SafariDriver alert handling possible workaround using HTTP requests & responses. This may or may not work for you depending on what your application under test does with the alerts.
/* Safari workaround below simply constructs the required HTTP POST data
* as key/value pairs (e.g. param1=value1&param2=value2, etc.)
* then makes an HTTP POST request with that data, then check the received
* HTTP response returned (e.g. status code 200 OK, or response body content contains what you expect)
* Example below currently skips checking response as that part is handled by the CustomHttpClient
* (implementation not shown). Making actual HTTP POST request is same thing. For details on that,
* see this for reference:
* http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
* http://stackoverflow.com/questions/9129766/urlconnection-is-not-allowing-me-to-access-data-on-http-errors-404-500-etc
*
@daluu
daluu / index.html
Last active January 31, 2016 23:19 — forked from jltran/index.html
Histogram Overlaid with CDF line to replicate Excel functionality
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
@daluu
daluu / index.html
Created February 1, 2016 01:43
d3 pareto histogram example with cumulative percentage line (e.g. replica of Excel histogram with pareto and cumulative percentage line options via the data analysis toolpak addon)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 10px sans-serif;
}
.bar rect {
fill: steelblue;
shape-rendering: crispEdges;
}
@daluu
daluu / dataset.csv
Last active February 10, 2016 21:08
Histogram with CDF line overlaid using nvd3.js
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Distance
2.4059769174850905
2.7600000000000002
3.8217080187144488
2.3899284588203313
3.7264403738739054
7.63
3.16
3.1600000000000006
3.160000000000001
@daluu
daluu / README.md
Last active May 11, 2016 16:11
Custom/additional maven repos to get some not so common maven hosted JARs

Just an example for others and a note for myself in case I need to reference this in the future.

Steps:

Add the custom/additional maven repos where you can find the JARs (that are not hosted on maven central or other common repo)

<repositories>
   <!-- has some useful JARs not hosted on maven central, a popular alternative repo -->