All Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh
is now part of
LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
You may have came across a situation where you need to share your local app to clients (in other words your Rails app running on your local server port 3000). You may have came across a situation where you need to share your local server. So in such cases a widely used tool is localtunnel But it has a limitation with consistent url as it generates a random URL for every new instance. Pagekite suffices this need and gives a consistent URL for one server bind to a port. PageKite makes local websites or SSH servers publicly accessible Getting Started
Jquery.isotope.js A jquery plugin to organize the Grids and shuffle the grids automatically based on the height and width of the container. Advantages It has different layouts that we can use to organize the grids in the way we want. Also enables us to extend the existing layouts extensively to suite our needs. It allows us to filter the grids based on the properties of grid. eg: "All employees, Male Employees, Female Employees" We can also order the grids based on priorities. From the above example, we can order employees based on their age( Male Employees
The plus point of having test environment is that we can test our whole application in a different dedicated environment without any manual efforts. Technically, it involves views, controller methods, request/response, routes, models(callbacks, validations, etc.) There are few scenarios in which we'd require to test after_commit changes.The application which manipulates data majorly in after_commit callback could cause issues in test environment thus causing it to fail. The problem is that the after_commit callback is never fired in rspec if we use transactional fixtures. -> What is transactional_fixtures ? -> ActiveRecord’s fixtures,
Upgrading Rails 3.2 to Rails 4 You’ll need to be running Ruby 1.9.3 or later Create New branch $ git checkout -b rails4 Gemfile Changes: Replace: gem 'rails', '3.2.x' with: gem 'rails', '4.0.0.rc1' Rails 4 removes 'assets' group, so remove assets group and change the gem version included in assets compatible to rails 4 like: gem 'coffee-rails', '~> 3.2.1' => gem 'coffee-rails', '~> 4.0.0.rc1' gem 'less-rails' gem 'sass-rails', '~> 3.2.3' => gem 'sass-rails', '~> 4.0.0.rc1' gem 'uglifier', '&
Code Climate is a great web-tool to check code complexity, duplications and security vulnerabilities. Internally, code climate uses Flog to calculate code complexity and BrakeMan for security vulnerabilities. But it checks only when we commit code to Git. We can check code complexity and security issues before committing to git. For code complexity: install flog gem install flog Goto project root path and run command: find path_of_file -name *.rb | xargs flog For example: find app/controllers/application_controller.rb -name *.rb | xargs flog It will display the total complexity for the class, complexity per method and complexity of
In ActiveAdmin, if your resource model is deriving some data from other models, using some kind of relationship(has_one or has_many). In this scenarios where you want to search and filter the resource based on the data in its related table, you can follow below: Suppose you have a model School, and a model Student, now you want to search or filter students based on the school name. We can filter using join(:schools).where("schools.name like") or say an In Query which is inefficient. Either way ActiveAdmin does not provide default filters based on
Backup your Database OR any of your personal stuff like directories with [backup][1] Backup's Components Archives and Databases Compressors and Encryptors Storages Syncers Notifiers Its a handy backup tool with plenty of storage options (for example: S3, Dropbox, FTP, SCP and many more) For installation(Dependencies should be installed if you are working with shell environment) gem install backup backup dependencies --install net-ssh backup dependencies --install net-scp backup dependencies --install excon backup dependencies --install fog Now execute the @backup generate@ command backup generate:model -t backup [-c ] --archives \ --storages='local,s3' --compressors='gzip' --notifiers='mail,twitter' This will create
Simple scheduler that runs periodically. Code is Really Simple. scheduler = Rufus::Scheduler.start_new scheduler.in '20m' do puts "order ristretto" end The Usage is Really Simple In Rails Environment. I'll take the example of Rake task First. I will try to create a resque:work like task. task :my_scheduler_work => :environment do scheduler = Rufus::Scheduler.start_new scheduler.in '20m' do User.call_some_method end end Doing This in an non rails Env. For Ex: abcd.rake require 'rake' # require 'abcd' # File with all the classes and libs that are needed for rake task to run. task
Everyone these days working with one or the other Version controls systems and Agile tracking tools. Currently for our most of the project, we are working with github and for tracking we all are using Pivotal, Trello or some other tools. Now these apps are having some cool apis and api tokens which helps us integrating Version control system and tracking tools. So that when we commit something that same message gets saved in our tracking tool. At the same time those tracking tools change their status automatically from Started -> Finished -> Delivered etc I am going
Postmark is widely used email delivery service for the web application. The “Postmark-Rails” Gem is a drop-in plug-in for ActionMailer to send emails via Postmark. Links: Postmark-app(Postmark-app) , Postmark-rails gem(Github Doc) , Postmark Developer’s Blog(Postmak Blog) To integrate it with your application: Create an account on postmark.com (it also provides free account), set your-email as sender’s signature. This email-signature only you can use to send email, by setting it in from address. In you environment files: (staging/ production) POSTMARK_API_KEY = your_postmark_api_key config.action_mailer.delivery_method = :postmark config.action_mailer.postmark_settings