docker images -a
docker images -f "dangling=true"
docker ps -a --format '{{.Image}}' | sort | uniq -c | sort -nr
docker ps -a --filter ancestor=<image_name_or_id>
docker image prune -a
docker images -a
docker images -f "dangling=true"
docker ps -a --format '{{.Image}}' | sort | uniq -c | sort -nr
docker ps -a --filter ancestor=<image_name_or_id>
docker image prune -a
- https://github.com/lazaronixon/authentication-zero | |
- https://github.com/seattlerb/flog | |
- https://gist.github.com/tenderlove/44fd4206b9cbc42bcafc90adb3f5820d | |
- https://github.com/anchietajunior/sporticalapp | |
- https://github.com/dphilla/boxer | |
- https://github.com/danmayer/churn | |
- https://github.com/whitesmith/rubycritic | |
- https://shopify.engineering/how-to-introduce-composite-primary-keys-in-rails |
/** | |
* Returns a random integer between min (inclusive) and max (inclusive). | |
* Pass all values as an array, as 3rd argument which values shouldn't be generated by the function. | |
* The value is no lower than min (or the next integer greater than min | |
* if min isn't an integer) and no greater than max (or the next integer | |
* lower than max if max isn't an integer). | |
* Using Math.round() will give you a non-uniform distribution! | |
*/ | |
function getRandomInt(min, max) { |
arr = [ 1, 1, 2, 3, 5, 8, 13, 21, 34 ] | |
res = arr.bsearch do |val| | |
case when val < 19 | |
then +1 when val > 23 | |
then -1 | |
else 0 | |
end | |
end | |
res # => 21 |
# arr | other_array → an_array | |
%w[a b c] | %w[c d a] # => ["a", "b", "c", "d"] |
class Stooges | |
def to_ary | |
%w[larry Curly Moe] | |
end | |
end | |
a = Stooges.new # => #<Stooges:0x00007f92438f6678> | |
a.class # => Stooges | |
b = Array.try_convert(Stooges.new) # => ["larry", "Curly", "Moe"] |
# arr * int → an_array | |
# arr * str → a_string | |
[1, 2, 3] * 3 # => [1, 2, 3, 1, 2, 3, 1, 2, 3] | |
[1, 2, 3] * "-" # => "1-2-3" | |
[1, 2, 3] * "--" # => "1--2--3" | |
[1, 2, 3] * "+" # => "1+2+3" | |
[1, 2, 3] * ";" # => "1;2;3" |
# arr.rassoc( key ) → an_array or nil | |
a = [[1, 'one'], [2, 'two'], [3, 'threee'], ['ii', 'two']] | |
a.rassoc('two') # => [2, "two"] | |
a.rassoc('four') # => nil |
# arr.product( ‹ arrays›* ) → result_array | |
# arr.product( ‹ arrays›* ) ‹{|combination| … }› → arr | |
suits = %w[ C D H S ] | |
ranks = [ *2..10, *%w{ J Q K A }] | |
card_deck = suits.product(ranks).shuffle | |
card_deck.first(13) # => [["H", "Q"], ["D", 7], ["S", "A"], ["S", "J"], | |
# .. ["D", 2], ["S", 10], ["D", 4], ["S", 9], ["C", 7], | |
# .. ["C", 4], ["H", 5], ["D", 5], ["S", 4]] |
# arr.pop( ‹n›* pop ) → obj or nil | |
a = %w[ f r a b j o u s ] | |
a.pop # => "s" | |
a # => ["f", "r", "a", "b", "o", "u"] | |
a.pop(3) # => ["b", "o", "u"] | |
a # => ["f", "r", "a", "b"] |