Skip to content

Instantly share code, notes, and snippets.

View C-ArenA's full-sized avatar

C-ArenA C-ArenA

View GitHub Profile
@C-ArenA
C-ArenA / notTimestampedTables.sql
Last active March 23, 2024 20:02
Get tables without Laravel timestamps in PostgreSQL
SELECT tables.table_name
FROM information_schema.tables as tables
LEFT JOIN(
SELECT t.table_name,
c.column_name,
c.is_nullable,
c.data_type
FROM information_schema.tables AS t
join information_schema.columns AS c ON c.table_name = t.table_name
WHERE t.table_schema = 'public'
@C-ArenA
C-ArenA / slugifier.py
Created September 25, 2021 01:24
Converts a string into a slug (It works for Spanish language)
def name_to_slug(name:str) -> str:
import unicodedata
lower_cased_name = name.lower()
# replaces spacews by "-"
hyphened_name = '-'.join(lower_cased_name.split())
# eliminates apostrophe
no_apost_name = ''.join(hyphened_name.split("'"))
# eliminates accentuation marks and ñ
# This part info: https://note.nkmk.me/en/python-split-rsplit-splitlines-re/
# https://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-normalize-in-a-python-unicode-string