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 gevent | |
from gevent.event import AsyncResult | |
import gevent.pool | |
import gevent.queue | |
class WorkerQueue(object): | |
def __init__(self): | |
self.group = gevent.pool.Group() | |
self.q = gevent.queue.Queue() |
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
from piston.handler import BaseHandler | |
from models import Apple | |
class AppleHandler(BaseHandler): | |
exclude = () # Ensure that the ID is shown. | |
allowed_methods = ('GET', 'POST', 'PUT', 'DELETE') | |
model = Apple |
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
var template = function(ctx, tpl) { | |
var accum = [], idx = 0; | |
while (true) { | |
var start = tpl.indexOf('{{', idx); | |
if (start < 0) break; | |
var end = tpl.indexOf('}}', start); | |
if (end < 0) break; | |
var str = tpl.slice(start+2, end); |
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
inspect = (o) -> | |
alert(JSON.stringify(o)) | |
# GWT-style module injection | |
class Module | |
constructor: (m) -> | |
@extend(m) | |
extend: (m) -> | |
for k, v of m |
NewerOlder