Skip to content

Instantly share code, notes, and snippets.

View westonal's full-sized avatar

Alan Evans westonal

View GitHub Profile
@westonal
westonal / JsonDsl.kt
Created January 5, 2022 04:59
Kotlin Json Dsl idea
package com.example
import kotlinx.serialization.json.*
import org.junit.Assert.assertEquals
import org.junit.Test
class JsonDslTest {
@Test
fun `declare complex object`() {
>+++++>>>+>+[>>>>[+[++[-][+]+>+][-]->]->>[+[++[-]++[-]+[-]++[-]+[-][+]]>[<]]+>>[+[++[-][-][+][+]]>[<]]->>[+[++[-]>---[+]]>+]->>[++[+[-][-]+[-[+]][+]]>[<][<]]->>[++[++[-]-[+]]>[<][-]]->>[+[++[-]>---[+]]+>+]->>[+[+[-]++[-][-][+]][-]]]->>[[++++[-][+][+]]]>[---[+]]<[+[+++[-][-]]]->>[+[+[-][+][+][-][<]]>[<]][+[][[+++++++]>>[+++][+][-][<]]>[<]][+[+[+++[-][+]]]>[---[+]]<[+[+++[-]>][-]]->>[+[++[-][++]]+[+++[-]]>>[<]]-[+[<]+[+++[-][]]]>[---[+]]<[+[++[-]]]->>[+[+++[-][+]]]>[---[+]]<[+[+++[-]>][-]]->>[+[++[-][++]]+[+++[-]>][-]]->>[+[++[-][++]]+[+++[-]]>>[<]]-[+[+++[-]][<]]-[>>[+++[-]]]]->+[----[+]]->++[++++[--[-]-[+][+]]>[<]]->>[+[++[-[-]]]>[<]]>>[+[+++[-][+]]>[<]]->>[+[+++[-][+][-][+]]>[<]]->>[+[+++[-][-][+][+]]]>[---[+]]<[+[++>[-][-][-][-]]]->>[+[++[-][+][+]]]>[---[+]]<[+[+++[->]]]->>[+[++[-][+][+][+][+][+][+]]]>[---[+]]<[+[[+]]]>[---[+]]<
>---->-<-[>>[++[+>[+]-]]]->>[+<[++++[-]]]->>[>+++[>[+++[-][+]+>+]>]+++>[>[+++[-][+][>++]>]]>[-]+++[>[+++[-][+][>++]>]]>[-]++++[>[+++[-][-]]-][>>>-]++++[>[+]+]]->>[>++[>[+++[-][+]+>+]>]++>-[>[+++[-][++]+>+]+]>>]->>[+[+[-][][+]]>[<]]->>[+[+++[-][-][+]]>[<]]->>[+[++[-][+]]>[<]]->>[++[+[-][+]]>[<]]->>[+[++[-][+]]>[<]]->>[+[++[-][+]]>[<]]->>[++[+[-][+]]]>[---[+]]<[+[+++[-]]]->+>[+[++[-][+][+]]]>[---[+]]<[+[+++>[-]]]->+>[+[++[-][+][+][+]]]>[---[+]]<[[+[+++[-]]]]>[---[+]]<[[+[+]]>>>[+[+[-]]]]>[---[+]]<[[+[+]]>>>[+[++[-]]>[<]]->>[+[+++[-]-]]]->>[+[++[-][+][+]]]>[---[+]]<[[+[+]]>>>[-]++++[++[-][+]]>[<]]-
@westonal
westonal / PulseInterpolator.java
Last active March 31, 2019 14:49
Interpolators, pulse and repeat
package com.example.animation;
import android.view.animation.Interpolator;
public final class PulseInterpolator implements Interpolator {
private final int duration;
private final int offFor;
/**
/**
* When used at the end of a `when` block which return value's not used, forces all branches to be listed.
*/
@Suppress("NOTHING_TO_INLINE")
inline fun <T> T?.exhaustive() = this
@westonal
westonal / KotlinUnion.kt
Created January 22, 2019 16:54
Union idea
interface A {
fun getInt(): Int
}
interface B {
fun getString(): String
}
sealed class Union<TA, TB> {
package com.example
import androidx.lifecycle.LiveData
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
@westonal
westonal / AutomaticDripCoffeeMaker.java
Last active May 4, 2018 16:44 — forked from arriolac/AutomaticDripCoffeeMaker.java
Software Design Interview Question
class AutomaticDripCoffeeMaker(inner: CoffeeMaker) : CoffeeMaker {
public Heater heater;
public Pump pump;
public AutomaticDropCoffeeMaker() {
super();
}


Welcome to StackEdit!

Hi! I'm your first Markdown file in StackEdit. If you want to learn about StackEdit, you can read me. If you want to play with Markdown, you can edit me. If you have finished with me, you can just create new files by opening the file explorer on the left corner of the navigation bar.