Skip to content

Instantly share code, notes, and snippets.

@maxivak
maxivak / _0__ssl_certbot_letsencrypt.md
Last active September 21, 2024 18:14
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@maxivak
maxivak / imagemagick-svg.md
Last active September 29, 2022 18:25
Issue with Carrierwave, ImageMagick with processing svg files

Issue with Carrierwave, ImageMagick (or MiniMagick) with processing svg files

Problem:

When uploading svg file with Carrierwave you may get an error:

Failed to manipulate with MiniMagick, maybe it is not an image? 
Original Error: `identify /tmp/mini_magick20190222-32759-1g7lnmy.svg` failed with error:

@maxivak
maxivak / webpacker_rails.md
Last active November 3, 2024 21:38
Webpack, Yarn, Npm in Rails
@maxivak
maxivak / date_time_picker_rails.md
Last active March 7, 2022 19:36
Datetime picker in Rails app

Date time picker in Rails app

There are several options to make Date input in Rails application:

  • Default inputs from simple_form
  • HTML 5 date input
  • Text input with jQuery UI Date time picker
  • Other plugins for date input with Bootstrap 4
@maxivak
maxivak / audit_globalize.md
Last active August 30, 2023 17:10
Rails: Audit Globalize translations
  • Globalize adds model translations to ActiveRecord models.
  • Audited is an ORM extension that logs all changes to your models.

Using Audited gem it will only logs changes to the base model and ignore changes to the translation table.

Below is how to add audited to the translation model.

Audited and Globalize

@maxivak
maxivak / checklist.md
Last active November 21, 2017 15:36
web-site-checklist

Error logging

  • log errors

    • on disk on server
  • notify errors

    • notify to slack or email or using other system
@maxivak
maxivak / web_development.md
Last active November 21, 2017 15:35
Web development
@maxivak
maxivak / readme.md
Created October 22, 2017 16:13
Dockerize Rails app

Rails app in Docker

@maxivak
maxivak / tabs-underline-bootstrap4.md
Created October 10, 2017 11:04
Bootstrap 4 tabs (pills) underlined

Bootstrap 4 tabs (or pills) rendered underline.

  • SASS:

_pills_underline_varibles.scss - edit styles using variables

$nav-pills-underline-link-active-color: $link-color !default;
$nav-pills-underline-link-hover-color: $link-hover-color !default;

$nav-pills-underline-bg:    transparent !default;
@maxivak
maxivak / __readme.md
Last active January 19, 2024 15:00
Load code in libraries in Rails 5

Load lib files in production (Rails 5)

If you have your code defined in classes in lib/ folder you may have problems to load that code in production.

Autoloading is disabled in the production environment by default because of thread safety.

Change config/application.rb:

    config.autoload_paths << Rails.root.join("lib")
 config.eager_load_paths &lt;&lt; Rails.root.join("lib")