Skip to content

Instantly share code, notes, and snippets.

@Jpuelpan
Jpuelpan / custom_file_store.rb
Last active September 7, 2015 00:49 — forked from bradpauly/custom_file_store.rb
simple file store for rails sessions
module ActionDispatch
module Session
class CustomFileStore < ActionDispatch::Session::AbstractStore
def get_session(env, session_id)
session_data = {}
session_id ||= generate_sid
File.open(tmp_file(session_id),'r') do |f|
data = f.read
session_data = ::Marshal.load(data) unless data.empty?
end rescue nil
require 'yaml'
require 'logger'
require 'active_record'
namespace :db do
def create_database config
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
create_db = lambda do |config|
ActiveRecord::Base.establish_connection config.merge('database' => nil)
@Jpuelpan
Jpuelpan / unicorn.rb
Last active September 3, 2015 18:50 — forked from rodw/pid-file-daemon.sh
Unicorn Basic configuration
APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
worker_processes 1
working_directory APP_ROOT
timeout 30
listen APP_ROOT + "/tmp/appname.sock", backlog: 64
listen "127.0.0.1:8080", tcp_nopush: true