Skip to content

Instantly share code, notes, and snippets.

View MaxMorais's full-sized avatar
🏢
Building TechMax Soluções

Maxwell Morais MaxMorais

🏢
Building TechMax Soluções
View GitHub Profile
{background-color: #465455} // barra superior
BUSCA
{background-color: #ECEDEF} // campo busca
{background-color: #5A6668} // botão busca
{background-color: #FFFFFF} // ícone busca
{background-color: #2D2D2D} // fundo
Description
"""
Inspired by http://code.activestate.com/recipes/578253-an-entry-with-autocompletion-for-the-tkinter-gui/
Changes:
- Fixed AttributeError: 'AutocompleteEntry' object has no attribute 'listbox'
- Fixed scrolling listbox
- Case-insensitive search
- Added focus to entry field
- Custom listbox length, listbox width matches entry field width
- Custom matches function
"""
from functools import wraps
from flask import Flask, request, Response
app = Flask(__name__)
def check_auth(username, password):
"""This function is called to check if a username /
password combination is valid.
"""
return username == 'username' and password == 'pass'
# coding: utf-8
from weasyprint import HTML, CSS
from weasyprint.document import _prepare
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box
from webclient import *
server = "http://myaccount.erpnext.com/server.py"
user = "your user name"
password = "your password"
login()
customer = get_doc("Customer", customer_name)
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