Skip to content

Instantly share code, notes, and snippets.

@roycollings
roycollings / gist:4585328
Last active November 1, 2022 04:07
VERY simplified Java Excel manipulation using "jxl": I found 'jxl' api to be very powerful, but very unintuative and much of it is left for *you* to figure out. For example, there's no simple call to make a cell italic, instead it's up to you to extract the correct sequence of objects, make your change to the correct one then re-assemble (an re-…
import jxl.CellType;
import jxl.CellView;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.Colour;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
@roycollings
roycollings / AngularJS E2E test each listitem in separate it.js
Created December 21, 2012 08:01
AngularJS E2E: loop through a list and test each item in a separate "it" statement.
// PROBLEM:
// ========
//
// If you have a list of 'something', perhaps links to another page, and you want to click each item,
// then run some tests (and possibly click more links in the next page and run tests etc...).
// You could have dozens (or even hundreds) of tests per list item.
// In AngularJS E2E you need to enclose the whole thing in ONE "it" statement
// (because otherwise you cannot see the 'element' object), something like this:
it ('clicking each link takes you to the correct page', function() {
@roycollings
roycollings / AngularJS E2E match multiline string.js
Created December 21, 2012 07:59
AngularJS E2E: nice way to match against multi-line string.
//
// Html
//
<a id="msg1">To start making payments you need to
verify your email address by clicking
the link in the confirmation email ...
</a>
//
@roycollings
roycollings / AngularJS E2E match a big list of possible entries.js
Created December 21, 2012 07:59
AngularJS E2E / Javascript: easy way to test against a big list of possible inputs.
//
// Html
//
// NOTE: I am using different names for "id" and "ng-model" here so you can clearly see
// which one I need to use at different parts of the AngularJS E2E test.
//
<input type="text" id="dateField" ng-model="myDate"/>
//
// AngularJS E2E test.
@roycollings
roycollings / Javascript - get all object items into simple array.js
Created December 21, 2012 07:57
Javascript: get all object elements and values into a simple array.
//
// Example object.
//
var DOM_matchers = {
pageURL : "/startPage",
emailBox : {model:"emailAddress", selector:"#emailAddress"},
passwordBox: {model:"password" , selector:"#password"},
enterBTN : {selector:".enterBTN"}
};
@roycollings
roycollings / AngularJS E2E compare value on page A to value on page B.js
Created December 3, 2012 17:11
AngularJS E2E: (futures) compare a value on page A with a value on page B.
//
// 2 pages:
// A: "Employee" page containing a link to an employee.
// B: "Person" page - click employee and it brings you here.
// There is an AngularJS binding called "person.name" which
// should match the Employee's name you clicked on.
//
describe('The link in the Employee screen', function() {
it('takes you to the correct "Person" page', function() {