Skip to content

Instantly share code, notes, and snippets.

View akprasad's full-sized avatar

Arun Prasad akprasad

  • Evergrow
View GitHub Profile
@akprasad
akprasad / flask_admin_enum.py
Last active June 12, 2018 23:30
Adds flask-admin support for the SQLAlchemy "Enum Recipe" on zzzeek's blog (http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/).
# -*- coding: utf-8 -*-
"""
flask-admin and "The Enum Recipe"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds flask-admin support for the enum recipe on zzzeek's blog_.
This code is specific to SQLAlchemy.
.. _blog http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/
@akprasad
akprasad / README.md
Last active December 19, 2015 20:59
Get and set caret / cursor position in any text field (input, textarea, etc.)

caret.js

Get and set the caret / cursor position in a text field (textarea, input, etc.). Tested on a few modern browsers and works as advertised.

namespace.getCaretPosition(el)

Get the caret position in el.

namespace.setCaretPosition(el, pos)

Set the caret position in el to position pos.