Skip to content

Instantly share code, notes, and snippets.

@kmikael
kmikael / dispatch_async
Created June 13, 2014 15:06
Update `dispatch_async` to take a default `queue`
import Dispatch
func dispatch_async(queue: dispatch_queue_t = dispatch_get_main_queue(), block: dispatch_block_t) {
Dispatch.dispatch_async(queue, block)
}
dispatch_async {
// Update the UI
}
@kmikael
kmikael / pg_parse_url.sql
Last active August 29, 2015 14:02
PostgreSQL Parsers
SELECT t.alias, p.token
FROM ts_parse('default', 'http://www.postgresql.org/docs/9.4/static/textsearch-parsers.html') AS p
NATURAL JOIN ts_token_type('default') AS t;
-- alias | token
-- ----------+------------------------------------------------------------
-- protocol | http://
-- url | www.postgresql.org/docs/9.4/static/textsearch-parsers.html
-- host | www.postgresql.org
-- url_path | /docs/9.4/static/textsearch-parsers.html