Skip to content

Instantly share code, notes, and snippets.

Andy Till andytill

Block or report user

Report or block andytill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andytill
andytill / DragResizer.java
Last active Aug 10, 2019
DragResizercan be used to add mouse listeners to a Region and make it resizable by the user by clicking and dragging the border in the same way as a window. Only height resizing is currently implemented.
View DragResizer.java
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
/**
* {@link DragResizer} can be used to add mouse listeners to a {@link Region}
* and make it resizable by the user by clicking and dragging the border in the
* same way as a window.
* <p>
@andytill
andytill / FXUtils.java
Last active Jun 8, 2019
Utility for for finding a JavaFX node by it's ID
View FXUtils.java
package test;
import javafx.scene.*;
import javafx.scene.control.*;
public class FXUtils {
/**
* Find a {@link Node} within a {@link Parent} by it's ID.
* <p>
@andytill
andytill / JavaFXThreadingRule.java
Created Oct 4, 2012
A Junit @rule for running tests on the JavaFX thread
View JavaFXThreadingRule.java
import java.util.concurrent.CountDownLatch;
import javax.swing.SwingUtilities;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@andytill
andytill / HierarchyTreeCell.java
Created Nov 4, 2012
A JavaFX TreeCell implementation with drag and drop.
View HierarchyTreeCell.java
package projmon.hierarchical;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.scene.control.TreeCell;
import javafx.scene.control.TreeItem;
import javafx.scene.effect.InnerShadow;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
@andytill
andytill / Erlang Project Ideas.md
Last active Feb 19, 2019
Erlang Project Ideas
View Erlang Project Ideas.md

When I started erlang, I had a hard time thinking of ideas for projects to improve my skills. Now I have way too many ideas to possibly implement Myself. Since I actually want these projects to exist so I can use them (everlasting glory coming secondary to some handy tools) I have written them up here. Feel free to try them out. I'm open to questions and suggestions.

swagger for erlang

swagger is a JSON spec for REST APIs. Once you have written a spec in swagger, it can generate documentation (demo) and REST handlers.

An erlang swagger library should take swagger specs and generate cowboy_rest handlers for them.

Difficulty: low

@andytill
andytill / ListViewIndexChangesWhenItemUpdated .java
Created Jul 15, 2012
Example application showing how changing an item in a ListView changes its index
View ListViewIndexChangesWhenItemUpdated .java
import java.io.IOException;
import java.util.Arrays;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@andytill
andytill / no war on russia motion.md
Last active Mar 25, 2018
no war on russia motion
View no war on russia motion.md

Even before this horrendous chemical attack in Salisbury, this Government has been following a dangerous and aggressive line of rhetoric and action that will inevitably escalate conflict between the UK and Russia. In the context of the Syrian War, where Britain and Russia are supporting opposing sides in a proxy war[1], the majority of the casualties of this escalation will likely be Syrian.

This Constituency Labour Party believes that the line taken by the Labour Leadership, to require evidence of Russian involvement before taking action is correct but we must go further. Escalating conflict MUST be ruled out, regardless of the origin of the attack. The Government and Labour must not fight fire with fire, it must stop and choose a path that leads to peace rather than one that taken to it's conclusion, will end in war[2].

This Constituency Labour Party therefore calls on the Prime Minister, Theresa May, for restraint and de-escalation in words and actions towards Russia, and must stop military drills and ex

@andytill
andytill / IntroduceVariableCommand.py
Last active Mar 21, 2018
A Sublime Text command to take some selected text and introduce an Erlang "variable" with the selection as the assigned value. It doesn't understand the text of course, I thought you were supposed to!
View IntroduceVariableCommand.py
import sublime
import sublime_plugin
import re
class IntroduceVariableCommand(sublime_plugin.TextCommand):
var_name = "NewVar"
def run(self, edit):
@andytill
andytill / brume.css
Created Aug 20, 2012
JavaFX Light Grey Brume Theme
View brume.css
/**
* JavaFX CSS light grey/white 'brume' theme.
*/
.titled-pane {
-fx-effect: dropshadow(three-pass-box, #9F9F9F, 15, 0, 0, 0);
-fx-animated: true;
-fx-text-fill: #505050;
}
View gist:ed553efc10aa16a13866fe53b6617ea4
andy.till ~/work erl -sname lol -setcookie lol
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Bus error: 10
andy.till ~/work erl -sname lol -setcookie lol
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.1 (abort with ^G)
(lol@ATILL-02)1> Segmentation fault: 11
You can’t perform that action at this time.