This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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+ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name No Alerts | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table if not exists items ( | |
id uuid default uuid_generate_v4() not null primary key, | |
value text, | |
acl_read uuid[] default array[]::uuid[], | |
acl_write uuid[] default array[]::uuid[] | |
); | |
-- e.g. ('f386...5e99', 'I row and therefore I am', {'eac6...f6c9'}, {'0fdc...947f'}) | |
create index read_permissions_index on items using gin(acl_read); | |
create index write_permissions_index on items using gin(acl_write); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create policy item_owner | |
on items | |
as permissive | |
for all | |
to application_user | |
using ( | |
items.acl_read && regexp_split_to_array(current_setting('jwt.claims.roles'), ',')::uuid[] | |
or items.acl_write && regexp_split_to_array(current_setting('jwt.claims.roles'), ',')::uuid[] | |
) | |
with check ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table if not exists users_and_groups ( | |
id uuid default uuid_generate_v4() not null primary key, | |
name text not null | |
); | |
-- e.g. ('eac6...f6c9', 'alice') or ('0fdc...947f', 'E Corp') | |
create table if not exists items ( | |
id uuid default uuid_generate_v4() not null primary key, | |
value text, | |
public boolean default false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create policy item_owner | |
on items | |
as permissive | |
for all | |
to application_user | |
using ( | |
items.public = true | |
or exists( | |
select item_id | |
from permissions |
OlderNewer