June had too many coding topics to chose one for the title
Oops, had almost a month long delay in posting. Because my life just sucks.
Anyway, there must be something to share with you here. I'll do it like I did previously -- by reviewing my last GitHub activity. I'll gather here some random interesting things.
unpacking CRX files and rubyzip drama
If you are going to use the gem crx_unpack
(for example to run headless Chrome with a downloaded extension) it will fail because it does not support CRX v3. Somehow the only documentation of the CRX format I could find is from some Android SDK and it's outdated, so the only actual source of truth is a crx3.proto
file in Chromium source code. If you need it, here is my pull request that is unlikely to be accepted because the gem repo wasn't updated in 10 years, but of course you can use my fork in your Gemfile
.
Oh and while I was figuring this out I found a funny drama about the gems zip
and rubyzip
. As I understood, many years ago when someone made a gem for ZIP archives and for some reason named it rubyzip
. Then another guy made another gem and named it more obviously, and he used the same Ruby module name, so now they are conflicting. And for years they can't come to peace, lol.
another pcbr-demo page: "Ruby Web App Frameworks"
While refreshing my knowledge about available simplistic Ruby web servers I decided to pass the "Web App Frameworks" Ruby Toolbox category page through the PCBR and this trivial line of code:
TableStructured.new( Oga.parse_html(page_html_budy).at_css "table" ).
map{ |_| _.to_h.transform_values(&:text}.values_at :_1, :Stars, :Forks, :"Latest release" }
obtains the array that you can then print like this:
stars forks latest_release
+ - +
rails 52970 20368 20230524
rack 4679 1551 20230424
sinatra 11908 1961 20230411
hanami 6066 515 20230201
padrino 3349 494 20230225
roda 1957 138 20230511
...
that then results in another PCBR-demo page telling you that judging by the above criteria the gem camping
is "the best web framework" today but don't ask me, I know nothing about it and at first I could not even find its repo. BTW, if you ever wondered how to add GitHub link to you gem Rubygems page, then you should look into the metadata
gemspec docs and use it like they did it in Sinatra for example.
Interesting, there is a web server called strelka
-- it's named after the first dog that survived orbiting the Earth. The README says the dog's name is translated as "little arrow" but that's not correct. It is "arrow sign", because it's neither a bow ammunition (it would be "стрела") nor little (it would be "стрелочка") but I'm lazy to make a pull request because the repo is on Sourcehut.
And while parsing the Ruby Toolbox I learned that HTML table rows can have <th>
too so I had to fix the gem tablestructured
.
gem nakicommon
Decided to make the stupidest library that one can make -- a library for everything, hehe. I saw such a one that extends Ruby stdlib with hundreds of refinements but as you know I'm still a minimalist. So I made only one simple method that is needed way too regularly -- it is the Array#assert_one
that asserts that an array is one element long and returns the element.
other little trivias
how bundler parses semver
Did you know how bundler parses the semver? It appears it does not know anything about the delimeters and they can be either dots, or gyphens, or even kittens, it just scans for digits.
test frameworks dependency tree
Have you ever wondered which test frameworks do test frameworks use for themselves? I clicked through some of them and here are the results I gathered:
* maxitest --- rspec
* rspec -- aruba, cucumber, rr, mocha, flexmock, minitest
* aruba -- rspec, minitest
* cucumber, rr, power_assert -- test-unit
* test-unit -- power_assert
* mocha, flexmock -- minitest
* minitest -- minitest
about Test Automation antipatterns
A good compilation of the common test automation antipatterns in Russian.
about OOP
Some insightful answer on Software Engineering SE about what's the real purpose of OOP and what this term really means.
benchmarked two more perceptual image hashing gems
Added gem dhashy
to my perceptual image diffing benchmark -- average fingerprinting speed, average comparison quality and awful comparison speed.
Also added gem phasion
-- average fingerprinting, fast comparison but the same bad quality as gem phamilie
, probably due to the same backend.
I guess it's enough for now. Next time I'll tell you about the "compose-launcher", give you one advice for dockerizing the chromium, and tell you about one big -- yet cheap ..( -- freelance project that I've spent like a week or two on it during June.