Skip to content

Instantly share code, notes, and snippets.

Dan Häberlein dhaeb

  • Universität Leipzig
  • Leipzig / Germany
Block or report user

Report or block dhaeb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dhaeb /
Created Sep 9, 2015
Java 8 - Function abstraction can be difficult. Any Ideas to make it better?
@SuppressWarnings("unchecked") // It's a cast, I am responsible.
private void callToMethod(int i, int j) {
if(f instanceof BiFunction){
BiFunction<Integer, Integer, Boolean> callable = (BiFunction<Integer, Integer, Boolean>) f;
callable.apply(0, 1);
} else if(f instanceof BiConsumer){
BiConsumer<Integer, Integer> callable = (BiConsumer<Integer, Integer>) f;
callable.accept(i, j);
dhaeb / init-spark.R
Created Oct 26, 2015
Load SparkR in normal R interpreter. Assumes that SparkR is globally installed.
View init-spark.R
sc <- sparkR.init(sparkPackages = "com.databricks:spark-csv_2.10:1.2.0")
sqlContext <- sparkRSQL.init(sc)
dhaeb / scrape.groovy
Created Oct 8, 2017
Scraping Bundestagswahlergebnis Ost/West
View scrape.groovy
@Grab(group='net.sourceforge.htmlunit', module='htmlunit', version='2.27')
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.html.HtmlPage
def isOsten = {bl ->
def ostenLabelBl = ["Sachsen", "Thüringen", "Sachsen-Anhalt", "Mecklenburg-Vorpommern", "Berlin", "Brandenburg"]
if (bl in ostenLabelBl)
You can’t perform that action at this time.