Skip to content

Instantly share code, notes, and snippets.

View subratrout's full-sized avatar

Subrat Rout subratrout

View GitHub Profile
@subratrout
subratrout / gist:0d0e56fd2038b1a93a85026a512b86f6
Created September 22, 2017 23:25 — forked from hiromipaw/gist:47fd3e4f3120dc8887b1
Interview questions reloaded

1. What is a class, what is an object and why we need modules

This may be simple, but it allows to start a conversation between two strangers involved into the same craft.

Answer:

Classes are a blue-print, they may hold data, likely they hold methods; classes are directly connected with an idea of objects, because object is an instance of a class. As objects are first-class citizens in Ruby, there is a main, root class Object, and all classes are inherited from this root entity. Modules, generally, are a tool for mix-ins and they provide something we call a namespace. Modules cannot be initialised the way we can do this with classes, but they provide a multiple inheritance.

2. Who’s _why and what’s up with his Shoes?

@subratrout
subratrout / job_interview_qs.md
Created September 22, 2017 23:25 — forked from amysimmons/job_interview_qs.md
Job Interview Questions

#A team

##What is Rails?

Rails is an open source web application framework written in Ruby. It is a full-stack framework that has been optimised for programmer happiness and sustainable productivity. It emphasises the use of well-known software engineering patterns and paradigms, including convention over configuration (CoC), don't repeat yourself (DRY), the active record pattern, and model–view–controller (MVC).

Extra: David Heinemeier Hansson (DHH) is the creator of Rails, having extracted it from his work on Basecamp. He first released Rails as open source in July 2004.

Useful Links:

@subratrout
subratrout / btc-eth-dca-buy.php
Created August 24, 2017 22:41 — forked from levelsio/btc-eth-dca-buy.php
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
Try implementing a method called occurrences that accepts a string argument and uses inject to build a Hash. The keys of this hash should be unique words from that string. The value of those keys should be the number of times this word appears in that string.
def occurrences(str)
word_hash = Hash.new(0)
str.scan(/\w+/).inject(word_hash) do | number, word|
number[word.downcase] += 1
number
end
end
@subratrout
subratrout / capybara cheat sheet
Created August 3, 2017 23:04 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@subratrout
subratrout / mac-apps.md
Created June 22, 2017 21:11 — forked from erikreagan/mac-apps.md
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@subratrout
subratrout / gist:e621e75f6e4c3eb0c46c85bf7bdd3ee9
Created May 11, 2017 06:01 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

select
a.id as article_id, m.template_id, a.url || a.external_id as url, m.country_code, m.language_code, m.wildcard_exclusion_locales
from obs.ARTICLE a, email.template_dms_map m
where a.id = m.dms_id and m.mapping_on = 1
and regexp_like(m.template_id,'salesorder','i')
-- and a.id in (77068)
order by lower(external_id);
You can configure an individual repo to use a specific user / email address which overrides the global configuration.
From the root of the repo, run
git config user.name "Your Name Here"
git config user.email your@email.com
whereas the default user / email is configured in your ~/.gitconfig
git config --global user.name "Your Name Here"
git config --global user.email your@email.com