Skip to content

Instantly share code, notes, and snippets.

View Groostav's full-sized avatar

Geoff Groostav

View GitHub Profile
@Groostav
Groostav / output_log.txt
Last active June 6, 2022 21:56
"prop counting failure!" w/ traffic light replacer on load & when changing light set.
This file has been truncated, but you can view the full file.
Initialize engine version: 5.6.7f1 (e80cc3114ac1)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: AMD Radeon RX 5700 XT (ID=0x731f)
Vendor: ATI
VRAM: 8151 MB
Driver: 30.0.13023.4001
Begin MonoManager ReloadAssembly
Platform assembly: H:\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\UnityEngine.dll (this message is harmless)
@Groostav
Groostav / DoubleArrayHashList.kt
Created October 12, 2021 20:01
a first crack at an implementation of a reasonably compact matrix with fast indexOf(row) and contains(row) operations
package com.empowerops.jargon.model.opt2
import java.lang.IndexOutOfBoundsException
/**
* Why, why on gods green earth would you implement this geoff!?
*
* Ok, after studying the access patterns, we need fast contains and fast indexOf.
* fast contains is easily provided by hashMap,
* to get indexOf, you want a NavigableSet (indexOf(elem) == headSet(elem).size)
package com.empowerops.visualizer;
import com.empowerops.common.*;
import com.empowerops.common.eventbus.EventBus;
import com.empowerops.common.ui.FXController;
import com.empowerops.common.ui.FXMLLoader;
import com.empowerops.dal.OptimizationMetadata;
import com.empowerops.dal.OptimizationModel;
import com.empowerops.jargon.OptimizerService;
import com.empowerops.jargon.events.NewExpensivePointFoundEvent;
@Groostav
Groostav / More-Testing-Try-Catch.ps1
Last active October 9, 2020 20:28
what is powershells Stop-Process doing
Write-Host "Host Version:" $Host.Version
Try
{
Write-Host "before!"
Stop-Process 123456789 -EA Stop
Write-Host "after!"
}
Catch
{
@Groostav
Groostav / code.kt
Last active November 27, 2019 01:11
@FXML fun onRunButtonClick(): Job {
println("clicked... launch coming")
val job = launch(Dispatchers.Default + CoroutineName("Run-button-click")) {
println("launched!")
}
println("launched, job=$job")
Platform.runLater {
println("Platform.runlater: running later, job=$job")
Caused by: java.nio.file.NoSuchFileException: C:\Users\Inhal\AppData\Roaming\OASIS 2020.1\licenses\trial-license.l4j
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
at sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:193)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.Files.size(Files.java:2332)
at com.empowerops.front_end.LicenseImportingServiceImpl$findLicenseCacheSources$2.invokeSuspend(LicenseImportingService.kt:142)
//second attempt, now with more code!
fun StyledTextArea<*, *>.asDebouncedTextChangesFlow(): Flow<PropertyChange<String?>>
= debounceAsTyping(textProperty(), textProperty().asFlow(), focusedProperty())
fun TextInputControl.asDebouncedTextChangesFlow(): Flow<PropertyChange<String?>>
= debounceAsTyping(textProperty(), textProperty().asFlow(), focusedProperty())
fun <T> Flow<PropertyChange<T>>.debounceAsTyping(source: ObservableValue<T>, focusedProperty: ObservableValue<Boolean> = BooleanConstant.TRUE): Flow<PropertyChange<T>>
= debounceAsTyping(source, this, focusedProperty)
@Groostav
Groostav / changes.md
Last active September 16, 2019 08:19
work-in-progress OASIS 2020 UI

before: image

after: image

before: image

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import custommenu.view.ContextMenuPane?>
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="custommenu.controller.CustomMenuController">
<children>
<VBox fx:id="vbox" onContextMenuRequested="#showMenu"
onMousePressed="#hideMenu" prefHeight="200" prefWidth="200">
@Groostav
Groostav / JavaFxUtilities.kt
Last active August 5, 2019 21:35
Strategy to synchronously enter asynchronous code
package com.empowerops.common
import com.sun.javafx.tk.Toolkit
import kotlinx.coroutines.*
import kotlinx.coroutines.javafx.JavaFx
import java.util.*
private class ExceptionWrapper(val ex: Throwable)