Skip to content

Instantly share code, notes, and snippets.

View antonfefilov's full-sized avatar
🚀
To infinity and beyond!

Anton Fefilov antonfefilov

🚀
To infinity and beyond!
  • Georgia, Tbilisi
View GitHub Profile
@antonfefilov
antonfefilov / README-Template.md
Created February 7, 2017 13:31 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@antonfefilov
antonfefilov / bootstrap.sh
Created November 26, 2015 10:38 — forked from keo/bootstrap.sh
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
index
home
top
help
about
security
contact
connect
support
faq
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@antonfefilov
antonfefilov / long_method_refactored.rb
Last active August 29, 2015 14:07
Refactored long method
ActiveAdmin.register SchedulingConstraint, as: 'Capacity' do
menu priority: 7, label: 'Ride Later Capacity'
config.sort_order = 'starting_at_asc,ending_at_asc'
NO_CONFLICT = -1
CONFLICT = -2
collection_action :capacities, method: :get do
respond_to do |format|

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
# config/initializers/active_admin.rb
require 'active_admin_custom_filter'
ActiveAdmin.setup do |config|
# ...
end
# Add these two gems
gem 'ice_cube', '0.9.3'
gem 'squeel', '1.0.16'

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

Brakeman setup:

Create ignore file, please name it .brakeman-ignore

bin/brakeman --interactive-ignore

Add to script/ci

bin/brakeman --quiet --skip-libs --exit-on-warn --ignore-config=.brakeman-ignore