- SublimeCodeIntel: "IntelliSense" for Sublime. Provides context-sensitive symbol/argument completion for a bunch of languages, Python included.
- SublimeLinter: Shows lint/compile errors in realtime for a whole bunch of languages.
- SyncedSideBar: Expands the sidebar to show the currently open file.
- SideBarEnhancements: Adds a bunch of very useful context-menu entriest to the sidebar.
- Color Highlighter: Highlight text that describes a color, in that color eg. #FFFFFF will show up as white, "red" will show up as red, and so on
- DashDoc: Open the currently selected symbol in Dash (document viewer).
- DocBlockr: Helper for Java-style documentation blocks.
- Git: Useful stuff for Git, like viewing diffs in Sublime.
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
from injector import Module, Injector, provides, inject, singleton | |
from some_credit_card_provider import CreditCardConnection, CreditCardVendor | |
class CreditCardProcessor(object): | |
def __init__(self, vendor, connection): | |
self.vendor = vendor | |
self.connection = connection | |
def charge_order(self, card, amount): |
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
logging.FINE = 7 | |
logging.FINER = 5 | |
logging.FINEST = 1 | |
logging.addLevelName(logging.FINE, 'FINE') | |
logging.addLevelName(logging.FINER, 'FINER') | |
logging.addLevelName(logging.FINEST, 'FINEST') | |
logging.Logger.fine = lambda self, *args, **kwargs: self.log(logging.FINE, *args, **kwargs) | |
logging.Logger.finer = lambda self, *args, **kwargs: self.log(logging.FINER, *args, **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
import inspect | |
from abc import ABCMeta | |
class SignatureValidatingABCMeta(ABCMeta): | |
"""An ABCMeta that validates the method signatures of concrete implementations. | |
That is, given: | |
class Class(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
from contextlib import contextmanager | |
@contextmanager | |
def patch(owner, attr, value): | |
"""Monkey patch context manager. | |
with patch(os, 'open', myopen): | |
... | |
""" | |
old = getattr(owner, attr) |
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
from injector import * | |
class Session(object): | |
def __init__(self, key, site): | |
self.key = key | |
self.site = site | |
SessionKey = Key('SessionKey') |
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
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 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
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 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 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 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
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 | |
""" |