Skip to content

Instantly share code, notes, and snippets.

View jsonExample.scala
import play.api.libs.json._
import play.api.libs.json.Reads._
import play.api.libs.functional.syntax._
import scala.util.control.Exception._
object Main extends App {
case class Person(name: String, height: Double)
val goodJson = Json.parse("""
@seance
seance / DnDUpload.js
Last active Feb 2, 2017
Example RxJS file dnd upload
View DnDUpload.js
var mouseDropS = $('#drop').onAsObservable('drop')
var uploadsS = mouseDropS.flatMap(function(e) {
var fileList = e.originalEvent.dataTransfer.files
var files = range(fileList.length).map(function(i) { return fileList[i] })
return Rx.Observable.fromArray(files.map(function(file) {
var subject = new Rx.ReplaySubject(1)
var reader = new FileReader()