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 pycountry | |
class CountrySelectField(SelectField): | |
def __init__(self, *args, **kwargs): | |
super(CountrySelectField, self).__init__(*args, **kwargs) | |
self.choices = [(c.alpha3, c.name) for c in pycountry.countries] |
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 unittest | |
import os | |
import django.core.handlers.wsgi | |
from ghost import GhostTestCase | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | |
app = django.core.handlers.wsgi.WSGIHandler() | |
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
# middlewares.py | |
import threading | |
_thread_locals = threading.local() | |
def get_current_user(): | |
"""Returns the current user.""" | |
return getattr(_thread_locals, 'user', None) |
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 os | |
import sys | |
from alembic import context | |
from sqlalchemy import engine_from_config | |
from logging.config import fileConfig | |
sys.path.append(os.getcwd()) | |
from models import metadata | |
from myapp import app |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="Leaflet/dist/leaflet.css" type="text/css" /> | |
</head> | |
<body> | |
<div id="map-canvas" style="height: 500px; width: 90%; margin: 0 auto;"> | |
</div> | |
<script type="text/javascript" src="Leaflet/dist/leaflet.js"></script> | |
<script type="text/javascript"> |
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
sysPath = require 'path' | |
express = require 'express' | |
oauth = require 'oauth' | |
_appSecret = "myawesomesecret" | |
_githubUrl = "https://github.com/login" | |
_githubKey = "xxxxxxxxxxxxxx" | |
_githubSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
_githubCallBack = "http://my.app/signin/callback" |
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 numpy | |
from PIL import Image, ImageDraw | |
import scikits.audiolab as audiolab | |
class Waveform(object): | |
"""Creates a waveform image for given wave audio file. | |
:param soundfile: The path to the wave file. | |
:param width: The output image width as an optional integer. |
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 unittest | |
@manager.command | |
@manager.option('-p', '--path', help='Path to specific test(s).') | |
def test(path=None, verbosity=1): | |
"""Runs tests. | |
""" | |
loader = unittest.TestLoader() | |
if path is None: |
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
class GroupSet(Set): | |
class __distillery__: | |
__model__ = Group | |
class admin: | |
name = 'admin' | |
class UserSet(Set) | |
class __distillery__: |
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 sqlalchemy.sql.expression import Executable, ClauseElement | |
class InsertFromSelect(Executable, ClauseElement): | |
_execution_options = \ | |
Executable._execution_options.union({'autocommit': True}) | |
def __init__(self, table, columns, select): | |
self.table = table | |
self.columns = columns |
OlderNewer