Skip to content

Instantly share code, notes, and snippets.

Max Ivak maxivak

Block or report user

Report or block maxivak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 Jul 7, 2019
Webpack, Yarn, Npm in Rails
View webpacker_rails.md
@maxivak
maxivak / date_time_picker_rails.md
Last active Apr 4, 2019
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 Mar 20, 2018
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 Aug 21, 2019
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")
@maxivak
maxivak / readme.md
Last active Dec 28, 2018
Restore repo from Gitlab bundle file
View readme.md

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git
You can’t perform that action at this time.