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
indirect enum List<A> { | |
case Cons(A, List<A>) | |
case Nil | |
func flatMap<B>(_ f: (A) -> List<B>) -> List<B> { | |
switch self { | |
case let .Cons(h, t): | |
return List.concat(f(h), t.flatMap(f)) | |
case .Nil: | |
return .Nil |
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
package main | |
import scala.io.Source | |
object Solution { | |
def main(args: Array[String]): Unit = { | |
def eval(expr: Expr, ops: List[Op]): String = Expr.show(ops.foldLeft(expr)(_ operate _)) | |
Source.stdin.getLines().map(line => line.split("/") match { | |
case Array(e, o) => eval(ExprParser.parse(e), Op.parse(o)) |
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
package me.priyesh | |
import org.json4s._ | |
import org.json4s.native.JsonMethods._ | |
import scala.io.Source | |
/** | |
* Getting shit done requires solid time management, so you’ve decided you need | |
* to stock up on clocks and watches. You head to your favourite Shopify store |
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
public class MainActivity extends Activity { | |
private static final String URL = "http://i.imgur.com/588BK.jpg"; | |
private static final String FILE_NAME = "the_starry_night.jpg"; | |
private void download() { | |
Downloader.downloadFile(URL, FILE_NAME) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe( |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest> | |
<remote name="aosp" | |
fetch="https://android.googlesource.com" | |
review="android-review.googlesource.com" /> | |
<remote name="codename13" | |
fetch="git://github.com/codename13/" /> | |