Install puma-dev as described in the official documentation
brew install puma/puma/puma-dev
# Configure some DNS settings that have to be done as root
str = "Czech Republic,CZK,139,000.00" | |
str.gsub(/[^\d\.,]/, '').gsub(/^,+/,'') | |
# => "139,000.00" |
Install puma-dev as described in the official documentation
brew install puma/puma/puma-dev
# Configure some DNS settings that have to be done as root
# via https://stackoverflow.com/questions/43519292/load-file-from-local-gem-in-irb#46941281 | |
# | |
# If you want to require a local file or gem in irb, I like this method: | |
# | |
# irb -I lib -r usps_countries | |
# This allows you to then require the module in your new irb instance: | |
# | |
# require 'usps_countries' | |
# Options used: | |
# |
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options | |
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full. | |
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}… | |
Getting help: | |
-h — print basic options | |
-h long — print more options | |
-h full — print all options (including all format and codec specific options, very long) |
# https://ihateregex.io/expr/uuid/ | |
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/ | |
# https://rubular.com/r/sXJ27X08h7tKZ2 refactor by soawesomeman | |
/([0-9a-fA-F]{8}-?(?:[0-9a-fA-F]{4}-?){2}[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})/ | |
# https://rubular.com/r/lIO6HeHPlHcTl3 further refactor by soawesomeman | |
# see: https://stackoverflow.com/questions/15205896/matching-any-character-except-an-underscore-using-regex#15206584 | |
/((?:(?!_)[\w\d]){8}-?(?:(?:(?!_)[\w\d]){4}-?){3}-?(?:(?!_)[\w\d]){12})/ |
# ruby-hash-with-or-without-rockets-to-javascript-object-notation-aka-json-style.rb | |
# | |
# - context: https://alwayscoding.ca/momentos/2012/06/15/ruby-hash-syntax-hashrocket-vs-json-style | |
# - regex by SoAwesomeMane: https://rubular.com/r/9wlDeHLHejZvuB | |
# - regex research: https://sadique.io/blog/2013/09/29/named-capture-groups-in-regular-expressions | |
# - more regex research: https://www.regular-expressions.info/refquick.html "\k Named backreference" | |
# - json schema from https://www.liquid-technologies.com/online-json-to-schema-converter | |
# - 🍻🍻🍻 | |
hash = {"$schema"=>"http://json-schema.org/draft-04/schema#", |
str = "ZZZ://ZZZZZZ (ZZZZ allocation - slider does not automatically reflect the entered Stop value and requires a click outside o | |
f the Stop input field)" | |
str.downcase.gsub(/\W/, '-').squeeze('-')[0..45].chomp('-') | |
# => "zzz-zzzzzz-zzzz-allocation-slider-does-not-aut" |
admin@ip-172-31-90-86:~$ json=$( | |
cat <<- EOF | |
{ | |
"foo": "baru-1", | |
"su": "baru-2", | |
"dive": "baru-3" | |
} | |
EOF | |
) | |
admin@ip-172-31-90-86:~$ echo $json |
# https://stackoverflow.com/questions/5608918/pad-an-array-to-be-a-certain-size#16180695 | |
def rpad(item, padding, num) | |
Array(item).fill padding, Array(item).size, num | |
end |
RX_URL = Regexp.new('^((?<protocol>https?):\/\/)?(?<host>[^\/]+)(\/(?<path>[^\?#]+))?(\?(?<query>[^#]+))?(#(?<fragment>.*))?', 'i') | |
# @see http://stackoverflow.com/questions/18825669/how-to-do-named-capture-in-ruby#18825787 | |
# @param url_str [String] URL string with or without `https://`, `http://` | |
# @return [Hash] hash with keys: `:protocol, :host, :path, :query, :fragment` | |
def url_to_hash(url_str) | |
m = url_str.match(RX_URL) | |
m.names.map(&:to_sym).zip(m.captures).to_h | |
end |