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 reload() { | |
| var child = node.createChildProcess("node df.js"); | |
| child.addListener('exit', function(code) { | |
| reload(); | |
| }); | |
| } |
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
| named_scope :matches, lambda { |value| { | |
| :select => sanitize_sql(["addresses.*, match(value) against(? in boolean mode) as relevancy", wildcardize(value)]), | |
| :conditions => ["match(value) against(? in boolean mode)", wildcardize(value)], |
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
| Couch.discover('localhost', 5984, function(couch) { | |
| var aDoc = { foo: 'bar' }; | |
| couch.aDatabase.post(aDoc, function(response, body) { | |
| puts('got response ' + response.statusCode + ' with body ' + body); | |
| }); | |
| }); |
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 createCouchRequest = function(httpClient, method, path, params) { | |
| var couchRequest = {}, | |
| httpClient = httpClient, | |
| method = method, | |
| path = path, | |
| body = ''; | |
| if (method === 'get') { | |
| path += toQueryString(params); | |
| } else { |
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 http = require('/http.js'); | |
| var utils = require('/utils.js'); | |
| include('../config.js'); | |
| var databases = {}; | |
| var designs = {}; | |
| var httpClients = {}; | |
| var servers = {}; | |
| var views = {}; |
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
| exports.DatabasesController = { | |
| index: function(request, response) { | |
| SERVER.get('_all_dbs', request, response); | |
| }, | |
| } |
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
| exports.PagesController = { | |
| index: function(request, response) { | |
| var params = { | |
| startkey: [request.customerId, request.organizationId], | |
| endkey: [request.customerId, request.organizationId, {}] | |
| }; | |
| DESIGN.view('pages_by_path').get(params, function(couchResponse, json) { | |
| response.finish_with_404(couchResponse.body); |
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
| class RedirectController < ApplicationController | |
| def show | |
| uri = URI.parse(request.url) | |
| uri.host = params[:host] if params[:host] | |
| uri.port = params[:port] || 80 | |
| if params[:path] | |
| uri.path = params[:path] | |
| else | |
| uri.path = "#{uri.path}/" unless uri.path.include?(".") || uri.path.ends_with?("/") | |
| end |
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 window = {}; | |
| function(head, request) { | |
| // !code vendor/couchapp/json2.js | |
| // !code vendor/couchapp/JSONQuery.js | |
| start({ headers: { "Content-Type" : "application/json" } }); | |
| var root = {}; |
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 http = require('http'); | |
| var cache = {}; | |
| var Cache = {}; | |
| Cache.fetch = function(key, callback) { | |
| var hit = cache[key]; | |
| if (!hit) { | |
| hit = callback(); |