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.
Teaching a Neural Network to play a game in Ruby
In this blog post we will walk through how to build an AI that can play a computer game with a Neural Network and Q-Learning using the ruby-fann gem. https://www.practicalai.io/teaching-a-neural-network-to-play-a-game-with-q-learning/
[Screencast] Auditing with Paper Trail
Using the paper_trail gem, track changes to model records for auditing purposes and rollback changes when required. https://www.driftingruby.com/episodes/auditing-with-paper-trail
How to: Multiple root level slugs with FriendlyId
Use FriendlyId’s History to move slugs from their namespace to the root level of your Rails app https://medium.com/@mauddev/root-level-slugs-for-multiple-controllers-with-friendlyid-1a4a7ba03ec1
Improving spec speed in a huge, old Rails app
The story of how we improved our test suite speed by 41% in a huge, 6-year-old Rails project. [more inside]
Tutorial on how to deploy your Rails app with Capistrano
Learn how to deploy your Rails app with Capistrano. https://revs.runtime-revolution.com/deploy-your-rails-app-with-capistrano-5ad5d58e9b07
A gem tells you what financial year is it now, and also the date range of it. Edit Ad
A gem tells you what financial year is it now, and also the date range of it. Edit Add topics [more inside]
tty-progressbar v0.12.0 release with parallel multi bars
The newest release of tty-progressbar provides parallel multi bars rendering. In addition, adds ability for a single progress bar to iterate over enumerable and many more - see changelog. Enjoy!
Change sidebar content for certain Rails controllers
Most (or even all) pages in your Rails application have the same sidebar content, but just one needs to show something different? On your login and registration pages, you don’t want to show the last five books/movies/events, but a marketing text why people should signup for your site? You’re currently using an if/elseif/else statement to switch content based on the controller’s name? I’ll show you how to fix this with the help of Rails’ template inheritance: https://christoph.luppri.ch/articles/2017/09/03/change-sidebar-content-for-certain-rails-controllers/
Rearmed-JS v2.0.0 Released! - Make your JS code relaxing and readable
I just released v2.0.0 of my plugin Rearmed-JS. This library is a collection of helpful methods and monkey patches for Arrays, Objects, Numbers, and Strings in Javascript that will make your code more relaxing and more readable by taking inspiration from Ruby. Works in the browser and NodeJS. See the changelog for more details. https://github.com/westonganger/rearmed-js
Tips on how to speed up a Ruby Test Suit
“Why on earth is my test suite taking so long to run?” [more inside]
Sequel 5 Released
After 50 releases of Sequel 4, Sequel 5 has been released with frozen datasets, symbol splitting disabled by default, and reduced chance of SQL injection by making SQL code fragment usage explicit.
Ruby: pass by value or pass by reference?
Describes how Ruby passes arguments into functions. http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference
The perils of writing request specs using concurrent-ruby under the JVM
On writing request specs for a JRuby API that uses the concurrent-ruby gem: what issues arise and how to fix them. full article
Autocorrect with Postgres Trigrams
I wrote an article about using pg_trgm to implement auto-correction in a Rails app backed by PostgreSQL.
Introduction to Concurrent Ruby Gem
Concurrency is the ability of a program to make progress on a task that is spread out over different slices of time. It allows us to run multiple “threads” at the same time. As one thread may be sleeping or waiting on I/O, another thread may take priority and start working, thus making optimal use of available CPU time. When you think of concurrency, think of “threads”. [more inside]
world.db.starter Sample - Build Your Own HTTP JSON API (w/ world.db)
Hello, I’ve updated the world.db web service starter sample that gets you started building your own HTTP JSON API using the world.db (incl. continents / countries / states / cities / etc.). What’s news? The starter sample now uses the new webservice library (a simplified sinatra 2.0-style library for HTTP JSON APIs). Enjoy. Cheers.
Automate repetitive coding tasks with Snippets
Snippets is a text-editor feature that can save you hours by automating the insertion of certain code blocks that come up often. Learn how to use Snippets in Sublime Text in this short screencast.
How I got RSpec to load 50 times faster
RSpec load time is important in a TDD workflow design environment. Here’s how I got mine to be lightning-fast. https://schwad.github.io/ruby/rails/testing/2017/08/14/50-times-faster-rspec-loading.html [more inside]
Careful what you measure: 2.1 times slower to 4.2 times faster – MJIT vs TruffleRuby
Have you seen the MJIT benchmarks and been impressed by their performance numbers? I was too, but upon closer inspection I’ve seen TruffleRuby go from 2.1 times slower to 4.2 times faster than MJIT. It’s an interesting story of what to measure and what really counts in the end.
Verify user phone numbers in Ruby on Rails with the Authy verification API
If you ever need to contact your application’s users by phone then it’s good practice to verify that the phone number they enter is in fact theirs. Let’s see how to verify phone numbers in a Rails 5 application using the Authy Verification API.
inject vs each_with_object - which is better and when
inject vs each_with_object are quite similar but there are tiny differences. Find out when to use which one and why
How to Implement a GraphQL API in Rails
Let’s explore how to implement a GraphQL API in Rails, something that giants such as GitHub and Shopify are already using in production. Read here.
ExceptionAlarm for Ruby
This simple gem play an alarm sound when an exception is raised on your Ruby code. https://github.com/pioz/exception_alarm