Skip to main content

Posts

Production deployment steps in rails?

Production deployment steps in rails? List of steps for Production deployment 1)In app folder -> git pull origin master 2)bundle install --path vendor/bundle 3)rake assets:precompile RAILS_ENV=production 4)touch tmp/restart.txt 5)If u want to restat server level command is  sudo service nginx restart 6)Stop the nginx server command is sudo service nginx stop 7)Starting the nginx server command is sudo service nginx start

Cronjob in ruby on rails

1)Install whenever gem 2)In application folder run the wheneverize. 3)In schedlue.rb file every 3.hours do runner "MyModel.some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end 4)Write the rake task 5)namespace :events do   desc "Rake task to get events data"   task :fetch => :environment do     events = Event.nba_search     events.each do |item|       item.each do |hash|         @event = Event.new({         # Code to instantiate an event         })         @event.save       end     end     puts "#{Time.now} - Success!"   end end end 6)whenever --update-crontab

Ruby Encoder Steps

List Of steps for RubyEncoder 1)Downlolad the https://www.rubyencoder.com/profile.html -> Or else we can download in this link also 2)Copy above file in this directory -> /usr/local/bin  (RubyEncoder-2.2-Evaluation-Linux-x86_64-Install) 3)Give the permissions chmod 755 RubyEncoder-2.2-Evaluation-Linux-x86_64-Install 4)Run the RubyEncoder-2.2-Evaluation-Linux-x86_64-Install command 5)Open Existing Project   i)Add button click   ii)Choose for destination   iii)Click on encode button   iv)select the platform which one we want to encode     1)FreeBSD     2)Linux     3)Windows     4)Macos x  6)Set the destination folder.  7)Click on install button.

Iquanti Apptitude Test for ror

Iquanti Apptitude Test for ror ? Anagrams Max. Marks 100 Given two strings A and B, check if they are anagrams. Two strings are said to be anagrams, if one string can be obtained by rearranging the letters of another. Examples of anagrams are dog, god; abac, baac; 123, 312 abab, aaba; dab, baad are not anagrams. INPUT : First line of the input is the number of test cases T. It is followed by T lines, each line has two space separated strings A and B; OUTPUT For each test case, print "YES" if they are anagrams, otherwise print "NO". (without quotes) Constraints 1 <= T <= 10 A and B both contain only lower case latin letters 'a' to 'z' and digits 0 to 9. Length of each string A and B does not exceed 5*10^5 (500000), Sample Input(Plaintext Link)  3 abcd bcda bad daa a1b2c3 abc123 Sample Output(Plaintext Link)  YES NO YES ==================== 4. Prime or Not Max. Marks 100 Given the number N check whether it i...

Basic Ruby Programs for Interview?

Basic Ruby Programs for Interview? # require 'prime' # # p Prime.first(10) # Prime.each(100) do |prime| #   p prime  #=> 2, 3, 5, 7, 11, ...., 97 # end #Prime number programe  def prime_numbers max for i in (2..10) do     for j in (2..i) do         break if i%j == 0     end     p "#{i} is a prime number." if i == j end  end #Factorial Programe n = gets n = n.to_i def fact(n)   if n == 0     1   else     n * fact(n-1)   end end p fact(n) #Reverse Number Programe x = 12345 y = 0 while x > 0 do     y = y*10     y = y + (x%10)     x = x/10   puts y     end puts "What character do you want to make the pyramid out of?" character = gets.chomp puts "How many rows of #{character}'s do you want?" row_count = gets.chomp.to_i character_count = 1 width = 100 row_count.times do put...

Facebook share url in rails

Facebook share url in rails ?   https://www.facebook.com/dialog/feed?app_id=14563499550189 &display=popup&caption=An%20example%20caption&link=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2&redirect_uri=https://developers.facebook.com/tools/explorer

Omniauth facebook email id not getting in rails?

Omniauth facebook email id not getting in rails? Better way use the koala api get the email address Steps 1)gem "koala" 2)bundle install 3)Get the request.env['omniauth.auth'] 3)@graph = Koala::Facebook::API.new( request.env['omniauth.auth']['credentials']['token'] ) 4)user_email = @graph.get_object("me?fields=email")