Posts

Showing posts from July, 2016

Add Ruby slim package into Sublime text editor

The simplest method of installation is through the Sublime Text console. The console is accessed via the  ctrl + `  shortcut or the  View  >  Show Console  menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console. Sublime-3 import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) Sublime- 2 import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442'

Create user in postgresql and connect it into rails application

Install Postgresql:- sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list" wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get install postgresql-common sudo apt-get install postgresql-9.5 libpq-dev   The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases. Feel free to replace arvind with your username. sudo -u postgres createuser arvind -s  # If you would like to set a password for the user, you can do the following  sudo -u postgres psql postgres=# \password arvind   Come into Rails Application config/database.yml default: &default adapter: postgresql pool: 5 username: 'arvind' password: 'arvind' timeout: 5000 host: 127.0.0.1 development: <<: *default database: db_developm

show loader on ajax start

In HTML:- <div class="ajax-loading">     <span>       <p id="please_wait"><strong>Please wait..</strong></p>       <p><i class="glyphicon glyphicon-refresh gly-spin" aria-hidden="true">       </i></p>     </span>   </div> <script>        $(document).ajaxStart(function() {              $(".ajax-loading").show();     });     $(document).ajaxStop(function() {          $(".ajax-loading").hide();     }); </script> In CSS:- /* Loading css*/ div.ajax-loading{   width: 100%;   height: 100%;   top: 0px;   left: 0px;   position: fixed;   display: none;   background: rgba(51,51,51,0.9);   z-index: 2000;   text-align: center;   color: #ffffff; } div.ajax-loading span{   position: absolute;   top: 40%;   left: 50%;   margin-left: -15px; } div.ajax-loading span p{   padding-top: 10px;   padding-right: 10px;   font-size: 1.1em; } div.ajax-loading sp