Skip to content

Instantly share code, notes, and snippets.

View acmi's full-sized avatar

Aleksei Sazonov acmi

View GitHub Profile
@acmi
acmi / WallTest.groovy
Last active December 17, 2015 16:59
Wall example
import com.vk.api.other.OtherCommon
import com.vk.api.wall.Post
import com.vk.api.wall.WallCommon
import com.vk.worker.impl.VKWorkerGroup
class WallTest {
static main(args) {
def tokens = [
'TOKEN1',
'TOKEN2'
@acmi
acmi / msg.css
Created May 27, 2013 14:18
vk view
.msg-low{
-fx-background-color: aquamarine;
}
.msg-mid{
-fx-background-color: gold;
}
.msg-high{
-fx-background-color: indianred;
}
@acmi
acmi / gist:e2ebae96dd3cf9d883b6
Created August 11, 2014 13:04
JAXBValidator
import classes.Products;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.util.JAXBSource;
import javax.xml.transform.Source;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.File;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
@acmi
acmi / VKAuth.groovy
Last active October 18, 2016 01:02
VK auth javafx app
import javafx.application.Application
import javafx.application.Platform
import javafx.beans.InvalidationListener
import javafx.beans.Observable
import javafx.scene.Scene
import javafx.scene.web.WebView
import javafx.stage.Stage
class VKAuth extends Application{
private static final String REDIRECT_URI = 'https://oauth.vk.com/blank.html'
@acmi
acmi / ObservableBase.java
Created February 11, 2016 08:34
simple Observable non thread safe implementation
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import java.util.HashSet;
import java.util.Set;
public abstract class ObservableBase implements Observable {
private Set<InvalidationListener> listeners = new HashSet<>(1);
@Override
@acmi
acmi / UnrealScript.g4
Created April 14, 2016 06:35
UnrealScript antlr4 grammar
grammar UnrealScript;
program : classdecl
( declarations | replicationblock | body)*
( defaultpropertiesblock )?
;
// CLASS
classdecl : CLASS identifier ( EXTENDS packageidentifier )? ( classparams )* ';';
classparams : constclassparams
| WITHIN packageidentifier
public static int log2(int bits) {
int log = 0;
if (bits >= 0x10000) {
bits >>>= 16;
log = 16;
}
if (bits >= 0x100) {
bits >>>= 8;
log += 8;
}
@acmi
acmi / T1.java
Created April 27, 2016 06:13
roads sql
import engine.osm.xml.Node;
import engine.osm.xml.Way;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
@acmi
acmi / AutoCompleteComboBox.java
Created May 18, 2016 16:51
Auto comple ComboBox for JavaFX.
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import java.util.function.BiPredicate;
import java.util.stream.Collectors;