Skip to content

Instantly share code, notes, and snippets.

View sethrylan's full-sized avatar

Seth Rylan Gainey sethrylan

View GitHub Profile
@sethrylan
sethrylan / scalaConsole1
Last active June 17, 2016 20:08
ScalaBasePlugin scalaConsole/scalaTestConsole tasks
apply plugin: 'scala'
repositories {
mavenCentral()
}
ext {
versions = [
scala: '2.9.2',
scalatest: '2.0.M3',
@sethrylan
sethrylan / csv_autocomplete
Created June 4, 2013 15:23
JQuery CSV Autocomplete
/* Symptoms */
// shuttlebox : http://blog.jeremymartin.name/2008/02/easy-multi-select-transfer-with-jquery.html
// another shuttlebox : http://stackoverflow.com/questions/4255946/dynamic-shuttlebox-implementation-using-javascript
function split(val) {
return val.split(/,\s*/);
}
function extractLast(term) {
return split(term).pop();
}
@sethrylan
sethrylan / PaxCucumber.java
Last active December 17, 2015 06:28
A PaxExam and Cucumber JUnit Test Runner
/**
* This class allows for running Cucumber features tests using PaxExam in-container testing.
*
* When added as a RunWith annotation to a test class
* @RunWith(PaxCucumber.class)
* this effectively means that
* @RunWith(PaxCucumber.class) and @RunWith(Cucumber.class)
* are used as test runners for that class. Cucumber and PaxExam are run
* in parallel, and any Cucumber tasks must manually verify that any PaxExam
* dependencies have been satisfied.
Document document = XMLUtils.getDom(fhirXmlFeedString);
DocumentTraversal traversal = (DocumentTraversal) document;
NodeIterator iterator = traversal.createNodeIterator(document.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
for (Node node = iterator.nextNode(); node != null; node = iterator.nextNode()) {
String tagname = ((Element)node).getTagName();
if (tagname.equals("totalResults")) {
assertEquals("1", ((Element)node).getTextContent());
// logger.debug("id=" + ((Element)n).getAttribute("id"));
}
}
@sethrylan
sethrylan / ST101_02.06
Created July 4, 2012 22:48
ST101_02.06 Homework
print.matrix <- function(m){
write.table(format(m, justify="right"),
row.names=T, col.names=T, quote=F)
}
p_loaded = 0.1
p_hfair = 0.5
p_hloaded = 0.9
cells <- c(4, 0,10, 0, 20, 0, 0, 5, 2, 3)
rnames <- c("# heads", "# tails")