Skip to content

Instantly share code, notes, and snippets.

View suchov's full-sized avatar
🌎
Evolution through Education

Artem Sychov suchov

🌎
Evolution through Education
View GitHub Profile
@suchov
suchov / gist:52ca59d9005db68021bef8d5c1662539
Last active April 12, 2017 08:51
Have a fast spec helper
Rspec-rails 3.0 introduced multiple default spec helpers.
When you initialize a Rails app with RSpec, it creates a `rails_helper.rb` which loads Rails and a `spec_helper.rb`
which doesn’t. When you don’t need Rails, or any of its dependencies, require your `spec_helper.rb`
for a modest time savings.
@suchov
suchov / gist:8fa2966ae8a27a36e69a1a32e9285e21
Created April 12, 2017 08:49
Have a fast spec helper
Rspec-rails 3.0 introduced multiple default spec helpers.
When you initialize a Rails app with RSpec, it creates a `rails_helper.rb` which loads Rails and a `spec_helper.rb`
which doesn’t. When you don’t need Rails, or any of its de- pendencies, require your `spec_helper.rb`
for a modest time savings.
@suchov
suchov / no_sleep
Last active April 11, 2017 16:55
Don't use sleep or wait:
This breaks if we try to test via Capybara:
first(".modal-open").click
first(".confirm").click
It will click the button but the next interaction will fail because the modal hasn’t finished loading.
We could add a sleep here in the test but this would slow the test down a lot and won’t guarantee that the modal is loaded.
Luckily, Capybara provides some helpers for this exact situation.
Finders such as `first` or `all` return `nil` if there is no such element.
`find` on the other hand will keep trying until the element shows up on the page or a maximum wait time has been exceeded (default 2 seconds).
Our scenarios:
scenario "create a new todo" do
sign_in_as "person@example.com"
todo = todo_on_page
todo.create
expect(todo).to be_visible
end
@suchov
suchov / NERDTree.mkd
Created November 13, 2015 10:06 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@suchov
suchov / Responsive Web Design Fundamentals
Last active August 29, 2015 14:18
Responsive Web Design Fundamentals
Min with & height of the buttons: 45px
Min space benween them -> 40 px
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
width in %
@media screen and (min-width: 500px){
body { background-color: green; }
}
min-width/max-width are the most popular one
@suchov
suchov / Security Groups
Last active August 29, 2015 14:14
AWS Security Groups
HTTP Listner - Allow 80, 443 From ELB SG
WS Client - Allow 443 to WS Listner
AWS Client - Allow 443 to known AWS subnets
Admin Client - Allow 22 from Admin Listener
http://prntscr.com/5xxftc
Check:
Does the account follow IAM Best Practices?
Is CloudTrail logging eneblad?
@suchov
suchov / Security Groups
Created January 28, 2015 00:01
AWS Security Groups
HTTP Listner - Allow 80, 443 From ELB SG
WS Client - Allow 443 to WS Listner
AWS Client - Allow 443 to known AWS subnets
Admin Client - Allow 22 from Admin Listener
http://prntscr.com/5xxftc
Evening Events / Sessions
Thursday, 01/22/2015
Escape the Dangers of Cybercrime in the Cloud
Date:Thursday, Jan 22, 2015 10:30 AM - 11:30 AM
A DevOps approach to security
Date:Thursday, Jan 22, 2015 12:30 PM - 1:30 PM
Live Attack Demo & Deployment/Architecture Session
=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')