Skip to content

Instantly share code, notes, and snippets.

View almibe's full-sized avatar
😺

Alex Michael Berry almibe

😺
View GitHub Profile
@almibe
almibe / CodeMirrorWebViewErrorGist.java
Last active June 9, 2016 08:37
Simple error example when loading multiple WebViews with instances of CodeMirror editors.
package org.almibe.codeeditor;
import javafx.application.Application;
import javafx.concurrent.Worker;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
package org.example;
import io.vertx.core.http.HttpMethod;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.Router;
import org.example.HttpApp;
import java.util.HashMap;
import java.util.Map;
@almibe
almibe / FileResourceDialogs.java
Created November 11, 2015 02:52
FileResourceDialogs
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.libraryweasel.commons.resource;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextInputDialog;
@almibe
almibe / NumericTextField.java
Created November 11, 2015 02:52
NumericTextField
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.libraryweasel.commons.controls;
import javafx.scene.control.TextField;
public class NumericTextField extends TextField {
@Override public void replaceText(int start, int end, String text) {
@almibe
almibe / VertxService.java
Last active November 23, 2015 23:06
Vert.x 3.1 OSGi shutdown issue
/*
Error produced:
Nov 23, 2015 6:05:36 PM io.netty.util.ThreadDeathWatcher$Watcher notifyWatchees
WARNING: Thread death watcher task raised an exception:
java.lang.NoClassDefFoundError: io/netty/util/Recycler$WeakOrderQueue
*/
private void stop() { //called by OSGi container
stopServer();
}
@almibe
almibe / DnDSample.java
Created April 3, 2016 15:43
Simple example of drag and drop replacement (similar to how tabs work)
package org.almibe.multipage.demo;
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
@almibe
almibe / PackageNames.groovy
Last active April 18, 2016 21:39
Get the list of inhabited packages from a list of jar files
//Simple script that outputs all the package names that contain classes from a list of
//jar files
import java.util.zip.*
def baseDir = "/home/alex/IdeaProjects/library-weasel/build/library-weasel/lib/"
def jarList = ["orientdb-core-2.1.15", "blueprints-core-2.6.0", "orientdb-graphdb-2.1.15"]
Set<String> packageNames = new HashSet<>()
jarList.each {
@almibe
almibe / SlideOut.java
Created January 16, 2017 21:57 — forked from jewelsea/SlideOut.java
Example of a JavaFX Pane which slides in and out on command.
import javafx.animation.*;
import javafx.application.Application;
import javafx.event.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
@almibe
almibe / gist:91d4d17659c49095158944409ebd0948
Created October 12, 2018 00:29
revert to a specific version in git easily + keep history
git rm -r .
git checkout HEAD~3 .
git commit
package scratchpad.jgroups
import org.jgroups.*
import java.io.Serializable
fun createWithReceiver(receiver: Receiver): JChannel {
val ch = JChannel()
ch.receiver = receiver