Skip to content

Instantly share code, notes, and snippets.

@jb-l
jb-l / FillingHtmlForm_barcode_camera_or_usb.html
Created August 20, 2024 15:28
This html page is an example of a form, allowing to be filled with either a usb barcode reader or Binary Eye (very nice barcode reader in Android)
<!-- Working example (20/08/2024) : Filling html form with either usb barcode reader or a camera in Android using Binary Eye (use the default browser to first fill the form (Firefox, Chrome or Samsung Internet...)) -->
<!doctype html>
<html lang=en>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="Provencale SA">
@jb-l
jb-l / test_fieldList.py
Last active December 3, 2017 21:07
Flask WTForms example for dynamic list (javascript) with data stored in a String (database)
# -*- coding: utf-8 -*-
"""
Example of a dynamic list (add, remove button handled on client side) with data stored in a classic String in database.
Works with Flask, Flask-WTForms, flask-SQLAlchemy (uses SQL lite for easy testing)
Inspired from https://gist.github.com/kageurufu/6813878
"""
import itertools
from flask import Flask, render_template_string
from flask import request
@jb-l
jb-l / flask_logging_smtp.py
Last active September 28, 2016 12:34
Quick Flask example of sending logged error via smtp
"""
This is a modification from another gist of doobeh :
https://gist.github.com/doobeh/cc9bf2a6709721ed270b
The actual emission is separated in another thread to avoid delaying the server answear in case of long smtp response
See: http://stackoverflow.com/questions/8616617/how-to-make-smtphandler-not-block
"""
import logging
from flask import Flask
@jb-l
jb-l / forms.py
Created September 22, 2016 09:57
A custom DateTime WTForms field that assumes the input is in a certain timezone and converts to UTC for database, model...
"""
This code can be considered Public domain.
I did not find this elsewhere, so here is my first Gist
"""
## Import theses from the app config or user...
TIMEZONE = 'Europe/Paris'
INPUT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm"
##