Skip to content

Instantly share code, notes, and snippets.

View dmitrykolesnikovich's full-sized avatar

Dmitry Kolesnikovich dmitrykolesnikovich

View GitHub Profile
@dmitrykolesnikovich
dmitrykolesnikovich / artifact.groovy
Last active January 31, 2021 12:25
featurea gradle interop
// featurea gradle interop
void artifact(String artifactId, Closure projects) {
String artifactPath = projects()
File artifactDir = new File(artifactPath)
if (!artifactDir.exists()) throw new RuntimeException("Artifact not found: ${artifactDir.absolutePath}")
def includeProject = { File projectFile, String specifier = null ->
if (!projectFile.exists()) return
File projectDir = projectFile.parentFile
@dmitrykolesnikovich
dmitrykolesnikovich / 4lKXWD.glsl
Created January 1, 2021 17:50
Animated selection rectangle
// https://www.shadertoy.com/view/4lKXWD
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
// rect boundaries
vec2 rectMin = vec2(0.4, 0.2);
vec2 rectMax = vec2(0.8, 0.8);
// some people prefer "min + (max - min) / 2", but for floating point UV space it
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
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 {
@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 {
@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 / 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 / `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 / cloc.sh
Created January 31, 2020 19:26
Count number of lines with cloc
cloc --vcs git --include-lang=Kotlin
@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());