This file contains 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
!define loag {http://local.apartmentguide.com/apartments/Georgia/Norcross/search/} | |
#!| script| | |
!|scenario |User opens advanced search for Norcross GA and checks refinements using|selector|and views the |displayed_name|in the refinements list| | |
|windowMaximize | | |
|user opens |${loag} | | |
|user clicks|css=@selector | | |
|user waits |3000 | | |
|user |verifies |that |css=p.refinement_list|shows text |@displayed_name |
This file contains 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 you were curious how to do it with lambdas, | |
# I think this way makes the method definition look ugly but w/e | |
def method(arr, fn = ->(e){ "" }) | |
arr[:no_key] | |
rescue => e | |
fn.call(e) | |
end | |
method([]) | |
# => "" |
This file contains 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 _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXX-Y']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); |
This file contains 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
1.9.3-p392 :001 > class Test | |
1.9.3-p392 :002?> def self.wtf | |
1.9.3-p392 :003?> "WHAT DA FUCK" | |
1.9.3-p392 :004?> end | |
1.9.3-p392 :005?> | |
1.9.3-p392 :006 > self.singleton_class.send(:alias_method, :wtf_mate, :wtf) | |
1.9.3-p392 :007?> end | |
=> #<Class:Test> | |
1.9.3-p392 :008 > Test.wtf | |
=> "WHAT DA FUCK" |
This file contains 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
class HealthCheck | |
class << self | |
def check! | |
status = { | |
service: service_working?, | |
db: db_connected? | |
} | |
[status.values.all?, status] | |
rescue e | |
[false, :exception => e.message] |
This file contains 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
require 'json' | |
require 'cgi' | |
server = "localhost:8098" | |
bucket = "portal_development_tokens" | |
request = `curl http://#{server}/buckets/#{bucket}/keys?keys=true` | |
keys = JSON.parse(request)["keys"] | |
keys.each do |key| |
This file contains 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
def char_occurrence str | |
str.split('').chunk{|x| x}.map do |letter, chunk| | |
[chunk.count, letter] | |
end.join | |
end | |
#second format | |
def char_occurrence str | |
str.split('').chunk{|x| x}.map do |letter, chunk| | |
chunk.join.capitalize |
This file contains 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
class House | |
LYRICS = [ | |
"This is the house that Jack built.", | |
"This is the malt that lay in the house that Jack built.", | |
"This is the rat that ate the malt that lay in the house that Jack built.", | |
"This is the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jac |
This file contains 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
class Bottles | |
attr_reader :where, :substance | |
def initialize(substance='of beer', where='on the wall') | |
@substance = substance | |
@where = where | |
end | |
def verse bottle_number | |
next_bottle_number = bottle_number - 1 |
This file contains 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
guard :minitest do | |
watch(%r{^test/(.*)\/?_test(.*)\.rb$}) | |
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[2]}_test.rb" } | |
watch(%r{^test/test_helper\.rb$}) { 'test' } | |
end |
OlderNewer