1
vote
0answers
42 views

scraping and saving using Arrays or Objects

I'm using Anemone to Spider a website, I am then using a set of rules specific to that website, to find certain parameters. I feel like it's simple enough, but any attempt I make to save the ...
7
votes
2answers
129 views

Generate permutations with symbols

Goal: Create a combination of emails based from inputted first name, last name, middle name, and a domain. Add in common separators. Then I'll check which one is correct with the rapportive API. This ...
10
votes
1answer
156 views

Faster way to find maximum deviation?

So, it was a part of my coding challenge and the last one, but I failed because it failed to yield a result in two seconds for some of sample inputs (out of six samples, three passed but three failed ...
4
votes
2answers
81 views

Processing array of objects into two strings

I have an array of Item objects that each have a string particular and a numeric amount. I ...
5
votes
2answers
1k views

Splitting a text file into paragraphs and words

I'm iterating through a number of text files, trying to locate all carriage-returns, and individually save the text between carriage-returns. I get the index numbers of all carriage-returns, but I ...
3
votes
1answer
76 views

Clone array elements when multiplying by a scalar

Update: Way to bury the lead. ;) The main question here is how best to make sure each array element is a separate string instance. I am building an array of strings to form the "empty" ...
3
votes
2answers
224 views

Implementing Array#uniq in Ruby

I've implemented a working version of Array#uniq in Ruby to answer the question here: http://www.rubeque.com/problems/like-a-snowflake, but I'd like to see if there's ways to clean up my code or some ...
1
vote
3answers
128 views

A pattern to destructively extract items from an array

I want to efficiently (few intermediate objects) and neatly (few lines and easy to read) filter an array, removing and returning rejected items. So like a call to delete_if except instead of returning ...
3
votes
3answers
1k views

Most efficient way to iterate through arrays/can I use .times method in place of while method?

I created a quick program to test the precision of randomness generated by the .rand method. The primary question is whether I can use the ...
4
votes
2answers
413 views

How can I optimize this array.each in ruby?

I'm trying to optimize this bit of code and I thought I'd throw it out here to see if anyone has any ideas. I've been testing the performance using ...
4
votes
3answers
2k views

Split post string into hash

...
2
votes
1answer
148 views

Ruby: working with arrays

I am working on a script that collects all comments from my DB and inserts them into a hash. I then do a collect on the comments hash and split the comments into two separate comment hashes ...