Skip to content

Instantly share code, notes, and snippets.

# https://swdandruby.wordpress.com/2013/07/19/did-i-select-the-right-element/
def highlight element, time = 3
orig_style = element.attribute("style")
@driver.execute_script("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", "border: 2px solid yellow; color: yellow; font-weight: bold;")
if time > 0
sleep time
@driver.execute_script("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", orig_style)
end
end
@ryancastro
ryancastro / Blocks.rb
Last active December 20, 2015 02:19
An example of how to use a Ruby block that I can understand. I'm sure it's not useful to everyone... but it's useful to me.
def changeitarray(amount)
arr = []
#amount is set by the caller
(1..amount).each do
#call the block that was sent to me.
a = yield(rand(100))
#Yield should return the value I expect, if it doesn't I'll break
#In this case, the passed in block should return a string
@ryancastro
ryancastro / Preferences.sublime-settings
Created June 17, 2013 19:19
Sublime Text 2 Settings
{
"#theme": "Soda Dark.sublime-theme",
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 12.0,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
"theme": "Nexus.sublime-theme",