Skip to content

Instantly share code, notes, and snippets.

@elubow
elubow / gist:825135
Created February 13, 2011 21:14 — forked from mraleph/gist:825124
std::string tag_key, tag_value;
bool has_tags = false;
map<string,string> tags;
if (!args[1]->IsUndefined()) {
Local<Object> tagsObj = args[1]->ToObject();
Local<Array> tagNames = tagsObj->GetPropertyNames();
uint32_t length = tagNames->Length();
for (uint32_t i=0; i<length;i++) {
Local<String> v8TagKey = tagNames->Get(i)->ToString();
Local<String> v8TagValue = tagsObj->Get(v8TagKey)->ToString();
@devdazed
devdazed / insert_bson_symbols.rb
Created July 21, 2011 18:39
BSON Symbols and Node.JS
require 'mongo'
@db = Mongo::Connection.new['test']
@symbol_coll = @db['bson_symbols']
@string_coll = @db['bson_string']
[@symbol_coll, @string_coll].each{|c| c.remove }
3.times do |i|
@symbol_coll.insert({'foo' => [:a, :b, :c, :d]})