Skip to content

Instantly share code, notes, and snippets.

View epsimatic's full-sized avatar

Oleg epsimatic

View GitHub Profile
@lorenadl
lorenadl / rails_active_storage_how_to_validate_file_type.md
Last active May 24, 2025 19:50
[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, 
@ekreutz
ekreutz / ansible_variable_precedence.md
Last active May 28, 2025 08:13
Ansible variable precedence (order, hierarchy)
require "rubygems"
require "rbosa"
if `ps aux`.match(/Things\.app/)
things = OSA.app('Things')
if things.lists[1].to_dos.size != 0
things.lists[1].to_dos.each {|todo|
`echo #{todo.name} | growlnotify -a Things`
}
end