Skip to content

Instantly share code, notes, and snippets.

View hendrikebbers's full-sized avatar

Hendrik Ebbers hendrikebbers

View GitHub Profile
{
"name": "My cool API",
"description": "A very cool API",
"licence": "Apache 2.0",
"urls": [{
"name": "Github repository",
"url": "www.github.com/cool/api",
"type": "repo"
},{
"name": "Stackoverflow section",
final List<String> baseList = new ArrayList<>();
final List<String> unmodifiableList = Collections.unmodifiableList(baseList);
Executors.newSingleThreadExecutor().execute(() -> {
while(true) {
baseList.add(UUID.randomUUID().toString());
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
@hendrikebbers
hendrikebbers / EventTopics.java
Created July 11, 2016 20:06
Event Bus Topics
public interface EventTopics {
Topic<Long> CHANGED_ITEM_TOPIC = Topic.create();
Topic<AddToCartEvent> ADD_TO_CART = Topic.create();
}
@hendrikebbers
hendrikebbers / ClientConnector.groovy
Last active June 23, 2016 17:15
ClientConnector
/*
* Copyright 2012-2015 Canoo Engineering AG.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hendrikebbers
hendrikebbers / gist:56a32bbde80d3e7dec3223557202e387
Created May 12, 2016 10:28
Client Context Error Handling
ClientContext context = ....
Subscription subscription = context.onSessionTimeout(e -> System.out.println("Session Timeout"));
Subscription subscription = context.onHttpError(e -> System.out.println("Http error: " e.getErrorCode()));
.button:hover {
-fx-background-color: darkorange;
}
.button {
-fx-background-color: orange;
}
.exploding-button:exploding {
-fx-background-color: red;
}
public class MyCustomButton extends Button {
private static PseudoClass EXPLODING_PSEUDO_CLASS = PseudoClass.getPseudoClass("exploding");
BooleanProperty exploding;
public MyCustomButton() {
exploding = new SimpleBooleanProperty(false);
exploding.addListener(e -> pseudoClassStateChanged(EXPLODING_PSEUDO_CLASS, exploding.get()));
public class MyCustomButton extends Button {
private static PseudoClass EXPLODING_PSEUDO_CLASS = PseudoClass.getPseudoClass("exploding");
BooleanProperty exploding = new BooleanPropertyBase(false) {
public void invalidated() {
pseudoClassStateChanged(EXPLODING_PSEUDO_CLASS, get());
}
@Override public Object getBean() {