Cloud Computing: The Digital Shift 2.0 – Understanding the Current Market Trends

sandipransing

Authorize Net (AIM) payment integration with rails

Authorize Net (AIM) method enables internet merchants to accept online payments via credit card. We shall see how to integrate authorize net payment gateway inside a rails app to accept online payments using activemerchant library. [sourcecode lang=”ruby”] # Gemfile gem ‘activemerchant’, :require => ‘active_merchant’ [/sourcecode] Register for authorize net sandbox account click here Payment gateway credentials …

Authorize Net (AIM) payment integration with rails Read More »

Setup Active Scaffold with rails 3 using jQuery

Create new rails project [sourcecode lang=”ruby”] rails new demo -d mysql [/sourcecode] Add active_scaffold gem to bundler [sourcecode lang=”ruby”] gem "active_scaffold_vho" bundle install [/sourcecode] Setup active scaffold to use jQuery [sourcecode lang=”ruby”] rails g active_scaffold_setup jquery create public/javascripts/rails_jquery.js create public/javascripts/jquery-ui-timepicker-addon.js create config/initializers/active_scaffold.rb insert app/views/layouts/application.html.erb insert config/locales/en.yml gsub app/views/layouts/application.html.erb [/sourcecode] Generate active scaffold for resource city …

Setup Active Scaffold with rails 3 using jQuery Read More »

Ghostype input Placeholder for search text fields using jQuery

>Placeholder Demo Ghostpe Demo $(document).ready(function(){ var search = “#home-search”; var chars = $(search).attr(‘placeholder’).split(”); $.each(chars, function(i, v){ setTimeout(function() { $(search).val((chars.slice(0, i+1).join(”))); }, 100*i); }); });jQuery placeholder plugin can be used to display default text inside input text fields.HTML5 introduced type search fields with placeholder attribute support. <input class=”query” id=”home-search” placeholder=”Enter search text here” type=”search” />It should …

Ghostype input Placeholder for search text fields using jQuery Read More »

Setting up nginx maximum upload size

>Edit nginx configuration and look for html block.Inside html block add following line.http { include conf/mime.types; default_type application/octet-stream; client_max_body_size 10m; ….}In above configuration “application/octet-stream” supports any kind of file upload.

Twitter share and facebook like button for haml-rails, html/erb

>Twitter share and facebook like button for html/erb<div class=’spread’>  <div class=’twshare left’>   <a href=”http://twitter.com/share” class=”twitter-share-button” data-count=”horizontal” data-via=”funonrails”>Tweet</a><script type=”text/javascript” src=”http://platform.twitter.com/widgets.js”></script>  </div>  <script src=”http://connect.facebook.net/en_US/all.js#xfbml=1″></script><fb:like href=”” layout=”button_count” show_faces=”false” width=”450″ font=””></fb:like></div>Twitter share and facebook like button for haml.spread .twshare.left %a.twitter-share-button.left{“data-count” => “horizontal”, “data-via” => “fuonrails”, :href => “http://twitter.com/share”} Tweet %script{:src => “http://platform.twitter.com/widgets.js”, :type => “text/javascript”} .fshare.left{:style => ‘padding-left: …

Twitter share and facebook like button for haml-rails, html/erb Read More »

number to indian currency helper for rails with WebRupee

>rails has built in number_to_currency helper which takes options like unit, delimeter, seperator which displays foreign currency correctly but somehow it is not best suited for indian currency.Below is how we managed 2 years ago to display indian currency formatted properly with comma as seperator. personally i think it could be more better than what …

number to indian currency helper for rails with WebRupee Read More »

Accessing View Helpers & Routes in Rails Console, Rake Tasks and Mailers

> While looking for accessing rails template tags to be accessed on rails console in order to examine whatever written needs to be correct, found that – rails template tags can be tested on rails console using helper objectmodule ApplicationHelper def display_amount(amount) number_to_currency amount, :precision => 0 end endHelpers on rails consolerails c>> helper.text_field_tag :name, …

Accessing View Helpers & Routes in Rails Console, Rake Tasks and Mailers Read More »

Monitor Delayed Job in rails

>Delayed Job & Monit configuration We were struggling through how to monit delayed_job from past few months because monit doesn’t work seamlessly with delayed_job start/stop commands and finally we got able to monit delayed_job. Here is our old configuration that wasn’t working anyhow- [sourcecode lang=”ruby”] check process delayed_job with pidfile /home/sandip/shared/pids/delayed_job.pid stop program = "/bin/bash …

Monitor Delayed Job in rails Read More »

Getting started with rails 3 & postgres database

>Rails 3 Installationsudo gem install rails -v3.0.4postgres as db installationbr/$ sudo apt-get install postgresqlRails 3 App with postgres as database$ rails new pg -d postgresbundle installationIt will install dependency gems & postgres adapter for db connectionbundle installHere by default ‘postgres’ database user gets created while installation but i recommend to create new db user with …

Getting started with rails 3 & postgres database Read More »

Auto login remote server by copying ssh public key to authorized keys

>While working on remote machine we often get headache of entering password for ssh login, scp files from one server to another server. Adding public key as authorized_keys on remote server solves this problem. Copying from my system to remote server cat ~/.ssh/id_rsa.pub | ssh sandip@server ‘cat >> ~/.ssh/authorized_keys’Copying from remote server to my system …

Auto login remote server by copying ssh public key to authorized keys Read More »