Skip to content

Instantly share code, notes, and snippets.


Dan Häberlein dhaeb

  • Universität Leipzig
  • Leipzig / Germany
View GitHub Profile
View <app>-<models>DatabaseExecutionContext.scala
package models
import javax.inject._
import play.api.libs.concurrent.CustomExecutionContext
* This class is a pointer to an execution context configured to point to "database.dispatcher"
* in the "application.conf" file.
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)
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 /
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);
You can’t perform that action at this time.