Skip to content

Instantly share code, notes, and snippets.

View MaxMorais's full-sized avatar
🏢
Building Solutions in Tech

Maxwell Morais MaxMorais

🏢
Building Solutions in Tech
View GitHub Profile
from webclient import *
server = "http://myaccount.erpnext.com/server.py"
user = "your user name"
password = "your password"
login()
customer = get_doc("Customer", customer_name)
@MaxMorais
MaxMorais / maskedentry.py
Last active October 24, 2023 12:06
Masked Entry Widget for TkinterFormWidget for Tkinter - Like web2py FormWidget, with label, entry and tooltipTo future, ensure validation.
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
# Name: maskedit.py
# Purpose:
#
# Author: Maxwell Morais ([email protected])
#
# Created: 10/04/2013
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
from StringIO import StringIO
font = ImageFont.load_default()
input = StringIO(self.request.get("img"))
img = Image.open(input)
draw = ImageDraw.Draw(img)
from PIL import Image
def get_white_noise_image(width, height):
pil_map = Image.new("RGBA", (width, height), 255)
random_grid = map(lambda x: (
int(random.random() * 256),
int(random.random() * 256),
int(random.random() * 256)
), [0] * width * height)
pil_map.putdata(random_grid)
# coding: utf-8
u"""
Redimensionamento proporcional de imagem, com base na altura, feito com um simples cálculo de proporção.
Ex:
+------+ 10 15 (altura desejada para a nova imagem)
| | -- x --
| 10x5 | 5 x (largura proporcional a nova altura)
| |
+------+ (10 x x) = (5 x 15)
10x = 75

Sete Atitudes para Hackear a Indústria de Software

By Klaus Wuestefeld

1) Torne-se excelente.

Seja realmente bom em alguma coisa. Não fique só choramingando ou querendo progredir às custas dos outros. Não pense q pq vc sentou 4 anos numa faculdade ouvindo um professor falar sobre software q vc sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo

# This widget requires jQuery-iMask to run
#https://github.com/cwolves/jQuery-iMask
def numeric_widget_factory():
import locale, string, random
from gluon.sqlhtml import StringWidget
from gluon import current
from gluon.http import HTTP
T = current.T
@MaxMorais
MaxMorais / linkinput.py
Last active August 1, 2016 13:54
Web2Py Link Widget [UNDER DEVELOPMENT] This widget adds 3 new features to AutoCompleteWidget` ```      - Search: Allows the user to easily locate a record.      - Preview: Allows the user to view the records referenced.      - Add: Allows the user to add and self-references a record. ```
#-*- coding: utf-8 -*-
from gluon.sqlhtml import AutoCompleteWidget
from gluon.contrib.simplejson import loads
class LinkWidget(AutoCompleteWidget):
AGGREGATION = 'agg'
CONDITION = 'condition'
FIELD = 'fieldname'
QUERY = 'query'
@MaxMorais
MaxMorais / moneyinput.py
Last active November 10, 2017 19:33
Web2py MoneyInput Widget
# This widget requires jQuery-iMask to run
#https://github.com/cwolves/jQuery-iMask
def money_widget_factory(international=False):
import locale, string, random
from gluon.sqlhtml import StringWidget
from gluon import current
from gluon.http import HTTP
T = current.T
@MaxMorais
MaxMorais / currency.json
Last active December 11, 2015 07:18
I18N Money Support
// Display Source http://www.thefinancials.com/Default.aspx?SubSectionID=curformat
{
'default': {
"symbol": null,
"display": "#,###.##"
},
"AFN": {
"symbol": null,
"display": "######"
},