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
create extension if not exists "unaccent"; | |
create or replace function slugify(name text) | |
returns text as $$ | |
begin | |
return trim( | |
regexp_replace( | |
unaccent(lower(name)), | |
'[^0-9a-z]+', |
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
# -*- coding: utf-8 -*- | |
import os | |
import re | |
import subprocess | |
from copy import copy | |
from difflib import unified_diff | |
from sqlalchemy import create_engine |
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
# -*- coding: utf-8 -*- | |
from fabric.state import env | |
from fabric.api import cd, local, run, abort, task | |
from fabric.context_managers import prefix | |
def worktree(cmd): | |
with prefix('source /usr/bin/virtualenvwrapper.sh'): | |
with cd(env.repo_path): | |
with prefix('cd `git config --get core.worktree`'): |
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 |
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
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
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
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
<!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
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 |
NewerOlder