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 'pry-debugger' | |
output = File.new("output.txt", 'a') | |
nm1 = File.open("names.txt", 'r') | |
nm2 = File.open("names2.txt", "r") | |
#binding.pry | |
nm1.each_line do |n1| | |
nm2.each_line do |n2| |
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
def generate(cardinality=1, result=[1]) | |
if cardinality == 0 | |
return result | |
else | |
elem = result.last | |
sub_ary = elem.to_s.split('').map(&:to_i) | |
result << group(sub_ary) | |
generate(cardinality - 1, result) | |
end | |
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
# Automatically precompile assets | |
load "deploy/assets" | |
# Execute "bundle install" after deploy, but only when really needed | |
require "bundler/capistrano" | |
# RVM integration | |
require "rvm/capistrano" | |
set :application, "app name" | |
set :rails_env, :production |
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 'minitest/mock' | |
require 'minitest/unit' | |
require 'date' | |
MiniTest::Unit.autorun | |
class TestMailPurge < MiniTest::Unit::TestCase | |
class MailPurge | |
def initialize(imap) | |
@imap = imap |
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 "interface" | |
Strategy = interface { | |
required_methods :use | |
} | |
class StrategyOne | |
implements Strategy | |
def use |
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
module Library | |
# <summary> | |
# Класс подсистемы | |
# </summary> | |
# <remarks> | |
# <li> | |
# <lu>реализует функциональность подсистемы;</lu> | |
# <lu>выполняет работу, порученную объектом <see cref="Facade"/>;</lu> | |
# <lu>ничего не "знает" о существовании фасада, то есть не хранит ссылок на него;</lu> |
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
Started GET "/polls/12" for 127.0.0.1 at 2013-09-30 16:51:13 +0400 | |
Processing by PollsController#show as JS | |
Parameters: {"id"=>"12"} | |
User Load (2.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 10 LIMIT 1 | |
Poll Load (1.7ms) SELECT "polls".* FROM "polls" WHERE "polls"."id" = $1 ORDER BY created_at DESC LIMIT 1 [["id", "12"]] | |
Client Load (3.2ms) SELECT "clients".* FROM "clients" WHERE "clients"."id" = 64 LIMIT 1 | |
User Load (3.1ms) SELECT "users".* FROM "users" WHERE "users"."profileable_id" = 64 AND "users"."profileable_type" = 'Client' LIMIT 1 | |
(2.9ms) SELECT COUNT(*) FROM "comments" WHERE "comments"."commentable_id" = 12 AND "comments"."commentable_type" = 'Poll' | |
(2.8ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."votable_id" = 12 AND "votes"."votable_type" = 'Poll' AND "votes"."vote_flag" = 't' AND "votes"."vote_scope" IS NULL | |
PollImage Load (3.1ms) SELECT "images".* FROM "images" WHERE "images"."type" IN ('PollImage') AND "images"."imageable_id" = 12 AND "images"."imageable_ty |
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
rvm: | |
- 1.9.2 | |
before_script: "bundle exec rake db:drop db:create db:migrate" | |
script: "bundle exec rspec spec/" |
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
class MyString < String | |
@@array_of_strings ||= [] | |
def self.new(str) | |
@@array_of_strings << super(str) | |
p @@array_of_strings | |
end | |
private | |
def self.all_strings | |
p @@array_of_strings |
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 'rubygems' | |
require 'oauth' | |
# Change the following values to those provided on dev.twitter.com | |
# The consumer key identifies the application making the request. | |
# The access token identifies the user making the request. | |
consumer_key = OAuth::Consumer.new( | |
"miJSmFqLUEVrY8huJJReZw", | |
"5ilaj6E2jFFxsd0zdA1wsKqc9dDv7OnjTR86206poQk") | |
access_token = OAuth::Token.new( |