Skip to content

Instantly share code, notes, and snippets.

View alexandreaquiles's full-sized avatar

Alexandre Aquiles alexandreaquiles

View GitHub Profile
@rponte
rponte / using-uuid-as-pk.md
Last active April 22, 2024 21:42
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@rponte
rponte / StringUtils.java
Last active April 10, 2024 23:01
Removing accents and special characters in Java: StringUtils.java and StringUtilsTest.java
package br.com.triadworks.rponte.util;
import java.text.Normalizer;
public class StringUtils {
/**
* Remove toda a acentuação da string substituindo por caracteres simples sem acento.
*/
public static String unaccent(String src) {
@rponte
rponte / get-latest-tag-on-git.sh
Last active March 11, 2024 07:50
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@jezen
jezen / Io Example Problems
Created December 15, 2013 13:17
The example problems have gone missing from the Io language website, so here’s a backup.
#Sample code
#Hello world
"Hello world!" print
#Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
@rponte
rponte / Sorteio.java
Last active January 19, 2023 19:34
Algoritimos: Encontrar menor lance (valor) único em uma lista
import static java.util.Comparator.naturalOrder;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.counting;
import static java.util.stream.Collectors.groupingBy;
import java.util.stream.Collectors;
import java.util.stream.Comparator;
import java.util.*;
public class Sorteio {
@ldaniel
ldaniel / _aviso.md
Created May 16, 2012 12:18
Crítica à comunidade .NET

Aviso importante

"Às vezes, um charuto é apenas um charuto."

Não almejamos mais seguidores no Twitter, leitores para o blog ou amigos no Facebook. Somos, assumidamente (e com discreto orgulho), pessoas pouco sociáveis. Sim, esta crítica é, nesse caso, apenas uma crítica.

@leandronet e @mantov

@rponte
rponte / Proposal.kt
Last active April 10, 2022 12:43
JPA and Hibernate: best way to mapping a primary key as UUID in MySQL 8.x
@Entity
class Proposal(
val name: String,
//
@Column(columnDefinition = "binary(16)") // this works but uses a MySQL's specific type
val customerId: UUID
) {
@Id
@GeneratedValue
@rponte
rponte / Intervalo_t.sql
Last active January 19, 2022 16:21
PL/SQL: exemplo de Objeto com estado e comportamentos no Oracle - Intervalo (Date Range)
--------------------------------------------------------
-- Representa um Intervalo de datas (Date Range)
-- https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/10_objs.htm
--------------------------------------------------------
create or replace type Intervalo_t FORCE as Object (
inicio Date
,fim Date
-- Construtores
,Constructor Function Intervalo_t(inicio Date, fim Date) Return Self as Result
@fmasanori
fmasanori / super salários USP.py
Created July 4, 2017 23:27
Super Salários USP
"""
Autores:
Tiago Henrique da Cruz Pereira
João Felipe de Moraes Borges
"""
import threading
import time
import os
from urllib.request import urlopen