Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
require 'mechanize'
class AvitoParser
# Base method in which we fetch seling engine with our search query
# and go through given number of pages with god blessed regexps
def fetch_engine(search_query, number_of_pages, city)
@search_query = search_query
host = "http://avito.ru"
require 'rubygems'
require 'rspec'
def includes arg1, arg2
arg1 = arg1.split if arg1.is_a? String
arg2 = arg2.split if arg2.is_a? String
not (arg1 & arg2).empty?
end
def includes_only arg1, arg2
@waaa
waaa / script
Created December 23, 2011 17:03
Script for refunds and charges
def script file_name
array = []
trans_hash = {}
File.open(file_name){ |f| f.each { |s|array << s }}
hash = array.group_by{ |a| a.split[6]}
hash.each do |order, operations|
trans_hash[order] = []
operations.each do |operation|
if operation.present?
fields = operation.split