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 -*- | |
""" | |
wakatime.admin | |
~~~~~~~~~~~~~~ | |
Flask-Admin. | |
""" | |
from .views import admin |
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
-e git://github.com/kennethreitz/inbox.py.git@551b4f44b144564504c687cebdb4c543cb8e9adf#egg=inbox | |
alembic==0.8.3 | |
amqp==1.4.9 | |
anyjson==0.3.3 | |
boto==2.39.0 | |
braintree==3.20.0 | |
cairosvg==1.0.19 | |
celery==3.1.20 |
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
""" Example for Blog Post: | |
https://wakatime.com/blog/34-part-3-flask-api-decorators-and-helpers | |
""" | |
def oauth(required_scopes=[]): | |
def wrapper(func): | |
@wraps(func) | |
def inner(*args, **kwargs): | |
# don't check oauth tokens if user already logged in with session cookie |
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
/* responsive.less | |
* ~~~~~~~~~~~~~~~ | |
* | |
* Responsive helper classes for Bootstrap style margins, padding, aligning, and displaying per screen size. | |
* Works along with Bootstrap3. | |
*/ | |
//== Media queries breakpoints from Bootstrap3 | |
// Extra small screen / phone |
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
$.ajaxSetup({ | |
beforeSend: function(xhr, settings) { | |
if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') { | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? |
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 -*- | |
""" | |
More info: | |
http://flask.pocoo.org/docs/patterns/wtforms/ | |
http://pythonhosted.org/Flask-SQLAlchemy/ | |
https://flask-login.readthedocs.org/en/latest/ | |
""" | |
from flask import current_app, request, render_template, redirect, url_for | |
from myapp.models import User |
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 -*- | |
""" | |
wakatime.amqp | |
~~~~~~~~~~~~~ | |
Setup for Celery distributed task queue. | |
""" | |
import socket |
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 logging import getLogger, ERROR, Formatter, Filter | |
from logging.handlers import WatchedFileHandler | |
from wakatime import app | |
from wakatime.background import wakaq | |
TASK_LOG_FORMAT = '[%(asctime)s] %(hostname)s %(levelname)s in %(task)s args=%(task_args)s kwargs=%(task_kwargs)s retry=%(task_retry)s: %(message)s' | |
class TaskFilter(Filter): |
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 io import BytesIO | |
from subprocess import PIPE, Popen | |
from typing import Optional | |
from PIL import Image, ImageFile, UnidentifiedImageError | |
from PIL.Image import DecompressionBombError | |
SUPPORTED_IMAGE_FORMATS = ["PNG", "JPEG", "JPEG2000"] | |
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 __future__ import with_statement | |
from alembic import context | |
from alembic.util.compat import configparser | |
from sqlalchemy import engine_from_config, pool | |
from logging.config import fileConfig | |
import os | |
import re | |
import sys | |
basedir = os.path.abspath(os.path.dirname(__file__) + '/../') |