Skip to content

Instantly share code, notes, and snippets.

View FDelporte's full-sized avatar

Frank Delporte FDelporte

View GitHub Profile
@FDelporte
FDelporte / FXGLGoapExample.java
Last active November 18, 2024 13:10
A Goal Oriented Action Planning (GOAP) example, implemented with FXGL (JavaFX game library)
///usr/bin/env jbang "$0" "$@" ; exit $?
// The GOAP functionality is not fully integrated in FXGL yet, so we need to grab it
// from the Snapshots Maven Central repository.
//REPOS mavencentralsnapshots,acme=https://oss.sonatype.org/content/repositories/snapshots
// This is the FXGL version we need for this demo.
// 21+dev-SNAPSHOT has a first implementation of the GOAP functionality.
//DEPS com.github.almasb:fxgl:21+dev-SNAPSHOT
@FDelporte
FDelporte / SignedUnsigned.java
Last active September 26, 2024 07:29
Code of the blog "Deep dive into bits, bytes, shorts, ints, longs, signed, and unsigned with Java"
// Read the full explanation of this code on this blog post:
// https://webtechie.be/post/2024-09-26-java-bits-bytes-short-int-long-signed-unsigned/
public class SignedUnsigned {
public static void main(String[] args) {
System.out.println("0 to 15 as bits:");
System.out.println("Value\tBits\tHex");
for (int i = 0; i <= 15; i++) {
System.out.println(i
+ "\t" + String.format("%4s", Integer.toBinaryString(i)).replace(' ', '0')
@FDelporte
FDelporte / FxNodesVersusCanvas.java
Created July 22, 2024 07:51
Test script to compare performance of many moving Nodes versus drawing on the Canvas
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.openjfx:javafx-controls:22.0.2
//DEPS org.openjfx:javafx-graphics:22.0.2:${os.detected.jfxname}
import javafx.animation.AnimationTimer;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.geometry.Pos;
@FDelporte
FDelporte / FxDemo.java
Last active July 18, 2024 14:51
JavaFX experiment with JBang
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.openjfx:javafx-controls:22.0.2
//DEPS org.openjfx:javafx-graphics:22.0.2:${os.detected.jfxname}
import javafx.animation.AnimationTimer;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.geometry.Pos;
@FDelporte
FDelporte / git-remove-local-branches-not-on-remote.txt
Last active July 19, 2022 08:29
GIT remove local branches not on remote
git branch --merged origin/master | grep -v master | xargs git branch -d