[This is sample output of the above script for a shared drive named "Shared Drive"]
Number of files in root of Shared drive: 4
| # I found this confusing to read... Active ones are ones that were read less than seven days ago so why is this a greater than symbol? | |
| scope :active, -> { where("read_at IS NULL OR read_at > ?", 7.days.ago) } | |
| # Of course! A date that is greater than another date is more recent than the other date 🤦♂️ | |
| scope :active, -> { where("read_at IS NULL OR read_at > ?", 7.days.ago) } # '>' == 'more recent than' | |
| # But I think we can do better than [just] a comment (plus I already had an unread scope, why aren't I using it here???) | |
| scope :unread, -> { where(read_at: nil) } | |
| scope :read_within_past, ->(period) { where("read_at > ?", period.ago) } # '>' == 'more recent than' | |
| scope :active, -> { unread.or(read_within_past(7.days)) } |
| # shorten user to max 20 characters | |
| def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) | |
| user = ENV['USER'] || 'UnknownUser' | |
| user.slice![0-19] | |
| File.join(base_dir, "ruby-debug-#{user}") | |
| end |
| #!/bin/sh | |
| # URL encode mailto link using Perl | |
| url="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$2")" | |
| # Then send email via one of the following Gmail accounts | |
| # 1) Default (first logged in) Gmail/Workspace account | |
| open -u "https://mail.google.com/mail/?extsrc=mailto&url=${url}" |