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
#!/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 |
-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'. |
<?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. |
Document Structure | |
------------------ | |
{ | |
_id: "whatever", | |
type: "some category style grouping", | |
date: Unix time stamp | |
} | |
Map Function |
#!/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 |
<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) { |
var docs = [ | |
{ _id: 'doc1', foo: 'bar' }, | |
{ _id: 'doc2', hi: 'there' } | |
]; | |
couch.bulk({ | |
docs: docs, | |
callback: function(resp, succ) { | |
//...do stuff | |
} |
//Compact the db | |
couch.compact({ | |
callback: function(resp, succ) { | |
//do stuff | |
} | |
}); | |
//Compact the view | |
couch.compact({ | |
viewName: 'app', |
sag.setDatabase('bwah'); | |
sag.login({ | |
user: 'user', | |
pass: 'pass' | |
); //using basic auth | |
sag.get({ | |
url: '/someDoc', | |
callback: function(resp, worked) { |