Skip to content

Instantly share code, notes, and snippets.

@kramer65
kramer65 / doc_view.py
Last active August 29, 2015 14:18
Flask caching endpoint for images stored MongoDB
@app.route('/doc/<docId>')
def getDoc(docId):
userDoc = UserDocument.objects(id=docId).first() # I use MongoEngine to query my mongodb instance
if not userDoc:
return abort(404)
desiredWidthStr = request.args.get('width')
desiredHeightStr = request.args.get('height')
if desiredWidthStr or desiredHeightStr:
@kramer65
kramer65 / JodaDateTimeSerializer.java
Created September 26, 2013 11:06
Serializer for Joda DateTime with ActiveAndroid ORM.
package com.activeandroid.serializer;
import org.joda.time.DateTime;
public final class JodaDateTimeSerializer extends TypeSerializer {
public Class<?> getDeserializedType() {
return DateTime.class;
}
public Class<?> getSerializedType() {