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.
Useful RSpec trick for testing method with arguments
This blog post shows how to test complicated methods with arguments in a concise and idiomatic way. It also provides some philosophical arguments on “one-assertion-per-test” practice and RSpec code styles.
How does Bitcoin force consensus among Byzantine generals?
Matias Fernandez has a very good example implementation of a blockchain exercise written in Ruby. In this post I want to use it to explain, in very simple terms, what a bitcoin blockchain is and why it’s so resilient.
Performance Improvements in Ruby 2.5
New Ruby versions keep improving & Ruby 2.5 is no different. Find out what changed! http://www.rubyguides.com/2017/11/ruby-2-5-performance/
The latest Ruby news: Roobykon Ruby Digest: Issue 16
Web servers! Everyone seems to have an opinion about which are the best and why, but if we’re not careful, habit and loyalty can blind us to rational decision-making. In this issue of Digest, we look in depth at some issues around servers for Ruby – and a whole bunch of other things besides. Enjoy. [more inside]
Memory Conscious Programming in Ruby
A short post about ways and strategies to keep memory usage low - https://gettalong.org/blog/2017/memory-conscious-programming-in-ruby.html
Cleanly Scaling Sidekiq
When your autoscaling group terminates instances running Sidekiq, you should finish the Sidekiq jobs before the instance gets terminated. This is how we do that at Honeybadger: http://blog.honeybadger.io/cleanly-scaling-sidekiq/
Relative Testing vs Absolute Testing
A subtle mind shift that serves as another approach to making your tests resilient and complete. [more inside]
Replacing Mocks With Hand-Written Test Doubles
If you reach for mocks when needing to stub out methods on objects under test, a hand-written test double may be a much better fit. [more inside]
Testing Stripe with Rails and RSpec
A quick high overview of ways you can test Stripe within your Rails application with RSpec: [more inside]
A 5-point Rails app performance audit
Like my office desk, the performance of a Rails app will trend toward disorder. An N+1 database query here, a forgotten pagination implementation there, a missing index here, etc. Here’s a quick 10-minute performance audit you can perform on your Rails app to gauge the health of your app.
Tutorial: Using Rails Event Store as a pub-sub message bus
Rails Event Store can do much more but you usually start by using it as your message bus
[Screencast] Sample Data with Factory Bot and Faker
Factory Bot is a fixtures replacement which can generate the needed records directly in the tests. Faker can be used to create fake data for these records. https://www.driftingruby.com/episodes/sample-data-with-factory-bot-and-faker
The Case Against Exotic Usage of :before_validate Callbacks
It’s nothing new that ActiveRecord callbacks are abused in many projects and used for the wrong reasons for many use cases where they can be easily avoided in favor of a much better alternative, like service objects. There is one callback though that is special and quite often used for pretty exotic reasons that have nothing to do with the process when it gets executed – it’s the before_validate callback. [more inside]
Newest tty-screen adds more checks for terminal size
The latest tty-screen adds more checks(Win API, ioctl, Java etc..) for terminal size detection to make it even more robust. Tested on Mac OS, Linux & Windows platforms.
Implementing OCR using a Random Forest Classifier in Ruby
In this blog post I will show how to implement OCR (optical character recognition) using a Random Forest classifier in Ruby. As our dataset we will be using the MNIST database of handwritten digits and for our Random Forest implementation we will be using Python’s sci-kit learn library. This post also shows how easy it is to integrate the plethora of data science tools from Python into Ruby applications. Read more here: https://www.practicalai.io/implementing-ocr-using-random-forest-classifier-ruby/
Slide Show (S9) v.4 Update - Write Yr Talks / Slides in Plain Text (w/ Jekyll Themes)
Hello, I’ve updated the Slide Show (S9) command line tool (and library/gem) that lets you write your talks / slides / presentations in plain text w/ markdown conventions. You can use any of the (Jekyll-compatible) theme packs such as reveal.js, bespoke.js, s6blank, etc. As an example, see the Blockchain! Blockchain! Blockchain! talk (source in markdown). Happy publishing & talking. Cheers.
HexaPDF 0.6.0 - Code Refinements
The last release brought some cool new features with respect to advanced text layout. This release builds on that and refines the implementation for future features.
How NOT to zero out your Pusher development quota
In a current project I am doing I was quickly reaching my free development quota over Pusher because all the team and the CI server were using the same account. So we replaced that for a local running Pusher Fake server. Learn how to configure it here
Event-Driven Rails from scratch - Part 1: Motivation
A first part of 4-episode long course about starting a fresh new Rails application with domain events included.
Transactions in Ruby on Rails and Atomic Bugs
A few examples of when transactions in Ruby on Rails don’t work as expected. [more inside]