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(); |
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
# 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
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
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
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 | |
@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.gen.coroutine | |
def get(self): | |
db = self.settings['db'] | |
rb = [] | |
cursor = db.messages.find().sort([('_id', -1)]) | |
messages = yield cursor.to_list(length=50) | |
while messages: | |
[rb.append({'id': m['_id'], 'msg': m['msg']}) for m in messages] | |
messages = yield cursor.to_list(length=50) |
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
import requests | |
import time | |
import random | |
from hashlib import sha1 | |
import hmac | |
import binascii | |
from getpass import getpass | |
from urllib import urlencode, quote, quote_plus | |
from urlparse import parse_qs | |
from pprint import pprint, pformat |
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
require 'Unirest' | |
require 'json' | |
puts "testing" | |
begin | |
url = "http://stage.maasive.net/v2.4/5379f153b2c4271b06d88351/plays/" | |
parameters = { | |
:user_score=>5, | |
:alien_score=>1, |
OlderNewer