First off - you rock! Community contributions are so awesome and have resulted in some awesome features landing in Sag.
This guide is meant to make it as easy as possible to contribute your code to Sag.
Sending the Contribution
var docs = [ | |
{ _id: 'doc1', foo: 'bar' }, | |
{ _id: 'doc2', hi: 'there' } | |
]; | |
couch.bulk({ | |
docs: docs, | |
callback: function(resp, succ) { | |
//...do stuff | |
} |
<html> | |
<head> | |
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"> | |
</head> | |
<body> | |
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | |
<script src="http://autobahn.tablesorter.com/jquery.tablesorter.min.js"></script> | |
<script> | |
function makeTable(parentSelector, colHeaders, data) { |
#!/bin/bash | |
# | |
# chkconfig: 23 90 10 | |
# Description: Quickly hacked together bigcouch init script for CentOS systems. | |
. /etc/init.d/functions | |
PID_FILE=/var/run/bigcouch.pid | |
BIGCOUCH_BIN=/opt/bigcouch/bin/bigcouch | |
SUBSYS_LOCK_FILE=/var/lock/subsys/bigcouch |
Document Structure | |
------------------ | |
{ | |
_id: "whatever", | |
type: "some category style grouping", | |
date: Unix time stamp | |
} | |
Map Function |
<?php | |
# Twitpic-Flickr bridge - v0.1pre - 10/18/2011 | |
# http://benalman.com/ | |
# | |
# Copyright (c) 2011 "Cowboy" Ben Alman | |
# Dual licensed under the MIT and GPL licenses. | |
# http://benalman.com/about/license/ | |
# There's no way I'm writing all the Flickr stuff myself. |
-module(fibo). | |
-export([calc/1, run/1]). | |
% Entry method to calculate fibo | |
calc(N) when N > 0 -> | |
calc(N, 1, 1, []); | |
calc(_) -> | |
'Can only calculate F(N) where N > 0'. |
#!/usr/bin/php | |
<?php | |
require('Sag.php'); | |
$sag = new Sag(); | |
$sag->setDatabase('bwah', true); | |
// Send a temp view | |
var_dump($sag->post(array( 'map' => 'function(doc) { emit(null, null); }'), '/_temp_view')); | |
// Send a doc |
#!/usr/bin/php | |
<?php | |
require('Sag.php'); | |
$sag = new Sag(); | |
$sag->setDatabase('bwah'); | |
for($i = 0; $i < 1000; $i++) { | |
echo "$i\n"; | |
if(!$sag->post(array('hi' => 'there'))->body->ok) { | |
echo "\t!!!!!!FAIL!!!!!!\n"; |
<?php | |
require_once 'CouchSessionStore.php'; | |
class SuperCouchSessionStore extends CouchSessionStore | |
{ | |
public static function setSag($sag) | |
{ | |
//use CouchSessionStore to set everything up, so our $this->sag == $sag | |
parent::setSag($sag); |