Skip to content

Instantly share code, notes, and snippets.

View cazzer's full-sized avatar
🦆

Caleb cazzer

🦆
View GitHub Profile
@cazzer
cazzer / schema.sql
Last active November 26, 2016 06:29
Row Level Security: Schema
create role application_user;
grant all on all tables in schema public
to application_user;
create table users (
name text not null primary key,
role text unique not null
);
create table data (
@cazzer
cazzer / policy.sql
Last active November 26, 2016 06:15
Row Level Security: Policy
alter table data enable row level security;
create policy data_owner
on data
for all
to application_user
using (
(
select true as bool from (
select data_id from user_data where user_role = current_user
@cazzer
cazzer / trigger.sql
Last active November 26, 2016 06:16
Row Level Security: Trigger
create or replace function insert_user_data()
returns trigger
as $$
begin
insert into user_data (data_id, user_role) values (
new.id,
current_user
);
return new;
end
@cazzer
cazzer / gist:c288733272e9157eefb7
Last active April 8, 2019 16:58
Keybase Proof
### Keybase proof
I hereby claim:
* I am cazzer on github.
* I am calebthebrewer (https://keybase.io/calebthebrewer) on keybase.
* I have a public key whose fingerprint is 65D8 991A 874D 68C1 3104 6C0F F58C 5E9F 199D B5EE
To claim this, I am signing this object:
@cazzer
cazzer / _gradients.scss
Last active August 29, 2015 13:59 — forked from mihar/_gradients.sass
Converted to SCSS
@mixin gradient($from, $to) {
/* fallback/image non-cover color */
background-color: $from;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient($from, $to);
/* Safari 4+, Chrome 1+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
/* Safari 5.1+, Chrome 10+ */