Sometimes we come across situations where we need to count numbers of words, characters etc. from some content. Lets say we are creating a Rails app like http://www.ghostbloggers.net/ in which the user buy/sell their content, there users are charged based on the number of words written in the article. This can easily be achieved by the words counted gem which gives you the count of the number of words, characters, longest word etc. from the content passed as an input.
If we want to use it in our Rails app then we just need to add it to our gemfile.
RuboCop is a very popular gem among ruby developers for the static code analysis of the ruby codebase. It does static code analysis as per ruby style guide. If you are a beginner in Ruby and Rails, it is highly recommended to use this gem as it will help you a lot to improve your coding skills.
The first thing you need to do is installing the rubocop gem.
$ gem install rubocop
You can always fire rubocop shell command from base directory of your source code to start code analysis but how about your favourite text editors help you…
Sometimes we come across situations where we need to add tags to some items e.g. there is an online shopping website which sells various items such as clothes, electronics, books, mobile accessories .etc. Now if there are items such as earphones, power banks, data cables etc. these all can be commonly tagged as mobile accessories. Tagging makes it easy to group the items and also facilitates searching. So when any user searches for the mobile accessories we can show all the items related to this tag.
Sails is a lightweight framework that sits on top of Express. Its ensemble of small modules work together to provide simplicity, maintainability, and structural conventions to NodeJS apps.
Sails is one of the most popular MVC framework used to build NodeJS apps. And for those who are from Ruby on Rails background will find SailsJS easy to use because of the directory structure is similar as any Rails app. Sails can be used to create Rest API’s, chat application, multiplayer games. etc. and many more. Just like Rails, it help to reduce boilerplate code.
While working on the project we came across the situation where the client told us the page load time of our home page is very high and we must do anything in the world in order to reduce this load time as it is the heart of our website.
Then we found the culprit! They were the high quality images (which were apple of our clients eye) on the page. And it contributed…
In my previous post I explained what is Handlebars JS and how we can use it with Ruby on Rails. In this article lets look at some of the useful helpers provided out of the box by Handlebars, how we can add custom helpers and also how we can create reusable partials.
This article will guide you on how we can take the advantage of the Mailchimp web hooks in order to keep our database synchronized with mailchimp data. Actually in our database we stored the data from mailchimp user profile such as email, name and subscription status(i.e subscribed or unsubscribed).
Now to keep our database column updated there are two ways:
Technology: Ruby on Rails
Versions: Rails: 5.1.4 , Ruby: 2.4.1 (would work with almost any version)
Git Repo: https://github.com/AnkurVyas-BTC/compare
We are going to build something like below.
Let’s have a brief introduction to Webpacker and React JS. If you are familiar with React JS and Webpacker directly go to Implementation section.