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
class MessagesHandler(tornado.web.RequestHandler): | |
@tornado.web.asynchronous | |
@tornado.gen.engine | |
def get(self): | |
db = self.settings['db'] | |
rb = [] | |
cursor = db.messages.find().sort([('_id', -1)]) | |
messages = yield motor.Op(cursor.to_list, length=50) | |
while messages: | |
[rb.append({'id': m['_id'], 'msg': m['msg']}) for m in messages] |
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
class MessagesHandler(tornado.web.RequestHandler): | |
@tornado.web.asynchronous | |
@tornado.gen.engine | |
def get(self): | |
db = self.settings['db'] | |
rb = [] | |
cursor = db.messages.find().sort([('_id', -1)]) | |
while (yield cursor.fetch_next) | |
message = cursor.next_object() | |
rb.append({ |
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
class MessagesHandler(tornado.web.RequestHandler): | |
@tornado.web.asynchronous | |
def get(self): | |
db = self.settings['db'] | |
self._response_buffer = [] | |
db.messages.find().sort([('_id', -1)]).each(self._found_callback) | |
def _found_callback(self, message, error): | |
if error: | |
raise tornado.web.HTTPError(500, error) |
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
Em.Handlebars.helper('md2html', function(options){ | |
console.log(options.hash.url); | |
var loading = '<i class="icon-refresh icon-spin icon-4x"></i> Loading...'; | |
var containerHtml = '<div id="'+options.hash.id+'">'+loading+'</div>'; | |
var errorHtml = '<i class="icon-frown icon-4x"></i> There has been an error...'; | |
md2html.get(options.hash.url, function(html){ | |
$('#'+options.hash.id).html(html); | |
}, function(){ | |
$('#'+options.hash.id).html(errorHtml); | |
}); |
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
# Input: | |
# 1. DynDNS style request: | |
# Input: | |
# Input: | |
# 1. DynDNS style request: | |
# modulepath = DynDNS | |
# queryurl = [Update URL]?[Query Parameters] | |
# | |
# 2. Self-defined module: | |
# modulepath = /sbin/xxxddns |
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
/** | |
* MaaSive.net JavaScript SDK. | |
* User: ntrepid8 | |
* Date: 8/17/13 | |
* Time: 8:03 PM | |
*/ | |
var maasive = (function(){ | |
var m = { | |
host: null |
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
/** | |
* Created with PyCharm. | |
* User: ntrepid8 | |
* Date: 9/9/13 | |
* Time: 4:55 PM | |
*/ | |
// Markdown Converter get it at https://code.google.com/p/pagedown/ | |
var converter = new Markdown.Converter(); |
NewerOlder