• MAKING FOLLOW-MAPPING ON RAILS

    MAKING FOLLOW-MAPPING ON RAILS   STEP-1:  On terminal $rails g model FollowMapping follower_id:integer followee_id:integer $rake db:migrate STEP-2: home_controller def users @users = User.all  end

  • Fixing a header after scrolling to a certain point

    Fixing a header after scrolling to a certain point For this we have to use javascript for fixing header at a certain point. $(document).scroll(function() { var y = $(document).scrollTop(); header = $(“#menu”); if (y >= 200) { header.css({ position: “fixed”, “top”: “0”, “left”: “0” }); } else { header.css(“position”, “relative”); } }); So here #menu…

  • Parallax Scrolling Effect

      Parallax Scrolling Effect This is purely based on html and css. Parallax is an effect where the position of an object seems to be different when viewed from different positions. Parallax motion, or in our case, parallax scrolling, then gives us the illusion that two objects in the same line of sight, but with…

  • Asymptotic Notations

    The following 3 asymptotic notations are mostly used to represent time complexity of algorithms. 1) Θ Notation: The theta notation bounds a functions from above and below, so it defines exact asymptotic behavior. A simple way to get Theta notation of an expression is to drop low order terms and ignore leading constants. For a…

  • Understanding USB cable Types

    Understanding USB cable Types   Computers and electronic devices have some form of USB connection, and many devices also come packaged with a USB cable. What are all these different cables for and does it matter which one you use? For now, yes it does matter. This may change in the near future. Universal Serial…

  • Change file_field_tag appearance

    Change file_field_tag appearance   HTML: <span class=”btn btn-large btn-warning btn-file”> Choose File <%= file_field_tag :attachment %> </span> CSS: .btn-file { position: relative; overflow: hidden; } .btn-file input[type=file] { position: absolute; top: 0; right: 0; min-width: 100%; min-height: 100%; font-size: 100px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; background: white; cursor: inherit; display: block; }

  • Ruby on Rails: putting class with submit_tag

    Ruby on Rails: putting class with submit_tag <%= submit_tag(“Update”, :id=>”button”, :class=>”Test”, :name=>”submit”) %> First parameter is required and it would be value and they any parameter you want to specify, can be done in a hash like :key=>”value”.

  • How to stop event propagation with inline onclick attribute?

    stop event propagation SO we will stop propagation at that point so that click will be performed for one div. Sample Code- <!DOCTYPE html> <html> <head> <title>Check Out Propagation</title> </head> <body> </div> </div> <style type=”text/css”> #third{ height: 300px; width: 300px; background-color: black; } #outer{ height: 200px; width: 200px; background-color: red; } #inner{ height: 100px; width:…

  • Readmorejs::Rails (HOW TO?)

      Readmorejs::Rails Installation Add this line to your application’s Gemfile: gem ‘readmorejs-rails’ And then execute: $ bundle install Or install it yourself through terminal:

  • Deploy Rails to Heroku

    Deploy Rails to Heroku Follow these 12 steps for deploying your app on heroku. Create a new Heroku account. In the terminal, log in using the email address and password of Heroku account: $ heroku login In Gemfile, add the pg gem to your Rails project. Change: gem sqlite to gem ‘sqlite3’, group: :development gem ‘pg’,…