Skip to content

Instantly share code, notes, and snippets.

View kennystone's full-sized avatar

Kenny Stone kennystone

View GitHub Profile
@kennystone
kennystone / gist:805387
Created February 1, 2011 03:47
mongoid datetime resolution less than a second
require 'rubygems'
require "test/unit"
require 'mongoid'
class DT
include Mongoid::Document
field :birthday, :type => DateTime
end
class TestDT < Test::Unit::TestCase
@kennystone
kennystone / gist:468629
Created July 8, 2010 21:10
champ ruby
conf = {:host=>"127.0.0.1", :port=>2345, :api_info=>{:name=>:ruby_client, :vers=>"ruby-api.0.1"}, :user=>"user", :password=>"password"}
require 'connamara_api'
require 'pub/champ/publisher'
require 'serializer/erlbin/erlang_binary_term'
include Connamara
cp = ConnamaraAPI.run( conf, ErlangBinaryTerm, ChampPub )
cp.subscribe(:Position) {|pos| puts 'pos ' + pos.inspect }
require 'connamara_api'
require 'serializer/protobuf/protobuf'
require 'pub/activemq/publisher'
include Connamara
## start
config = {'connect_string'=>"tcp://localhost:61616"}
api = ConnamaraAPI.run( config, Connamara::ProtoBuf, Connamara::AMQPublisher )