Skip to content

Instantly share code, notes, and snippets.

View HanSolo's full-sized avatar

Gerrit Grunwald HanSolo

View GitHub Profile
@dblevins
dblevins / Dates.java
Last active May 28, 2022 20:02
Works for Java 8 and above. For Java 7 and before, see this legacy version https://gist.github.com/dblevins/03df3cd5eb12f2da05997eef80ac4eca
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
* This pattern has the following benefits:
*
* - Date formats are referenced as a strong type
* - Code completion on patterns
@tomsontom
tomsontom / SkiaFX.java
Created November 26, 2020 10:40
Hardware Accelerate SkiaCanvas in JavaFX
package at.bestsolution.skia.example;
import org.jetbrains.skija.Paint;
import org.jetbrains.skija.Path;
import org.jetbrains.skija.Point;
import org.jetbrains.skija.Surface;
import at.bestsolution.skia.SkiaCanvas;
import javafx.application.Application;
import javafx.scene.Scene;
@Roland09
Roland09 / Algorithm.java
Created February 13, 2016 15:54
Line of Sight Demo
package application;
import java.util.ArrayList;
import java.util.List;
public class Algorithm {
/**
* Sweep around the given circle with the given distance and create the scan lines
* @param startX
@hendrikebbers
hendrikebbers / JavaFXNodeCreationBenchmark.java
Last active December 22, 2015 14:28
JavaFX Performance
import com.sun.javafx.scene.control.skin.ButtonSkin;
import com.sun.javafx.scene.control.skin.TextFieldSkin;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.property.*;
import javafx.embed.swing.SwingNode;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.*;
@AliSoftware
AliSoftware / struct_vs_inheritance.swift
Last active March 27, 2024 11:57
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
// http://realm.io/news/andy-matuschak-controlling-complexity/
@james-d
james-d / EditCell.java
Created February 13, 2015 03:18
(Fairly) reusable edit cell that commits on loss of focus on the text field. Overriding the commitEdit(...) method is difficult to do without relying on knowing the default implementation, which I had to do here. The test code includes a key handler on the table that initiates editing on a key press.
import javafx.event.Event;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
@dmiddlecamp
dmiddlecamp / Adafruit_GPS.cpp
Last active April 21, 2018 05:07
Spark GPS demo with Adafruit Ultimate GPS breakout
/***********************************
This is our GPS library
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above must be included in any redistribution
@gabrielemariotti
gabrielemariotti / mobile-AndroidManifest.xml
Last active September 15, 2020 11:33
Android Wear: small gist to start an Activity on the mobile handheld from the Android Wear device.
<service android:name=".ListenerServiceFromWear">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
@mikehearn
mikehearn / AffinityExecutor.java
Last active November 18, 2020 09:26
Some code for JavaFX observable collections (maps and sets) which replicate changes between threads. From the open source, Apache licensed Lighthouse project. Check there for the latest code.
// Contact: hearn@vinumeris.com
package lighthouse.threading;
import com.google.common.util.concurrent.Uninterruptibles;
import javafx.application.Platform;
import lighthouse.protocol.LHUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@pjobson
pjobson / remove_mcafee.md
Last active March 26, 2024 04:26
OSX McAfee Removal

Removal of McAfee from OSX

Note: This was written in 2015, it may be out of date now.

There are a lot of commands here which I use sudo if you don't know what you're doing with sudo, especially where I rm you can severely screw up your system.

There are many reasons which you would want to remove a piece of software such as McAfee, such as not wanting it to hammer your CPU during work hours which seems like primetime for a virus scan.

I intend this to be a living document, I have included suggestions from peoples' replies.