Skip to content

Instantly share code, notes, and snippets.

@lorenadl
lorenadl / gitlab-add-ssh-key.md
Last active February 22, 2024 18:06
[GitLab] Adding a new SSH Key in user profile

How to add a new SSH Key to GitLab

Generate the public/private key pair

First of all check if the system already has a SSH key:

  • Windows command line:

    type %userprofile%\.ssh\id_rsa.pub

  • Linux command:

@lorenadl
lorenadl / rails_active_storage_how_to_validate_file_type.md
Last active January 25, 2024 00:11
[Rails] Active Storage how to validate file type

Rails Active Storage how to restrict uploadable file types

Active Storage doesn't have validations yet.

We can restrict the accepted file types in the form:

<div class="field">
  <%= f.label :deliverable %>
 &lt;%= f.file_field :deliverable, direct_upload: true, 
@lorenadl
lorenadl / add_password_expiration_to_devise.md
Last active October 27, 2023 07:35
[RoR] Add password expiration feature to Devise

Add password expiration feature to Devise

Assuming you already have a Devise model named User and you want to add following Devise Security Extension to it:

  • Password Expirable
  • Password Archivable
  • Session Limitable

Add gem and run the generator

@lorenadl
lorenadl / rails_download_active_storage_attachment.md
Last active January 10, 2023 01:04
[Rails] Download an Active Storage attachment
@lorenadl
lorenadl / rails_index_vs_foreign_key.md
Last active April 12, 2022 11:33
[Rails] index: true vs foreign_key: true

index: true vs foreign_key:true in migration

In migration:

create_table :educations do |t| 
  t.belongs_to :profile, index: true, foreign_key: true
end

Index improve speed of data retrieval operations on database tables. When we write index: true to any column, it adds a database index to this column.

@lorenadl
lorenadl / rails_autocomplete.md
Last active March 21, 2022 12:25
[Rails] Autocomplete
@lorenadl
lorenadl / notes_from_clear_architecture_robert_c_martin.md
Last active December 15, 2021 11:19
Notes from "Clean Architecture" - Robert C. Martin

Notes from "Clean Architecture" - Robert C. Martin

Part I: Introduction

What is design and architecture

"Architecture" is often used in the context of something at a high level, whereas "design" more often seems to imply structures and decisions at lower level. But this usage is nonsensical. In software design the low-level details and the high-level stucture are all part of the same whole, there is a continuum of decisions from the highest to the lowest levels.

@lorenadl
lorenadl / enabling-disabling-hyper-v-docker.md
Last active October 26, 2021 17:15
Enabling and disabling Hyper V Docker
@lorenadl
lorenadl / rails_app_workflow.md
Last active September 5, 2019 14:03
Rails app workflow
@lorenadl
lorenadl / rvm_create_ruby-version_and_ruby-gemset.md
Last active May 6, 2019 01:46
RVM: create .ruby-version and .ruby-gemset

RVM: create .ruby-version and .ruby-gemset

rvm --ruby-version use 2.5.1@test_app --create