Skip to content

Instantly share code, notes, and snippets.

View dmitrykolesnikovich's full-sized avatar

Dmitry Kolesnikovich dmitrykolesnikovich

View GitHub Profile
@dmitrykolesnikovich
dmitrykolesnikovich / KotlinFunctions.md
Created July 6, 2019 11:53 — forked from cbeyls/KotlinFunctions.md
Comparison of Kotlin functions: also, apply, let, run, with
Function Function type Target passed as Returns
also Extension it Target
apply Extension this Target
let Extension it Block return value
run Extension this Block return value
with Regular this Block return value
@dmitrykolesnikovich
dmitrykolesnikovich / KotlinFunctions.md
Created July 6, 2019 11:53 — forked from cbeyls/KotlinFunctions.md
Comparison of Kotlin functions: also, apply, let, run, with
Function Function type Target passed as Returns
also Extension it Target
apply Extension this Target
let Extension it Block return value
run Extension this Block return value
with Regular this Block return value
@dmitrykolesnikovich
dmitrykolesnikovich / Sample.java
Created January 6, 2020 23:54
How to make JavaFX divider narrower
// style1.css
.split-pane > .split-pane-divider {
-fx-padding: 1;
}
// Sample.java
splitPane.getStylesheets().add(getClass().getResource("style1.css").toExternalForm());
@dmitrykolesnikovich
dmitrykolesnikovich / cloc.sh
Created January 31, 2020 19:26
Count number of lines with cloc
cloc --vcs git --include-lang=Kotlin
@dmitrykolesnikovich
dmitrykolesnikovich / `How to make resources in featurea`.kt
Last active February 3, 2020 00:21
How to make resources in featurea
/*
unlike dependencies resources needs to be defined explicitly e. g. without any sort of inheritance
*/
/*platform*/
typealias LoaderOnSuccess = Loader.() -> Unit
object Loader {
fun load(vararg resources: List<String>, onSuccess: LoaderOnSuccess? = null) {
@dmitrykolesnikovich
dmitrykolesnikovich / glsl-sample.kt
Created February 8, 2020 01:51
How to create GLSL bindings for Kotlin.
import java.lang.Math.*
val t: Double = 0.0
data class vec2(var x: Double = 0.0, var y: Double = 0.0)
open class Pixel {
val uv: vec2 = vec2()
}
@dmitrykolesnikovich
dmitrykolesnikovich / HelloSpreadsheetView4.java
Last active October 20, 2020 14:27
javafx tableview span
package org.controlsfx.samples.spreadsheet;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.stage.Stage;
import org.controlsfx.ControlsFXSample;
import org.controlsfx.control.spreadsheet.GridBase;
import org.controlsfx.control.spreadsheet.SpreadsheetCell;
import org.controlsfx.control.spreadsheet.SpreadsheetCellType;
@dmitrykolesnikovich
dmitrykolesnikovich / settings.gradle
Created December 8, 2020 20:18
Gradle settings for Featurea
/*featurea gradle settings*/
enableFeaturePreview("GRADLE_METADATA")
void artifacts(Closure closure) {
closure.delegate = new Catalog(this, settings.rootProject.projectDir)
closure()
}
class Catalog {
private void artifact(String path) {
File artifactDir = new File(path.replaceAll(":", ""))
if (!artifactDir.exists()) throw new RuntimeException("Artifact not found: ${artifactDir.absolutePath}")
String projectName
if (path.contains(":")) {
List<String> tokens = path.split("/").toList()
tokens.removeIf {it.endsWith(":")}
projectName = tokens.join(":")
} else {
package featurea
import kotlin.jvm.JvmOverloads
import kotlin.jvm.Transient
class PriorityQueue<E> : Queue<E> {
companion object {
private const val DEFAULT_INITIAL_CAPACITY = 11
private const val MAX_ARRAY_SIZE = Int.MAX_VALUE - 8