Skip to content

Instantly share code, notes, and snippets.

@mandric
mandric / gist:983745
Created May 20, 2011 20:37
phenny module
"""
Phenny module for a readthedocs.com docs push.
"""
import urllib2
def readthedocs(phenny, input):
"""Start a docs build on medic-dashboard.readthedocs.org."""
req = urllib2.Request(url='http://readthedocs.org/build/806', data='')
f = urllib2.urlopen(req)
res = f.read()
@mandric
mandric / gist:1127917
Created August 5, 2011 16:29
install kanso
git clone https://github.com/caolan/kanso
cd kanso
git checkout dev
make install
exports['clinic totals'] = function(test) {
var args = { group_level: 1 };
var sum = function(data) {
var t = 0;
for (var i in data.rows) {
t += data.rows[i].value;
}
return t;
};
<receiver android:name="StartupReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
/**
* Update functions to be exported from the design doc.
*/
var _ = require('underscore')._
exports.add_sms = function (doc, req) {
// add validation
var new_doc = _.extend(req.form, {_id: req.uuid});
// support Ushahidi response protocol
{
"payload": {
"task": "send",
"secret": "secret_key",
"messages": [
{
"to": "+000-000-0000",
"message": "the message goes here",
"callback": "POST http://server/url?id=123&param=true"
},
@mandric
mandric / gist:1424480
Created December 2, 2011 19:20
couchdb regex test
// fails in couchbase single server, you can test in Futon by pasting into Custom Test
couchTests.custom_test = function(debug) {
var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
db.deleteDb();
db.createDb();
if (debug) debugger;
var testregexDoc = {
_id: "_design/testregex",
@mandric
mandric / gist:1488631
Created December 17, 2011 00:13
Chicago Aldermen
"Person Name","Ward","Ward Phone","E-mail","Web Site","Ward Office","City","State","Zip","City HallPhone","Web Site 2"
"Arena, John","45","(773) 286-4545","ward45@cityofchicago.org","http://ward45.org","4754 N. Milwaukee Ave.","Chicago","IL","60630","(312) 744-6841"
"Austin, Carrie M.","34","(773) 928-6961","caustin@cityofchicago.org","507 W. 111th St. ", "Chicago","IL","60628","(312)744-6820","Budget Committee: http://committeeonthebudget.cityofchicago.org/index.html"
"Balcer, James","11","(773) 254-6677","jbalcer@cityofchicago.org","http://www.11thward.com/","3659 S. Halsted St. ","Chicago","IL","60609","(312) 744-6663"
"Beale, Anthony","09","(773) 785-1100","ward09@cityofchicago.org","http://www.ward09.cityofchicago.org/","34 East 112th Place ","Chicago","IL","60628","(312) 744-6838"
"Brookins, Jr."," Howard","21","(773) 881-9300","ward21@cityofchicago.org","9011 S. Ashland Ave."," Unit B ","Chicago","IL","60620","(312) 744-4810"
"Burke, Edward M.","14","(773) 471-1414","eburke@cityofchicago.org","2650 W.
// passes in couchbase single server, you can test in Futon by pasting into Custom Test
couchTests.custom_test = function(debug) {
var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
db.deleteDb();
db.createDb();
if (debug) debugger;
var testregexDoc = {
_id: "_design/testregex",
$ npm install -g kanso
npm ERR! error installing kanso@0.1.2 Error: Unsupported
npm ERR! error installing kanso@0.1.2 at checkEngine (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:570:14)
npm ERR! error installing kanso@0.1.2 at Array.0 (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! error installing kanso@0.1.2 at LOOP (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:13)
npm ERR! error installing kanso@0.1.2 at chain (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:4)
npm ERR! error installing kanso@0.1.2 at installOne_ (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:548:3)
npm ERR! error installing kanso@0.1.2 at installOne (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:488:3)
npm ERR! error installing kanso@0.1.2 at /Users/mandric/local/node/lib/node_modules/npm/lib/install.js:425:9
npm ERR! error installing kanso@