Skip to content

Instantly share code, notes, and snippets.

View jumperchen's full-sized avatar

Jumper Chen jumperchen

View GitHub Profile
@jumperchen
jumperchen / socket-cheatsheet.js
Created December 22, 2017 07:18 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@jumperchen
jumperchen / TestOKHttp.java
Created May 3, 2017 07:21
onClosing : 1001 reason
import java.util.concurrent.TimeUnit;
import okio.ByteString;
public class TestOKHttp {
private static OkHttpClient client;
private static WebSocket ws;
private static boolean success = false;
@jumperchen
jumperchen / README.md
Created April 29, 2016 01:56 — forked from digulla/README.md
Make ZK play nice with Fediz SSO
@jumperchen
jumperchen / Dockerfile
Created December 15, 2015 06:10
ZKSandbox's Dockerfile
FROM java:8-jdk
MAINTAINER Jumper Chen <jumperchen@potix.com>
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# Config to get to install git, maven, and tomcat7
RUN apt-get update && apt-get install -y --force-yes git maven tomcat7
VOLUME /zksandbox
# copy your zksandbox (depends on where the Dockerfile located) folder
@jumperchen
jumperchen / Book.java
Last active October 31, 2023 04:32
ZK MVVM with Spring MVC Example
public class Book {
private Set<Category> categories = new LinkedHashSet<Category>();
private String author;
private String name;
public Book() {}
public void setCategories(Set<Category> categories) {
this.categories = categories;
}
public Set<Category> getCategories() {
@jumperchen
jumperchen / Todo.java
Last active November 18, 2015 04:21
ZK Spring MVC Example
public class Todo {
private String message;
private boolean done;
public Todo() {}
public Todo(String message) {
this.message = message;
}
@jumperchen
jumperchen / Serialization.java
Created May 29, 2015 09:59
Javassist with JDK 8 serialization issue
package issue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Method;
import javassist.util.proxy.MethodFilter;
@jumperchen
jumperchen / ForEachVM.java
Created May 6, 2015 05:01
ZK 8-RC Performance Testing
package org.zkoss.test;
import java.util.Collections;
import java.util.List;
public class ForEachVM {
private List<Integer> array = Collections.nCopies(30, 30);
public void setArray(List<Integer> array) {}
public List<Integer> getArray() {
return array;
@jumperchen
jumperchen / t.zul
Created December 4, 2012 06:56
Global Monitor
<script><![CDATA[
zk.afterMount(function () {
zk.Desktop._dt.firstChild.appendChild(new GlobalResizeMonitor());
});
GlobalResizeMonitor = zk.$extends(zk.Widget, {
bind_: function () {
this.$supers('bind_', arguments);
zWatch.listen({onSize: this});
},
unbind_: function () {
@jumperchen
jumperchen / ExampleTest.scala
Created October 7, 2011 10:40
an example of ZTL Scala test case
@Tags(tags = "Example")
class ExampleTest extends ZTL4ScalaTestCase {
def testClick() = {
val zscript = {
<vbox>
Click "hello world", if you see the message change, it is ok.
<zscript><![CDATA[
public void doCreate(Event evt) {
evt.target.setValue(" hello,\\n world");