This file contains hidden or 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
AllCops: | |
RunRailsCops: true | |
Exclude: | |
- 'bin/**/*' | |
- 'db/**/*' | |
- 'vendor/**/*' | |
- 'tmp/**/*' | |
- 'spec/spec_helper.rb' | |
- 'spec/rails_helper.rb' |
This file contains hidden or 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 Peg | |
attr_accessor :title, :rings | |
def initialize(title: , rings: 0) | |
@title = title | |
@rings = Array(1..rings) | |
end | |
end | |
def move(rings, from, destination, other) |
This file contains hidden or 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
a = [ ['a',1], ['b',2], ['c',3] ] | |
h={} | |
a.flatten!.each_with_index {|el, i| i % 2 == 0 ? h[el]=a[i+1] : () } | |
h | |
# => {"a"=>1, "b"=>2, "c"=>3} |
This file contains hidden or 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
a = [4,1,1,2,2,3,3,3,2,2,5,5,5,5] | |
el = a.pop | |
while el do # O(N) | |
# в массиве осталось нечетное число чисел равных el | |
if a.find_all {|m| m == el}.size % 2 != 0 # O(N2) | |
a.delete_if {|m| m == el} # O(N3) значит вместе с el их было четное число, значит это не то что мы ищем | |
else # если осталось четное число или 0, то изначально было нечетное, это то что мы ищем | |
puts "Непарный элемент: #{el}" | |
break |
This file contains hidden or 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
source "http://rubygems.org" | |
group :development do | |
gem 'rake', '~> 0.9' | |
gem 'rack', '~> 1.4.1' | |
gem 'jekyll', '~> 0.12' | |
gem 'rdiscount', '~> 1.6.8' | |
gem 'pygments.rb', '~> 0.3.4' | |
gem 'RedCloth', '~> 4.2.9' | |
gem 'haml', '~> 3.1.7' |
This file contains hidden or 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
# lib/package_level/package_level.rb | |
module PackageLevel | |
module CareerSection | |
module Bronze | |
class Config | |
class << self | |
attr_accessor :max_active_job_postings, | |
:max_employers, | |
:max_job_postings_error_text, |
This file contains hidden or 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
Failures: | |
1) CreateQuasarJobPosting perform when both company and employer exist on Quasar should have the correct QuasarJobPosting | |
Failure/Error: CreateQuasarJobPosting.perform(@job_posting.id).last.attributes.should == @quasar_job_posting.attributes | |
expected: {"id"=>1011, "source_id"=>1055, "employer_id"=>1010, "title"=>"Application Wrangler", "description"=>"Quis omnis molestias nobis sint mesh user-centric web-readiness minus. Sapiente tempora sunt delectus voluptatem facilis Advanced local conglomeration fugiat est. Eligendi mollitia autem inventore est id explicabo. Est • officia voluptas accusantium.", "city"=>"Virginia Beach", "state"=>"VA", "zip"=>"23453", "employment_type"=>"Full Time", "posted_at"=>Mon, 07 May 2012 17:02:58 EDT -04:00, "latitude"=>36.8527778, "longitude"=>-75.9783333, "active"=>true, "requisition_number"=>"4016e97e8e3f5a0f"} | |
got: {"id"=>1011, "source_id"=>1055, "employer_id"=>1010, "title"=>"Application Wrangler", "description"=>"Quis omnis molestias nobi |