arrays code snippets in ruby

[{:s, 1, :xl, 4}] is returned to me. i want to only return {:s, 1, :xl, 4}. how to? in ruby
a function to flatten a nested array, if it contains nil, removes the nils, if its elements are all nil, return empty array. in ruby
a shorter way to do: ` arr = %w[black brown red orange yellow green blue violet grey white] cols = arr.each_with_index.map {|col , ind| [col, ind.to_s]}.to_h` in ruby
add an element to the end of an array in ruby
check if array is empty in ruby
check if array is not empty in ruby
concatenate two arrays in ruby
count instances of an element inside an array in ruby
count words in array in ruby
create a csv file 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 average of a list of numbers in ruby
find the index of an element in an array 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 longest word in a string in ruby
find the kth most common element in an array in ruby
find the kth smallest element in an array in ruby
find the last element in an array in ruby
find the length of an array 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 mode of a list of numbers in ruby
find the range of all elements in an array in ruby
find the standard deviation of all elements in an array in ruby
for an input like: `%w[black brown white], write a function that takes the index of 1st element and index of 2nd element and combines them into a digit in ruby
get a sample of 5 elements from an array in ruby
gimme a function that take only the first two elements of an array passed to it, even though it can take a variable amount of arguments in ruby
give me a function that does this: input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] in ruby
given a string representing a matrix of numbers, return the rows and columns of that matrix. in ruby
how do i convert this to an array of strings: `[0, [0, 1], {foo: 0}] * ', '` in ruby
how to check if a number is in an array? like `5 in [1, 3, 5]`? in ruby
how to check if an array is empty? in ruby
how to find multiples of two numbers not exceeding some n? in ruby
how to return the total value, as an integer, of all the hash values of three hashes, each of which is an element of an array? in ruby
how to sum hash values in an array of five hashes? in ruby
how to sum the values in [{ a: 5, b: 10, c: 15 }, {}, { q: 67 }] in ruby
i did not understand this when i was reading ruby docs: "::[]: returns a new array populated with given objects." 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 an array of strings with index using the map function in ruby
join an array of substrings into a string 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
reverse an array in ruby
shuffle an array in ruby
split a string into an array of substrings in ruby
teach me array#each what it does and how? in ruby
what is wrong? `print([1, 3, 6, 9 ].find { |e| e < 9 })` in ruby
when i do `%w[0, [0, 1], {foo: 0}]` i get ["0,", "[0,", "1],", "{foo:", "0}"]. what to do in order to get ["0", "[0, "1], "{foo: 0}"] in ruby

gistlibby LogSnag