Skip to content

Instantly share code, notes, and snippets.

View boxxxie's full-sized avatar
👙
disrupting absurdism

Paul Iannazzo boxxxie

👙
disrupting absurdism
View GitHub Profile
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 += ";";
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,
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
^
fetch:function (options) {
if(_.isFunction(options)){
var callback = options;
var newOptions = {
success : function(resp, status, xhr){
callback(null,resp, status, xhr)
},
error : function(){
callback()
}
@boxxxie
boxxxie / gist:2220217
Created March 27, 2012 21:03
couchdb user creation problems on 1.2
//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)
@boxxxie
boxxxie / gist:2202673
Created March 26, 2012 03:34
why does $.couch.db().bulkSave not work?
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");
@boxxxie
boxxxie / adfdsaf.js
Created March 25, 2012 06:20 — forked from anonymous/gGkvgSfX
a guest on Mar 25th, 2012 - pastebin.com/gGkvgSfX
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;
@boxxxie
boxxxie / gist:2190674
Created March 25, 2012 01:47
walking
_.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."
@boxxxie
boxxxie / rating.js
Created March 24, 2012 23:48 — forked from anonymous/BJMXR0wM
rating.js
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;
}
{
"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",