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
| =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') |
| test |
| Is it frontend language? | |
| Yes | |
| No |
| / ================= preventDefault() ================= | |
| // В примере сработали: event.preventDefault() и event.stopPropagation(). | |
| $('a').click(function () { | |
| return false; | |
| }); | |
| // Если вы всего лишь хотите предотвратить действие браузера по умолчанию, то вам следует использовать preventDefault метод. | |
| $('a').click(function (event) { | |
| event.preventDefault(); | |
| }); | |
| // ================= stopPropagation() ================= |
| Is it frontend?? | |
| Yes | |
| No |
| homework 3.7 | |
| gist.github.com | |
| 1. | |
| CREATE DATABASE test_guru; | |
| \c test_guru |
| Homework 1.4 | |
| https://gist.github.com/shilovk/9511ad4bf0fec14f01d0eefdab9cd5e5 | |
| 1. | |
| ncat -C httpbin.org 80 | |
| GET /anything HTTP/1.1 | |
| Host: httpbin.org |
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 sessionDebugger
| def is_vowel_elsif(letter) | |
| if letter == "a" | |
| true | |
| elsif letter == "e" | |
| true | |
| elsif letter == "i" | |
| true | |
| elsif letter == "o" | |
| true | |
| elsif letter == "u" |
| 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 |