Skip to content

Instantly share code, notes, and snippets.

View ItsPriyesh's full-sized avatar

Priyesh Patel ItsPriyesh

View GitHub Profile
@ItsPriyesh
ItsPriyesh / List.swift
Last active November 29, 2016 21:37
Linked list implementation as an algebraic data type in Swift
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
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))
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
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(
@ItsPriyesh
ItsPriyesh / gist:9587493
Created March 16, 2014 18:17
Beanstalk default.xml for Galaxy Ace II X
<?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/" />