Skip to content

Instantly share code, notes, and snippets.

View Groostav's full-sized avatar

Geoff Groostav

View GitHub Profile
@Groostav
Groostav / build.output
Created March 13, 2017 18:51
ant build output from kotlinc with -Xmx 2G
config.versions:
[echo] Build configured for 1.3.96.320-1469s
[echo] host=1.8.0_77, source=1.8, target=1.8.0_77
[echo] running javac -version...
[exec] javac 1.8.0_77
[exec] Kotlin version 1.1.0 (JRE 1.8.0_77-b03)
[echo] running kotlinc -version...
config.java:
@Groostav
Groostav / KotlinFXMLExtensions.kt
Created February 24, 2017 20:58
a file that allows you to configure margines nicely from FXML
package com.empowerops.common.ui
import com.empowerops.common.ReflectionUtilities
import com.empowerops.common.ReflectionUtilities.getStaticFieldValue
import com.empowerops.common.Unit
import com.empowerops.common.ui.FXMLExtensions.Node.StandardContextMenuRequestHandler.Companion.standardContextHandler
import javafx.event.EventHandler
import javafx.geometry.Insets
import javafx.scene.control.ContextMenu
import javafx.scene.control.TextFormatter
@Groostav
Groostav / GraphModelBuilder.kt
Last active March 15, 2017 00:05
kotlinc heap overflow in heavy DSL user
package com.empowerops.jargon.assists
import com.empowerops.common.get
import com.empowerops.jargon.EvaluableCompiler
import com.empowerops.jargon.model.*
import com.empowerops.linqalike.Factories
import com.empowerops.linqalike.Factories.empty
import com.empowerops.linqalike.Queryable
import javax.inject.Inject
@Groostav
Groostav / this_isnt_sparta.java
Created January 19, 2017 22:11
copy paste madness
package com.empowerops.doe;
import com.empowerops.jargon.model.Evaluable;
import com.empowerops.jargon.model.ExpensivePoint;
import com.empowerops.jargon.model.VariableSymbol;
import com.empowerops.linqalike.common.Tuple;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.TextField;
@Groostav
Groostav / client-side.ps1
Last active January 6, 2017 06:57
ssh pseudocode for running simulation on remote PC
#Client (OASIS-side) SSH starting script
$SSHcredentials =
#TODO: Find-Module Posh-SSH ??
echo ./server-side.sh | ssh localhost $SSHcredentials >> output.txt
package com.empowerops.front_end.ui.external_tool.variable_detection
import com.empowerops.common.Disposable
import com.empowerops.common.EventBus
import com.empowerops.common.NumberParser
import com.empowerops.common.ui.FXMLLoader
import com.empowerops.front_end.ui.external_tool.variable_detection.VariableDetectionStepController.Companion.bindCaptureButtonText
import com.empowerops.front_end.ui.external_tool.variable_detection.VariableDetectionStepController.Companion.checkCaptureAndAsNecessary
import com.empowerops.front_end.ui.external_tool.variable_detection.VariableDetectionStepController.Companion.createStylePropertyWithBindingsTo
import com.empowerops.front_end.ui.external_tool.variable_detection.VariableDetectionStepController.LocationState.LOCATED
@Groostav
Groostav / NoSuchMethodSSCCE.class
Last active November 24, 2016 05:19
Generated code problem
// ================com/empowerops/language/NoSuchMethodSSCCE.class =================
// class version 50.0 (50)
// access flags 0x31
public final class com/empowerops/language/NoSuchMethodSSCCE {
// access flags 0x11
public final asking for statically initialized field should not get NoSuchMethodError()V
@Lorg/junit/Test;()
L0
@Groostav
Groostav / CLIClient.kt
Last active October 16, 2016 21:59
Could-be CLI parser for kotlin
import kotlin.reflect.KClass
import kotlin.reflect.KProperty
fun main(args: Array<String>){
val args = ClientImpl(args).parse()
val importantServiceOrUIOrWhatever = IOC.doResolveThings(domainModel1 = args.domainModel, ...)
//...
}
@Groostav
Groostav / LooperWorker.kt
Last active September 27, 2016 23:01
UI workload sample problem
class LoopWorker {
private val executor = SingleThreadedScheduledExecutorService()
fun doLoops() {
val stopwatch = Stopwatch.createUnstarted()
executor.scheduleWithFixedDelay(5000.ms) {
@Groostav
Groostav / coerceTo.kt
Created September 10, 2016 00:10
methods to coerce one file system directory "into" another
/**
* make `targetToModify` identical to `source` in as few changes as possible.
*/
@JvmStatic fun coerceTo(source: Path, targetToModify: Path){
NIOFiles.walkFileTree(targetToModify, PruneByComparisonFileVisitor(source, targetToModify))
NIOFiles.walkFileTree(source, AddByComparisonFileVisitor(source, targetToModify))
}
infix fun Int.pow(power: Int) = Math.pow(this.toDouble(), power.toDouble()).toInt()