Skip to content

Instantly share code, notes, and snippets.

View gi0baro's full-sized avatar

Giovanni Barillari gi0baro

View GitHub Profile
@gi0baro
gi0baro / pydal_jsonb.py
Created June 13, 2017 15:39
Add jsonb postgres support to pydal
# -*- coding: utf-8 -*-
"""
Adds some PostgreSQL jsonb support to pydal.
Check https://www.postgresql.org/docs/9.6/static/functions-json.html for additional info.
In order to use operators you must specify the 'jsonb' type on `Field` class.
Included query operators:
- `@>`: db.where(db.table.jsonb_field.jcontains({"foo": "bar"}))
- `<@`: db.where(db.table.jsonb_field.jin({"foo": "bar"}))
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459