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
# 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
// add a trigger on field "custom_field1"
cur_frm.cscript.custom_field1 = function(doc, cdt, cdn) {
// update a new field "custom_field3"
doc.custom_field3 = flt(doc.custom_field1)*flt(doc.custom_field2)/1000;
// refresh in form
refresh_field('custom_field3');
}
@MaxMorais
MaxMorais / flatten_wsdl.py
Created October 29, 2015 16:00 — forked from pavelpatrin/flatten_wsdl.py
Нерабочий вариант функции для схлопывания wsdl-схем
def _get_flatten_wsdl(self, url):
"""
Выполняет загрузку wsdl-схемы и зависимых файлов и объединяет их
в единый файл.
Ускоряет загрузку wsdl-схемы для клиента.
TODO: реализовать.
:type url: unicode
@MaxMorais
MaxMorais / gist:a066b2350ed2f7c28c2b
Created October 3, 2015 04:16 — forked from nanonyme/gist:6268358
brainstorming on suds + python-requests thinamabob, MIT-licensed
from suds.transport import Transport, Reply
from suds.client import Client
import requests
from StringIO import StringIO
class RequestsTransport(Transport):
def open(self, request):
""" suds assumes urllib2 which doesn't have keepalives so things can go royally wrong if it doesn't
read the entire request. Hence, read it all up and give a StringIO object instead.
@MaxMorais
MaxMorais / DE.py
Last active August 29, 2015 14:26 — forked from jumbojet/DE.py
Dynamic Expression Parsing
''' expressionString = IF Variable_3 > 1000 RETURN VARIABLE_3* VARIABLE_1 END IF Variable_3 < 1000 RETURN VARIABLE_3* VARIABLE_2 END '''
def parse_expression(expressionString):
expressionStringArray = filter(None,expressionString.split("END"))
''' expressionStringArray[0] = IF Variable_3 > 1000 RETURN VARIABLE_3* VARIABLE_1
expressionStringArray[1] = IF Variable_3 < 1000 RETURN VARIABLE_3* VARIABLE_2 '''
for expression in expressionStringArray:
expConditionResult = expression.strip().split("RETURN")
<style>
table.black {
background-color: #000 !important;
height: 1px;
width: 100%;
}
table.black > tr > td {
color: white;
{%- macro add_header(page_num, max_pages, doc) -%}
{%- if doc.meta.is_submittable and doc.docstatus==2-%}
<div class="alert alert-danger text-center">
<h4 style="margin: 0px;">{{ _("CANCELLED") }}</h4></div>
{%- endif -%}
{% if max_pages > 1 %}
<p class="text-right">{{ _("Page #{0} of {1}").format(page_num, max_pages) }}</p>
{% endif %}
{%- endmacro -%}
def gera_boleto():
import datetime
import pyboleto
from pyboleto.bank.caixa import BoletoCaixa
from pyboleto.pdf import BoletoPDF
import os
listaDadosCaixa = []
for i in range(2):
d = BoletoCaixa()
{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