git clone git://github.com/drsm79/situp.git
cd situp
export PYTHONPATH=$PYTHONPATH:$PWD
chmod u+x situp.py
export PATH=$PATH:$PWD
{"latitude": "42.40N", "country": "Bulgaria", "longitude": "023.18E", "city": "Sofia"} | |
{"latitude": "50.06N", "country": "Czech Republic", "longitude": "014.26E", "city": "Prague"} | |
{"latitude": "15.20N", "country": "Eritrea", "longitude": "038.58E", "city": "Asmera"} | |
{"latitude": "59.22N", "country": "Estonia", "longitude": "024.48E", "city": "Tallinn"} | |
{"latitude": "18.08S", "country": "Fiji", "longitude": "178.25E", "city": "Suva"} | |
{"latitude": "60.08N", "country": "Finland", "longitude": "025.00E", "city": "Helsinki"} | |
{"latitude": "06.09N", "country": "Iceland", "longitude": "021.51W", "city": "Reykjavik"} | |
{"latitude": "28.37N", "country": "India", "longitude": "077.13E", "city": "New Delhi"} | |
{"latitude": "53.20N", "country": "Ireland", "longitude": "006.15W", "city": "Dublin"} | |
{"latitude": "41.48N", "country": "Italy", "longitude": "012.36E", "city": "Rome"} |
# encoding: utf-8 | |
""" | |
Quick script to dump out the long/lat of most of the capital cities in the world (I removed ones with unicode characters). | |
""" | |
import csv | |
import json | |
cities = u"""Bulgaria,Sofia,42.40N 023.18E | |
Czech Republic,Prague,50.06N 014.26E |
function(doc){ | |
index("default", doc._id); | |
if(doc.min_length){ | |
index("min_length", doc.min_length, {"store": "yes"}); | |
} | |
if(doc.diet){ | |
index("diet", doc.diet, {"store": "yes"}); | |
} | |
if (doc['class']){ | |
index("class", doc.['class'], {"store": "yes"}); |
from flask import Blueprint, current_app, request, jsonify | |
users = Blueprint('users', __name__) | |
@users.route('/<username>', methods=['GET', 'POST', 'PUT', 'DELETE']) | |
def profile(username): | |
messages = {'GET': 'info about %s' % username, | |
'POST': 'create account for %s' % username, |
from flask import Flask, url_for | |
from user_api import users | |
app = Flask(__name__) | |
app.register_blueprint(users, url_prefix='/users') | |
if __name__ == "__main__": | |
app.run(debug=True) |
$ python bookmark_test.py | |
all animals: [u'llama', u'elephant', u'lemur', u'zebra', u'badger', u'aardvark', u'giraffe', u'panda'] | |
[u'llama', u'elephant'] | |
g1AAAAETeJzLYWBgYMlgTWFQSElKzi9KdUhJMtLLTS3KLElMT9VLzskvTUnMK9HLSy3JAapkymMBkgwNQOr____7sxL53ew_MIBBIiOqKcYETTkAMeV_ViKrm_1vccUGkCkMqKYY4jElyQFIJtWDTWBys7-8uIoBiwkmeExIZEiyhzngxR0miDeyAOI8V1I | |
[u'zebra', u'badger'] | |
g2wAAAABaAVkACBkYmNvcmVAZGI0Lm1lcml0YWdlLmNsb3VkYW50Lm5ldGwAAAACYQBiP____2phBUY_6NwCAAAAAGEDag | |
[] | |
g2o | |
[u'llama', u'elephant', u'lemur', u'zebra'] | |
g1AAAAETeJzLYWBgYMlgTWFQSElKzi9KdUhJMtLLTS3KLElMT9VLzskvTUnMK9HLSy3JAapkymMBkgwNQOr____7sxL53ew_MIBBIiPxpiQyJNkD9WclsrrZv7jDBNbOjKrdkKAjDkAcATHlt7hiA8gUBuJNSXIAkkn1YBOY3OwvL64Cu4MhCwApB1dQ |
git clone git://github.com/drsm79/situp.git
cd situp
export PYTHONPATH=$PYTHONPATH:$PWD
chmod u+x situp.py
export PATH=$PATH:$PWD
To create my_view
in $PWD/_design/my_design
run:
situp.py view -d my_design my_view
This produces a skeleton map.js
and reduce.js
in $PWD/_design/my_design/views/my_view/
. If you want to use a built-in reduce (sum|count|stats) run:
situp.py view -d my_design my_view --count
bundle: { | |
// Files to bundle up that aren't css/js managed by release. Copied into | |
// same directory structure | |
files: ['*.html'], | |
// Folders to bundle up that aren't managed by release. Copy files and | |
// folders from src (key) to destination (value), relative to the | |
// destination parameter. | |
folders: {'assets/img':'assets/img', 'dist/release':''}, | |
destination: 'bundle' | |
} |
map: | |
function(doc) { | |
for (key in doc){ | |
emit(key, 1); | |
} | |
} | |
reduce: |