This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 six | |
| import inflection | |
| import marshmallow as ma | |
| class Model(object): | |
| def __init__(self, **kwargs): | |
| self._schema = self.Schema() | |
| self.load(**kwargs) |
This file contains hidden or 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
| """Approximate query count based on ANALYZE output for PostgreSQL and SQLAlchemy. | |
| Count logic borrowed from https://wiki.postgresql.org/wiki/Count_estimate | |
| ANALYZE borrowed from https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/Explain | |
| """ | |
| import re | |
| from sqlalchemy.ext.compiler import compiles | |
| from sqlalchemy.sql.expression import Executable, ClauseElement, _literal_as_text |
This file contains hidden or 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 hidden or 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 |
This file contains hidden or 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
| { | |
| "$schema": "http://json-schema.org/schema#", | |
| "title": ".about.yml", | |
| "type": "object", | |
| "properties": { | |
| "shortName": { | |
| "type": "string", | |
| "description": "" | |
| }, | |
| "fullName": { |