The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Rubber Duck Dev Show Episode 16 | When Should You Comment Your Code
Hear two rubyists discuss when you should comment your code: https://www.rubberduckdevshow.com/episodes/16-when-should-you-comment-your-code/
Business logic in Rails with operators
Having a thousand lines long controllers and/or models is not the right way to have sustainable applications or developers’ sanity. Let’s look at my solution for business logic in the Rails app. https://petr.codes/blog/rails/business-logic-with-operators/
Supporting fractions in Ruby/Rails
Have you ever needed to store and display fractions in a Rails app? Read about Ruby’s Rational class and how to convert Floats into Unicode fractions.
Befunge GUI by Glimmer (2 for 1: LibUI & SWT)
In light of the recent Beta release of Glimmer DSL for LibUI, I have been looking for applications that could take advantage of its productivity and speed in building desktop GUI with its Ruby DSL. One such application has been Befunge98 GUI, built for a Ruby implementation of the Befunge98 programming language. In fact, I built its GUI twice with two different approaches, one using the up and coming Glimmer DSL for LibUI on CRuby relying on a multi-canvas-grid (LibUI area) approach, and one using the very mature Glimmer DSL for SWT on JRuby by relying on a button-grid approach. [more inside]
I couldn't debug the code because of my name
It turns out that the same problem also affects users of other InteliJ-based IDEs like RubyMine, PyCharm, PhpStorm and GoLand. Fortunately, I was able to fix it. Here’s how I handled it: [more inside]
Rubber Duck Dev Show Episode 15 | When To Use UUIDs
Hear two rubyists discuss when to use UUIDs (and when not to): https://www.rubberduckdevshow.com/episodes/15-when-to-use-uuids/
Ruby Pixel Art Programming Challenge #2 - Cryptopunk Redux - Generative Modern Art
Hello, Let’s try another round in the ruby pixel art (graphics) programming challenge: Ruby Pixel Art Programming Challenge #2 - Cryptopunk Redux - Generative Art Taking Each of the 576 Pixels [from a Punk] from the Original Series and Placing the Pixels Randomly within the Same 24x24 Pixel Grid - Yes, You Can - Let’s Do A Free (Right-Click & Save Image) Edition / Share Your Pixel Art Scripts (in Ruby) ++ Let’s get inspired by the pre-currency (spots painting “Damien Hirst-style”) Cryptopunk Redux collection. The modern art (pixel art) collection blurb reads [..] Share your generative (pixel) art script(s) in ruby (on ruby-talk) or for an alternative join us on r/CryptoPunksDev - a channel mostly about - yes, pixel art programming in ruby. Bonus - for trying circles (“spots”) instead of square pixels / rectangles :-). Cheers. Prost.
This week's Ruby roundup
Here’s the latest issue of Ruby Weekly: https://rubyweekly.com/issues/574
Embracing Infinite Loops with Ruby and Polyphony
Infinite loops are great for expressing long-running concurrent operations. In this article I’ll discuss the use of infinite loops as a major construct when writing concurrent apps in Ruby using Polyphony. I’ll show how infinite loops differ from normal, finite ones; how they can be used to express long-running tasks in a concurrent environment; and how they can be stopped. Read it now!
Get ready for Rails 7.0: How to upgrade your Rails 6.x app from Classic to Zeitwerk
Zeitwerk is the code autoloader and reloader that was integrated with Rails 6. Beginning in Rails 7, it will be the only codeloader option. As a result, upgrading to Zeitwerk will be an important step in getting your application ready for the next version of Rails. In this article, we’ll talk about upgrading your Rails 6 application from classic to zeitwerk mode. [more inside]
Rails 7 introduces ActiveModel::API
https://blog.saeloun.com/2021/10/13/rails-7-introduces-activemodel-api
Just Enough Hotwire for Rails Developers with Chris Oliver (Oct 14th @ 2 PM PST)
Want to add a touch of JavaScript sprinkles to make the Frontend of a Ruby on Rails app shine? Learn Just Enough Hotwire with Chris Oliver (GoRails): [more inside]
Organizing business logic in Rails with contexts
Rails models can get messy without a lot of discipline… [more inside]
Code Concurrency and Two Easy Fixes
Not sure how to manage code concurrency in your rails code? We help you manage code concurrency through two easy fixes using Executors and Reloaders. https://blog.engineyard.com/code-concurrency-and-fixes?utm_source=RubyFlow&utm_id=QiWorks.in
Using DynamoDB in Your Rails App
DynamoDB is a NoSQL database offered by AWS. It can be a great way to avoid adding load to your primary database when you need tens of thousands of reads/writes per second. In this article, Julie Kent walks us through the basics of using DynamoDB with Rails. https://www.honeybadger.io/blog/aws-dynamo-db-rails/
Install Bootstrap with CSS Bundling
CSSbundling-rails is a new gem for bundling CSS by directly using Node modules. It will even include the Javascript automatically if it can. Learn How to install Bootstrap with CSS Bundling Rails.
Minehunter - terminal puzzle game
Minehunter is a terminal puzzle game inspired by the classic “Minesweeper”. It comes preconfigured with three levels: easy, medium and hard. But, you can also create a custom grid with an arbitrary number of mines. Enjoy!
The Story of a Critical Issue With Kafka
Recently, I’ve had an unfortunate opportunity to deal with a very unexpected issue with Kafka that had quite terrible consequences. The exact origin of the issue is yet to be discovered; nevertheless, the process leading to the final solution to the problem and the fix itself were interesting enough that I decided to write a quick blog post about it as it might be potentially valuable to someone who also encounters a similar problem. [more inside]
Glimmer DSL for LibUI Beta Release
Glimmer DSL for LibUI (Prerequisite-Free CRuby Desktop Development GUI Library) has been a passion project for the last 3 weeks that ended today with Glimmer DSL for LibUI becoming feature-complete and moving from Alpha to Beta. What is LibUI? LibUI is a thin Ruby wrapper around libui, a relatively new C GUI library that renders native controls on every platform (similar to SWT, but without the heavy weight of the Java Virtual Machine). [more inside]