Skip to content

Instantly share code, notes, and snippets.

@kez
kez / slugify.sql
Created May 13, 2019 14:50 — forked from ianks/slugify.sql
Generating Slugs in Postgres
CREATE EXTENSION IF NOT EXISTS "unaccent"
CREATE OR REPLACE FUNCTION slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
WITH "unaccented" AS (
SELECT unaccent("value") AS "value"
),
-- lowercases the string
"lowercase" AS (
@kez
kez / xvfb
Created March 13, 2012 13:22 — forked from dmitriy-kiriyenko/console
Init.d to start/stop xvfb. Put it into /etc/init.d and chmod it to 755
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
XVFB=/usr/bin/Xvfb
XVFBARGS=":0 -screen 0 1024x768x24 -fbdir /var/run -ac"