Skip to content

Instantly share code, notes, and snippets.

@rascio
rascio / _usage.kt
Last active November 11, 2022 16:29
Kotlin parallel DSL
fun main() = runBlocking {
val (first, second, third) = (
parallel {
println("I/O")
delay(100)
"FIRSTRESULT"
} and {
println("I/O")
@rascio
rascio / .block
Last active May 7, 2020 21:07 — forked from mbostock/.block
Tidy Tree vs. Dendrogram
license: gpl-3.0
border: no
height: 2400
nil
"Hello World!"
:hello-world!
:what-is-the-difference-with-a-string?
:this-is-like-an-infinite-enum
@rascio
rascio / Main.java
Last active May 15, 2018 20:43
JavaRx parallelism
package it.r.rx;
import org.apache.commons.lang.RandomStringUtils;
import rx.Observable;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
package it.r.meta;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
/**
* Created by rascio on 28/07/16.
*/
public class Content {
package it.r.rapportini.utils.optional;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Created by rascio on 26/02/16.
*/
@rascio
rascio / gist:9710824
Created March 22, 2014 17:17
DI with partials
function Dispatcher(){
var handlers = {}
this.register = function(queryExecutorDescriptor){
handlers[queryExecutorDescriptor['for']] = queryExecutorDescriptor.retrieve;
}
this.dispatch = function(query, params){
var handle = handlers[query]
if (handle){
return handle(params);
}