Skip to content

Instantly share code, notes, and snippets.

View mandric's full-sized avatar

Milan Andric mandric

View GitHub Profile
@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","[email protected]","http://ward45.org","4754 N. Milwaukee Ave.","Chicago","IL","60630","(312) 744-6841"
"Austin, Carrie M.","34","(773) 928-6961","[email protected]","507 W. 111th St. ", "Chicago","IL","60628","(312)744-6820","Budget Committee: http://committeeonthebudget.cityofchicago.org/index.html"
"Balcer, James","11","(773) 254-6677","[email protected]","http://www.11thward.com/","3659 S. Halsted St. ","Chicago","IL","60609","(312) 744-6663"
"Beale, Anthony","09","(773) 785-1100","[email protected]","http://www.ward09.cityofchicago.org/","34 East 112th Place ","Chicago","IL","60628","(312) 744-6838"
"Brookins, Jr."," Howard","21","(773) 881-9300","[email protected]","9011 S. Ashland Ave."," Unit B ","Chicago","IL","60620","(312) 744-4810"
"Burke, Edward M.","14","(773) 471-1414","[email protected]","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 [email protected] Error: Unsupported
npm ERR! error installing [email protected] at checkEngine (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:570:14)
npm ERR! error installing [email protected] at Array.0 (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! error installing [email protected] at LOOP (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:13)
npm ERR! error installing [email protected] at chain (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:4)
npm ERR! error installing [email protected] at installOne_ (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:548:3)
npm ERR! error installing [email protected] at installOne (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:488:3)
npm ERR! error installing [email protected] at /Users/mandric/local/node/lib/node_modules/npm/lib/install.js:425:9
npm ERR! error installing kanso@