Skip to content

Instantly share code, notes, and snippets.


Sudhir Vishwakarma sudhirsb2003

Block or report user

Report or block sudhirsb2003

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View YARD cheatsheet
cribbed from
Templates to remind you of the options and formatting for the different types of objects you might
want to document using YARD.
## Modules
# Namespace for classes and modules that handle serving documentation over HTTP
sudhirsb2003 /
Last active Nov 30, 2017
Ruby & Rails questions

Ruby and Rails Interview Questions


  • What is a class?
  • What is an object?
  • What is a module? Can you tell me the difference between classes and modules?
  • Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
  • There are three ways to invoke a method in ruby. Can you give me at least two?
  • Explain this ruby idiom: a ||= b
View gist:7564fd2eca8b852d8fac4e982a387898
Interval Queries (Basically to find Age range)
User.where(%q{created_at - birthdate < interval '13 years'})
sudhirsb2003 / Rails 4 Deployment Configuration
Last active Aug 9, 2019
Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
View Rails 4 Deployment Configuration
### Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3
SSH into Root
$ ssh root@
Change Root Password
$ passwd
sudhirsb2003 / gist:1064701
Created Jul 5, 2011
Naive CSRF-protection: Rails 3 and Ext.js 4's
View gist:1064701
Ext.define('Ext.rails.ForgeryProtection', {
csrfParams: function() {
var params = {};
var metaCsrfParam ='meta[name=csrf-param]').item(0);
var metaCsrfToken ='meta[name=csrf-token]').item(0);
if (metaCsrfParam != undefined && metaCsrfToken != undefined) {
var name = metaCsrfParam.getAttribute('content');
var value = metaCsrfToken.getAttribute('content');
if (name != undefined && value != undefined) {
params[name] = value;
You can’t perform that action at this time.