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 _Bar(object): | |
pass | |
class Foo(object): | |
def __init__(self): | |
self._bar = None | |
@property |
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 -*- | |
"""Tornado / Celery / sockets proof of concept | |
To run: | |
$ celery -A app worker | |
$ python app.py | |
""" | |
import os | |
import socket | |
import random |
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 asyncio | |
import aiohttp | |
import tornado.web | |
import tornado.options | |
import tornado.concurrent | |
import tornado.platform.asyncio | |
URL = '...' | |
UPLOAD_URL = '...' |
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 abc | |
import math | |
import collections | |
import six | |
@six.add_metaclass(abc.ABCMeta) | |
class Paginator(object): | |
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 nodeIds = db.node.find({ | |
is_public: true, | |
is_registration: false | |
}).map(function(node) { | |
return node._id; | |
}); | |
function reducer(key, values) { | |
var count = 0; | |
for (var i=0; i<values.length; i++) { |
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
# TODO: Make this work with konch @sloria | |
from IPython.extensions import autoreload | |
ip = get_ipython() # noqa | |
autoreload.load_ipython_extension(ip) | |
ip.magics_manager.magics['line']['autoreload']('2') |
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
"""Utilities for annotating workshop RSVP data.""" | |
import re | |
import logging | |
from dateutil.parser import parse as parse_date | |
from modularodm import Q | |
from modularodm.exceptions import ModularOdmException |
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 | |
# encoding: utf-8 | |
""" | |
Examples :: | |
$ ./cron.py | |
$ forever -c `which python` cron.py | |
""" | |
import datetime |
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 time | |
import random | |
from webservices import rest | |
from webservices.common import models | |
rest.app.app_context().push() | |
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
drop table if exists ofec_sched_a_aggregate_zip; | |
create table ofec_sched_a_aggregate_zip as | |
select | |
cmte_id, | |
rpt_yr + rpt_yr % 2 as cycle, | |
contbr_zip as zip, | |
sum(contb_receipt_amt) as total | |
from sched_a | |
where rpt_yr >= 2011 | |
group by cmte_id, cycle, zip |
OlderNewer