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
#!/usr/bin/env python | |
""" | |
JSON encoder/decoder adapted for use with Google App Engine NDB. | |
Usage: | |
import ndb_json | |
# Serialize an ndb.Query into an array of JSON objects. | |
query = models.MyModel.query() |
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
#!/usr/bin/env python | |
""" | |
AppStats serializer module which converts App Engine profile data from Protocol Buffers into JSON. | |
Usage: | |
import appstats_serializer | |
# List all AppStats summaries: | |
appstats_dicts = appstats_serializer.appstats_to_dict(summaries_only=True) |
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
/** | |
* Usage: | |
* var MyRouter = Backbone.Router.extend(_.extend({}, OptionalRouteMixin, { | |
* userRoutes: { | |
* '/profile': 'profile' | |
* }, | |
* initialize: function(options) { | |
* this._bindOptRoutes(this.userRoutes); | |
* } | |
* })); |
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
// Last Sync timestamp mixin. Works for Models and Collections. | |
var LastSync = { | |
// Update lastSync with current timestamp. | |
_timestampSync: function() { | |
this.lastSync = new Date(); | |
}, | |
// Note: Call LastSync.initialize.apply(this) from the Model/Collection .initialize. | |
initialize: function() { | |
// Setup lastSync to timestamp sync events. | |
this.lastSync = null; |
NewerOlder