This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 require 'spreadsheet' | |
# Open workbooks | |
current_workbook = Spreadsheet.open('jan.xls') | |
total_workbook = Spreadsheet.open('output.xls') | |
# Process xls | |
# Iterate through workbook spreadsheets | |
current_workbook.worksheets.each_with_index do |current_spreadsheet, spreadsheet_index| | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'hpricot' | |
class Reporter | |
attr_accessor :path | |
attr_accessor :documents | |
def initialize(path) | |
@path = path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hash[*a.map{|x| [x.text, x]}].values | |
a = [Thing.new('a'), Thing.new('b'), Thing.new('c'), Thing.new('c')] | |
# => [#<Thing a>, #<Thing b>, #<Thing c>, #<Thing c>] | |
Hash[a.map{|x| [x.text, x]}].values | |
# => [#<Thing a>, #<Thing b>, #<Thing c>] | |
class Thing | |
attr_reader :text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'builder' | |
require 'spreadsheet' | |
Spreadsheet.client_encoding = 'UTF-8' | |
class Person | |
attr_accessor :fam, :im, :ot, :w, :dr | |
attr_accessor :s_pol, :n_pol, :enp, :dp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'nokogiri' | |
require 'open-uri' | |
require 'colorize' | |
doc = Nokogiri::HTML(open('http://www.peoplescinema.ru/cgi-bin/i10.cgi')) | |
puts "Peoples Park\n".colorize(:blue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'nokogiri' | |
require 'open-uri' | |
require 'colorize' | |
doc = Nokogiri::HTML(open('http://www.peoplescinema.ru/cgi-bin/i10.cgi')) | |
puts "Peoples Park\n".colorize(:blue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'nokogiri' | |
require 'open-uri' | |
require 'colorize' | |
doc = Nokogiri::HTML(open('http://fabrikakino.ru/kino/')) | |
puts "Fabrika Kino\n".colorize(:yellow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# dependencies | |
require '~/Repo/sax-machine/lib/sax-machine.rb' | |
require 'pp' | |
class ZGLV | |
include SAXMachine | |
element :VERSION, as: :version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'dbf' | |
require 'ostruct' | |
class Dictionary | |
def initialize | |
@doc = Nokogiri::XML(File.open("dictionaries/F014.xml")) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Utility commands surrounding Hubot uptime. | |
spawn = require('child_process').spawn | |
module.exports = (robot) -> | |
robot.hear /hubot (who|where) are you\??/i, (msg) -> | |
msg.finish() | |
child = spawn('/bin/sh', ['-c', "echo I\\'m $LOGNAME@$(hostname):$(pwd) \\($(git rev-parse HEAD)\\)"]) | |
child.stdout.on 'data', (data) -> | |
msg.send "#{data.toString().trim()} running node #{process.version} [version: #{robot.version}, pid: #{process.pid}, name: #{robot.name} ]" |
OlderNewer