Skip to content

Instantly share code, notes, and snippets.

View hlapp's full-sized avatar

Hilmar Lapp hlapp

View GitHub Profile
library(whisker)
library(knitr)
responses <- read.csv(file="applicants.csv", stringsAsFactors=FALSE)
# names(responses)[ncol(responses)] <- "attendance"
responses_lst <- apply(responses, 1, function(x) as.list(x))
template <- "
--------------------
allenday = Allen Day <allenday@allenday.com>
bobular = Bob MacCallum <r.maccallum@imperial.ac.uk> ?
boconnor = Brian O'Connor <briandoconnor@gmail.com>
briano = briano <briano>
cmungall = Chris Mungall <cmungall@gmail.com>
cpommier_gmod = cpommier_gmod <cpommier_gmod>
cwiel = cwiel <cwiel>
daveclements = Dave Clements <clements@galaxyproject.org>
dongilbert = dongilbert <dongilbert>
e-just = e-just <e-just>
@hlapp
hlapp / benchmarking_java
Created October 24, 2012 15:41 — forked from dongyemeng/benchmarking_java
Test the performance of java on regex. There are 5 cases. I put the running time of each on my machine as comment. You can remove the "/*" and "*/" of any case to run on it.
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class benchmarking_java {
public static void main(String[] args) {
// regular expression
//Pattern pattern = Pattern.compile("^.*(.*?)<i>\\s*([^<]*)\\s*<\\/i>(.*).*$");
Pattern pattern = Pattern.compile("^(.*?)<i>\\s*([^<]*)\\s*<\\/i>(.*)$");
long startTime = 0;
<?xml version="1.0" encoding="ISO-8859-1"?>
<nex:nexml
version="0.9"
xsi:schemaLocation="http://www.nexml.org/2009 http://www.nexml.org/2009/nexml.xsd"
xmlns:phen="http://www.bioontologies.org/obd/schema/pheno"
xmlns:gml="http://www.opengis.net/gml"
xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns="http://www.nexml.org/2009"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"