Skip to content

Instantly share code, notes, and snippets.

View JulienBreux's full-sized avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / read-access.sql
Last active February 18, 2020 17:24 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT CONNECT ON DATABASE _database_name_ TO readaccess;
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO readaccess;
-- Grant access to future tables
@JulienBreux
JulienBreux / puma.sh
Last active August 29, 2015 14:21 — forked from runlevel5/puma.sh
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
class Document < ActiveRecord::Base
belongs_to :parent, class_name: 'Document'
def self.get_ancestors(who)
@tree ||= []
# @tree is instance variable of Document class object not document instance object
# so: Document.get_instance_variable('@tree')
if who.parent.nil?
@JulienBreux
JulienBreux / smalte-migration_03-26-2013.sh
Created March 26, 2013 17:07 — forked from Asenar/gist:5246483
smalte-migration_03-26-2013.sh
mkdir ~/tmp_working_dir
cd ~/tmp_working_dir
git init full_smalte
cd full_smalte
all_subs="installer framework module.sample tests theme.backoffice.default theme.frontoffice.default"
# part 1 : import all
# Six branch doomed to die