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
Hi 2 |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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 yipWhenL[I, O, O2](ord: (I, O) => Ordering)(f: (I, Option[O]) => O2): Wye[I, O, O2] = { | |
val fbL: Tee[I, O, O2] = tee.passL[I] map (f(_, None)) | |
def go(io: Option[I], oo: Option[O]): Wye[I, O, O2] = { | |
io match { | |
case None => awaitL[I].flatMap { i => go(Some(i), oo) } | |
case Some(i) => oo match { | |
case None => awaitR[O] | |
.flatMap { o => go(io, Some(o)) } | |
.orElse { emit(f(i, None)) fby go(None, None) } | |
case Some(o) => ord(i, o) match { |
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
object Reckeys { | |
import shapeless.{ HList, HNil, Id }, shapeless.Poly1, shapeless.record.FieldType, shapeless.ops.hlist.{ Mapper, Tupler }, shapeless.syntax.singleton._; | |
object recordKeys extends Poly1 { | |
implicit def caseAll[K, V] = at[FieldType[K, V]](ft => ??? : K) | |
} | |
def reckeys[L <: HList, P <: HList](ev: L)(implicit m: Mapper.Aux[recordKeys.type, L, P], | |
t: Tupler[P]): t.type { type Out = t.Out } = t | |
} |
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
void testSort(UnivInteger len) { | |
// For Random | |
val mult = 7**5; | |
val md = 2**31 - 1; | |
var ran = Random.start(len, mult, md); | |
println("Seed = " + len + ", mult = " + mult + ", md = " + md); | |
type MySorter is Sorting<Vector<UnivInteger>>; | |
var Vector<UnivInteger> vec = []; |
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 yipWhenL[I,O,O2](ord: (I,O) => Ordering)(f: (I,Option[O]) => O2): Wye[I,O,O2] = { | |
val fbL = tee.passL[I] map (f(_,None : Option[O])) | |
def go(io : Option[I], oo : Option[O]): Wye[I,O,O2] = { | |
io match { | |
case None => awaitL[I].flatMap { i => go(Some(i), oo) } | |
case Some(i) => oo match { | |
case None => awaitR[O].flatMap(o => go(io,Some(o))) // TODO receiveROr(fbL)... | |
case Some(o) => ord(i,o) match { | |
case Ordering.LT => emit(f(i,None)) then go(None,oo) | |
case Ordering.EQ => emit(f(i,oo)) then go(None,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
val sql = """select grandparent_id, parent_id, child_id | |
from children | |
order by grandparent_id, parent_id, child_id""" | |
def elementsR[R](invoker: scala.slick.jdbc.Invoker[R]): Process[Task, R] = | |
resource(Task.delay(invoker.elements()))( | |
src => Task.delay(src.close)) { src => | |
Task.delay { if (src.hasNext) src.next else throw End } | |
} |
NewerOlder