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
ddoc.shows = { | |
csv:function(doc,req){ | |
function csvEscapeOnePerLine(arr){ | |
var csv = ''; | |
var arr_last = arr.length - 1; | |
for(var i = 0; i <= arr_last; i++){ | |
var value = arr[i].replace(/"/g, '""'); | |
csv += '"' + value + '"'; | |
if( i != arr_last ){ | |
csv += ";"; |
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 couchapp = require("couchapp"); | |
var _ = require('underscore'); | |
const user = 'adsfasdf:asdfasdf'; | |
const location = 'localhost:5984'; | |
function couchapp_push_as_user(user,url){ | |
return function(file,db){ | |
couchapp | |
.createApp(file, |
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
paul@paul-rt7-desktop:~/Dropbox/work/rt7/db$ npm install underscore | |
npm http GET https://registry.npmjs.org/underscore | |
npm http 304 https://registry.npmjs.org/underscore | |
[email protected] /home/paul/node_modules/underscore | |
paul@paul-rt7-desktop:~/Dropbox/work/rt7/db$ node push_all.js | |
The "sys" module is now called "util". It should have a similar interface. | |
node.js:201 | |
throw e; // process.nextTick error, or 'error' event on first tick | |
^ |
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
fetch:function (options) { | |
if(_.isFunction(options)){ | |
var callback = options; | |
var newOptions = { | |
success : function(resp, status, xhr){ | |
callback(null,resp, status, xhr) | |
}, | |
error : function(){ | |
callback() | |
} |
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
//create a server admin in futon {name:"paul",password:"password"} via futon | |
//delete _users database | |
$.couch.signup({name:"admin"},"1") | |
//set _users security members names = ["admin"] via futon | |
//logout via futon | |
//login via futon as 'admin' | |
$.couch.signup({name:"user1"},"password",{success:function(){console.log(arguments)},error:function(){console.log(arguments)}}) | |
//console output: | |
//PUT http://localhost:5984/_users/org.couchdb.user%3Auser1 404 (Object Not Found) |
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
function inject_script(string){ | |
var x = document.createElement('script'); | |
x.src = string | |
document.body.appendChild(x); | |
} | |
inject_script("http://documentcloud.github.com/underscore/underscore-min.js") | |
inject_script("https://raw.github.com/boxxxie/underscore_extended/master/underscore_extended_browser.js") | |
var _users_db = $.couch.db("_users"); |
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
function myAjaxObject (){ | |
var varTo; | |
var varFrom; | |
var callbackfunctions = callbackfunctions; | |
var callajax = callajax; | |
var ajxmstrcl = ajxmstrcl; | |
var settoandfrom = settoandfrom; | |
function settoandfrom(setUrlTo,setUrlFrom){ | |
varTo = setUrlTo; | |
varFrom = setUrlFrom; |
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
_.mixin({ | |
/* | |
* (defn walk | |
* | |
"Traverses form, an arbitrary data structure. inner and outer are | |
functions. Applies inner to each element of form, building up a | |
data structure of the same type, then applies outer to the result. | |
Recognizes all Clojure data structures except sorted-map-by. | |
Consumes seqs as with doall." |
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
function fill_stars(rating,full_img,half_img) | |
{ | |
var rattings = ['one','two','three','four','five']; | |
if(rating > 0){ | |
document.getElementById("one").src = full_img; | |
} | |
if(rating > 1){ | |
document.getElementById("two").src = half_img; | |
} |
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
{ | |
"transactions":[ | |
{ | |
"_id":"f25e83e3-c0cf-ab04-28fe-96e4d4d3de46-25", | |
"_rev":"2-c9f2909ba468de86e409da9cc17d5e72", | |
"company_id":"66dd38570eb7791c02158c70e32429d3", | |
"store_id":"30881464-3625-19e2-8844-6b3c9b9c1412", | |
"group_id":"ff1c08cc-3393-c7b9-d99c-4b1cd8403468", | |
"transactionNumber":25, | |
"receipt_id":"1194738626", |