Show Menu
Cheatography

ruby selenium nose python Cheat Sheet (DRAFT) by

for rapid access to nose parameters, selenium and python search methods and other stuff like jenkins URL coomands

This is a draft cheat sheet. It is a work in progress and is not finished yet.
 

Ruby Math

Command
Descri­ption
Expo­n­en­­tiation (**)
Expone­­nt­i­ation raises one number (the base) to the power of the other (the exponent). For example, 23 is 8, since23 means "give me 2 2 2" (2 multiplied together 3 times).
Modulo (%)
Modulo returns the remainder of division. For example, 25 % 7 would be4, since 7 goes into 25 3 times with 4 left over.

Ruby Miscel­aneous

Command
Descri­ption
puts & print
Puts prints but adds a new line at the end
=begin

multi­line

comments

=end
no space between the = and the keyword, they need to be on a line by themselves
gets
Is the Ruby method that gets input from the user. When getting input, Ruby automa­­ti­cally adds a blank line after each bit of input.
.chomp
removes extra blank lines
!
It modifies the variable in itself,
example: instead of doing
print "This is my questi­­on­?­"

answer = gets.c­­homp

answer2 = answer.ca­­pi­t­alize

print = answer2

you can use
print "This is my questi­­on­?­"

answer = gets.c­­homp

answe­­r.c­­ap­i­t­al­ize!

print answer

Ruby String methods

Command
Descri­ption
.length
returns the length of a string
.reverse
returns the string backwards
.upcase
returns the same string all in caps
.down­case
returns the same string all in lowercased
.capi­­talize
returns the string with just the first letter in caps and the rest on lowercase
string interp­­ol­a­tion
first­­_name = "­­Ke­v­i­n"

puts "Your name is #{firs­­t_­n­a­me­­}!"

#=> Your name is Kevin