Skip to content

Instantly share code, notes, and snippets.

Michael Nitschinger daschl

Block or report user

Report or block daschl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
package org.testcontainers.couchbase;
import org.junit.ClassRule;
View gist:288150e4d48ddaa3414475e4bfe1d86c
> cbq -u Administrator -p password --script "select * from `travel-sample` limit 10" -q | from-json | get | sort-by name
callsign │ country │ iata │ icao │ id │ name │ type
MILE-AIR │ United States │ Q5 │ MLA │ 10 │ 40-Mile Air │ airline
> cbq -u Administrator -p password --script "select * from `travel-sample` limit 10" -q | from-json | get results | get travel-sample | sort-by name
# │ callsign │ country │ iata │ icao │ id │ name │ type
View build.gradle
* Copyright (C) 2014 Couchbase, Inc.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
daschl /
Created Aug 22, 2016
Couchbase Spark Samples
// Start the Shell
./pyspark --packages com.couchbase.client:spark-connector_2.10:1.2.1 --conf ""
// Create a DF
>>> df ="com.couchbase.spark.sql.DefaultSource").option("schemaFilter", "type=\"airline\"").load()
// Print the Schema
>>> df.printSchema()
View bla.jsx
<ul id="results-list" className="list-group">
{, key) => {
if (item.success) {
<li key={key} className="list-group-item list-group-item-success">
<pre>{JSON.stringify(item, null, 2)}</pre>
} else {
<li key={key} className="list-group-item list-group-item-success">bla</li>
View build.gradle
plugins {
id 'scala'
id 'maven-publish'
repositories {
* Copyright (c) 2018 Couchbase, Inc.
* 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
* Unless required by applicable law or agreed to in writing, software
daschl / gist:db9fcc9d2b932115b679
Last active Jan 10, 2019
Draft: Writing Code for Production
View gist:db9fcc9d2b932115b679

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)

daschl / couchbase-php-2pc-advanced.php
Created Jul 21, 2012
Advanced Couchbase 2PC PHP Implementation
View couchbase-php-2pc-advanced.php
* A more general PHP two-phase commit implementation.
* This assumes that we run on 5.3 or later.
class TransactionException extends Exception {}
// --- Collection API ---
// full doc fetch
Optional<Document> doc = collection.get("id");
// full doc fetch, turns into subdoc actually
Optional<Document> doc = collection.get("id", getOptions().withExpiration(true));
// full doc insert (since we now return a doc, let's take a document!)
You can’t perform that action at this time.