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
[ | |
{ | |
"key": "FEATURE_NEW_CREATE_POST", | |
"enabled": false, | |
"debug": false, | |
"permission": { | |
"enabled": false, | |
"debug": false, | |
"user_ids": [] | |
}, |
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
object future { | |
def groupedCollect[A, B](xs: Seq[A], par: Int)(f: A => Future[B]): Future[Seq[B]] = { | |
val bsF: Future[Seq[B]] = Future.value(Seq.empty[B]) | |
xs.grouped(par).foldLeft(bsF){ case (bsF, group) => { | |
for { | |
bs <- bsF | |
xs <- Future.collect(group.map(f)) | |
} yield bs ++ xs | |
}} | |
} |
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
function groupBy(xs, key) { | |
return xs.reduce(function (rv, x) { | |
let v = key instanceof Function ? key(x) : x[key]; | |
let el = rv.find((r) => r && r.key === v); | |
if (el) { | |
el.values.push(x); | |
} else { | |
rv.push({ | |
key: v, | |
values: [x] |
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 Functional { | |
public interface Function3<A,B,C,R> { | |
R apply(A a, B b, C c) throws Throwable; | |
} | |
public static class Either<L, R> { | |
final public Optional<L> left; | |
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 static String lem() { | |
System.out.println("lem"); | |
return "return from lem"; | |
} | |
public static String foo() { | |
int x = 0; | |
int y = 5; | |
try { | |
System.out.println("start try"); |
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
object GlobalGraph { | |
type NodeId = Int | |
type Distance = Int | |
type Nodes = Set[Node] | |
type Path = (Nodes, Distance) | |
type Graph = Map[Edge, Distance] | |
case class Node(id: NodeId, dist: Distance = Int.MaxValue, prevNode: Option[Node] = None) | |
case class Edge(from: NodeId, to: NodeId) | |
} |
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
contract KeyValueStore { | |
uint256 keyIndex; | |
struct values { | |
string value1; | |
string value2; | |
} | |
mapping (uint256 => values) Obj; | |
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
class ExecutorService { | |
def submit[A](a: Callable[A]): Future[A] | |
} | |
trait Callable[A] { def call: A } | |
trait Future[A] { | |
def get: A | |
def get(timeout: Long, unit: TimeUnit): A | |
def cancel(evenIfRunning: Boolean): Boolean |
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.concurrent.Future | |
import scala.language.higherKinds | |
sealed trait Monad[T[_]] { | |
def map[A, B](value: T[A])(f: A => B): T[B] | |
def flatMap[A, B](value: T[A])(f: A => T[B]): T[B] | |
def pure[A](x: A): T[A] | |
} |