Skip to content

Instantly share code, notes, and snippets.

Dale King dalewking

View GitHub Profile
@dalewking
dalewking / gist:947fb57e0916d24a397d
Created Jul 15, 2014
Build.gradle setup for running Robolectric
View gist:947fb57e0916d24a397d
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.+'
}
}
@dalewking
dalewking / CamCompatListView
Created Jun 6, 2014
Backwards compatible Contextual Action Mode
View CamCompatListView
import android.content.Context;
import android.support.v7.view.ActionMode;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ListView;
public class CamCompatListView extends ListView
{
public CamCompatListView(Context context)
@dalewking
dalewking / gist:5744791
Last active Dec 18, 2015
Example of streaming text data to client in Scala on Play Framework 2.1 using OutputStream. It took me a long time to figure out how to get this working, so in case it helps someone else, here it is. The >>> Enumerator.eof is very important other wise it hangs
View gist:5744791
def index = Action {
val output = Enumerator.outputStream
{
o =>
val out = new PrintWriter(new OutputStreamWriter(o, "utf8"), true)
for(i <- 1 to 5)
{
out.println(s"Hello $i")
}
out.close()
You can’t perform that action at this time.