Skip to content

Instantly share code, notes, and snippets.

View jchris's full-sized avatar

Chris Anderson jchris

View GitHub Profile
@jchris
jchris / _README.md
Last active September 25, 2015 13:29 — forked from brett19/_README.md

This is a listing of various examples used for the Couchbase Go SDK GA Release Blog.

Blog Post

#!/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');
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
/**
* 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;
@jchris
jchris / couchdb.yml
Created October 20, 2008 21:59 — forked from sco/couchdb.yml
---
development: &defaults
:url: http://0.0.0.0:5984/gathering
production: &production
<<: *defaults
:url: http://0.0.0.0:5984/gathering
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