Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let’s talk abount the programming part, since it is the most interesting one.
I created a small library called “Esearchy” capable of searching the internet for email addresses. Currently, we the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, etc , but I intend to add many more.
Also, the library searches inside .pdf and .txt files for emails addresses and adds them to the list of found accounts.
For now, there are two main ways of performing a search, “the ruby way”
Esearchy.create "domain.com" do |domain|
domain.maxhits = 500
domain.search
domain.clean {|e| e =~ /<|>/ }
domain.save_to_file "~/emails.txt"
end
and the more classic way in which users can create an Esearchy objetc and work on it
domain = Esearchy.new :query => "domain.com", :maxhits => 500
domain.search
domain.save_to_file "~/emails.txt"
For now , that’s it for now , but keep on tuned for more shitty code ajjajaa
While coding a new lib i’m doing I was trying to do something with a Hash and I came across this.
irb(main):002:0> {:a => 1, :b => 2}.map do |k,v| v+2 end
=> [3, 4]
When I try to map a Hash I get in return an Array. Shoulnd’t I get a Hash??? It’s that the idea of “mapping” ? I tried in both 1.8 and 1.9.1 and both returned the same. I guess I’m either missing something or map is not implemented as it should be.
Help please!!, Anyone ?
UPDATE:
Well, I think this is an explanation (extracted from the RDoc) :
enum.collect {| obj | block } => array
enum.map {| obj | block } => array
Returns a new array with the results of running block once for every element in enum.
(1..4).collect {|i| i*i } #=> [1, 4, 9, 16]
(1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
