This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'base64' | |
| # converts attached PNGs into base64 strings | |
| # Eg | |
| # <img src="my.png" /> to <img src="data:image/png;base64,..." /> | |
| class To64Html | |
| def initialize(path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :deploy do | |
| Rake::Task["deploy:compile_assets"].clear_actions | |
| task :compile_assets => [:set_rails_env] do | |
| run_locally do | |
| if capture("git --no-pager diff #{fetch(:previous_revision)} #{fetch(:current_revision)} app/assets vendor/assets").empty? | |
| info "Skipping assets compilation" | |
| else | |
| invoke 'deploy:assets:precompile' | |
| invoke 'deploy:assets:backup_manifest' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sidekiq/api' | |
| Sidekiq::ScheduledSet.new.find_job("61374d5d51db323507376158") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/initializers/instrumentation.rb | |
| # Subscribe to grape request and log with Rails.logger | |
| ActiveSupport::Notifications.subscribe('grape.request') do |name, starts, ends, notification_id, payload| | |
| Rails.logger.info '[API] %s %s (%.3f ms) -> %s %s%s' % [ | |
| payload[:request_method], | |
| payload[:request_path], | |
| (ends-starts)*1000, | |
| (payload[:response_status] || "error"), | |
| payload[:x_organization] ? "| X-Org: #{payload[:x_organization]}" : "", |