Skip to content

Instantly share code, notes, and snippets.

View frsyuki's full-sized avatar

Sadayuki Furuhashi frsyuki

View GitHub Profile
class Example
slot :slot1 # 出力先1の宣言(メンバメソッドをメタプログラム)
slot :slot2 # 出力先2の宣言(メンバメソッドをメタプログラム)
def func(input)
emit(:slot1, input.a)
emit(:slot2, input.b)
end
end
diff --git a/cpp/src/msgpack/object.hpp b/cpp/src/msgpack/object.hpp
index 96c026e..4d8f2f7 100644
--- a/cpp/src/msgpack/object.hpp
+++ b/cpp/src/msgpack/object.hpp
@@ -26,6 +26,7 @@
#include <typeinfo>
#include <limits>
#include <ostream>
+#include <tr1/type_traits>
@frsyuki
frsyuki / memo.msgspec
Created March 26, 2011 20:53
MessagePack IDL言語仕様案とパーサの実装
// example1.msgspec
namespace com.example
namespace cpp example
namespace ruby Example
message BasicTypeExample {
1: int8 f1
2: int16 f2
@frsyuki
frsyuki / gist:915047
Created April 12, 2011 06:30
compile error with JDK 5 #msgpack
Started by user frsyuki
Checkout:workspace / /var/lib/jenkins/jobs/msgpack-java-jdk5/workspace - hudson.remoting.LocalChannel@320817d6
Using strategy: Default
Last Built Revision: Revision 65ddd1a455eb975e6a88f87b4e89759e57289f10 (origin/master)
Checkout:workspace / /var/lib/jenkins/jobs/msgpack-java-jdk5/workspace - hudson.remoting.LocalChannel@320817d6
Fetching changes from the remote Git repository
Fetching upstream changes from git://github.com/msgpack/msgpack.git
Commencing build of Revision 65ddd1a455eb975e6a88f87b4e89759e57289f10 (origin/master)
Checking out Revision 65ddd1a455eb975e6a88f87b4e89759e57289f10 (origin/master)
[workspace] $ /var/lib/jenkins/tools/Maven_3.0.3/bin/mvn -f java/pom.xml test
@frsyuki
frsyuki / gist:958445
Created May 6, 2011 04:27
Dispatch sample of versioned RPC
package com.example.server;
import java.util.Map;
import java.util.HashMap;
import java.io.IOException;
import org.msgpack.MessageTypeException;
import org.msgpack.rpc.dispatcher.Dispatcher;
import org.msgpack.rpc.Request;
public class MyApp implements Dispatcher {
@frsyuki
frsyuki / gist:971862
Created May 14, 2011 02:41
Get meta key to work in vim on Terminal.app
map å <M-a>
map ∫ <M-b>
map ç <M-c>
map ∂ <M-d>
map ´ <M-e>
map ƒ <M-f>
map © <M-g>
map ˙ <M-h>
map ˆ <M-i>
map ∆ <M-j>
git clone [email protected]:msgpack/msgpack.git
cd msgpack/cpp/src
NG:
llvm-gcc -DHAVE_CONFIG_H -I. -I.. -O3 -Wall -Wno-unused-function -I/Users/frsyuki/arch/darwin-i386/gtest-1.5/include -O3 -g -MT unpack.lo -MD -MP -MF .deps/unpack.Tpo -c unpack.c -fno-common -DPIC -o .libs/unpack.o
llvm-gcc -DHAVE_CONFIG_H -I. -I.. -O4 -Wall -Wno-unused-function -I/Users/frsyuki/arch/darwin-i386/gtest-1.5/include -O3 -Wno-unused-function -g -MT unpack.lo -MD -MP -MF .deps/unpack.Tpo -c unpack.c -fno-common -DPIC -o .libs/unpack.o
llvm-gcc -DHAVE_CONFIG_H -I. -I.. -O4 -Wall -Wno-unused-function -I/Users/frsyuki/arch/darwin-i386/gtest-1.5/include -O3 -Wno-unused-function -g -MT unpack.lo -MD -MP -MF .deps/unpack.Tpo -c unpack.c -fno-common -DPIC -o .libs/unpack.o
unpack.c:463: internal compiler error: Segmentation fault
Please submit a full bug report,
require 'java'
require 'msgpack-0.6.0-devel.jar'
##
# Serialize
#
gzout = java.io.ByteArrayOutputStream.new
out = java.util.zip.GZIPOutputStream.new(gzout)
import java.io.InputStream;
public class X {
public static void main(String[] args) {
new X().write(null);
// ^
// X.java:5: reference to write is ambiguous, both method write(java.lang.String) in X and method write(java.io.InputStream) in X match
}
public void write(Object o) {
import java.lang.reflect.Method;
public class GenericsOverload {
public static void main(String[] args) throws Exception {
GenericsOverload go = new GenericsOverload();
go.read(String.class); //=> Class<String>
go.read(Long.class); //=> Class<Long>
go.read(Integer.class); //=> Class<T> T=class java.lang.Integer
go.read(byte[].class); //=> Class<T> T=class [B