Skip to content

Instantly share code, notes, and snippets.

View CromonMS's full-sized avatar

Eugene CromonMS

View GitHub Profile
@CromonMS
CromonMS / 1 setup vps
Created August 6, 2018 19:18 — forked from PavloBezpalov/1 setup vps
Deploy Rails 5.1.1 to VPS(Ubuntu 16.04.2 LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL 9.6, RVM, Certbot
root# apt-get update
root# apt-get upgrade
// dependencies for Ruby
root# apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev \
libpcre3-dev unzip
// Node.js v7
root# curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
@CromonMS
CromonMS / capybara.rb
Created September 17, 2017 18:04 — forked from guzart/capybara.rb
Capybara configuration to run a webpack dev server for e2e testing
# spec/support/capybara.rb
require 'capybara/rails'
require 'capybara/rspec'
# port and url to webpack server
WEB_TEST_PORT = '5005'.freeze
WEB_TEST_URL = "http://localhost:#{WEB_TEST_PORT}".freeze
def capybara_wait_for_webpack_server
10.times.each do |_|
@CromonMS
CromonMS / OUTPUT.md
Created July 29, 2017 11:13 — forked from rmm5t/OUTPUT.md
How to properly introduce a new counter_cache to an existing Rails project.

Fast/efficient approach:

-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
   -> 1.3197s

Slow/naïve approach: