Skip to content

Instantly share code, notes, and snippets.


Marcin Gryszko mgryszko

View GitHub Profile
mgryszko / ParApplicativeTest.kt
Created May 30, 2020
Arrow ParApplicative mapN combining effects sequentially (unlike parMapN)
View ParApplicativeTest.kt
import arrow.fx.IO
import arrow.fx.fix
import kotlin.test.Test
fun f1(): IO<String> = IO {
"f1 ${Thread.currentThread().name}"
mgryszko / CaffeineRefreshableCacheTest.kt
Created Mar 26, 2020
Characterisation test of Caffeine refreshable cache
View CaffeineRefreshableCacheTest.kt
import com.github.benmanes.caffeine.cache.CacheLoader
import com.github.benmanes.caffeine.cache.Caffeine
import com.github.benmanes.caffeine.cache.Ticker
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
class CaffeineAsyncRefreshableCacheTest {
mgryszko / dyson_jsonp_endpoint.js
Created Nov 30, 2015
Render conditionally JSON or JSONP in Dyson
View dyson_jsonp_endpoint.js
function renderJsonp(res, callback) {
res.append('Content-Type', 'application/javascript');
res.send(callback + '(' + JSON.stringify(res.body) + ');');
function renderJson(res) {
function render(req, res) {
mgryszko /
Created Sep 21, 2013
DDD practice - shipping

Use cases

Book new cargo

Shipping agent provides origin, destination and arrival deadline. Origin and destination as UN locode [1].

System assigns a unique tracking id. Tracking id should be unique and generated by the system.

Cargo is initially unrouted.

Route new cargo

You can’t perform that action at this time.