Skip to content

Instantly share code, notes, and snippets.

-- JSONB to text array
CREATE OR REPLACE FUNCTION jsonb_arr2text_arr(_js jsonb)
RETURNS text[] AS
$func$
SELECT ARRAY(SELECT jsonb_array_elements_text(_js))
$func$
LANGUAGE sql IMMUTABLE;
-- JSONB to int array
CREATE OR REPLACE FUNCTION jsonb_arr2int_arr(_js jsonb)
@urodoz
urodoz / _box_shadow.scss
Created July 29, 2016 07:22
Material Box Shadow SASS Mixin
@mixin box_shadow ($level) {
@if $level == 1 {
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
} @else if $level == 2 {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
} @else if $level == 3 {
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} @else if $level == 4 {
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
@urodoz
urodoz / clean_docker.sh
Last active September 12, 2022 18:17
Cleans the old images and exited containers
# Clean the exited containers
docker rm $(sudo docker ps -a | grep Exit | cut -d ' ' -f 1)
# Clean the untagged images (or old images)
docker rmi $(docker images | tail -n +2 | awk '$1 == "<none>" {print $'3'}')
# On Docker 1.9+ you can remove the orphan volumes with the next command
docker volume rm $(docker volume ls -qf dangling=true)
@urodoz
urodoz / countrycodes.yml
Created November 17, 2013 12:11
List of country iso codes ISO 3166-1 (alpha-2) translated to English, Spanish, Catalonian, French and German
#
# List of country codes and country ens.
#
# Data taken from: http://openconcept.ca/blog/mgifford/text_list_all_countries
#
countries:
AF:
en: "Afghanistan"
es: "Afganistán"
fr: "Afghanistan"