Skip to content

Instantly share code, notes, and snippets.

View themillhousegroup's full-sized avatar

themillhousegroup

View GitHub Profile
@themillhousegroup
themillhousegroup / FrontEndServingController.scala
Created July 8, 2017 04:35
Play controller for serving a React App out of /public - including front-end routes
package controllers
import play.api.mvc.{Action, Controller}
import play.api.Logger
import javax.inject.Inject
import java.io.File
import play.api.libs.json.Json
class FrontEndServingController @Inject() (val assets:Assets) extends Controller {

Keybase proof

I hereby claim:

  • I am themillhousegroup on github.
  • I am millhouse (https://keybase.io/millhouse) on keybase.
  • I have a public key whose fingerprint is 7F96 C377 F73B 29C8 17FE 4E24 1890 2E56 B58A 9B11

To claim this, I am signing this object:

@themillhousegroup
themillhousegroup / DirectoryFileCreationWatcher
Last active May 21, 2018 20:55
Watching a directory with Scala Futures via Java nio
class DirectoryFileCreationWatcher(directoryToWatch:Path) {
import java.nio.file._
import java.nio.file.StandardWatchEventKinds._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.collection.JavaConversions._
val watcher = FileSystems.getDefault.newWatchService
// Work properly on Mac:
//http://stackoverflow.com/questions/9588737/is-java-7-watchservice-slow-for-anyone-else