Skip to content

Instantly share code, notes, and snippets.

View bduisenov's full-sized avatar

Babur bduisenov

  • Munich
View GitHub Profile
@bduisenov
bduisenov / ErraiApplicationListener.java
Last active December 30, 2015 21:50
jboss errai and spring integration
package kz.bas.app.server.core.integration;
import kz.bas.app.server.core.utils.Pair;
import org.jboss.errai.bus.client.api.builder.DefaultRemoteCallBuilder;
import org.jboss.errai.bus.client.api.messaging.Message;
import org.jboss.errai.bus.client.api.messaging.MessageCallback;
import org.jboss.errai.bus.server.annotations.Remote;
import org.jboss.errai.bus.server.api.ServerMessageBus;
import org.jboss.errai.bus.server.io.RPCEndpointFactory;
import org.jboss.errai.bus.server.io.RemoteServiceCallback;
@bduisenov
bduisenov / SpringCDIObservesListener.java
Created December 12, 2013 11:07
Spring CDI @observes implementation (quick PoC)
package kz.bas.app.server.core.integration.cdi;
import org.jboss.errai.common.client.api.annotations.Portable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
@bduisenov
bduisenov / VaadinEventBusApplication.java
Created February 26, 2014 05:55
vaadin and guava eventBus example
/*
* Copyright 2009 IT Mill Ltd.
*
* 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
@bduisenov
bduisenov / jQuery.java
Created December 18, 2015 14:09
gwt jsinterop for jQuery
import com.google.gwt.dom.client.Element;
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
/**
* Created by bduisenov on 27/10/15.
*/
@JsType(namespace = JsPackage.GLOBAL, name = "jQuery", isNative = true)
@bduisenov
bduisenov / Rx.java
Created December 18, 2015 14:11
gwt jsinterop for Rx.js
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsType;
/**
* Created by bduisenov on 15/12/15.
*/
public class Rx {
@FunctionalInterface
@bduisenov
bduisenov / Vue.java
Last active March 18, 2016 11:55
gwt jsinterop mapping to vue.js
import jsinterop.annotations.JsConstructor;
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import com.google.gwt.dom.client.Element;
import * as m from 'mithril';
import Page from "../page/page";
import * as Stomp from 'stompjs';
import * as SockJS from 'sockjs-client';
var vm = {
value: m.prop('')
};
const StatisticsPage = {
{
"id": "https://tools.ietf.org/rfc/rfc7807.txt",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "schema for a rfc7807",
"definitions": {
"validation": {
"type": "object",
"required": [
"type"
],
class Reader<E, A> {
let g: (E) -> A
init(g: @escaping (E) -> A) {
self.g = g
}
func apply(e: E) -> A {
return g(e)
}
func map<B>(f: @escaping (A) -> B) -> Reader<E, B> {
return Reader<E, B>{ e in f(self.g(e)) }
import Foundation
private func bash(_ commandName: String, _ arguments: [String]) -> String? {
guard var whichPathForCommand = executeShell(command: "/bin/bash" , arguments:[ "-l", "-c", "which \(commandName)" ]) else {
return "\(commandName) not found"
}
whichPathForCommand = whichPathForCommand.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
return executeShell(command: whichPathForCommand, arguments: arguments)
}