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
""" | |
wakatime.geocoding_utils | |
~~~~~~~~~~~~~~~~~~~~~~~~ | |
Utils to get location from ip address. | |
""" | |
import traceback | |
import flag # https://pypi.org/project/emoji-country-flag |
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
/* | |
BSD 3-Clause License | |
Copyright (c) 2023 Alan Hamlett. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. |
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 uuid | |
import wtforms_json | |
from sqlalchemy import not_ | |
from sqlalchemy.dialects.postgresql import UUID | |
from wtforms import Form | |
from wtforms.fields import FormField, FieldList | |
from wtforms.validators import Length | |
from flask import current_app as app | |
from flask import request, json, jsonify, abort |
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__) + '/../') |
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 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
# -*- 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
# -*- 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
$.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
/* 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 |
NewerOlder