Skip to main content

Posts

Showing posts from February, 2014

Doorkeeper Api Integration in Rails

for controller::: doorkeeper_for :all require 'rest-client' require 'json' def index client_id = 'my_client_id...' client_secret = 'my_client_secret...' response = RestClient.post 'http://localhost:3000/oauth/token', {   grant_type: 'client_credentials',   client_id: client_id,   client_secret: client_secret } token = JSON.parse(response)["access_token"] getiing data to apis for doorkeeper----------------- ####Getting data from doorkeeper api########## response = RestClient.get('http://localhost:3000/api/v1/profiles.json', { 'Authorization' => "Bearer #{token}"}) data = JSON.parse(response) p data.inspect ####Posting data to api########## response_user = RestClient.post('http://localhost:3000/api/v1/profiles.json',{       profile:       {       first_name: params[:first_name]       last_name: params[:last_name]       }}...

Postgresql Commands

postgresql basic commands  1)sudo -u postgres psql  2)psql -U postgres -W template1  3)\list ---list of databases;  4)\c chinna_development(databasename); connect to database  5)\d user(table name); seetable rows or  \d+  6)quit q ===========     \l :List databases     \c database-name :List databases     \d :List tables in database     \d table-name :Describe table     \q : quit     select * from table-name :List table contents     delete from table where condition => ======================  \a             toggle between unaligned and aligned mode  \c[onnect] [dbname|- [user]]                 connect to new database (currently 'booktown')  \C <title>     table tit...

Onclick open Popup in jquery

$(document).ready(function() { $('.popup').click(function() {       var toppos = (screen.height/2)-(height/2);         var leftpos = (screen.width/2)-(width/2);         window.open($(this).attr("href"), "popupWindow", "width=600,height=600",top="+toppos+", left="+leftpos+");     retun false  }); });

Deployment Commands For Ruby On Rails

bundle install  --path vendor/bundle RAILS_ENV=staging (or) production bundle exec rake db:migrate RAILS_ENV=staging (or) production bundle exec rake assets:precompile #sudo /etc/init.d/nginx stop #sudo /etc/init.d/nginx start sudo /etc/init.d/memcached restart touch tmp/restart.txt ###########Using sunspot solr RAILS_ENV=staging (or) production   rake sunspot:solr:stop RAILS_ENV=staging (or) production   rake sunspot:solr:start RAILS_ENV=staging (or) production rake sunspot:reindex