This is a listing of various examples used for the Couchbase Go SDK GA Release Blog.
This file contains 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
#!/usr/bin/env node | |
var cordova_util = require('cordova/src/util'); | |
var projectRoot = cordova_util.isCordova(process.cwd()); | |
var projectXml = cordova_util.projectConfig(projectRoot); | |
var projectConfig = new cordova_util.config_parser(projectXml); | |
projectConfig.name(); | |
var fs = require ('fs'); |
This file contains 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
require 'lib/yajl/http_stream' | |
require 'uri' | |
uri = URI.parse('http://jchrisa.net/toast/_changes') | |
Yajl::HttpStream.get(uri) do |hash| | |
# will take a few seconds, since the response is a single ~4MB JSON string | |
# if the response was a bunch of individual JSON strings, this would be fired | |
# for every string parsed off the stream, as they were parsed | |
puts hash.inspect | |
end |
This file contains 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
/** | |
* Support for generating SHA-1 of a stream. | |
* | |
* Based on http://pajhome.org.uk/crypt/md5/sha1.js. | |
*/ | |
function naked_sha1_head() { | |
var w = Array(80); | |
var a = 1732584193; | |
var b = -271733879; |
This file contains 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
--- | |
development: &defaults | |
:url: http://0.0.0.0:5984/gathering | |
production: &production | |
<<: *defaults | |
:url: http://0.0.0.0:5984/gathering |
This file contains 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 Question | |
include CouchRest::Model | |
key_accessors :type, :position, :text, :required_answers_count, :possible_answers, :hint | |
def initialize (node = {}) | |
@doc = node | |
end | |
def to_json |