Skip to content

Instantly share code, notes, and snippets.

Avatar

Max Ivak maxivak

View GitHub Profile
@maxivak
maxivak / _0__ssl_certbot_letsencrypt.md
Last active Nov 2, 2020
Let's encrypt SSL certificates using certbot in docker
View _0__ssl_certbot_letsencrypt.md

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 Feb 22, 2019
Issue with Carrierwave, ImageMagick with processing svg files
View imagemagick-svg.md

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 Nov 27, 2020
Webpack, Yarn, Npm in Rails
View webpacker_rails.md
@maxivak
maxivak / date_time_picker_rails.md
Last active Jul 22, 2020
Datetime picker in Rails app
View date_time_picker_rails.md

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 Oct 20, 2019
Rails: Audit Globalize translations
View audit_globalize.md
  • 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 Nov 21, 2017
web-site-checklist
View checklist.md

Error logging

  • log errors

    • on disk on server
  • notify errors

    • notify to slack or email or using other system
@maxivak
maxivak / readme.md
Created Oct 22, 2017
Dockerize Rails app
View readme.md

Rails app in Docker

@maxivak
maxivak / tabs-underline-bootstrap4.md
Created Oct 10, 2017
Bootstrap 4 tabs (pills) underlined
View tabs-underline-bootstrap4.md

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 May 14, 2020
Load code in libraries in Rails 5
View __readme.md

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 << Rails.root.join("lib")
You can’t perform that action at this time.