Skip to content

Instantly share code, notes, and snippets.

Avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / read-access.sql
Last active Feb 18, 2020 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
View read-access.sql
-- 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
View 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
View app-model-document.rb
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 Mar 26, 2013 — forked from Asenar/gist:5246483
smalte-migration_03-26-2013.sh
View 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