Skip to content

Instantly share code, notes, and snippets.

@freiden
freiden / rails http status codes
Created September 11, 2018 08:40 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@freiden
freiden / macos_minikube_install.md
Last active August 26, 2017 20:57
Installation of minikube on MacOS

1/ Install Docker for Mac through DMG

2/ Install minikube with Homebrew:

  • brew cask install minikube

3/ Install kubernetes-cli with Homebrew:

  • brew install kubectl

4/ Install xhyve driver:

  • brew install docker-machine-driver-xhyve

Speed up integration tests in Rails 5 app

Rails 5 recompiles templates on every request in test env. Fix will be released only in 5.0.2.

Add this lines to test helper to get the performance now (I've got x2 improvement):

class << ActionView::LookupContext::DetailsKey
 def clear

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

Install ree with the following commands: CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rbenv install ree-1.8.7-2012.02
@freiden
freiden / deploy.rb
Created October 23, 2013 08:58 — forked from thbar/deploy.rb
# cap deploy deploy:db_schema_load
namespace :deploy do
desc "Load the initial schema - it will WIPE your database, use with care"
task :db_schema_load, :roles => :db, :only => { :primary => true } do
puts <<-EOF
************************** WARNING ***************************
If you type [yes], rake db:schema:load will WIPE your database
any other input will cancel the operation.
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <[email protected]>
# Copyright:: 2007-2010 The Authors
@freiden
freiden / gist:6308681
Created August 22, 2013 15:25
Example logrotate sidekiq
# rotate log files daily, keep 32 days
daily
rotate 32
# create new (empty) log files after rotating old ones
create
compress