Skip to content

Instantly share code, notes, and snippets.

View ibaca's full-sized avatar
🐄
cowding

Ignacio Baca Moreno-Torres ibaca

🐄
cowding
View GitHub Profile
@ibaca
ibaca / BeanLocator.java
Created March 7, 2012 19:43 — forked from messo/BeanLocator.java
My EJB Bean
public class BeanLocator implements ServiceLocator {
@Override
public Object getInstance(Class<?> clazz) {
System.out.println(clazz);
if (clazz.equals(GroupManager.class)) {
return lookupBean(clazz, "GroupManager");
} else {
return null;
}
@ibaca
ibaca / DefaultRuntimeInfo.java
Created February 22, 2013 11:00
GWT.isSuperDevMode()
package com.intendia.igestion.web.util.info;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.ScriptElement;
public class DefaultRuntimeInfo implements RuntimeInfo {
@ibaca
ibaca / IO.java
Last active August 29, 2015 13:57
AnsiRenderWriter compatible with ssh groovy shell
/*
* Copyright 2003-2007 the original author or authors.
*
* 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
package javaapplication1;
import tempbarosensor.I2CSensor;
public class MPL115A2 extends I2CSensor {
private static final int ADDRESS = 0x60;
private final double a0;
private final double b1;
private final double b2;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Semaphore;
public class SocketCloseDetection {
public static void main(String[] args) throws IOException, InterruptedException {
final ServerSocket serverSocket = new ServerSocket(6677);
final Semaphore semaphore = new Semaphore(1);
@ibaca
ibaca / RangePerf.java
Created September 24, 2015 15:52
Range performance using mutable Number
/**
* Copyright 2015 Netflix, Inc.
*
* 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 distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
@ibaca
ibaca / RxJavaJacksonSerializers.java
Last active May 10, 2018 11:47
Simple RxJava (Observable and Single) jackson serialiers.
package com.intendia.igestion.server.resource;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
package dtachoviewer.client;
import static com.google.gwt.safehtml.shared.SafeHtmlUtils.htmlEscape;
import static elemental.events.Event.CHANGE;
import static elemental.events.Event.COPY;
import static elemental.events.Event.DRAGLEAVE;
import static elemental.events.Event.DRAGOVER;
import static elemental.events.Event.DROP;
import com.google.gwt.core.client.EntryPoint;
@ibaca
ibaca / SuperDevModeHelper.java
Last active April 23, 2019 15:10
GWT superdevmode helper
package com.intendia.igestion.client.ui;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.Window;
public class SuperDevModeHelper {
/** Configure devmode and try to compile and reload the app, if it fails do nothing. */
public static void devModeOn() {
@ibaca
ibaca / ElementoFileDndUploadExample.java
Created July 15, 2017 07:33
GWT Elemento file drop onto a browser div and then upload the file example.
package dnd;
import static elemental2.dom.DomGlobal.document;
import static org.jboss.gwt.elemento.core.EventType.dragend;
import static org.jboss.gwt.elemento.core.EventType.dragover;
import static org.jboss.gwt.elemento.core.EventType.drop;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import elemental2.dom.DataTransfer;