This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Item < CBLModel | |
attr_reader :created_at | |
def self.docType | |
"item" | |
end | |
def initInDatabase database, withTitle: title | |
self.initWithNewDocumentInDatabase database | |
self.setValue(self.class.docType, ofProperty: "type") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_item title | |
list = Item.alloc.initInDatabase(database, withTitle:title) | |
error_ptr = Pointer.new(:object) | |
list.save(error_ptr) | |
if error_ptr[0] | |
alert = UIAlertView.alloc.initWithTitle("Error", message: "Failed to create new item", delegate: nil, cancelButtonTitle: "Ok", otherButtonTitles: nil) | |
alert.show | |
else | |
list | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ItemsViewController < UIViewController | |
attr_accessor :database, :user_id, :data_source | |
def viewDidLoad | |
super | |
navigationItem.title = "Items" | |
@items_table = UITableView.alloc.initWithFrame(view.bounds) | |
@items_table.delegate = self | |
@data_source = CBLUITableSource.alloc.init |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Blocks.h" | |
#import <CouchbaseLite/CouchbaseLite.h> | |
@implementation Blocks | |
+(void)setupListsMapBlockForView:(CBLView*)view | |
{ | |
if (!view.mapBlock) { | |
[view setMapBlock: MAPBLOCK({ | |
if ([doc[@"type"] isEqualToString:@"list"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# %CopyrightBegin% | |
# | |
# Copyright Ericsson AB 1996-2012. All Rights Reserved. | |
# | |
# The contents of this file are subject to the Erlang Public License, | |
# Version 1.1, (the "License"); you may not use this file except in | |
# compliance with the License. You should have received a copy of the | |
# Erlang Public License along with this software. If not, it can be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"-W025": false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cb = require("couchbase") | |
var async = require("async") | |
var cluster = new cb.Cluster("couchbase://localhost/") | |
var bucket = cluster.openBucket("default") | |
bucket.queryhosts = ["localhost:8093"] | |
var log = function () { | |
var args = Array.prototype.slice.call(arguments, 0) | |
console.log.apply(null, args.filter(function (e) { return e != null })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var couchbase = require("couchbase") | |
var async = require("async") | |
var bucket = new couchbase.Connection({}) | |
function die(msg) { | |
if(msg) console.log(msg) | |
bucket.shutdown() | |
process.exit() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cberl:set(default, list_to_binary(X), 0, {[{<<"type">>,<<"bar">>}]}) || X <- [lists:flatten(io_lib:format("bar-~p", [X])) || X <- lists:seq(4, 10000)]]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var couchbase = require("couchbase") | |
var async = require("async") | |
var db = new couchbase.Connection({}) | |
// create insert function which expects just a callback | |
function insertFormObject(object) { | |
return function (cb) { | |
db.set(object._id, object.value, cb) | |
} |