Previous example: https://gist.github.com/tanmatra/04b049a77918b8b321ba4c37f4c582c1
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
package example | |
class DataChannel { | |
fun registerObserver(dataChannelObserver: DataChannelObserver?) {} | |
} | |
interface DataChannelObserver { | |
fun onStateChange() | |
} |
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 java.lang.reflect.InvocationHandler | |
import java.lang.reflect.Method | |
import java.lang.reflect.Proxy | |
import java.util.Timer | |
import kotlin.concurrent.timerTask | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.resumeWithException | |
import kotlinx.coroutines.CancellationException |
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
/* | |
* https://overreacted.io/algebraic-effects-for-the-rest-of-us/ | |
*/ | |
private val effectsStack = ThreadLocal<EffectsFrame>() | |
fun <T> perform(effectKey: Any): T { | |
var frame = effectsStack.get() | |
while (frame != null) { | |
@Suppress("UNCHECKED_CAST") |
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 com.google.gson.Gson | |
import com.google.gson.GsonBuilder | |
import com.google.gson.JsonArray | |
import com.google.gson.JsonElement | |
import com.google.gson.JsonObject | |
import com.google.gson.JsonParser | |
@DslMarker | |
annotation class JsonDSL |
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 java.util.Random; | |
import javafx.application.Application; | |
import javafx.beans.property.ReadOnlyIntegerWrapper; | |
import javafx.beans.property.ReadOnlyStringWrapper; | |
import javafx.scene.Node; | |
import javafx.scene.Scene; | |
import javafx.scene.control.TreeItem; | |
import javafx.scene.control.TreeTableColumn; | |
import javafx.scene.control.TreeTableView; | |
import javafx.scene.layout.BorderPane; |
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 Example(val time: Long, | |
val short: Short = -111, | |
val eventId: Int?, | |
val data: ByteArray?, | |
val extra: Any = Unit, | |
val extra2: LongArray? = null) | |
{ | |
override fun hashCode() = initHash() | |
.addHash(time) | |
.addHash(short) |
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 java.util.Date; | |
import java.util.function.Consumer; | |
public interface Caller | |
{ | |
void call(String id, Consumer<Integer> integerConsumer, Consumer<String> stringConsumer, Consumer<Date> dateConsumer); | |
} |
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 java.lang.reflect.Field; | |
import org.eclipse.jface.layout.GridDataFactory; | |
import org.eclipse.swt.SWT; | |
import org.eclipse.swt.events.KeyAdapter; | |
import org.eclipse.swt.events.KeyEvent; | |
import org.eclipse.swt.events.PaintEvent; | |
import org.eclipse.swt.events.PaintListener; | |
import org.eclipse.swt.events.SelectionAdapter; | |
import org.eclipse.swt.events.SelectionEvent; | |
import org.eclipse.swt.graphics.Color; |