ActiveSupport::TimeZone.all.group_by(&:formatted_offset).each {|offset| puts "### UTC #{offset[0]}"; offset[1].each {|tz| puts "* #{tz.tzinfo.identifier}"}; puts "\n"};nil- Pacific/Pago_Pago
- Pacific/Midway
- Pacific/Honolulu
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' |
| def range_within_bounds(range, min, max) | |
| min ||= range.min | |
| max ||= range.max | |
| [range.min, min].max .. [range.max, max].min | |
| end |
| #!/usr/bin/env ruby | |
| # Usage: dedup-imovie-library LIBRARY ORIGINALS | |
| # | |
| # Goes through an iMovie 10 library and replaces all the "Original Media" with | |
| # symlinks to the actual original media, in order to conserve disk space. Note | |
| # that because they're symlinks, if the path to the originals changes (e.g. you | |
| # rename the external drive they are on) then the links will be broken. | |
| # | |
| # This assumes you've already imported the files into iMovie and waited for them |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem 'benchmark-ips' | |
| gem 'benchmark-memory' | |
| gem 'memo-it' | |
| gem 'memoist' | |
| gem 'memery' |
| def model | |
| @model ||= controller_name.classify.constantize | |
| end | |
| def record | |
| @record ||= records.find(params[:id]) | |
| end | |
| def records | |
| @records ||= policy_scope(model) # Requires Pundit |
| module StringEnum | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # ActiveRecord enum has undocumented support for enums with string rather than integer representations. | |
| # To enable it you have to define an enum like so: | |
| # | |
| # enum field: { value1: 'value1', value2: 'value2' } | |
| # | |
| # which is rather redundant. This is a shortcut which lets you define it as follows: |