Skip to content

Instantly share code, notes, and snippets.

View nelsoncbf's full-sized avatar
:octocat:

Nelson Fonseca nelsoncbf

:octocat:
  • Software Enginer at Mambo Wifi
  • Campinas, Brasil
  • 07:26 (UTC -03:00)
View GitHub Profile
@nelsoncbf
nelsoncbf / Estados Brasileiros Python Array WTForms SelectField
Last active October 14, 2020 20:38
Estados Brasileiros Python Array WTForms SelectField
from flask_wtf import FlaskForm
from wtforms.fields import SelectField
def opcoes_UF():
return [
("AC", "Acre"),
("AL", "Alagoas"),
("AP", "Amapá"),
("AM", "Amazonas"),
("BA", "Bahia"),
@nelsoncbf
nelsoncbf / expiration.py
Last active September 14, 2022 20:40
set expiration in redis python keys
from apiman.redis import db
from datetime import timedelta
def set_expiration(data):
c = 0
for x in data:
if 'analytics' in x:
db.expire(x, timedelta(minutes=20))
print(f'Implementada expiração em {c} chaves')
@nelsoncbf
nelsoncbf / Clipboard.js
Created May 2, 2023 03:25 — forked from rproenca/Clipboard.js
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');