Using Selenium IDE

What is selenium IDE: Selenium-IDE (Integrated Development Environment) is a tool that you use to develop your Selenium test cases. It’s a Firefox plug-in. The 'record' button in selenium IDE enables user to record his actions and is a real time saver. Although, many-a-times, due to the external plugins used in our app, we need to manually write scripts or atleast modify the recorded scripts. Why should developers know about selenium IDE? In many of our applications, we have multiple forms and features that require testing/checking whenever we make slightest of change in our code. Selenium IDE provides

CSS and ActionMailer in Rails3.

Lately, I was working on a project where I found an issue that emails sent using ActionMailer were not applying css styles to the html elements of the email. On adding style tag in the email view files, I was able to view stylings on thunderbird mail and ymail but still I was unable to view css stylings for emails in gmail. On furthur investigating the issue, I found that gmail requires inline stylings to be applied to the email templates. I found some gems which could fix this problem by converting external css to inline css. I tried the

PRY gem - Smarter replacement to irb

PRY GEM Pry is a powerful alternative to the standard IRB shell for Ruby. It is a REPL (it reads, evaluates, prints, loops). Pry’s advantages over irb are Pry adds additional features such as syntax-highlighting, managing history, Live help system etc. CONFIGURE YOUR RAILS APP TO USE PRY INSTEAD OF IRB: Add this line to your gemfile: gem 'pry-rails', :group => :development then run: bundle install you can go ahead and load the console normally using: rails console Once you have the gem installed, you can enter into a session with pry, by just typing pry in your Terminal. pry

ActiveSkin gem

ActiveSkin gem provides an easy way to customize Active Admin CSS depending upon your website's color scheme in just few minutes. Steps: 1/ Add to your Gemfile: gem 'active_skin' 2/ Run: bundle install 3/ Add to active_admin.css.scss: //Add the Website's logo. This is displayed on the top-left corner of the page. $skinLogo: url("logo.png") no-repeat 0 0; //This color is applied to buttons, drop-down lists etc. in the AA UI $skinActiveColor: #05B6C7; //Applied to the main header of Active Admin $skinHeaderBck: #000000; //Applied to the header of AA filters. $panelHeaderBck: #000000; @import "active_skin"; Sample

Code refactor and reusable code snippets

Hello Team, Last week I got an opportunity to refactor code for one of our projects. Along with that I got an opportunity to share some code modules that can be used in other projects. It was a good experience. I also found some places in the code where performance of the app could be improved by refactoring the code. Please feel free to correct me if I am wrong at any place. Please do let me know your suggestions. Refactored code snippets: 1)Eg: FactoryGirl.define do factory :attachinary_file do attachinariable_type { 'Bottle' } scope { 'images' } public_id { ('a'.

Webhooks & Stripe

What are webhooks A Webhook is a method of altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application. WebHooks are an HTTP POST callback request sent to URL of a user’s choice in response to some event occurring. They offer simple and effective server to server communication without long running connections How do I implement WebHooks? Simply provide your users with the ability to submit their own URL, and POST

View formatted table columns using table_print gem

table_print Gem It's an efficient way to view a list of structured data, making it easy to scan and compare across large swaths of records. It even lets you nest other tables of related objects, contextualizing data across tables. It’s incredibly flexible, yet simple, making it easy to see exactly the data you care about. INSTALLATION: To install the gem: Add the following to your gemfile- gem "table_print", "~> 1.0.0" Then run: $ bundle install USAGE: Go to rails console: $ rails c Eg. 1) To view the entire table: tp Size.all Will give the output: ID

Monitor Form Changes

All of us have e-forms in our apps, it is an effective tool for gathering information of and from the users. A user fills the e-form and saves the same. Many-a-times, we need to monitor if the user has modified the form contents after once saving the form. Found a plugin that monitors form changes. Add the following code to .js file: (function ($) { $.fn.watchChanges = function () { return this.each(function () { $.data(this, 'formHash', $(this).serialize()); }); }; $.fn.hasChanged = function () { var hasChanged = true; this.each(function () { var formHash = $.data(this, 'formHash'); if (formHash == $(this).serialize()) { hasChanged = false; return true; } }); return hasChanged; }; }).call(

Reek Gem

Reek gem is a code smell detector for ruby. It examines Ruby classes, modules, methods and reports any code smells it finds. To install this gem, use: gem install reek USAGE: 1/ Scan the current directory: <pre>$ reek .</pre> 2/ scan specific directories like: <pre>$ reek lib/your/files</pre> To read more about reek gem click here(reek doc) To find up to date details of what exactly reek will check in your code check this(reek wiki)