This file contains 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
defmodule Formatter.Log do | |
@moduledoc """ | |
This is a good resource to learn about formatters | |
https://timber.io/blog/the-ultimate-guide-to-logging-in-elixir/ | |
""" | |
def format(level, message, timestamp, metadata) do | |
message | |
|> Jason.decode() | |
|> case do |
This file contains 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
module ForkDetach | |
def chk_download_complete(job_list) | |
loop do | |
process_output = [] | |
job_list.each do | job| | |
process_output << format_process_output(Fury.run_now("ps ho pid,state -p #{job}")) | |
end | |
break if wait_process_completion(process_output) | |
end |
This file contains 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
# The following should prevent an ArgumentError "invalid %-encoding (...%)" exception from being raised for malformed URLs. | |
# To use this code simply drop this in your rails app initializers. | |
# See: https://github.com/rack/rack/issues/337 | |
# Taken from: http://stackoverflow.com/a/11162317/1075006 | |
module URI | |
major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i } |
This file contains 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
###################### | |
# | |
# Monkey patch to ActiveRecord to prevent 'implicit' checkouts. Currently tested with Rails 4.0.8, prob | |
# should work fine in Rails 4.1 too. | |
# | |
# If you create a thread yourself, if it uses ActiveRecord objects without | |
# explicitly checking out a connection, one will still be checked out implicitly. | |
# If it is never checked back in with `ActiveRecord::Base.clear_active_connections!`, | |
# then it will be leaked. | |
# |