View stddev.js
This file contains 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
// standard deviation MongoDB aggregation pipline | |
// using method from http://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods | |
var parts = db.stat.aggregate( { $group: { _id: null, | |
s0: {$sum:1}, | |
s1:{$sum:"$stat"}, | |
s2:{$sum:{$multiply:["$stat","$stat"]}} }} ).result[0]; | |
var stddev = Math.sqrt( parts.s0 * parts.s2 - Math.pow( parts.s1, 2) ) / parts.s0 |
View gridfsBinaryTest.py
This file contains 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
## import the necessary libraries | |
from io import BytesIO | |
from pymongo import MongoClient | |
import gridfs | |
import random | |
from math import ceil | |
## delete all versions of the file | |
def deleteFile(db, fs, name): | |
oldFile = db['fs.files'].find_one({"filename":name}) |
View not_indexing_fields
This file contains 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
DELETE /storedvsunstoredtest | |
## notice I disable the _all text index and the index: no setting on field2 | |
PUT /storedvsunstoredtest | |
{ | |
"settings": { | |
"number_of_replicas": 0, | |
"number_of_shards": 3 | |
}, | |
"mappings": { |
View videogame2ES.py
This file contains 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
## Dependencies in order for this to work | |
## 1) google spreadsheet lib: https://github.com/burnash/gspread | |
## pip install gspread | |
## 2) oauth2 lib: http://gspread.readthedocs.org/en/latest/oauth2.html | |
## pip install oauth2client | |
## 3) create a "service account" in your google api console following the instructions from the oauth2 lib above |
View alias_filters.sense
This file contains 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
DELETE /foo | |
PUT /foo | |
{ | |
"settings": { | |
"number_of_replicas": 0, | |
"number_of_shards": 1 | |
}, | |
"mappings": { | |
"people": { |
View config.xqy
This file contains 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
xquery version "1.0-ml" ; | |
(: config.xqy | |
This library module holds configuration | |
variables for the application | |
:) | |
module namespace cfg = "http://framework/lib/config"; | |
(: The rewrite library route configuration |
View header.html
This file contains 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
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<link href='http://fonts.googleapis.com/css?family=Aguafina+Script|Vast+Shadow' rel='stylesheet' type='text/css'/> | |
<link rel="stylesheet" href="/css/mobshake-jm.min.css"/> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile.structure-1.0rc2.min.css"/> | |
<link rel="stylesheet" href="/css/mobshake.css" /> | |
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script> |
View config-snip.xqy
This file contains 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
<get path="play/:id/act/:act/scene/:scene/speech/:speech"><to>play#scene</to></get> | |
<get path="search"><to>search#get</to></get> | |
<post path="search"><to>search#get</to></post> |
View circles.xqy
This file contains 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
xquery version "1.0-ml"; | |
(: a whole bunch of random circles to make the reverse-query harder :) | |
let $n := 10000 | |
for $count in (1 to $n) | |
let $lat := xdmp:random(180) - 90 | |
let $lon := xdmp:random(360) - 180 | |
let $query-doc := | |
View event.xml
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<event> | |
<name>Bethesda</name> | |
<point>38.9846520, -77.0947092</point> | |
</event> |
OlderNewer