Posts

#18. Ruby on Rails usefull commands

 gem install rails rails new hrms -d postgresql

#17. RVM useful commands

 rvm get head - update rvm rvm install ruby - install latest version of ruby rvm list known - list all known version of Ruby rvm list  - list all installed version of ruby rvm install ruby-3.2  - install ruby version 3.2 rvm --default use ruby-3.2.0-preview1 - set default version for ruby

#16. postgresql useful commands

Remove commands sudo apt-get --purge remove postgresql postgresql-* dpkg -l | grep postgres - list all postgres related packages sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/ sudo deluser postgres sudo apt-get --purge remove postgresql postgresql-doc postgresql-common pg_config --version  psql --version  Install commands sudo apt update && sudo apt upgrade sudo apt install postgresql postgresql-contrib sudo systemctl start postgresql.service Postgres uses a concept called “roles” to handle authentication and authorization. sudo -i -u postgres - switch over to postgres account psql - access postgresql prompt \q - exit from postgresql prompt sudo -u postgres psql - open postgres prompt without switching accounts create new role sudo -i -u postgres createuser --interactive or with sudo command, sudo -u postgres createuser --interactive reset password of the role sudo -u postgres psql alter role aarya with password 'Pass@t...

# 15. My used gems list

-------- For RSpec testing ------------ gem 'capybara' gem 'selenium-webdriver' gem 'webdrivers' gem 'rails-controller-testing' gem 'faker' gem 'factory_bot_rails' gem 'rspec-rails' gem 'rswag' - testing and API documentation ------- for code quality --------- gem 'rubocop' -----------------Miscellaneous-------------- gem 'mini_racer' - for java script runtime gem 'caxlsx' - for excel sheet gem 'caxlsx_rails' gem 'active_link_to' gem 'simple_calendar' - for calendar gem 'jquery-ui-rails' gem 'jquery-rails' gem 'bootstrap' gem 'awesome_print' --------- database --------- gem 'mysql2' gem 'sqlite3' ---------------------------------- gem 'faraday' - For API calling  gem 'oj' -  For JSON parser gem 'paho-mqtt' - for interacting with the mqtt server gem 'dalli' - for memcache

#14. Rails notes command

 raj@linux:~/workspace/test_app$ rails notes -h Usage:   rails notes [options] Options:   -a, [--annotations=one two three]  # Filter by specific annotations, e.g. Foobar TODO Example, raj@linux:~/workspace/test_app$ rails notes -a DEBUG app/controllers/configs_controller.rb:   * [6] This is not exactly working raj@linux:~/workspace/test_app$ rails notes -a DEBUG TEST TODO app/controllers/application_controller.rb:   * [5] [TODO] Check this method for optimization app/controllers/configs_controller.rb:   * [6] [DEBUG] This is not exactly working app/controllers/feedbacks_controller.rb:   * [2] [TEST] Have to write test cases for this method raj@linux:~/workspace/test_app$ rails notes app/controllers/application_controller.rb:   * [5] [TODO] Check this method for optimization

#12. Memcache

Uninstallation/Installation, sudo apt-get remove memcached sudo apt-get remove --auto-remove memcached sudo apt update && sudo apt upgrade sudo apt install memcached  # For the use of mem-cache gem 'dalli' root@test_app:~# memcached -h | head -1 memcached 1.5.22 rails dev:cache root@test_app:~# ls tmp/ cache  data  development_secret.txt  miniprofiler  pids  res  restart.txt  sockets root@test_app:~# rails dev:cache Development mode is now being cached. root@test_app:~# ls tmp/ cache  caching-dev.txt data  development_secret.txt  miniprofiler  pids  res  restart.txt  sockets root@test_app:~# rails dev:cache Development mode is no longer being cached. root@test_app:~# ls tmp/ cache  data  development_secret.txt  miniprofiler  pids  res  restart.txt  sockets touch tmp/restart.txt root@test_app:~# ls tmp/ cache  caching-dev.txt data  development_secret.txt ...

#10. positive? method

 3.0.4 :001 > 0.positive?  => false  3.0.4 :002 > 1.positive?  => true  3.0.4 :003 > -1.positive?  => false