Posts

Showing posts from March, 2019

Create worker in rails by sidekiq and redis

Add sidekiq to your Gemfile: Add this to your Gemfile gem 'sidekiq' Run bundle install bundle install Create worker rails g sidekiq:worker Test #will create app/workers/test_worker.rb class TestWorker   include Sidekiq::Worker   def perform(id, name)     # do something   end end Call worker without any time boundation TestWorker.perform_async(5, 'rahul') //use this anywhere from your rails app(controller, model, helpers..) Call worker within particular time period TestWorker.perform_in(5.minutes, 5, 'rahul')  //use this anywhere from your rails app(controller, model, helpers..) Call worker after specific time interval once only TestWorker.perform_at(5.minutes.from_now, 5, 'rahul')  //use this anywhere from your rails app(controller, model, helpers..) Start sidekiq on development bundle exec sidekiq Start sidekiq on production bundle exec sidekiq -d //run this first if you get some error then use second one bundle exec si

css for iso device or ipad or safari browser and media query

@supports (-webkit-overflow-scrolling: touch) {   /* CSS specific to iOS devices */  } @supports not (-webkit-overflow-scrolling: touch) {   /* CSS for other than iOS devices */  } For example: @media only screen and (device-width: 768px) {         /* default iPad screens */     }     /* different techniques for iPad screening */     @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {       /* For portrait layouts only */     }     @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {       /* For landscape layouts only */     } HTML <div class="scroll-touch">   <p>     This paragraph has momentum scrolling   </p> </div> <div class="scroll-auto">   <p>     This paragraph does not.   </p> </div> div {   width: 100%;   overflow: auto; } p