In this tutorial, Toptal Engineer Orban Botond demonstrates how to use the Grape gem -- a REST-like API micro-framework for Ruby -- to build backend support in Rails for a JSON API. Grape is designed to run as a mountable rack engine that complements your web applications without interfering with them.
With modern image editing tools, we often take for granted the ability to extract or identify color on some part of any image. However, doing it programmatically is not exactly so straightforward. Camalian, a Ruby gem, changes that, making extracting and manipulating colors in an image as easy as possible. In this article, Toptal engineer Nazar Hussain provides some insight into how various color spaces work, introduces Camalian, and gives an overview of how to use it to build a color-based image search engine in Ruby.
Ruby metaprogramming, one of the most interesting aspects of Ruby, enables the programming language to achieve an extreme level of expressiveness. It is because of this very feature that many gems, such as RSpec and ActiveRecord, can work the way they do. In this article, Toptal engineer Nikola Todorovic demystifies Ruby metaprogramming using some examples that are relevant to everyday programming and aims to bring it closer to average Ruby developers.
One of the most misused, misunderstood, and neglected of all the Rails built-in structures is the view helper. Helpers often get a bad reputation for being a dumping ground for one-off methods used across the entire application's view layer. But what if your helpers could be more semantic, better organized, and even reusable across projects? What if they could be more than just one-off functions sprinkled throughout the view, but powerful methods that generated complex markup with ease leaving your views free of conditional logic and code? Let's see how to do this when building an image carousel, with the familiar Twitter Bootstrap framework and some good old-fashioned object-oriented programming.
It's no surprise that more and more people, from all kinds of backgrounds, are deciding to learn to code. But, each person who tackles the task is soon faced with an unpleasant reality: Learning to program is hard. Contrary to expectations, the feeling of "I don't get it," may persist unabated long into the journey, making once bright-eyed beginners feel hopeless, lost, and ready to give up. The moral of the story is this: Be prepared. The path to programmer paradise is a long one, and without the right mindset at the beginning, it can quickly lose its appeal. In this article, I'll attempt to give you some guidance on what to expect on your journey, how best to go about it, and what tools and resources you may find helpful along the way.
In an attempt to make web applications a lot more dynamic, front-end Javascript frameworks like Angular.js, Backbone.js and Ember.js have gained a lot of popularity. However, these frameworks often require a back-end application to be useful, so they are used in conjunction with web frameworks like Ruby on Rails and Django. On the other hand, Volt is capable of managing the back-end and a dynamic front-end; since both functionalities are tightly integrated into its core.
A thorough and practical introduction to concurrent and parallel programming in Ruby, presenting and contrasting a number of techniques and options available, from the standpoints of both performance and complexity. Discusses forking, multithreading, the Global Interpreter Lock (GIL), and more.
The publish-subscribe pattern (or pub/sub, for short) is a messaging pattern where senders of messages (publishers), do not program the messages to be sent directly to specific receivers (subscribers). Instead, the programmer "publishes" messages (events), without any knowledge of any subscribers there may be. This article provides insight in how to use the pub/sub pattern, in Rails, to communicate messages between different system components without these components knowing anything about each other's identity.
Why are Rails Engines not used more often? I don't know the answer, but I do think that the generalization of "Everything is an Engine" has hidden the problem domains that they can help to solve.
World-class articles, delivered weekly.
Subscription implies consent to our privacy policy
Thank you!
Check out your inbox to confirm your invite.
Join the Toptal® community.