Skip to content

Instantly share code, notes, and snippets.

@dpratt
dpratt / async_example.js
Created December 6, 2015 17:53
An example of how ES6 generators can be used to make async code look synchronous
"use strict";
//A basic generator that iterates across four values.
function* simpleGenerator() {
yield 1;
yield 2;
yield 3;
return "HI THERE";
}
@dpratt
dpratt / spray-stream-enumerator
Created July 24, 2014 16:52
A Spray chunking marshaller for Play Enumerators
package com.vast.utils
import akka.actor._
import akka.io.Tcp
import play.api.libs.iteratee._
import scala.concurrent.ExecutionContext
import spray.http._
import spray.httpx.marshalling.{MarshallingContext, Marshaller}
import akka.util.{ByteString, Timeout}
import scala.util.control.NonFatal