Skip to content

Instantly share code, notes, and snippets.

View OleksandrPoltavets's full-sized avatar
🇺🇦
🇧🇪🇪🇺🇺🇸

Alex Poltavets OleksandrPoltavets

🇺🇦
🇧🇪🇪🇺🇺🇸
  • Brussels, Belgium
  • 16:31 (UTC +02:00)
View GitHub Profile
@ruslan-oliinyk
ruslan-oliinyk / deploy_with_kamal.md
Last active September 20, 2024 20:30
Deploy Rails app with Kamal

Deploying a Rails app to cloud services using Docker and Kamal (a library for deploying apps containerized with Docker).

https://kamal-deploy.org/

1. Create a new app

rails new APP_NAME -d postgresql -j esbuild -c bootstrap --skip-test

cd APP_NAME
@VasylShevchenko
VasylShevchenko / terminal-git-branch-name.md
Last active October 24, 2021 15:49 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

Version 1

@mocon
mocon / .bash_profile
Created May 31, 2017 16:06
Example `.bash_profile` file
# Edit this file
alias aliases="nano ~/.bash_profile" # usage: type `aliases` in Terminal
# Navigate to location
alias home="cd ~"
alias desktop="cd ~/Desktop/"
alias repos="cd ~/Documents/Repos/"
# Navigate to project directory
alias ds="clear && cd ~/Documents/Repos/design-system"
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active September 21, 2024 00:27
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@PavloBezpalov
PavloBezpalov / 1. ELK.install
Last active January 5, 2024 16:14
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@PavloBezpalov
PavloBezpalov / 1 Gist conventions
Last active January 7, 2024 11:55
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@PavloBezpalov
PavloBezpalov / 1 Gist conventions
Last active August 30, 2019 14:40
Deploy Rails 4.2.6 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL.
<<USER>> <<APP>> change this variables

RouteTranslator gem is wrapping the current locale assignment in an around_filter set_locale_from_url and then resets it to the previous value.

Devise has a FailureApp to deal with unauthenticated requests, and it uses I18n to build the flash message and the redirection URL. But at that stage, the I18n default locale is set and the messages and URL are not localized in the context of the request (i.e. if the request URL is in French, and the default locale of the app is English, Devise will redirect to the English URL with an english flash message).

This is a solution for propagating the application locale to the the Devise middleware.