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
| " make sure vim-plug is installed, https://github.com/junegunn/vim-plug | |
| call plug#begin() | |
| Plug 'tpope/vim-sensible' | |
| Plug 'morhetz/gruvbox' | |
| Plug 'bling/vim-airline' | |
| Plug 'w0rp/ale' | |
| Plug 'scrooloose/nerdtree' | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'tpope/vim-surround' | |
| Plug 'ctrlpvim/ctrlp.vim' |
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 functools import wraps | |
| def jsonp(func): | |
| """Wraps JSONified output for JSONP requests.""" | |
| @wraps(func) | |
| def decorated_function(*args, **kwargs): | |
| from flask import request, current_app | |
| import re | |
| callback = request.args.get('callback', False) |
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 collections | |
| def convert(data, charset, func): | |
| from functools import partial | |
| convert_charset_func = partial(convert, charset=charset, func=func) | |
| if isinstance(data, basestring): | |
| return getattr(data, func)(charset) | |
| elif isinstance(data, collections.Mapping): | |
| return type(data)(map(convert_charset_func, data.iteritems())) |
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
| """Distributing lock.""" | |
| from contextlib import contextmanager | |
| SLEEP_SECONDS = .1 | |
| @contextmanager | |
| def redis_lock(redis_client, key, timeout, expires): | |
| """Redis based lock.""" | |
| import time |