Skip to content

Instantly share code, notes, and snippets.

@luiz
luiz / enum-values.sql
Created February 2, 2026 19:12
Get enum type allowed values (Postgres)
SELECT
n.nspname AS enum_schema,
t.typname AS enum_name,
e.enumlabel AS enum_value
FROM
pg_type t
JOIN
pg_enum e ON t.oid = e.enumtypid
JOIN
pg_namespace n ON n.oid = t.typnamespace
@luiz
luiz / foreign-keys.sql
Last active February 2, 2026 19:09
Find foreign keys from/to a table (Postgres)
select distinct
fk_tco.table_schema || '.' || fk_tco.table_name as fk_table_name,
'>-' as rel,
pk_tco.table_schema || '.' || pk_tco.table_name as primary_table_name
from information_schema.referential_constraints rco
join information_schema.table_constraints fk_tco
on rco.constraint_name = fk_tco.constraint_name
and rco.constraint_schema = fk_tco.table_schema
join information_schema.table_constraints pk_tco
on rco.unique_constraint_name = pk_tco.constraint_name
@luiz
luiz / preprocess-sass.ts
Last active August 12, 2019 15:37
Code that does not compile with Svelte 3.8.0 and Typescript 3.5.3
import * as sass from 'node-sass';
import * as svelte from 'svelte/compiler';
import * as fs from 'fs';
import { promisify } from 'util';
const renderSass = promisify(sass.render);
const readFile = promisify(fs.readFile);
const preprocessSass = async (data: string) => {
const result = await renderSass({ data });
@luiz
luiz / menu-example.html
Last active February 1, 2016 23:04
Example of menu tag usage
<article>
<h1>Using the correct tags in HTML</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et iaculis
risus. Quisque quis magna diam. Suspendisse aliquet urna eu erat pretium, et
scelerisque odio pulvinar. Nullam fermentum diam nibh, vel eleifend ipsum
tempus ut. Nunc accumsan ligula eget tellus vestibulum, sit amet euismod quam
molestie. Integer feugiat urna sed enim hendrerit vestibulum. Suspendisse
ullamcorper, nisi non mollis eleifend, est nunc sagittis augue, nec convallis
eros est ultrices sem. Curabitur pretium condimentum nulla. Sed convallis augue
vitae metus interdum commodo nec in nulla. Vivamus vulputate eleifend semper.
@luiz
luiz / dabblet.css
Created December 11, 2014 13:56
CSS text balloon using variables, calc and transform
/* CSS text balloon using variables, calc and transform */
@import url(http://fonts.googleapis.com/css?family=Chewy);
div {
--balloon-color: #FFF;
--balloon-border: 3px;
position: relative;
top: 1em;
left: 1em;
@luiz
luiz / dabblet.css
Last active August 29, 2015 14:10
Pulsating multiple borders with box-shadow & var
/* Pulsating multiple borders with box-shadow & var */
body {
--bg: #6495ED;
background-color: var(--bg);
}
div {
--border-size: 4px;
width: 50%;
height: 10em;
background-color: white;
@luiz
luiz / dabblet.css
Created November 28, 2014 17:34
transform order test
/* transform order test */
html,body {
height: 100%;
margin: 0;
padding: 0;
}
div {
width: 100px;
height: 100px;
background: red;
@luiz
luiz / async-define.js
Last active August 29, 2015 14:09 — forked from sergiolopes/async-define.js
AMD-compatible 'define' with async and exports support
/*
AMD-compatible async 'define' modularization by sergiolopes and luiz:
https://gist.github.com/luiz/d71c99cf1cda53190e70
Contains the 'define' module syntax compatible with the official API and
support for injecting the 'export' variable and a flexible dependency
resolver with no restrictions on how you load your files.
This implementation doesn't load your JS files so you have to do it. You
can bundle one big file, load multiple files, load them asynchronously, out
@luiz
luiz / dabblet.css
Created October 27, 2014 14:19
:lang pseudoclass tests
/* :lang pseudoclass tests */
:lang(fr) > p {
background-color: yellow;
}
:lang(fr) > strong {
font-style: italic;
}
strong:lang(pt) {
color: red;
}
@luiz
luiz / dabblet.css
Created August 11, 2014 20:24 — forked from anonymous/dabblet.css
Untitled
html,body {
height: 100%;
}
body:before {
content: '';
height: 100%;
display: inline-block;
vertical-align: middle;
}
meter {