Nithin Bekal is a Ruby and Rails developer who writes release summaries and short tips on the language.
HN commenters link his "What's New" posts for Ruby 3.2 and Rails 5, and his explanation of Ruby's flip-flop operator.
Here's some of my tips for a handwritten HTML site, since the author wished more tips existed:
- consider using an HTML boilerplate template like this one if you don't know where to start: https://www.matuzo.at/blog/html-boilerplate/
- consider using a CSS template, or a CSS reset, if you don't know where to start with styling. Pico CSS is a good drop-in: https://picocss.com/. Frontend devs always blog about their CSS resets, like this one: https://piccalil.li/blog/a-more-modern-css-reset/. But if you're someone inclined to write their own HTML, then you'll probably also want to write your own CSS. This takes time to learn. Especially learning how to design the page without looking crappy
- I copy my last page as a template whenever writing a new page
- I don't worry about code duplication. If I need to refactor duplicated content, I use search and replace across files in vim (like https://nithinbekal.com/posts/vim-search-replace/). Hopefully your editor/IDE has something similar, and hopefully you're comfortable with regexes
- markdown + pandoc + scripting is a common solution. Technically it's not handwriting HTML at this point -- it's hacking together your own static site generator instead of using an existing framework -- but no biggie
- frontend people have made a lot of live reload tools over time. Here's a couple: https://nitoyon.github.io/livereloadx/ and https://github.com/tapio/live-server. Personally, I've cobbled together something with…
One approach that has worked for me so far is:
1) find out if the runtime/framework is supported but Heroku or if there are any buildpacks available.
2) spin up a Dokku instance using Vagrant for local development and testing
3) deploy to a live Dokku server
If/when I encounter any issues I add Heroku or Dokku to my search query and 9 times out of 10 I’ll find an answer to my issue. Else I just dig into the Dokku docs and GitHub issues and figure it out.
So for instance googling for deploying a Phoenix app with Dokku results in a few hits such as this one [0].
There's also a lovely UI for Dokku being actively developed: Ledokku [1]
The only drawback currently is when you want to horizontally scale your deployment. You can use their kubernetes or nomad schedulers but I think those are an overkill in terms of complexity. You could also use a load balancer in front of multiple Dokku instances but you then lose the ease of deployment, configuration, etc…
Which is why I think their docker swarm scheduler [2] will be one of the most important feature they could add. It’s currently on the roadmap but I’m sure with a bit of sponsorship and a few pull/merge requests it will become a reality.
[0] https://nithinbekal.com/posts/dokku-phoenix-deploy/
[1] https://github.com/ledokku/ledokku
[2] https://github.com/dokku/dokku/projects/1#card-59170273
Fwiw ruby borrows heavily from perl, and can be coaxed into serving as a driver for other commands. See eg:
http://ibmsystemsmag.com/aix/tipstechniques/systemsmanagement/ruby_shell_scripting/
https://redpanthers.co/different-ways-to-run-shell-commands-in-ruby/
Perl/awk like one-liner/filters in ruby:
http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-one-liners.html
https://nithinbekal.com/posts/ruby-sed-awk/
Of note is that ruby allows "backtick execution":
filename = 'some_file.txt'
wordcount = `wc --words #{filename}`
I find that much of the strength of bash/shell comes from the surrounding utilities though. So simply jumping to ruby won't magically let your "shell script" work on both windows and Linux, just because you have ruby installed;there likely not be a similar set of building blocks like "wc" etc. You could of course replicate most via the ruby std lib - and it's arguably easier to write test driven ruby than bash.
I haven't done much with Phoenix but I think there are a few libraries out there. I think addict is the front
runner:
https://github.com/trenpixster/addict
https://github.com/opendrops/passport
Also here's a nice blog post that was in the elixir newsletter that may help!
http://nithinbekal.com/posts/phoenix-authentication/
Ruby 3.2 comes with YJIT which is a new JIT compiler Ruby totally rewritten in rust. Also native Ruby extensions can now be written in rust in addition to C. So the ecosystem here lets you write C, Rust or Ruby.
https://nithinbekal.com/posts/ruby-3-2/
The replacement for ActiveRecord::Base in Rails 5. All your models will inherit from ApplicationRecord. See http://nithinbekal.com/posts/rails-5-features/