My Ruby code:

ruby -ne 'puts %{#{$_} >#{$_[0..-2].codepoints.map {|c| sprintf("%04X",c)}}<}'

I don't know how to do this in Awk (especially non-GNU one).

How to re-run without re-running every task?

I use ash instead of bash. If I have to install an additional package to NetBSD or Alpine Linux, I will install Ruby instead of bash.

I usually don't define any new class in my Ruby scripts recently. 馃槄

In 10 minutes, I can write a small and useful program in Ruby; or I can finish setup a project and run REPL in Clojure. 馃槢

After handling these exceptions, my Ruby script looks fine now.

rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, HTTPClient::ReceiveTimeoutError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e

馃槄

I started using a Ruby 2.7 feature.

fo.puts(JSON.dump(m)) if m.any? { _1["key"] == "metadata-something"}

I still cannot stop coding in Ruby. 馃槄

To me, Ruby is a class-based Awk-like command. Elixir, Clojure, Haskell, Python, Golang, Lua cannot replace it.

veer66 boosted

Hello fellow rubyists, I'm thrilled to be tooting with you.

veer66 boosted

"Ruby 2.7 introduces a new convenience method in Enumerable#tally"

list = %w(red red red blue blue fish blue blue)
list.tally # => {"red"=>3, "blue"=>4, "fish"=>1}

til.hashrocket.com/posts/rrpt8

veer66 boosted
veer66 boosted

I had no idea how complex Ruby's block argument spreading is until I started trying to implement it myself. Doing it in C is hard, but even if I were using a higher-level language, I don't think it'd be much simpler to implement.

For instance:

proc { |a=5, b, c, d| [a, b, c, d] }.call([1, 2])
# => [5, 1, 2, nil]

I would have assumed [1, 2, nil, nil] as the result. And that's what my first-pass implementation did.

veer66 boosted
Two of my books on Ruby Language are out for delivery today along with three more books later this week 馃槃

I still maintain my old codebase in Ruby (not on Rails). However, I use Ruby on none of my new projects since 2019. 馃ズ

Show more
Ruby.social

A Mastodon instance for Rubyists & friends