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
# some setup | |
FactoryGirl.create(:some_useful_things) | |
allow(OtherService).to receive(:an_interesting_message) | |
# exercising code | |
Todo.add_enquiry(enquiry) | |
# assertions | |
expect(OtherService).to have_receive(:an_interestign_message).with(todo_id: Todo.last.id) |
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
# some setup | |
FactoryGirl.create(:some_useful_things) | |
# exercising code | |
Todo.add_enquiry(enquiry) | |
# assertions | |
expect(OtherService).to receive(:an_interestign_message).with(todo_id: Todo.last.id) |
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
The candidate clearly didn't read all the task brief. | |
The validation of the I command has not been implemementec correctly (limit width and height to 250). | |
Code is not too bad but doesn't show off much. | |
Extra feature not implemented or not documented. | |
Fill command extremely buggy, see below: | |
> S | |
00000000000000000000 | |
00000000000000000000 | |
00000000000000000000 |
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
a = ['a', 'b', 'c'] | |
b = [1, 2, 3, 4, 5 ] | |
interleave(a, b).should == ['a', 1, 2, 'b', 3, 4, 'c', 5] | |
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 'rack/cache/key' | |
class QuerystringBlacklistingHttpCacheKey < Rack::Cache::Key | |
BLACKLISTED_QUERYSTRINGS = %w( type | |
makemodel | |
mkwid | |
pcrid | |
pkw | |
pmt | |
gclid |
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 'csv' | |
require 'json' | |
File.open('Desktop/all-data-final.json', 'w') do |file| | |
CSV.foreach("Desktop/all-data-final.csv", headers: true) do |row| | |
json_row = {} | |
row.headers.each do |key| | |
json_row[key] = row[key] unless row[key].nil? | |
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
▶ bundle exec rake test:sqlite3 --trace | |
** Invoke test:sqlite3 (first_time) | |
** Invoke sqlite3:env (first_time) | |
** Execute sqlite3:env | |
** Execute test:sqlite3 | |
/home/vagrant/bin/ruby -w -I"lib:test" -I"/home/vagrant/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib" "/home/vagrant/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/cases/adapter_test.rb" "test/cases/adapters/sqlite3/copy_table_test.rb" "test/cases/adapters/sqlite3/explain_test.rb" "test/cases/adapters/sqlite3/quoting_test.rb" "test/cases/adapters/sqlite3/sqlite3_adapter_test.rb" "test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb" "test/cases/adapters/sqlite3/statement_pool_test.rb" "test/cases/aggregations_test.rb" "test/cases/ar_schema_test.rb" "test/cases/associations/association_scope_test.rb" "test/cases/associations/belongs_to_associations_test.rb" "test/cases/associations/callbacks_test.rb" "test/cases/associations/cascaded_eager_loading_test.rb" "test/cases/associations/eager_load_includes_full_sti_class_test.rb" "tes |
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 YourFace | |
def initialize | |
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
bash "install_something" do | |
user "root" | |
cwd "/tmp" | |
code <<-EOH | |
wget http://www.example.com/tarball.tar.gz | |
tar -zxf tarball.tar.gz | |
cd tarball | |
./configure | |
make | |
make install |
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
# Good | |
Message.where(:author_type => 'User'). | |
includes(:next_message). | |
includes(:next_message => :author). | |
limit(25).each { |m| puts m.next_message.author if m.next_message }; nil | |
# Bad | |
Message.where(:author_type => 'User'). | |
includes(:next_message). |