Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
function reload() {
var child = node.createChildProcess("node df.js");
child.addListener('exit', function(code) {
reload();
});
}
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)],
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);
});
});
var createCouchRequest = function(httpClient, method, path, params) {
var couchRequest = {},
httpClient = httpClient,
method = method,
path = path,
body = '';
if (method === 'get') {
path += toQueryString(params);
} else {
var http = require('/http.js');
var utils = require('/utils.js');
include('../config.js');
var databases = {};
var designs = {};
var httpClients = {};
var servers = {};
var views = {};
exports.DatabasesController = {
index: function(request, response) {
SERVER.get('_all_dbs', request, response);
},
}
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);
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
var window = {};
function(head, request) {
// !code vendor/couchapp/json2.js
// !code vendor/couchapp/JSONQuery.js
start({ headers: { "Content-Type" : "application/json" } });
var root = {};
var http = require('http');
var cache = {};
var Cache = {};
Cache.fetch = function(key, callback) {
var hit = cache[key];
if (!hit) {
hit = callback();