This file contains hidden or 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
var endtable = require('endtable'); | |
var engine = new endtable.Engine({ | |
database: 'people_example', | |
username: 'xxxxxx', | |
password: 'xxxxxx', | |
host: 'xxxxxx.couchone.com', | |
}); |
This file contains hidden or 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
var Person = endtable.Object.extend( | |
{ | |
sayName: function() { | |
sys.puts('Hello, my name is ' + this.name + '!'); | |
} | |
}, | |
{ | |
engine: engine, | |
type: 'person' | |
} |
This file contains hidden or 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
var ben = new Person({ | |
name: 'Benjamin Coe', | |
age: 27, | |
sex: 'male', | |
interests: ['climbing'] | |
}) | |
ben.interests.push('programming') |
This file contains hidden or 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
new Person().load({ | |
keys: 'age', | |
startkey: 28, | |
endkey: 50 | |
}, function(error, people) { | |
for (var i = 0; i < people.length; i++) { | |
people[i].sayName(); | |
} | |
}) |
This file contains hidden or 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
from mongate.connection import Connection | |
connection = Connection( | |
'example.com', | |
27080, | |
https=True, | |
auth=True, | |
username='auth_username', | |
password='auth_password' | |
) |
This file contains hidden or 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
upstream mongo_rest { | |
server 127.0.0.1:xxxx; | |
server 127.0.0.1:xxxx; | |
server 127.0.0.1:xxxx; | |
} | |
server { | |
listen xxxxx; | |
ssl on; | |
server_name example.com; |
This file contains hidden or 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 time | |
def retry(f): | |
MAXIMUM_RETRIES = 24 | |
SLEEP_TIME = 5 | |
def wrapper(*args): | |
for tries in range(0, MAXIMUM_RETRIES): |
This file contains hidden or 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
def _get_email_uuid(self, message_id): | |
try: | |
typ, data = self.connection.fetch(message_id, '(X-GM-MSGID)') | |
# 1 (X-GM-MSGID 1363378113778197832) | |
mid_regex = re.compile(r'^.* \(.* ([0-9]*)\)$') | |
match = mid_regex.match(data[0]) | |
if match: | |
raw_hex = hex( int( match.group(1) ) ) | |
# 0x12ebb12bc64aa548L |
This file contains hidden or 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
from pytoad import pytoad_decorator | |
@pytoad_decorator() | |
def foobar(): | |
raise Exception('banana') |
This file contains hidden or 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
@pytoad_decorator(monitored_exceptions=[StandardError, LookupError]) | |
def foo(): | |
raise StandardError('banana') |