Skip to content

Instantly share code, notes, and snippets.

View shilovk's full-sized avatar

Kᴏɴsᴛᴀɴᴛɪɴ Sʜɪʟᴏᴠ shilovk

View GitHub Profile
@shilovk
shilovk / capybara cheat sheet
Created April 8, 2020 20:12 — 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')
@shilovk
shilovk / test-guru-question.txt
Created February 13, 2020 03:16
Вопрос теста First из TestGuru
Is it frontend language?
Yes
No
@shilovk
shilovk / js_events.txt
Created February 6, 2020 21:40
preventDefault() stopPropagation() и stopImmediatePropagation
/ ================= preventDefault() =================
// В примере сработали: event.preventDefault() и event.stopPropagation().
$('a').click(function () {
return false;
});
// Если вы всего лишь хотите предотвратить действие браузера по умолчанию, то вам следует использовать preventDefault метод.
$('a').click(function (event) {
event.preventDefault();
});
// ================= stopPropagation() =================
@shilovk
shilovk / test-guru-question.txt
Created February 3, 2020 11:19
Вопрос теста Begin из TestGuru
Is it frontend??
Yes
No
@shilovk
shilovk / gitsfile2.txt
Last active December 15, 2019 09:56
Задание по основам баз данных и SQL
homework 3.7
gist.github.com
1.
CREATE DATABASE test_guru;
\c test_guru
@shilovk
shilovk / gist:9511ad4bf0fec14f01d0eefdab9cd5e5
Last active December 11, 2019 11:41
Задание к уроку "Архитектура клиент-сервер и HTTP-протокол"
Homework 1.4
https://gist.github.com/shilovk/9511ad4bf0fec14f01d0eefdab9cd5e5
1.
ncat -C httpbin.org 80
GET /anything HTTP/1.1
Host: httpbin.org

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@shilovk
shilovk / vowels
Created November 20, 2019 17:57 — forked from davidbella/vowels
Ruby: All about finding vowels
def is_vowel_elsif(letter)
if letter == "a"
true
elsif letter == "e"
true
elsif letter == "i"
true
elsif letter == "o"
true
elsif letter == "u"
@shilovk
shilovk / Hash Keys to Symbols.rb
Created November 7, 2019 12:18 — forked from Integralist/Hash Keys to Symbols.rb
Convert Ruby Hash keys into symbols
hash = { 'foo' => 'bar' }
# Version 1
hash = Hash[hash.map { |k, v| [k.to_sym, v] }]
# Version 2
hash = hash.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = v }
end