This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import org.msgpack.*; | |
class Test { | |
public static void main(String[] args) throws Exception { | |
// シリアライズしたいオブジェクト | |
List<String> list = new ArrayList<String>(); | |
list.add("msgpack"); | |
list.add("kumofs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rev/websocket' | |
class PubSub | |
def initialize | |
@subscriber = {} | |
@seqid = 0 | |
end | |
def subscribe(&block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package my.test; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.Map; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.HashMap; | |
import java.io.IOException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rev' | |
$LOAD_PATH << File.join(File.dirname(__FILE__),'lib') | |
require 'rev/websocket' | |
$connections = {} | |
class MyConnection < Rev::WebSocket | |
def on_open | |
$connections[self] = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.msgpack; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.Map; | |
public abstract class MessagePackObject { | |
public boolean isNull() { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventBus | |
def initialize | |
@map = {} # kind => [block] | |
end | |
def signal(kind, *args) | |
if blocks = @map[kind] | |
blocks.each {|block| | |
block.call(*args) rescue nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Outer { | |
public static class Inner extends Outer { | |
public static void main(String[] args) { | |
new Inner().doit(); | |
} | |
} | |
protected void doit() { | |
System.out.println("done."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MembershipError extends Exception { | |
public MembershipError(String message) { | |
super(message); | |
} | |
public static class JoinRequired extends MembershipError { | |
public JoinRequired(String message) { | |
super(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <msgpack/rpc/client.h> | |
#include <stdlib.h> | |
#include <sys/time.h> | |
int main(int argc, char* argv[]) | |
{ | |
int num = atoi(argv[1]); | |
msgpack::rpc::client c("127.0.0.1", 19701); | |
c.start(4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <msgpack.hpp> | |
#include <iostream> | |
struct pack_int32 { | |
public: | |
pack_int32(int64_t value = 0) : value(value) { } | |
operator int64_t() const { return value; } | |
int64_t get() const { return value; } | |
public: |