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
var couchDoc = Backbone.Model.extend(
{
idAttribute: "_id",
save:function(attrs,options){
function updateRev(model,resp,status){
model.set({_rev:status.rev},{silent: true});
};
options || (options = {});
var model = this;
var success = options.success;
@boxxxie
boxxxie / gist:1328409
Created October 31, 2011 18:41
does this look correct?
var countryList = Locations.extend(
{model:country,
initialize:function(){
var stores_db = db('stores_rt7');
var reigion_v = appView('country_prov_city_postal_code');
groupQuery(reigion_v,stores_db,1)
(function(data){
this.add(_(data.rows).chain()
.pluck('key')
.flatten()
var countryList = Locations.extend(
{model:country,
initialize:function(){
var that = this;
var stores_db = db('stores_rt7');
var reigion_v = appView('country_prov_city_postal_code');
groupQuery(reigion_v,stores_db,1)
(function(data){
var colData = _.map(extractKeysArr(data),function(item){return {name:item};});
console.log("done setting up collection");
@boxxxie
boxxxie / gist:1334752
Created November 2, 2011 20:13
always returns :false-false no matter if the DBs exist or not (:false-false is when they both don't exist)
(defmulti statsTransform
(fn [fromDB toDB]
(let [dbs (db/all-databases)
fromDB? (some #(= % fromDB) dbs)
toDB? (some #(= % toDB) dbs)]
(swank.core/break)
[fromDB? toDB?])))
(defmethod statsTransform [true true] [from to] :rect-shape)
(defmethod statsTransform [true false] [from to]
(create-transformation-db to))
var couchCollection = function(couch,options){
couch || (couch = {});
couch.db || (couch.db = 'db');
options || (options = {});
var urlBase = window.location.protocol + "//" + window.location.hostname + ":" +window.location.port + "/";
return Backbone.Collection.extend(
_.extend(options,
{url:urlBase + couch.db,
parse: function(response) {
return _(response.rows)
var install_db = db('install');
var Selection = new (Backbone.Model.extend());
var Company = couchDoc.extend(
{defaults: function() {
return {
name:"unknown",
hierarchy:{groups:["none"]}
};
var Workspace = Backbone.Router.extend(
{
routes: {
"help": "help", // #help
"search/:query": "search", // #search/kiwis
"search/:query/p:page": "search" // #search/kiwis/p7
},
help: function() {
function quickViewDialog (html,options) {
$(html).dialog({
autoOpen: false,
height: 400,
width: 500,
modal: true,
buttons: {
Cancel: function() {
$(html).dialog('destroy');
}
@boxxxie
boxxxie / gist:1365761
Created November 15, 2011 00:59
Why doesn't my destroy function work with data:{rev....}?
var couchDoc = Backbone.Model.extend(
{
idAttribute: "_id",
save:function(attrs,options){
function updateRev(model,resp,status){
model.set({_rev:status.rev,_id:status.id},{silent: true});
};
options || (options = {});
var model = this;
var success = options.success;
function BindValidator(validator){
return function(validationObj){
var str = validationObj.str;
var isValid = validator(str);
if(!validationObj.valid){
return{str:str,valid:false};
}
return {str:str,valid:isValid};
};
};