Skip to content

Instantly share code, notes, and snippets.

@ermouth
ermouth / nested2.js
Created March 30, 2017 16:37
Nested-nested
{
init:[
'<div id="list"></div>'
],
data:{
data: [
{ idfield:'abc', desc: 'parent1', children: [ { id:'fgh', desc: 'child1' }, { id:'lmn', desc: 'child2' } ] },
{ idfield:'def', desc: 'parent2', children: [ { id:'xyz', desc: 'child1' } ] }
]
},
({
"id": "cw.Sys.Diff",
"require": [{
"jsondiffpatch": "lib/diff.js"
}],
"params": {
},
"data": {
"cmd": "",
"title": "Diff",
@ermouth
ermouth / ddoc:query_server:protocol.rst
Last active December 21, 2017 01:24
CouchDB js rewrites QS protocol
.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
.. use this file except in compliance with the License. You may obtain a copy of
.. the License at
..
.. http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
.. License for the specific language governing permissions and limitations under
@ermouth
ermouth / json_structure.rst
Last active December 9, 2015 10:26
CouchDB js rewrites – json_structure
.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
.. use this file except in compliance with the License. You may obtain a copy of
.. the License at
..
.. http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
.. License for the specific language governing permissions and limitations under
function(doc){
// Validates ddoc map functions to prevent them
// from calling send(), getRow() and so on.
// Ddoc with this validate_doc_update must have
// property .Uglify with UglifyJS lib (tested for 2.4.15).
require("Uglify");
@ermouth
ermouth / rewrites.rst
Last active December 5, 2015 15:22
CouchDB js rewrites - I
.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
.. use this file except in compliance with the License. You may obtain a copy of
.. the License at
..
.. http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
.. License for the specific language governing permissions and limitations under
@ermouth
ermouth / treematch.js
Last active November 16, 2015 05:03
Recursive pattern matcher for CouchDB
(function () {
// matches.js
// ----------
// Powerful pattern matching for Javascript
//
// version : 0.5.1
// author : Nathan Faubion <nathan@n-son.com>
// repo : https://github.com/natefaubion/matches.js
// license : MIT
@ermouth
ermouth / b010.log
Created October 10, 2015 20:49
Barrel 010 build log
===> Cleaning out couch...
===> Cleaning out couch_changes...
===> Cleaning out couch_dbupdates...
===> Cleaning out couch_httpd...
===> Cleaning out couch_index...
===> Cleaning out couch_mrview...
===> Cleaning out couch_randomdoc...
===> Cleaning out couch_replicator...
===> Cleaning out geocouch...
===> Verifying dependencies...
@ermouth
ermouth / couch-rewrite-fn-penalties.js
Last active September 25, 2015 07:03
CouchDB query server js call penalties
// Tests process switching penalties for calling
// CouchDB query server js functions.
// Requires jQuery
var passes = 50, host="https://cloudwall.cloudant.com/testr/";
function go (msg, url) {
var pi = $.Deferred(),
ctr = passes,
@ermouth
ermouth / expenseReportDemo.js
Last active September 20, 2015 22:40
Sample expense repor widget
({
// name must be present for widgets,
// and it must be unique
name:"Expense report demo",
id:"in.ExpenseReportDemo",
// Default data
data:{
ERROR:false, // holds overall error state, true if form has errors
title:"",