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 blueprint import example | |
from extensions import mail | |
from flask import Flask | |
import settings | |
def create_app(settings=settings): | |
ret_val = Flask(__name__) | |
ret_val.config.from_object(settings) | |
# initialize extensions... |
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
/********************************************************** | |
ADOBE SYSTEMS INCORPORATED | |
Copyright 2005-2010 Adobe Systems Incorporated | |
All Rights Reserved | |
NOTICE: Adobe permits you to use, modify, and | |
distribute this file in accordance with the terms | |
of the Adobe license agreement accompanying it. | |
If you have received this file from a source |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
pkgtag | |
~~~~~~ | |
Execute git-tag based on package versions. | |
""" | |
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 | |
try: | |
from pip import get_installed_distributions | |
except ImportError: | |
from sys import exit | |
exit("pip not available") | |
from pkg_resources import parse_version |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head prefix="fb: http://ogp.me/ns/fb# og: http://ogp.me/ns#"> | |
<meta charset="utf-8" /> | |
<title>[localhost]</title> | |
<meta property="og:url" content="https://gist.github.com/4219899" /> | |
<meta property="og:site_name" content="[localhost]" /> | |
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 re | |
def duplicates(module): | |
"""Determine if the given module contains multiple definitions for the | |
same constant. | |
:param module: The module to check. | |
""" | |
ret_val = set() |
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
def diff(module1, module2): | |
"""Determine the difference in constant definitions between two modules. | |
:param module1: First module with constants. | |
:param module2: Second module with constants. | |
""" | |
_and = {} | |
_or = {} | |
_xor = {module1: {}, module2: {}} |
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 blueprint import example | |
from extensions import celery, mail | |
from flask import Flask | |
import settings | |
def create_app(settings=settings): | |
ret_val = Flask(__name__) | |
ret_val.config.from_object(settings) | |
# initialize extensions... |
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
def survivor(count): | |
if count >= 2: | |
survivors = range(1, count + 1) | |
start = 1 | |
last = survivors[-1] | |
while len(survivors) > 1: | |
survivors = survivors[start::2] | |
start = 1 if last == survivors[-1] else 0 | |
last = survivors[-1] |
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 -*- | |
""" | |
LRU Cache. | |
:author: Jonathan Zempel | |
""" | |
from threading import Lock | |
from unittest import main, TestCase | |
NewerOlder