Skip to content

Instantly share code, notes, and snippets.

View ingenthr's full-sized avatar

Matt Ingenthron ingenthr

View GitHub Profile
@daschl
daschl / couchbase-php-2pc-simple.php
Created July 21, 2012 08:39
Simple Couchbase PHP 2PC Implementation
<?php
/**
* Simple two-phase commit for PHP couchbase.
*
* Michael Nitschinger (@daschl, 2012)
*
* Additional Remarks
* ------------------
* - The Couchbase extension makes it currently pretty hard to write easy readable code when dealing with
* CAS (compared to the ruby adapter). This could certainly be improved with closures. I also found that
DATA_TYPE
=========
+---------------+
|7 6 5 4 3 2 1 0|
+---------------+
00000000: RAW_BYTES
0-2: Serializers.
@davidjrice
davidjrice / README.md
Created June 14, 2012 21:53
New Relic Instrumentation for Couchbase Ruby
  • Install & Setup New Relic
  • cd my_rails_project/config/initializers
  • wget http://raw.github.com/gist/2933202/5adcf11839c0ef2064a5f0c6e0fe795d9ed2c60a/couchbase_new_relic_instrumentation.rb
  • git add and deploy as usual!

Couchbase New Relic Instrumentation

@johnzablocki
johnzablocki / python-couchbase-view-enumeration.py
Created March 26, 2012 22:48
View enumeration with the Couchbase Python Client Library
import couchbase
cb = couchbase.Server("192.168.1.131:8091", "", "")
bucket = cb.bucket("default")
rows = bucket.view("_design/breweries/_view/all_breweries")
for row in rows:
print row
@johnzablocki
johnzablocki / python-couchbase-set-get.py
Created March 26, 2012 22:47
Set and Get with the Couchbase Python Client Library
import couchbase
cb = couchbase.Server("127.0.0.11:8091", "", "")
bucket = cb.bucket("default")
bucket.set("foo", 0, 0, "bar")
print bucket.get("foo")
@avsej
avsej / repositories.rake
Created February 27, 2012 15:04
DEB/RPM repository maintenance script
# GistID: 1924422
# Author:: Couchbase <[email protected]>
# Copyright:: 2011, 2012 Couchbase, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@isopov
isopov / BasicAuthTest.java
Created September 30, 2011 15:20
Sample for using basic authentication with Netty.
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
<?php
$cb = new Couchbase;
$cb->addServer("localhost", 11211); // BC compat
$view = $cb->getView("ddocname", "viewname"); // returns Couchbase_View
$result = $view->getResult(); // returns Couchbase_ViewResult
foreach($result->rows AS $row) {
echo $row->value;
}
@mikewied
mikewied / java-couchbase-api
Created July 5, 2011 20:00
Java Couchbase API
===========
Examples:
===========
CouchbaseClient couchbase_client = new CouchbaseClient(Arrays.asList(URI.create("http://localhost:8091/pools")), "default", "");
// Get views from a design document
List<View> views = couchbase_client.getViews("design_doc_name");
// Get a single view from the server