Skip to content

Instantly share code, notes, and snippets.

View thiagodiniz's full-sized avatar
🏠
Working from home

Thiago Diniz thiagodiniz

🏠
Working from home
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
SELECT
users.email, gateway_wallets.id as gateway_wallet_id,
count(payments.id) FILTER (WHERE total_amount_in_cents > 25000) AS payments_count_min,
count(payments.id) FILTER (WHERE total_amount_in_cents <= 25000) AS payments_count,
((count(payments.id) FILTER (WHERE total_amount_in_cents > 25000) * 8) +
(count(payments.id) FILTER (WHERE total_amount_in_cents <= 25000) * 3)) as cost
FROM payments
left outer join gateway_wallets on gateway_wallets.id = payments.gateway_wallet_id
left outer join users on users.id = gateway_wallets.user_id
where payments.aasm_state = 'pending'
@thiagodiniz
thiagodiniz / html_parser.py
Created July 4, 2019 18:07
HTML 2 DOCX @ Python
# -*- coding: utf-8 -*-
import io
import requests
from bs4 import NavigableString, BeautifulSoup
from docx import Document as DocxDocument
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Cm, Pt, Mm
from docx.image.exceptions import UnrecognizedImageError
from lxml import etree
@thiagodiniz
thiagodiniz / .gitignore
Created August 15, 2011 14:01
My git ignore file
# Application source #
######################
app/views/*/.tmp_*
tmp/**/*
/.bundle
/vendor/bundle
.rspec
.sass-cache/
# Logs and databases #