This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package unfilteredx | |
import unfiltered.response.{ContentLength, InternalServerError, ResponseFunction} | |
import scala.language.implicitConversions | |
import scala.language.higherKinds | |
import scala.concurrent.{ExecutionContext, Future} | |
import d2.{Result, Directive, Directives} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package recsys | |
import org.apache.spark.SparkContext._ | |
import org.apache.spark.mllib.recommendation.{MatrixFactorizationModel, Rating} | |
import org.apache.spark.rdd.RDD | |
import org.jblas.DoubleMatrix | |
import org.slf4j.LoggerFactory | |
package object collaborative { | |
implicit class MatrixFactorizationModelOps(val m: MatrixFactorizationModel) extends AnyVal { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def string[T](req: HttpRequest[T])(implicit codec: Codec = Codec.UTF8) = { | |
loan(new InputStreamReader(req.inputStream, codec.charSet)) { reader => | |
val writer = new java.io.StringWriter | |
val ca = new Array[Char](4096) | |
@scala.annotation.tailrec def read() { | |
val len = reader.read(ca) | |
if (len > 0) writer.write(ca, 0, len) | |
if (len >= 0) read | |
} | |
read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
jq "{template: .collection.template}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package emsnav | |
import dispatch._, Defaults._ | |
import java.net.URI | |
import net.hamnaberg.json.collection._ | |
import concurrent.Await | |
import concurrent.duration._ | |
object Main extends App { | |
val MediaType = "application/vnd.collection+json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package unfilteredx.logging | |
import unfiltered.request._ | |
import unfiltered.response._ | |
import unfiltered.Cycle | |
import com.typesafe.scalalogging.Logger | |
import org.slf4j.LoggerFactory | |
object TraceLogging { | |
def apply[A, B](intent: Cycle.Intent[A, B])(implicit tl: TraceLogger[A, B]) = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.hamnaberg.funclite.*; | |
public class Collect { | |
public static <A, B> Option<B> collect(A value, Predicate<A> p, Function<A, B> f) { | |
if (p.apply(value)) { | |
return Option.fromNullable(f.apply(value)); | |
} | |
return Option.none(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"templates": [ | |
{ | |
"data": [ | |
{"name": "synth-id", "value": "urn:uuid:536c2060-c9ea-4781-97d9-12d6f717a88c"}, | |
{"name": "foo", "value": "bar"} | |
] | |
}, | |
{ | |
"data": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/spec/ems_spec.rb b/spec/ems_spec.rb | |
index 9620341..93732ed 100755 | |
--- a/spec/ems_spec.rb | |
+++ b/spec/ems_spec.rb | |
@@ -117,14 +117,14 @@ describe 'EMS' do | |
collection['href'].should eql collection_url | |
end | |
- %w(format body state audience slug title lang summary level).each do |field| | |
+ %w(format body state title lang summary level).each do |field| |