Skip to content

Instantly share code, notes, and snippets.

View andretietz's full-sized avatar

André Tietz andretietz

View GitHub Profile
@andretietz
andretietz / problem.kt
Last active April 23, 2024 19:53
transforming nodes
// following data classes are available, feel free to create more if necessary
data class Node(
val id: String,
val parentId: String? = null, // nullable string , default null
val repeat: Int? = null // nullable int , default null
)
data class TargetNode(
val id: String, // this id's can be generated somehow
@andretietz
andretietz / test1.kt
Created December 18, 2020 07:32
Sample for multiple files
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
@Retention(RUNTIME)
annotation class SomeAnnotation(
val value: String
)
@Authenticated
@GET("/some/path")
fun someCall(): Call<MyResponseObject>
@andretietz
andretietz / TEST.md
Created December 14, 2020 13:42
Error with markdown interpretor

ProxyCallAdapter

And here the simple ProxyCallAdapter that doesn't do anything special, but records the request and it's annotation content into our map/registry. Everything else is Proxy functionality.

class ProxyCallAdapter<RETURN_TYPE : Any>(
  private val adapter: CallAdapter<Any, RETURN_TYPE>,
  private val registration: MutableMap<Int, String>,
  private val info: String
) : CallAdapter<Any, RETURN_TYPE> {
@andretietz
andretietz / list_tree_list.kt
Last active November 17, 2020 08:46
How to create a node tree from a node list using kotlin
data class Node(
val id: String,
val name: String,
val parentId: String? = null,
val childs: MutableList<Node> = mutableListOf()
)
// replace with:
<manifest package="some.library.packagename"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
class SomeInitializer : Initializer<SomeContent> {
override fun create(context: Context): SomeContent {
// do some things to provide
return SomeContent(context)
}
}
import javafx.beans.property.SimpleListProperty
import javafx.beans.property.SimpleObjectProperty
import javafx.collections.FXCollections
import javafx.collections.ObservableList
import javafx.scene.control.SelectionMode
import javafx.scene.control.TreeItem
import javafx.scene.text.Font
import tornadofx.*
fun main() {
package androidx.lifecycle
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.savedstate.SavedStateRegistryOwner
object ViewModelHelper {
/**
@andretietz
andretietz / cube.dart
Last active May 26, 2019 17:54
Flutter: Rubics Cube
import 'dart:math';
import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart';
class TestCubeWidget extends StatelessWidget {
static const _angle = pi / 4;
final double _height;
final double _width;