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 logging | |
import gevent | |
from thrift.server.TServer import TServer | |
# XXX Hackish, but should be safe: monkey patch gevent socket support into | |
# Thrift. Overall I think this is cleaner than reimplementing all of TSocket. | |
from thrift.transport import TSocket; TSocket.socket = gevent.socket | |
from thrift.transport.TTransport import TTransportException |
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
$ curl -d 'hello world' http://pushyrobot.appspot.com/push/swapoff.org/m6I02zmlA | |
<pre>Traceback (most recent call last): | |
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 512, in __call__ | |
handler.post(*groups) | |
File "/base/data/home/apps/pushyrobot/1.340741887312755514/pushy/receive.py", line 19, in post | |
if self._pushy.handle_push(self.request.path, self.request.body): | |
File "/base/data/home/apps/pushyrobot/1.340741887312755514/pushy/pushy.py", line 23, in handle_push | |
self._reply_to_wave(wave_id, wavelet_id, message) | |
File "/base/data/home/apps/pushyrobot/1.340741887312755514/pushy/pushy.py", line 27, in _reply_to_wave |
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
type TaskNode struct { | |
children []*Node | |
} | |
func (self *Task) AddChild(node *TaskNode) { | |
self.children = append(self.children, node) | |
} | |
func (self *Task) ChildAt(index int) *TaskNode { | |
return self.children[index] |
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
# -*- coding: utf-8 -*- | |
# golang.py - sublimelint package for checking golang files | |
import glob | |
import os | |
import re | |
import subprocess | |
from base_linter import BaseLinter, INPUT_METHOD_FILE |
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 injector import Module, inject, singleton | |
from flask import Flask, Request, jsonify | |
from flask.ext.cache import Cache | |
from flask.ext.injector import Builder, route, decorator | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm.exc import NoResultFound | |
from sqlalchemy import Column, String | |
""" |
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 itertools | |
import functools | |
import fnmatch | |
import os | |
from StringIO import StringIO | |
import yaml | |
from yaml.parser import ParserError | |
import voluptuous as V |
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
if (typeof console !== undefined) { | |
console.logJack = console.log; | |
console.log = function(){ | |
console.groupCollapsed.apply(console, arguments); | |
console.logJack(new Error().stack); | |
console.groupEnd(); | |
}; | |
} | |
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
models.User.objects.order_by('date_joined').extra({'day_joined': 'date(date_joined)', 'hour_joined': 'hour(date_joined)'}).values('day_joined', 'hour_joined').annotate(joined_count=Count('id')) |
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 injector import * | |
class Session(object): | |
def __init__(self, key, site): | |
self.key = key | |
self.site = site | |
SessionKey = Key('SessionKey') |
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 contextlib import contextmanager | |
@contextmanager | |
def patch(owner, attr, value): | |
"""Monkey patch context manager. | |
with patch(os, 'open', myopen): | |
... | |
""" | |
old = getattr(owner, attr) |
OlderNewer