Skip to content

Instantly share code, notes, and snippets.

View dvoryankin's full-sized avatar
🌴
On vacation

Dvoryankin Dmitry dvoryankin

🌴
On vacation
View GitHub Profile
@dvoryankin
dvoryankin / bootstrap errors
Created June 22, 2017 14:12
bootstrap errors
Started GET "/Starter%20Template%20for%20Bootstrap_files/bootstrap.css" for 127.0.0.1 at 2017-06-22 19:11:30 +0500
ActionController::RoutingError (No route matches [GET] "/Starter%20Template%20for%20Bootstrap_files/bootstrap.css"):
actionpack (5.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
1. Знание основ Ruby, фреймворка Ruby on Rails
- http://guides.rubyonrails.org/
- http://rusrails.ru/
Вопросы:
1. Чем отличается статическая и динамическая типизации в языках программирования?
2. Какие виды наследования поддерживаются в Ruby?
3. Что такое модуль? Какая разница между классом и модулем?
4. Какие есть уровни контроля доступа к методам для классов и модулей?
5. Какие есть способы вызова методов в Ruby?
6. Что означает ключевое слово self?
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
Counting objects: 14, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.53 KiB | 0 bytes/s, done.
Total 14 (delta 9), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
git push heroku master
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.6
remote: -----> Installing dependencies using bundler 1.13.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
@dvoryankin
dvoryankin / rsp_auto_opt.rb
Created September 5, 2016 16:52
rock scissors paper autoplay less code
options = [:paper, :rock, :scissors]
player1 = ""
player2 = ""
loop do
p1 = rand(0..2)
p2 = rand(0..2)
puts "Player 1: #{options[p1]}, Player 2: #{options[p2]}"
@dvoryankin
dvoryankin / rock_scissors_paper.rb
Created September 5, 2016 16:42
rock scissors paper
print "(R)ock, (S)cissors, (P)aper? "
s = gets.strip.capitalize
if s == "R"
user_choice = :rock
elsif s == "S"
user_choice = :scissors
elsif s == "P"
user_choice = :paper
else
@dvoryankin
dvoryankin / bandit99.rb
Created September 4, 2016 16:04
English version
print "How old are you? "
age = gets.to_i
print "Continue? (Y/N) "
answer = gets.strip.capitalize
if answer == "Y" && age >= 18
puts "Ok, let's play!"
money = 100
@dvoryankin
dvoryankin / bandit99.rb
Created September 4, 2016 16:00
version_1.1
print "Сколько вам лет? "
age = gets.to_i
print "Хотите играть? (Y/N) "
answer = gets.strip.capitalize
if answer == "Y" && age >= 18
puts "Хорошо, поиграем!"
money = 100
@dvoryankin
dvoryankin / guess.rb
Created September 4, 2016 14:35
guess the number
def start
@num = rand (1..100)
print "Enter attempts number: "
@attempts = gets.to_i
print "Guess the number, #{@attempts} attempts, "