This file contains 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
func() = { | |
Stream.range(0, noItems) map { | |
_ => channel.basicGet(queueName, true) match { | |
case x: GetResponse => Some(x.getBody) | |
case _ => None | |
} | |
} takeWhile (_.isDefined) toList | |
} |
This file contains 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
func() = { | |
def rec(i: Int, acc: List[Array[Byte]]) { | |
if (i == 0) | |
acc | |
else | |
channel.basicGet(queueName, true) match { | |
case x: GetResponse => rec(i - 1, x.getBody +: acc) | |
case _ => acc | |
} | |
} |
This file contains 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 ensureContiguity(xs: List[(Int, Int)], acc: List[(Int, Int)] = List.empty): List[(Int, Int)] = | |
(xs, acc) match { | |
case (Nil, l) => l | |
case (l, Nil) => ensureContiguity(l dropRight 1, List(l.last)) | |
case _ => { | |
val t = xs.last | |
val h = acc.head | |
if (t._2 == h._1) | |
ensureContiguity(xs dropRight 1, t +: acc) |
This file contains 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 scala.util.continuations._ | |
// might need to be compiled and run separately due to a bug in App | |
object ContinuationsExample extends App { | |
def prompt(display: String): Boolean = { | |
print(display + " (Y/N) ") | |
Console.readLine.trim.headOption match { | |
case Some('Y') | Some('y') => true | |
case Some('N') | Some('n') => false |
This file contains 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
vagrant@ubuntu-xenial:/async-generators-test$ npm i -S typescript ts-node | |
...omitted... | |
vagrant@ubuntu-xenial:/async-generators-test$ node --version | |
v9.11.1 | |
vagrant@ubuntu-xenial:/async-generators-test$ npm ls ts-node | |
/async-generators-test | |
└── ts-node@6.0.0 | |
vagrant@ubuntu-xenial:/async-generators-test$ npx ts-node --harmony_async_iteration index.ts | |
> .exit | |
vagrant@ubuntu-xenial:/async-generators-test$ npx tsc -p tsconfig.json |
This file contains 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
cargo-features = ["edition"] | |
[package] | |
name = "goodbooks-recommender" | |
version = "0.1.0" | |
authors = ["A"] | |
edition = "2018" | |
[dependencies] | |
reqwest = "0.8.8" |
This file contains 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
module.exports = function (eleventyConfig) { | |
eleventyConfig.addPassthroughCopy("images"); | |
eleventyConfig.addPassthroughCopy("admin"); | |
eleventyConfig.addPassthroughCopy("CSS"); | |
eleventyConfig.addPassthroughCopy("Javascript"); | |
eleventyConfig.addWatchTarget("images"); | |
eleventyConfig.addWatchTarget("admin"); | |
eleventyConfig.addWatchTarget("CSS"); | |
eleventyConfig.addWatchTarget("Javascript"); |