Skip to content

Instantly share code, notes, and snippets.

View GeorgePaiva's full-sized avatar
💻
Java Developer

George Paiva GeorgePaiva

💻
Java Developer
View GitHub Profile
@danparanhos
danparanhos / sgf-util-eletro
Last active January 6, 2020 14:11
Consultas úteis para sistema SGF ELETRO
-- Contratos e Parcelas Parados (TODOS) (Executar após confirmação de todas as pendências)
select
c.id as "Nº Contrato",
case
when c.situacao_contrato = 4 then 'EM ANDAMENTO'
when c.situacao_contrato = 10 then 'EM ATRASO'
end as "Situação do Contrato",
pf.nome as "Cliente (PF)",
pj.nome_fantasia as "Cliente (PJ)",
(select pf.nome from core.pessoa pe
@adrianoluis
adrianoluis / DocumentUtil.java
Last active May 4, 2024 16:12
Utility class to validate CPF and CNPJ document types. For CPF use isValidSsn and for CNPJ use isValidTfn. Added to repo https://github.com/adrianoluis/misc-tools
public class DocumentUtil {
// CPF
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
// CNPJ
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2};
private static int sum(int[] weight, char[] numbers, int length) {
if (length <= 0) return 0;