ruby code snippets in ruby

add a getter to a class in ruby
add a getter to a subclass in ruby
add a key-value pair to a map in ruby
add a method to a class in ruby
add a method to a subclass in ruby
add a node to the beginning of a linked list in ruby
add a node to the end of a linked list in ruby
add a private method to a class in ruby
add a private property to a class in ruby
add a private static method to a class in ruby
add a private static property to a class in ruby
add a property to a class in ruby
add a protected method to a class in ruby
add a protected property to a class in ruby
add a protected static method to a class in ruby
add a protected static property to a class in ruby
add a public method to a class in ruby
add a public property to a class in ruby
add a public static property to a class in ruby
add a setter to a class in ruby
add a setter to a subclass in ruby
add a static method to a class in ruby
add a static method to a subclass in ruby
add a static property to a class in ruby
add an element to the beginning of an array in ruby
add an element to the end of an array in ruby
add cors headers to a http server in ruby
add cors headers to a http server with a specific origin in ruby
add cors headers to a http server with a specific origin and methods in ruby
add two numbers in ruby
append a string to the end of another string in ruby
append to a csv file in ruby
append to a file in ruby
append to a json file in ruby
call a getter on an instance of a class in ruby
call a method on an instance of a class in ruby
call a private property on an instance of a class in ruby
call a private static method on an instance of a class in ruby
call a protected method on an instance of a class in ruby
call a protected property on an instance of a class in ruby
call a protected static method on an instance of a class in ruby
call a protected static property on an instance of a class in ruby
call a public method on an instance of a class in ruby
call a public property on an instance of a class in ruby
call a public static method on an instance of a class in ruby
call a public static property on an instance of a class in ruby
call a setter on an instance of a class in ruby
call a static method on an instance of a class in ruby
call a static property on an instance of a class in ruby
check if array is empty in ruby
check if array is not empty in ruby
check if string starts with a timestamp in ruby
check if string starts with a timestamp and capture suffix in ruby
combine two maps in ruby
concatenate two arrays in ruby
convert a number from base 10 to base 16 in ruby
convert a number from base 10 to base 2 in ruby
convert a number from base 2 to base 10 in ruby
convert a number from base 2 to base 16 in ruby
convert a number from base 2 to base 8 in ruby
convert seconds to minutes in ruby
copy a csv file in ruby
copy a directory in ruby
copy a file in ruby
copy a json file in ruby
count instances of an element inside an array in ruby
count words in array in ruby
create a 3 dimensional array in ruby
create a blake2b hash from a string in ruby
create a class in ruby
create a class with a constructor in ruby
create a csv file in ruby
create a directory in ruby
create a file in ruby
create a function that appends text to a string from an input array in ruby
create a function to output an html file with the title and body content and an ordered list from the input array in ruby
create a get request handler in ruby
create a http server and add a custom header to the response in ruby
create a http server and parse authorization headers in ruby
create a http server and parse cookies in ruby
create a http server and parse cookies and return a json response in ruby
create a http server and read the request body in ruby
create a http server and read the request body as binary in ruby
create a http server and read the request body as binary and return a binary response in ruby
create a http server and read the request body as form data in ruby
create a http server and read the request body as form url encoded in ruby
create a http server and read the request body as html in ruby
create a http server and read the request body as json in ruby
create a http server and read the request body as json and return a json response in ruby
create a http server and read the request body as multipart form data in ruby
create a http server and read the request body as text in ruby
create a http server and upload a file and return a binary response in ruby
create a http server on a specific port in ruby
create a http server on a specific port and host in ruby
create a http server with a connect route in ruby
create a http server with a custom route in ruby
create a http server with a get route in ruby
create a http server with a head route in ruby
create a http server with a options route in ruby
create a http server with a patch route in ruby
create a http server with a post route in ruby
create a http server with a put route in ruby
create a http server with a specific route in ruby
create a http server with a specific route and a specific status code in ruby
create a http server with a trace route in ruby
create a json file in ruby
create a linked list in ruby
create a loop in ruby
create a matrix in ruby
create a md5 hash from a string in ruby
create a password in ruby
create a password with a custom length in ruby
create a password with a custom length and lowercase letters in ruby
create a password with a custom length and numbers in ruby
create a password with a custom length and symbols in ruby
create a password with a custom length and uppercase letters in ruby
create a password with a custom length, uppercase letters and lowercase letters in ruby
create a password with at least one lowercase letter in ruby
create a password with at least one number in ruby
create a password with at least one symbol in ruby
create a password with at least one uppercase letter in ruby
create a password with lowercase letters in ruby
create a password with numbers in ruby
create a password with symbols in ruby
create a password with uppercase letters in ruby
create a password with uppercase letters and lowercase letters in ruby
create a password with uppercase, lowercase letters and numbers in ruby
create a password with uppercase, lowercase letters, numbers and symbols in ruby
create a rails model method to send an http post request with basic authorization in ruby
create a retry function in ruby
create a sha1 hash from a string in ruby
create a sha256 hash from a string in ruby
create a sha3_256 hash from a string in ruby
create a sha3_512 hash from a string in ruby
create a sha512 hash from a string in ruby
create a subclass in ruby
create a subclass with a constructor in ruby
create a tcp client in ruby
create a tcp client on a specific port in ruby
create a tcp server in ruby
create a tcp server on a specific port in ruby
create a template string in ruby
create a udp client in ruby
create a udp client on a specific port in ruby
create a udp server in ruby
create a udp server on a specific port in ruby
create an api call to gather nba player stats in ruby
create an array with every book of the bible in it in ruby
create an dictionary with every book of the bible in it where the key is all lowercase and the value is capitalized in ruby
create an example function that uses dynamic programming to sort a binary tree in ruby
create an instance of a class with a constructor in ruby
creatye a method to send an http post request with basic authorization in ruby
delete a csv file in ruby
delete a directory in ruby
delete a file in ruby
delete a json file in ruby
divide two numbers in ruby
find all the strings matching ‘tony’ in an array of strings, then return how many there are. if there are none then return nil in ruby
find the area of a circle in ruby
find the area of a parallelogram in ruby
find the area of a rectangle in ruby
find the area of a regular polygon in ruby
find the area of a regular polygon circumscribed around a circle in ruby
find the area of a regular polygon inscribed in a circle in ruby
find the area of a sector of a circle in ruby
find the area of a segment of a circle in ruby
find the area of a square in ruby
find the area of a triangle in ruby
find the average of a list of numbers in ruby
find the average of all elements in an array in ruby
find the average of all keys in a map in ruby
find the average of all nodes in a linked list in ruby
find the average of all values in a map in ruby
find the base 10 logarithm of a number in ruby
find the base 2 logarithm of a number in ruby
find the base e logarithm of a number in ruby
find the contents of a directory in ruby
find the creation date of a csv file in ruby
find the creation date of a directory in ruby
find the creation date of a file in ruby
find the creation date of a json file in ruby
find the cube root of a number in ruby
find the current date in ruby
find the current month in ruby
find the current year in ruby
find the difference of two maps in ruby
find the distance between two points in ruby
find the extension of a csv file in ruby
find the extension of a file in ruby
find the factorial of a number in ruby
find the first character in a string in ruby
find the first element in an array in ruby
find the first index of a character in a string in ruby
find the first index of a substring in a string in ruby
find the first node in a linked list in ruby
find the greatest common divisor of a list of numbers in ruby
find the greatest common divisor of two numbers in ruby
find the index of an element in an array in ruby
find the intersection of two maps in ruby
find the key associated with a value in a map in ruby
find the keys of a map in ruby
find the kth character in a string in ruby
find the kth index of a character in a string in ruby
find the kth index of a substring in a string in ruby
find the kth largest element in an array in ruby
find the kth largest key in a map in ruby
find the kth largest node in a linked list in ruby
find the kth largest number in a list in ruby
find the kth least common element in an array in ruby
find the kth least frequent element in an array in ruby
find the kth longest word in a string in ruby
find the kth most common element in an array in ruby
find the kth most frequent element in an array in ruby
find the kth smallest element in an array in ruby
find the kth smallest key in a map in ruby
find the kth smallest number in a list in ruby
find the largest element in an array in ruby
find the largest key in a map in ruby
find the largest value in a map in ruby
find the last accessed date of a csv file in ruby
find the last accessed date of a directory in ruby
find the last accessed date of a file in ruby
find the last character in a string in ruby
find the last element in an array in ruby
find the last index of a character in a string in ruby
find the last index of a substring in a string in ruby
find the last modified date of a csv file in ruby
find the last modified date of a file in ruby
find the last modified date of a json file in ruby
find the last node in a linked list in ruby
find the least common multiple of a list of numbers in ruby
find the least common multiple of two numbers in ruby
find the length of a linked list in ruby
find the length of a map in ruby
find the length of a string in ruby
find the length of an array in ruby
find the logarithm of a number in ruby
find the median of a list of numbers in ruby
find the median of all elements in an array in ruby
find the median of all keys in a map in ruby
find the median of all nodes in a linked list in ruby
find the median of all values in a map in ruby
find the midpoint between two points in ruby
find the mode of a list of numbers in ruby
find the mode of all elements in an array in ruby
find the mode of all keys in a map in ruby
find the mode of all nodes in a linked list in ruby
find the mode of all values in a map in ruby
find the name of a csv file in ruby
find the name of a directory in ruby
find the name of a file in ruby
find the natural logarithm of a number in ruby
find the nth decagonal number in ruby
find the nth fibonacci number in ruby
find the nth hexagonal number in ruby
find the nth lucas number in ruby
find the nth nonagonal number in ruby
find the nth prime number in ruby
find the nth root of a number in ruby
find the nth square number in ruby
find the parent directory of a directory in ruby
find the parent directory of a file in ruby
find the path of a directory in ruby
find the path of a file in ruby
find the path of a json file in ruby
find the range of a list of numbers in ruby
find the range of all elements in an array in ruby
find the range of all keys in a map in ruby
find the range of all nodes in a linked list in ruby
find the range of all values in a map in ruby
find the remainder of two numbers in ruby
find the root directory of a directory in ruby
find the root directory of a file in ruby
find the shortest word in a string in ruby
find the size of a file in ruby
find the size of a json file in ruby
find the slope between two points in ruby
find the smallest key in a map in ruby
find the smallest node in a linked list in ruby
find the smallest value in a map in ruby
find the square root of a number in ruby
find the standard deviation of a list of numbers in ruby
find the standard deviation of all elements in an array in ruby
find the standard deviation of all keys in a map in ruby
find the standard deviation of all nodes in a linked list in ruby
find the standard deviation of all values in a map in ruby
find the sum of a list of numbers in ruby
find the sum of all elements in an array in ruby
find the sum of all keys in a map in ruby
find the sum of all nodes in a linked list in ruby
find the sum of all values in a map in ruby
find the surface area of a cone in ruby
find the surface area of a cylinder in ruby
find the surface area of a rectangular prism in ruby
find the surface area of a regular polygon circumscribed around a cone in ruby
find the surface area of a regular polygon circumscribed around a cylinder in ruby
find the surface area of a regular polygon circumscribed around a pyramid in ruby
find the surface area of a regular polygon circumscribed around a sphere in ruby
find the surface area of a regular polygon circumscribed around a triangular prism in ruby
find the surface area of a regular polygon inscribed in a cone in ruby
find the surface area of a regular polygon inscribed in a cylinder in ruby
find the surface area of a regular polygon inscribed in a pyramid in ruby
find the surface area of a regular polygon inscribed in a sphere in ruby
find the surface area of a regular polygon inscribed in a triangular prism in ruby
find the surface area of a sphere in ruby
find the surface area of a triangular prism in ruby
find the symmetric difference of two maps in ruby
find the union of two maps in ruby
find the value associated with a key in a map in ruby
find the values of a map in ruby
find the variance of a list of numbers in ruby
find the variance of all keys in a map in ruby
find the variance of all nodes in a linked list in ruby
find the variance of all values in a map in ruby
find the volume of a cone in ruby
find the volume of a pyramid in ruby
find the volume of a regular polygon circumscribed around a cone in ruby
find the volume of a regular polygon circumscribed around a cylinder in ruby
find the volume of a regular polygon circumscribed around a pyramid in ruby
find the volume of a regular polygon circumscribed around a sphere in ruby
find the volume of a regular polygon circumscribed around a triangular prism in ruby
find the volume of a regular polygon inscribed in a cone in ruby
find the volume of a regular polygon inscribed in a cylinder in ruby
find the volume of a regular polygon inscribed in a pyramid in ruby
find the volume of a regular polygon inscribed in a sphere in ruby
find the volume of a regular polygon inscribed in a triangular prism in ruby
find the volume of a sphere in ruby
format a date in to the format 'yyyy-mm-dd hh:mm:ss' in ruby
format a date in to the format 'yyyy-mm-dd hh:mm:ss.fff zzz' in ruby
format a date in to the format 'yyyy-mm-dd hh:mm:ss.fff' in ruby
format a date in to the format 'yyyy-mm-dd' in ruby
format a date in to the format month day, year in ruby
format a date in to the format month day, year hour:minute am/pm in ruby
format a date in to the format month day, year hour:minute:second am/pm in ruby
format a date in to the format month day, year hour:minute:second.fff am/pm in ruby
format a date in to the format month day, year hour:minute:second.fff am/pm zzz in ruby
format a date in to the format october 13, 2014 in ruby
format a date in to the format october 13, 2014 11:13 am in ruby
format a date in to the format october 13, 2014 11:13:00 am in ruby
format a date in to the format october 13, 2014 11:13:00.000 am in ruby
format a date in to the format october 13, 2014 11:13:00.000 am gmt-07:00 in ruby
format seconds to minutes awnd seconds in ruby
generate a random array in ruby
generate a random boolean in ruby
generate a random number in ruby
generate a random number between 0 and 1 in ruby
generate a random number between 1 and 10 in ruby
generate a random number between 1 and 100 in ruby
generate a random string in ruby
generate random string in ruby
generate uuid in ruby
get a random element from an array in ruby
get a random number from a normal distribution with a mean of 0 and a standard deviation of 1 in ruby
get a sample of 5 elements from an array in ruby
get a sample of 5 elements from an array with replacement in ruby
get a sample of 5 elements from an array without replacement in ruby
get a uniformly distributed random number in ruby
get system architecture in ruby
get system boot time in ruby
get system boot time in milliseconds in ruby
get system boot time in minutes in ruby
get system boot time in seconds in ruby
get system cpu frequency in ruby
get system cpu temperature in ruby
get system cpu temperature in celsius in ruby
get system cpu temperature in fahrenheit in ruby
get system cpu usage in ruby
get system free disk space in ruby
get system free memory in ruby
get system name in ruby
get system platform in ruby
get system release in ruby
get system total memory in ruby
get system type in ruby
get system uptime in ruby
get the first 3 characters and last 5 characters in a string then combine into a new string in ruby
hg in ruby
how to calculate prime numebrs in ruby
how to salt a password in ruby
if a string begins with a bullet or dash, remove it. in ruby
if example in ruby
insert a string into another string at a specific index in ruby
insert an element into an array at a specific index in ruby
iterate an array of strings with index in ruby
iterate over a list in ruby
iterate over an array of strings with index using the map function in ruby
iterate through json variables in ruby
join an array of characters into a string in ruby
join an array of substrings into a string in ruby
join two strings in ruby
left pad with space in ruby
make a get request in ruby
make a http delete request in ruby
make a http head request in ruby
make a http post request in ruby
make a http request with a custom body in ruby
make a http request with a custom body as binary in ruby
make a http request with a custom body as binary and return a binary response in ruby
make a http request with a custom body as form data in ruby
make a http request with a custom body as form url encoded in ruby
make a http request with a custom body as html in ruby
make a http request with a custom body as json in ruby
make a http request with a custom body as json and return a json response in ruby
make a http request with a custom body as multipart form data in ruby
make a http request with a custom body as text in ruby
make a http request with a custom method in ruby
make a http request with url parameters in ruby
make me a website in ruby
move a csv file in ruby
move a directory in ruby
move a file in ruby
move a json file in ruby
multiply two numbers in ruby
oauth in ruby
override a getter on a subclass in ruby
override a method on a subclass in ruby
override a private property on a subclass in ruby
override a private static property on a subclass in ruby
override a property on a subclass in ruby
override a setter on a subclass in ruby
override a static method on a subclass in ruby
override a static property on a subclass in ruby
parse authorization headers in ruby
parse jwt tokens in ruby
prepend a string to the beginning of another string in ruby
print "welcome back!" in ruby
read a csv file in ruby
read a file in ruby
read a json file in ruby
remove a character from a string in ruby
remove a character from a string at a specific index in ruby
remove a key-value pair from a map in ruby
remove a node from the beginning of a linked list in ruby
remove a node from the end of a linked list in ruby
remove a node from the middle of a linked list in ruby
remove a substring from a string in ruby
remove a substring from a string at a specific index in ruby
remove an element from an array at a specific index in ruby
remove an element from the beginning of an array in ruby
remove an element from the end of an array in ruby
remove an element from the middle of an array in ruby
remove any leading white space (tabs, spaces, and new lines) in ruby
rename a csv file in ruby
rename a directory in ruby
rename a file in ruby
rename a json file in ruby
replace a character in a string in ruby
replace a substring in a string in ruby
return a binary response from a http server in ruby
return a html response from a http server in ruby
return a json response from a http server in ruby
return a json response from a http server with a specific status code in ruby
return a text response from a http server in ruby
reverse an array in ruby
round a number to the nearest hundredth in ruby
round a number to the nearest integer in ruby
round a number to the nearest ten thousandth in ruby
round a number to the nearest tenth in ruby
round a number to the nearest thousandth in ruby
send a binary json message to a tcp server in ruby
send a binary json message to a udp server in ruby
send a binary message to a tcp server in ruby
send a binary message to a udp server in ruby
send a json message to a tcp server in ruby
send a json message to a udp server in ruby
send a message to a tcp server in ruby
send a message to a udp server in ruby
send a post request with multipart/form-data in ruby
shuffle a string in ruby
shuffle an array in ruby
sort an array in ruby
split a map into two maps in ruby
split a string into an array of characters in ruby
split a string into an array of substrings in ruby
split a string into an array of words in ruby
split a string into two strings in ruby
subscribe to webhook in ruby
subtract two numbers in ruby
take the absolute value of a number in ruby
take the arccosine of a number in ruby
take the arcsine of a number in ruby
take the arctangent of a number in ruby
take the ceiling of a number in ruby
take the cosecant of a number in ruby
take the cosine of a number in ruby
take the cotangent of a number in ruby
take the derivative of a function in ruby
take the floor of a number in ruby
take the integral of a function in ruby
take the secant of a number in ruby
take the sine of a number in ruby
take the tangent of a number in ruby
vending machine in ruby
write a method to return true if the input string equals 'cool' otherwise return false in ruby
write to a csv file in ruby
write to a file in ruby
write to a json file in ruby

gistlibby LogSnag