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
render:function(){ | |
#('selector').html(my_tab_html); | |
_.defer( | |
function(){ | |
view.$('.nav-tabs a'+selected_tab).tab('show'); | |
view.delegateEvents(); //this smoothed out the user experience (somehow) | |
//need to do things related to tabs here, not right after being rendered to page .... | |
}); |
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
[debug] [<0.1228.0>] 'PUT' /categorization/9aef603131112c1f3aba4efb090031cb {1, | |
1} from "127.0.0.1" | |
Headers: [{'Accept',"application/json, text/javascript, */*; q=0.01"}, | |
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"}, | |
{'Accept-Encoding',"gzip,deflate,sdch"}, | |
{'Accept-Language',"en-GB,en-US;q=0.8,en;q=0.6"}, | |
{'Connection',"keep-alive"}, | |
{'Content-Length',"417"}, | |
{'Content-Type',"application/json"}, | |
{'Host',"127.0.0.1:5984"}, |
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
#!/bin/bash | |
base_dir=$(dirname "$0") | |
echo basedir "$base_dir" | |
script=$(readlink -f "$0") | |
echo script "$script" | |
# Absolute path this script is in, thus /home/user/bin | |
script_path=$(dirname $script) | |
echo sript path" $script_path" | |
script_parent_path="$script_path"/.. |
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
//requires underscore.js & JSON.js | |
/* | |
* This is a functional implementation of a SET | |
* adding and removing from sets do not overwrite previous values of the set | |
*/ | |
function Set(initial_items){ | |
if(initial_items && !_.isObject(initial_items)){ | |
throw "the set must be given a list of initial items, or empty arguments" | |
} | |
function initialize_items(initial_items){ |
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
{ | |
"httpd_design_handlers": { | |
"_info": "{couch_httpd_db, handle_design_info_req}", | |
"_list": "{couch_httpd_show, handle_view_list_req}", | |
"_rewrite": "{couch_httpd_rewrite, handle_rewrite_req}", | |
"_show": "{couch_httpd_show, handle_doc_show_req}", | |
"_update": "{couch_httpd_show, handle_doc_update_req}", | |
"_view": "{couch_httpd_view, handle_view_req}" | |
}, | |
"uuids": { |
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
_export_csv:function(convert_to_array,file_name){ | |
var export_db = 'export_requests_rt7'; | |
var router = this; | |
var handler = { | |
success:function(resp){ | |
var href = window.location.origin + '/'+ export_db +'/_design/app/_show/csv/' + resp.id; | |
window.location.href = href; | |
}, | |
error:function(){ | |
alert('there was an error exporting your data'); |
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 _ = {}; | |
// By default, Underscore uses ERB-style template delimiters, change the | |
// following template settings to use alternative delimiters. | |
_.templateSettings = { | |
evaluate: /<%([\s\S]+?)%>/g, | |
interpolate: /<%=([\s\S]+?)%>/g, | |
escape: /<%-([\s\S]+?)%>/g | |
}; | |
// When customizing `templateSettings`, if you don't want to define an |
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({ | |
toNumber:function(obj){ | |
if(_.isNumber(obj)){ | |
return obj | |
} | |
else if(_.isString(obj)){ | |
return parseFloat(obj) | |
} | |
else{ | |
return obj |
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 inventory_table_view = | |
Backbone.View.extend( | |
{ | |
render:function(data){ | |
var view = this, | |
template = view.options.template, | |
el = view.$el, | |
html = ich[template](data); | |
el.html(html) | |
} |
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
//requires jquery.form.js | |
//<script src="/_utils/script/jquery.form.js"></script> | |
/* | |
<form action="" method="post" id="upload-form"> | |
<h2>Upload Attachment</h2> | |
<fieldset> | |
<p class="help"> | |
Please select the file you want to upload as an attachment to this | |
document. Please note that this will result in the immediate creation of | |
a new revision of the document, so it's not necessary to save the |