Ruby Screenshot Website Capture – Screencap, Phantomjs

This tutorial will discuss various tools for Ruby Screenshot capture such as Phantomjs (Command-line) Screencap (Ruby gem) Objective You need to capture screenshot of a particular web page and you want to do that programmatically by just passing an url then you can use of the gems that I have listed above. After reading this article, you […]

Ruby Flay Gem – DRY code base

Tutorial will discuss Ruby Flay gem used to DRY up Ruby/Rails application. Flay gem enforces Best practices to be followed while coding with Ruby and Rails Flay gem Source: Flay on Github When to Use? - To make your codebase more DRY! Usage: 1) Install gem by - gem install flay 2) Process your files. […]

Resque Setup Development Mode

This tutorial will guide you setting up Resque locally in development mode with Multiple workers and how to use with Rails application to process background jobs. What is Resque? You might want to know what is Resque before we begin with commands/flow to set it up locally. It uses Redis as backend, thus you need […]

Memoization in Ruby

This tutorial will help you understanding Memoization pattern in Ruby. Memoization is different from Lazy Initialization. Rails had Memoize to support memoization pattern which will be discussed as well. What is Memoization? Memoization can be used to initialize a variable and store it with the result of some computation that is expected to give same result if computed […]

Integrate ActiveAdmin with Rails

This tutorial will help you integrating ActiveAdmin with Rails 4+ project. ActiveAdmin is open source administrative framework for Ruby on Rails. Source: Github Source Website: ActiveAdmin Website What is ActiveAdmin? As described ActiveAdmin is open source administrative framework that can be used with Rails framework. ActiveAdmin is helpful for content management by creating admin users. And giving them access to features […]

Difference between to_s and inspect in Ruby

While running a script in Ruby, we usually want to log data from objects for debugging purpose. puts, p, logger methods are used to log along with to_s, inspect methods to log object. This tutorial will give brief about each method and when to use which one.   1. to_s to_s is very common method used by Ruby […]

Access specifiers in Ruby

This tutorial will discuss how to define Access specifiers in Ruby and what do they mean for classes and modules where they are being used. Default Scope Whenever you define a new method in any class/module the default access specifier that Ruby will use is public. Thus, all methods defined without any scope are public by […]

Profiling Rails Apps with Rack-Mini-Profiler

This tutorial will discuss profiling Ruby on Rails Applications using rack-mini-profiler gem. rack-mini-profiler gem helps finding performance bottlenecks by showing speed badge on every page which can be configured to be displayed in particular environments. E.g. development/staging/production environment. How to Install You can install Rack-Mini-Profiler gem by command - gem install rack-mini-profiler This command will help you install […]

Rails Pluck vs Select and Map/Collect

In Rails, Pluck vs Select can be understood while active record querying. Pluck is used to get array of particular attribute based on particular condition. Same can be obtained using select and then collect on model. This tutorial will help you understand the difference between these ways of collection of specific attribute values. We will […]