Skip to content

Instantly share code, notes, and snippets.

View sudiptamondal's full-sized avatar
🏠
Working from home

Sudipta Mondal sudiptamondal

🏠
Working from home
  • New Delhi, India
View GitHub Profile
@sudiptamondal
sudiptamondal / hello_world.rb
Last active December 19, 2015 11:29
Complementing a tutorial video with ruby code. Part 2. Hello World
# hello_world.rb
# This will manage routes and display the content.
# I am sure, you did watch the video before checking this out.
require "sinatra"
set :bind, '127.0.0.1'
set :port, '8080'
get '/hello/:name' do
@sudiptamondal
sudiptamondal / install_gem.sh
Created July 8, 2013 11:16 — forked from anonymous/install_gem.sh
Complementing a tutorial video with ruby code. Part 1. Installing ruby gem
# Steps
# 1. Install the gem sinatra
gem install sinatra
# you you skip rdoc and ri using
# gem install sinatra --no-rdoc --no-ri
@sudiptamondal
sudiptamondal / Hoppr_interview_question.rb
Last active December 16, 2015 08:59
Scope: Many programming languages implement scope for variables – and they are context sensitive. For example a global scope variable will be over-ridden using local variable definition. You need to implement simple interpreter which tells us current value of a variable, if its not defined then value should be zero, Input will start with ‘[‘ and…
puts "Enter your statements separated by a carriage return, The matching braces will terminate the loop"
variables = Hash.new(Hash.new)
opening_brackets = 0
closing_brackets = 0
while true
variable = nil
level = nil
value = nil
input = gets.chomp