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
time = 12345678 # seconds | |
formatted_time = Time.at(time).utc.strftime("%H:%M:%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
# Helper method for retrieving value from yaml file | |
# @param [String, String] | |
# keys, eg. "timeouts:implicit_wait" to retrieve value "60" from | |
# yml file with content: | |
# timeouts: | |
# implicit_wait: 60 | |
def read_yml(file_name, keys) | |
data = Hash.new | |
begin | |
data = YAML.load_file "#{file_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
cl = ClassLoader.getSystemClassLoader(); | |
URL[] urls = ((URLClassLoader)cl).getURLs(); | |
for (URL url: urls) { | |
System.out.println(url.getFile()); | |
} |
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
function arrayLength(obj) { | |
if (typeof(obj) == 'string') { | |
return 1; | |
} else { | |
return obj.length; | |
} | |
} |
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 method_missing(method_sym, *arguments) | |
if arguments.empty? | |
puts method_sym | |
else | |
puts "#{method_sym}(#{arguments.join(',')})" | |
end | |
end |
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
# can be useful when you are not in that directory, eg. use it in RSpec.configure block | |
# but you'll need access to the example object | |
RSpec.configure do |config| | |
config.before :each do |example| | |
puts spec_dir = File.dirname(example.metadata[:file_path]) | |
end | |
end |
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
# to check whether TEST_OPTIONS contains "-P" or "--parallel", or not | |
# TEST_OPTIONS can be "-P 20", "--parallel=15", or any string | |
if [[ "$TEST_OPTIONS" == -P* ]] || [[ "$TEST_OPTIONS" == --paralell* ]]; then echo "yes"; else echo "no"; fi |
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
# Two ways: | |
# 1. Print out dependencies of all gems, then search for the 'given gem' | |
gem list | egrep '^.*[ ]' -o | gem dependency | |
# 2. Look inside Gemfile.lock |
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
Regular expression match condition to launch Sauce Connect on jenkins: | |
Launch when env ends with "_ci": | |
Expression: ^.*_ci$ | |
Label: ${ENV,var="HOST_ENV"} |
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
@media (max-width: 479px) { | |
.show-on-desktop, .show-on-tablets, .hide-on-mobile { display: none; } | |
} | |
@media (min-width: 480px) and (max-width: 979px) { | |
.show-on-desktop, .hide-on-tablets, .show-on-mobile { display: none; } | |
} | |
@media (min-width: 980px) { | |
.hide-on-desktop, .show-on-tablets, .show-on-mobile { display: none; } | |
} |
OlderNewer