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 Concerns | |
module NestedAttributesSync | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :nested_attributes_sync_options, instance_writer: false | |
self.nested_attributes_sync_options = {} | |
end | |
class_methods do |
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
#include <iostream> | |
#include <set> | |
#include <vector> | |
int countUnique(const std::vector<std::string> &a) { | |
std::set<std::string> uniqueStrings; | |
for (std::vector<std::string>::const_iterator itr = a.begin(); itr != a.end(); itr++) { | |
if (uniqueStrings.end() == uniqueStrings.find(*itr)) { | |
uniqueStrings.insert(*itr); | |
} |
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
bool all_done = false; | |
for (int i = 0; i < 100; i ++) { | |
for (int j = 0; j < 100; j ++) { | |
if (i * j == 81) { | |
all_done = true; | |
break; | |
} | |
} | |
if (all_done) { |