Skip to content

Instantly share code, notes, and snippets.

# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
require.paths.unshift('lib');
require('express');
require('express/plugins');
redisclient = require('redis-node-client/lib/redis-client');
redis = redisclient.createClient();
sys = require('sys');
configure(function () {
use(Logger);
<!-- This is a Node+WebSocket powered demo to sync videos
across different browsers. This file is the client,
the other one is the Node server. Powered by Node and
http://github.com/miksago/node-websocket-server -->
<style>
.inactive { display: none; }
.active { display: block; }
</style>
<script>
require 'rubygems'
require 'json'
require 'rest_client'
def create_person(name)
JSON.parse RestClient.post( "http://localhost:8988/neo4jr-social/nodes", :name => name )
end
def make_mutual_friends(node1, node2)
RestClient.post "http://localhost:8988/neo4jr-social/nodes/#{node1['node_id']}/relationships", :to => node2['node_id'], :type => 'friends'
# The router
router: require 'node-router'
server: router.getServer()
asset: require 'node-asset'
# Javascript package
scripts: new asset.Package 'assets/js/all.js', [
'assets/coffee'
], {
watch: true
// picard_sample/app.js
require('./config/env')
get('/', function(){
return { text: '<h1>Hello to TestApp!</h1>' }
})
#!/usr/bin/env ruby
require 'erb';
File.open(ARGV[0], "w") do |f|
f.write ERB.new(File.read(ARGV[1] || 'nginx-io.conf.erb')).result(binding)
end
# vim:filetype=ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'fsevents'
require 'json'
ignores = JSON.parse(File.read(".couchappignore")).map { |s| Regexp.new(s) }
ignores.push /(^.git|.DS_Store|\.swp$|\.couchappignore)/
appdir = File.expand_path(File.dirname(__FILE__))
var couchapp = require('../lib/couchapp.js');
ddoc = {"views":{}}
exports.app = ddoc;
ddoc.views.simple = {
map: function (doc) {emit(doc._id, null)}
}
ddoc.views.simpleReduce = {
map: function (doc) {emit(doc._id, 1)},
upstream bavomatic_cluster {
server unix:/tmp/thin.bavomatic.0.sock;
}
server {
include /usr/pkg/etc/nginx/compress;
listen 80;
server_name *.bavomatic.net bavomatic.net;