This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| page.driver.browser.window_handles.size == 2 | |
| page.within_window page.driver.browser.window_handles.last do | |
| current_path = #... | |
| end | |
| #Simply refocus for current session: | |
| session.driver.browser.switch_to.window(page.driver.browser.window_handles.last) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getParameterByName(name) -> | |
| name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]") | |
| regexS = "[\\?&]" + name + "=([^&#]*)" | |
| regex = new RegExp(regexS); | |
| results = regex.exec(window.location.search) | |
| if(results == null) | |
| "" | |
| else | |
| decodeURIComponent(results[1].replace(/\+/g, " ")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #m - dot match newlines | |
| page.body.should =~/ITEM1.*ITEM2.*ITEM3/m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find(:xpath, "//div[preceding-sibling::select[@id='sibling_id']]/input").set('test') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #make db column text | |
| class Expense < ActiveRecord::Base | |
| serialize :parties | |
| # other model code | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #routes | |
| member do | |
| get :download | |
| end | |
| #model | |
| has_attached_file :gpx, | |
| path: ":rails_root/assets/:class/:id_partition/gpx/route#:id-:basename.:extension", | |
| dependent: :destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - if @agent.avatar.file? | |
| = image_tag @agent.avatar.url(:normal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* apply a natural box layout model to all elements */ | |
| * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #git add files that you don't want to stash | |
| git stash --keep-index | |
| #this will stash files that are not added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var answer = confirm("Are you sure?") | |
| if (answer){ | |
| .. | |
| } | |
| else{ | |
| .. | |
| } |