Skip to content

Instantly share code, notes, and snippets.

View Epigene's full-sized avatar

Augusts Bautra Epigene

View GitHub Profile
@Epigene
Epigene / Puma auto startup workflow.md
Last active October 26, 2015 13:06
Puma auto startup workflow

Set up production puma config file

# in config/puma.rb
app = "shproduct" # App-specific
root = "/home/deployer/apps/#{app}"

workers  6
threads  1, 1
@Epigene
Epigene / Latest DF Installation workflow
Last active August 29, 2015 14:17
Latest DF Installation workflow
1. DL the latest binary from DF homepage at
http://www.bay12games.com/dwarves/
2. DL minimal soundsense from Copy Public/pakas
Unrar, place in DF folder
3. DL latest therapist at https://github.com/splintermind/Dwarf-Therapist or
http://www.bay12forums.com/smf/index.php?topic=122968
4. DL Quickfort
@Epigene
Epigene / Rails dev Ubuntu
Last active August 29, 2015 14:19
Setting up Rails dev environment on Ubuntu as of 2015
If you are on windows, start by setting up an Ubuntu in a VirtualBox
= http://www.psychocats.net/ubuntu/virtualbox
First you wanna update Ubuntu
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo reboot
Add repositories
@Epigene
Epigene / deploy.rb
Created April 28, 2015 10:54
Fully setup deployment of rails application with mina
# Mina Deploy
# ===========
#
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015
# On first deploy do: mina setup --verbose
# Then do : mina deploy --trace
#
# Usage:
# mina deploy --verbose # Standard deploy task | mina deploy[hard,seed] to hard-reset and seed
# mina rake[db:seed]

This is just a jotting of notes on how to embed Faye into a single Rails process. Makes it nice to do simple real time things without the need for a separate Faye server/process.

Also uses Faye Redis to work across load balanced Rails apps.

You also need to copy the compiled javascript into vendor/assets/javascripts and include into application.js manifest.

Ignore the numbers in the file names... just used to add order to the Gist.

This uses the faye/faye Github repo at edc5b42f6560d31eae61caf00f6765a90e1818d1 since I wanted to use with the Puma rack server and that is only available in the master branch (until Faye 1.0)

@Epigene
Epigene / Sync Realtime Workflow.md
Last active February 10, 2016 13:43
Integrating Sync realtime partials in a rails app | Estimated difficulty: Medium, time required: 65 minutes

Setup (ABandoned, awaiting Rails5 ActionCable)

1 Setup gems

We will be using puma instead of thin.

gem 'faye'
gem 'puma'
gem 'sync', '~> 0.3.0'
@Epigene
Epigene / BootPuma.md
Last active October 29, 2015 12:08
Boot puma on Ubuntu server boot using Upstart and RVM gemset wrapper

1. Make a wrapper for production gemset

rvm gemdir #=> get current gemset
rvm alias create <app_name> <app_gemset>
# rvm alias create test ruby-2.1.2@test

Find the wrapper path

echo $rvm_path/wrappers/
@Epigene
Epigene / deploy.rb
Last active June 14, 2019 06:01
Mina deployment file for rails applications
# Mina Deploy
# ===========
#
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015
# On first deploy do: mina setup --verbose
# Then do : mina deploy[initialize] --trace
#
# Usage examples:
# mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production
# mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]'
@Epigene
Epigene / rails_request_object
Last active August 29, 2015 14:23
Rails 4 request object
request
.env={
"rack.version"=>[1,3]
"rack.errors\"=>#<IO:<STDERR>>
"rack.multithread\"=>false
"rack.multiprocess\"=>false
"rack.run_once\"=>false
"SCRIPT_NAME\"=>\"\"
"CONTENT_TYPE\"=>\"text/plain\"
"QUERY_STRING\"=>\"param1=true&param2=false\"
@Epigene
Epigene / gist:47c059a825acd4445e61
Created June 27, 2015 12:54
First Data FDL response (error) codes
RESPONSE_CODES = {
"000" => "Approved",
"001" => "Approved, honour with identification",
"002" => "Approved for partial amount",
"003" => "Approved for VIP",
"004" => "Approved, update track 3",
"005" => "Approved, account type specified by card issuer",
"006" => "Approved for partial amount, account type specified by card issuer",
"007" => "Approved, update ICC",
"100" => "Decline (general, no comments)",