query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Percentage of the urban area total area.
def percent_urban_area_total_area total_area / urban_area.total_area end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_urban_area_land_area\n land_area / urban_area.land_area\n end", "def percent_county_subdivision_total_area\n total_area / county_subdivision.total_area\n end", "def percent_county_subdivision_land_area\n land_area / county_subdivision.land_area\n end", "def percent_land\n ...
[ "0.86593354", "0.82140315", "0.80313486", "0.787898", "0.69252634", "0.68133247", "0.6751706", "0.67063016", "0.66517645", "0.6631253", "0.6519375", "0.64447653", "0.6406938", "0.6325251", "0.6286061", "0.62712646", "0.6259621", "0.62175095", "0.6201035", "0.6144239", "0.6091...
0.92091095
0
Percentage of the county land area.
def percent_county_subdivision_land_area land_area / county_subdivision.land_area end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_land\n land_area / total_area if land_area\n end", "def percent_urban_area_land_area\n land_area / urban_area.land_area\n end", "def percent_county_subdivision_total_area\n total_area / county_subdivision.total_area\n end", "def percent_urban_area_total_area\n total_a...
[ "0.8607573", "0.8346606", "0.80813706", "0.7616261", "0.66282284", "0.6587714", "0.65848833", "0.6170063", "0.6036713", "0.6008433", "0.5971052", "0.5932467", "0.5932467", "0.5873295", "0.5866733", "0.5865603", "0.58470106", "0.5837831", "0.582521", "0.58191276", "0.58028376"...
0.890019
0
Percentage of the county total area.
def percent_county_subdivision_total_area total_area / county_subdivision.total_area end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_county_subdivision_land_area\n land_area / county_subdivision.land_area\n end", "def percent_urban_area_total_area\n total_area / urban_area.total_area\n end", "def percent_urban_area_land_area\n land_area / urban_area.land_area\n end", "def percent_land\n land_area /...
[ "0.83872736", "0.77667546", "0.7245833", "0.71519065", "0.665116", "0.6622293", "0.63421416", "0.6327798", "0.6267017", "0.6267017", "0.62666166", "0.6261902", "0.62539035", "0.6234958", "0.6234958", "0.6232058", "0.62296396", "0.6223995", "0.6203937", "0.61968565", "0.618921...
0.87839943
0
Unlike the ping method for other Ping subclasses, this version returns a PingStatus struct which contains various bits of information about the results of the ping itself, such as response time. In addition, this version allows you to pass certain options that are then passed on to the underlying WQL query. See the MSD...
def ping(host = @host, options = {}) super(host) lhost = Socket.gethostname cs = "winmgmts:{impersonationLevel=impersonate}!//#{lhost}/root/cimv2" wmi = WIN32OLE.connect(cs) query = "select * from win32_pingstatus where address = '#{host}'" unless options.empty? options.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ping\n response = connection.get(get_ping_url)\n if response.success?\n PingResponse.new(response.body)\n end\n end", "def ping(options = Options::Ping::DEFAULT)\n resp = @backend.ping(@name, options.to_backend)\n PingResult.new do |res|\n res.version = res...
[ "0.68066955", "0.65837246", "0.65152436", "0.6391189", "0.6365383", "0.63503945", "0.6273008", "0.6206251", "0.6195524", "0.61446035", "0.6079077", "0.6020854", "0.5989309", "0.5933099", "0.59102404", "0.5867549", "0.5816162", "0.5743289", "0.5735439", "0.5653538", "0.5630177...
0.7587996
0
Unlike Net::Ping::WMIping, this method returns true or false to indicate whether or not the ping was successful.
def ping?(host = @host, options = {}) ping(host, options).status_code == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ping?\n rpc.request Util::MessageCode::PING_REQUEST\n\n return rpc.status\n end", "def ping?\n cmd = \"ping -c #{@count} -i #{@wait} #{@host}\"\n\n # Execute command and handle resulting exit status from command.\n Open3.popen3(cmd) do |_, _, stderr, thread|\n case thread.value.exi...
[ "0.76237774", "0.75487036", "0.7486414", "0.7481002", "0.735756", "0.7286508", "0.71328306", "0.70725083", "0.70600665", "0.7002911", "0.696726", "0.6942562", "0.6809135", "0.6732013", "0.6715968", "0.6662612", "0.66299057", "0.6617794", "0.6588857", "0.657226", "0.6464698", ...
0.686154
12
config = :id, :normal_balance
def category(config = {}) config = config.symbolize_keys # get subledger id calculated from config subledger_id, key = to_subledger_id(:category, config[:id]) if subledger_id.present? subledger.categories.read(id: subledger_id) else # create the category the_category = subledger....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balance=(balance)\n @balance = balance\n end", "def set_addbalance\n @addbalance = Addbalance.find(params[:id])\n end", "def initialize(balance)\n @balance = balance\n end", "def set_account_balance\n @account_balance = AccountBalance.find(params[:id])\n end", "def set_account_b...
[ "0.62068254", "0.62059575", "0.6161359", "0.6094473", "0.6094473", "0.60352325", "0.60260683", "0.6020873", "0.6006998", "0.59290576", "0.5922868", "0.5907301", "0.5901033", "0.5901033", "0.5900476", "0.5861113", "0.58432335", "0.58216155", "0.58167475", "0.58116114", "0.5789...
0.0
-1
BigQuery's Table Date suffix structure
def format_table_date(date) date.strftime('%Y%m%d') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_new_name table,timestamp\n table + \"_\" + to_date(timestamp)\n end", "def compute_table_name\n \"#{full_table_name_prefix}#{undecorated_table_name(name)}#{table_name_suffix}\"\n end", "def date_time_reference\n ['DTM', '405', @batch.date.strftime(\"%Y%m%d\")].join(@ele...
[ "0.6084281", "0.54407275", "0.5423675", "0.53750575", "0.53692454", "0.5320569", "0.5301764", "0.529366", "0.5249054", "0.52235854", "0.5186219", "0.5168517", "0.5168517", "0.5168517", "0.5168517", "0.5168517", "0.5168517", "0.5133966", "0.51177263", "0.5102895", "0.5090453",...
0.54707813
1
BigQuery's Table Date Range suffix structure
def format_table_date_range(date) date.strftime('%Y%m*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temporal_index_names(table, range, options = {})\n prefix = options[:name].presence || \"index_#{table}_temporal\"\n\n # When creating computed indexes\n #\n # e.g. ends_on::timestamp + time '23:59:59'\n #\n # remove everything following the field name.\n ...
[ "0.63056296", "0.58260953", "0.55683047", "0.5469751", "0.5456242", "0.53761333", "0.5334861", "0.5241325", "0.524119", "0.5231713", "0.5193038", "0.5175526", "0.51528406", "0.51259434", "0.50719315", "0.50403273", "0.5017394", "0.50040156", "0.5003139", "0.5000825", "0.49908...
0.6086722
1
Schema Helpers Builds a model schema and then formats it for QueryBigly::Client
def format_model_schema(klass) hsh = klass.columns_hash.map { |column_name,column| [column_name, column.type] }.to_h format_schema_helper(hsh) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n @_format.schema\n end", "def build_schema(**args)\n if Helper.collection?(object)\n build_collection_schema(**args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def build_schema(**args)\n if object.respond_to?(:each)\n ...
[ "0.67366225", "0.6717951", "0.6628064", "0.63147527", "0.6302985", "0.6254521", "0.62544805", "0.62121314", "0.6203368", "0.61462486", "0.61333495", "0.61142194", "0.61031085", "0.60853475", "0.6000538", "0.5962434", "0.5931733", "0.5924545", "0.59195226", "0.588303", "0.5874...
0.6845699
0
formats the schema for QueryBigly::Client
def format_schema_helper(hsh) hsh = map_data_types(hsh) hsh.map { |column_name,column_type| ["#{column_type}".to_sym,"#{column_name}"] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n @_format.schema\n end", "def schema\n adapter.schema\n end", "def schema_from_hash schema\n json = schema.to_json.to_java(:string) # !\n \n rs = (ObjectMapper.new()).readValue(json, ResourceSchema.java_class);\n Util.translateSchema(Schema.getPigSchema(rs))\n ...
[ "0.6863541", "0.6112079", "0.60868716", "0.6056756", "0.5922157", "0.58728814", "0.5799946", "0.5777537", "0.577224", "0.57429045", "0.57270986", "0.5722055", "0.57133853", "0.5696575", "0.5683457", "0.5671719", "0.5654153", "0.56448823", "0.56284684", "0.56284684", "0.562745...
0.5234098
50
Persist only the aliases in the custom fields after the record has been instansiated
def use_any_aliases(custom_fields) custom_fields.map { |column_name,column_type| [column_name.gsub(/.*AS\s+/, ''), column_type] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases\n @aliases ||= FIELD_ALIASES.dup\n end", "def after_find\n add_assosiations\n map_fields\n end", "def setup!\n setup_instance_methods!\n @owner_class.embedded_relations = @owner_class.embedded_relations.merge(name => self)\n @owner_class.aliased_fields[name...
[ "0.65005606", "0.6096802", "0.6022013", "0.5859807", "0.5859807", "0.5859807", "0.57835674", "0.57720184", "0.57671815", "0.5664147", "0.5574559", "0.55453676", "0.5435966", "0.5399444", "0.53966343", "0.53912914", "0.53638583", "0.5300773", "0.52958393", "0.52819556", "0.527...
0.60336125
2
Sidekiq turns the symbol values into strings, undo that
def reformat_custom_field_types_to_sym(custom_fields) result = {} custom_fields.each_pair do |key, value| result[key] = if value.class == Hash reformat_custom_field_types_to_sym(value) else value.to_sym ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sym!\n self.keys.each do |key| \n self[key.to_sym] = self.delete key if key.class == String\n end\n return self\n end", "def stringify_keys!\n\t\t\tself.each do |k,v|\n\t\t\t\tnext if k.kind_of? String\n\t\t\t\tself[k.to_s] = v\n\t\t\t\tself.delete k\n\t\t\tend\n\t\tend"...
[ "0.53676236", "0.53092283", "0.530224", "0.5222847", "0.5204207", "0.51477814", "0.5118584", "0.5118584", "0.5118584", "0.5118584", "0.5118584", "0.5118584", "0.5118584", "0.5118584", "0.50546527", "0.5052045", "0.50369936", "0.5034432", "0.5034432", "0.5034432", "0.5034432",...
0.0
-1
Rails datatypes != BigQuery datatypes
def map_data_types(hsh) hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect { |d| detected_type.match(d).present? }\n self.data_type...
[ "0.6218538", "0.6201601", "0.6169116", "0.61244786", "0.6053087", "0.6025468", "0.59099203", "0.58934563", "0.5872623", "0.58634317", "0.5858832", "0.58243674", "0.5823587", "0.5821947", "0.57928085", "0.57815367", "0.5758491", "0.5742791", "0.5653745", "0.56176937", "0.56072...
0.0
-1
TODO: Possible find a way to keep an updatable 'constants' of this list and make this logic smarter
def map_value(column_type) case column_type when :datetime then :timestamp when :json then :string else column_type end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n @@list ||= constants.inject({}){|a, c| a.merge! c => const_get(c)}\n end", "def constants() end", "def constants\n @constants.uniq\n end", "def constants\n end", "def constants\n @context.constants.sort{|a,b| a.name<=>b.name}.collect{|c| {:name=>c.name, :value=>c.value, :descriptio...
[ "0.67934066", "0.63434106", "0.6073535", "0.5919584", "0.5912073", "0.59059685", "0.5893967", "0.58789164", "0.58365005", "0.58178306", "0.58093643", "0.5757175", "0.5731928", "0.5702741", "0.56973165", "0.565869", "0.5624948", "0.5613153", "0.549843", "0.5495658", "0.5475357...
0.0
-1
JSON data types is not supported. Ingest a record an transforms all JSON values to strings It is recommended the User flattens the JSON by formatting custom fields
def stringify_json_attributes(record) record.each_with_object({}) { |(key, value), hash| hash[key] = json_values_to_string(value) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit_json(tag,time,record)\n if record\n case @flatten_mode\n when \"none\"\n Fluent::Engine.emit(tag,time, record)\n when \"string\"\n Fluent::Engine.emit(tag,time,\n record.each{ |k,v| \n record[k] = (v.cl...
[ "0.6207322", "0.61569595", "0.61505204", "0.61222166", "0.604883", "0.604883", "0.59103394", "0.5889771", "0.58616054", "0.58408874", "0.5835472", "0.58302885", "0.5829109", "0.5814513", "0.57781184", "0.57767516", "0.5776054", "0.57628316", "0.5751574", "0.57081693", "0.5700...
0.56826186
22
Stringify a value with a class of Hash
def json_values_to_string(value) value.class == Hash ? value.to_s : value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def serialize(hash)\n hash.inspect\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n return to_s.hash\n end", "def to_s\r\n to_hash.to_s\r\n end", "def ...
[ "0.7500793", "0.74104595", "0.74104595", "0.740388", "0.73379934", "0.7305658", "0.7121798", "0.7055796", "0.7055796", "0.70483583", "0.7048176", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", "0.7047001", ...
0.0
-1
Equivalente ao attr_reader :description def description
def done? @done end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description\n @description\n end", "def description\n return @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n\n retur...
[ "0.90962446", "0.9095214", "0.9086837", "0.9086837", "0.9086837", "0.9086837", "0.90443146", "0.89221233", "0.89221233", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116", "0.8916116",...
0.0
-1
returns the list of modules from this pathway
def get_module_list years = JSON.parse data out = [] years.each do |year| year.each do |group| group.each do |module_id| out.push UniModule.find_by_id(module_id) end end end out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_modules\n pal.list_modules\n end", "def modules\n @modules.values\n end", "def modules\n @modules.values\n end", "def childModules()\n\t\t\t\tlist = []\t\t\t\n\t\t\t\tdir = Dir.new( path() )\n\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext unless File.directory?( path() + \"/\" + file...
[ "0.77617174", "0.77116567", "0.77116567", "0.73217505", "0.71564895", "0.7094591", "0.703698", "0.6943605", "0.6931869", "0.6931674", "0.6881268", "0.67955345", "0.67770386", "0.67460847", "0.674236", "0.6645579", "0.6577826", "0.6543589", "0.6521179", "0.6521179", "0.6521179...
0.56822556
91
=> "Bye Beyonce." OR
def goodbye(name) return = "Bye " + name + "." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bob(sentence)\n\tif sentence.empty?\n\t\t\"Fine. Be that way!\"\n\telsif sentence == sentence.upcase && sentence != sentence.downcase\n\t\t\"Woah, chill out\"\n\telsif sentence.end_with?(\"?\")\n\t\t\"Sure\"\n\telse\n\t\t\"Whatever\"\n\t\t\n\tend\n\t\nend", "def matching_the_word_and\n /WRITE ME/\n end",...
[ "0.66352665", "0.6525487", "0.6385366", "0.63586223", "0.6248272", "0.6236626", "0.62313867", "0.6166558", "0.615777", "0.61470914", "0.614349", "0.6142697", "0.61409223", "0.6128819", "0.6121", "0.61186063", "0.6116439", "0.6092787", "0.60923743", "0.6075347", "0.60744834", ...
0.0
-1
=> "Bye Beyonce." Conditinonals Write a method is_div_by_5(number) that takes in a number and returns the boolean true if the given number is divisible by 5, false otherwise
def is_div_by_5(number) if number % 5 == 0 return "true" else return "false" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_div_by_5(number)\n if number % 5 == 0\n return true\n else\n return false\n end\nend", "def is_div_by_5(number)\n return number % 5 == 0 ? true : false\nend", "def can_be_divided_by_five(number)\n is_divisible_by_5 = number % 5\n is_divisible_by_5 == 0\nend", "def divisible_by_5?(num)\n n...
[ "0.88565075", "0.8782965", "0.8704751", "0.86978555", "0.8614547", "0.8570576", "0.8149002", "0.81116635", "0.8057326", "0.77630967", "0.76322794", "0.7592495", "0.7581852", "0.75778216", "0.738798", "0.7212122", "0.7179818", "0.7117536", "0.7082628", "0.70643634", "0.6967383...
0.90537566
0
=> false Write a method either_only(number) that takes in a number and returns true if the number is divisible by either 3 or 5, but not both. The method should return false otherwise.
def either_only(number) if number % 3 == 0 && number % 5 != 0 return "true" elsif number % 3 != 0 && number % 5 == 0 return "true" else return "false" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def either_only(number)\r\n if (number % 3 == 0 || number % 5 == 0) && !(number % 3 == 0 && number % 5 == 0)\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def either_only(number)\n if (number % 3 ==0 || number % 5 ==0) && !(number % 3 == 00 && number % 5 == 0)\n return true\n ...
[ "0.9020982", "0.8623155", "0.74558604", "0.6961036", "0.694383", "0.6882737", "0.68453705", "0.6843933", "0.6733904", "0.6657102", "0.6631171", "0.66233057", "0.66064346", "0.66037995", "0.6568361", "0.65625656", "0.6500689", "0.6497163", "0.64925694", "0.6477822", "0.6462263...
0.8605242
2
=> false Write a method larger_number(num1, num2) that takes in two numbers and returns the larger of the two numbers.
def larger_number(num1, num2) if num1 > num2 return num1 elsif num1 < num2 return num2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def larger_number(num1, num2)\r\n\tif num1 > num2\r\n return num1\r\n else\r\n return num2\r\n end\r\nend", "def larger_number(num1, num2)\n\tif num1 > num2\n return num1\n elsif num1 == num2\n return \"they're equal\"\n else\n return num2\n end\nend", "def return_larger...
[ "0.9053492", "0.8826584", "0.82993567", "0.81153697", "0.8007561", "0.79624116", "0.79624116", "0.7948982", "0.7913098", "0.7888935", "0.7865011", "0.7843494", "0.7822341", "0.78047013", "0.7769674", "0.76011264", "0.75913316", "0.7588915", "0.7588255", "0.73797655", "0.73772...
0.9016614
1
=> 100 Write a method longer_string(str1, str2) that takes in two strings and returns the longer of the two strings. In the case of a tie, the method should return the first string.
def longer_string(str1, str2) if str1.length > str2.length return str1 elsif str2.length > str1.length return str2 else return str1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longer_string(str1, str2)\r\n\tif str1.length >= str2.length\r\n return str1\r\n else\r\n return str2\r\n end\r\nend", "def longer_string(str1, str2)\n # Write your code here\nend", "def largest_substring(str_1, str_2)\n lengths = Array.new(str_1.length){Array.new(str_2.length, 0)}\n l...
[ "0.860792", "0.8270621", "0.72436917", "0.72294503", "0.7202181", "0.71980643", "0.7161952", "0.71420765", "0.71181667", "0.7102094", "0.7076569", "0.7056233", "0.7041843", "0.7035954", "0.7000718", "0.6996021", "0.69955355", "0.69945335", "0.6983917", "0.69631577", "0.695845...
0.87346196
0
=> "hello" Write a method number_check(num) that takes in a number and returns a string. The method should return the string 'positive' if the num is positive, 'negative' if the num is negative, and 'zero' if the num is zero.
def number_check(num) if num > 0 return "positive" elsif num < 0 return "negative" else return "zero" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_check(num)\r\n\tif num > 0\r\n return \"positive\"\r\n elsif num < 0\r\n return \"negative\"\r\n else\r\n return \"zero\"\r\n end\r\nend", "def number_check(num)\n if num > 0\n return \"positive\"\n elsif num < 0\n return \"negative\"\n elsif num == 0\n return \"zer...
[ "0.8962125", "0.8940657", "0.8693646", "0.8301974", "0.7634013", "0.7584809", "0.75216943", "0.74807733", "0.74759233", "0.7462345", "0.7180902", "0.7115286", "0.7096556", "0.70925075", "0.702698", "0.6953887", "0.6938624", "0.6885253", "0.6846881", "0.6842304", "0.67793846",...
0.8971845
0
=> "zero" Write a method word_check(word) that takes in a word and returns a string. The method should return the string "long" if the word is longer than 6 characters, "short" if it is less than 6 characters, and "medium" if it is exactly 6 characters long.
def word_check(word) if word.length > 6 return "long" elsif word.length < 6 return "short" else return "medium" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_check(word)\r\n\tif word.length > 6\r\n return 'long'\r\n elsif word.length < 6\r\n return 'short'\r\n else\r\n return 'medium'\r\n end\r\nend", "def legal_word?(word)\n word.length >= 5 && word.length <= 12\n end", "def wordMin(word)\n\tword.length >= 5\nend", "def long_...
[ "0.9083946", "0.74195063", "0.7390262", "0.6915799", "0.678869", "0.6675342", "0.6642344", "0.66372144", "0.6624028", "0.65875435", "0.6563734", "0.6536422", "0.65180117", "0.6502008", "0.649846", "0.6449967", "0.6443581", "0.64251", "0.641841", "0.64031196", "0.63992554", ...
0.9107152
1
=> "medium" Loops Write a method count_e(word) that takes in a string word and returns the number of e's in the word
def count_e(word) puts word.count('e') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_e(word)\n i = 0\n count = 0\n while i < word.length\n if word[i] == 'e'\n count += 1\n end\n i += 1\n end\n return count\nend", "def count_e(word)\n counter = 0\n i = 0\n while i < word.length\n if word[i] == \"e\"\n counter += 1\n end \n i...
[ "0.8927247", "0.89014566", "0.88670033", "0.87865895", "0.8770513", "0.8509373", "0.84866846", "0.84053856", "0.8387788", "0.8310471", "0.82860756", "0.7610927", "0.76009417", "0.759244", "0.7591473", "0.75612026", "0.7549866", "0.7499068", "0.74963504", "0.7485231", "0.74569...
0.898403
0
=> 3 Write a method count_a(word) that takes in a string word and returns the number of a's in the word. The method
def count_a(word) count = 0 i = 0 while i < word.length char = word[i] if char == "a" count += 1 elsif char == "A" count += 1 end i += 1 end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_a(word)\n\tcounter = 0\n \ti = 0\n \twhile i < word.length\n if word[i] == \"a\" || word[i] == \"A\"\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def count_a(word)\n counter = 0\n i = 0\n while i < word.length\n if word[i] == 'a' || word[i] == 'A'\n ...
[ "0.8371601", "0.81701857", "0.8121104", "0.80905294", "0.80758524", "0.80442125", "0.7908084", "0.78392327", "0.7815409", "0.7694279", "0.76374155", "0.7557444", "0.7490985", "0.73172134", "0.7315213", "0.7315213", "0.73116326", "0.73033607", "0.7284173", "0.7245566", "0.7234...
0.79467815
6
=> 3 Write a method, count_vowels(word), that takes in a string word and returns the number of vowels in the word. Vowels are the letters a, e, i, o, u.
def count_vowels(word) count = 0 i = 0 while i < word.length char = word[i] if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" count += 1 end i += 1 end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_vowels(word)\nend", "def vowel_count(word)\n count = 0\n vowels = \"aeiouAEIOU\"\n word.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n return count\nend", "def count_vowels(string)\n string.downcase.count('aeiou')\nend", "def vowel_count(word)\n count ...
[ "0.908518", "0.8851811", "0.8834529", "0.88122475", "0.8804663", "0.8745898", "0.87277526", "0.8693494", "0.8692525", "0.8678067", "0.8668767", "0.86497957", "0.86237216", "0.8621421", "0.85995007", "0.85594136", "0.8534055", "0.84874415", "0.84492755", "0.84386784", "0.84332...
0.84360653
20
=> 2 Write a method sum_nums(max) that takes in a number max and returns the sum of all numbers from 1 up to and including max.
def sum_nums(max) sum = 0 i = 1 while i <= max sum += i i += 1 end return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_nums(max)\n # Write your code here\nend", "def sum_nums(max)\n\t# create a variable to store sum\n \t# loop until max\n \t# sum += iterator\n idx = 0\n sum = 0\n while(idx <= max)\n sum+= idx\n idx+=1\n end\n return sum\nend", "def sum_nums(max) # Defines method\n\n\ti = 1 # i starts at...
[ "0.87026966", "0.850498", "0.8401732", "0.8389831", "0.83346725", "0.8214649", "0.8139319", "0.8115689", "0.8108291", "0.8049485", "0.75462085", "0.74585855", "0.74558204", "0.74119645", "0.7252567", "0.7236126", "0.72118604", "0.71939045", "0.7176187", "0.71691763", "0.71619...
0.81048477
9
=> 15 Write a method factorial(num) that takes in a number num and returns the product of all numbers from 1 up to and including num.
def factorial(num) product = 1 i = 1 while i <= num product *= i i += 1 end return product end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(num)\n product = num\n (1...num).each{|n| product *= n}\n product\nend", "def factorial(num)\n product = 1\n for factor in 1..num\n product *= factor\n end\n product\nend", "def factorial(num)\n\tproduct = 1\n\twhile num > 1\n\t\tproduct = product*num\n\t\tnum -= 1\n\tend\n\tproduct\nen...
[ "0.8809026", "0.86852574", "0.8669018", "0.865152", "0.86454374", "0.8608884", "0.86054605", "0.86010337", "0.859789", "0.8577119", "0.85693526", "0.85646814", "0.85586035", "0.85357493", "0.8527021", "0.85182154", "0.85169715", "0.8505437", "0.8492601", "0.84915906", "0.8463...
0.8591376
9
=> 120, because 1 2 3 4 5 = 120 Write a method is_palindrome(word) that takes in a string word and returns the true if the word is a palindrome, false otherwise. A palindrome is a word that is spelled the same forwards and backwards.
def is_palindrome(word) forwards = "" backwards = "" i = 0 while i < word.length char = word[i] forwards = forwards + char backwards = char + backwards i += 1 end if forwards == backwards return "true" else return "false" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_palindrome?(word)\n if word == word.reverse\n return true\n else\n return false\n end\nend", "def palindrome?(word)\n word.reverse == word\nend", "def is_palindrome(word)\n\t# too easy\n # return word == word.reverse\n \tidxReverse = word.length-1\n \tidxForward = 0\n \twhile(idxForward<...
[ "0.8975902", "0.88977915", "0.88537604", "0.88191926", "0.88148516", "0.8811359", "0.8761158", "0.8740029", "0.8670944", "0.8669612", "0.8661523", "0.8657018", "0.8653076", "0.86529833", "0.8619913", "0.86108834", "0.8586978", "0.85861546", "0.8583475", "0.85820556", "0.85783...
0.86023504
16
=> false Arrays Write a method doubler(numbers) that takes an array of numbers and returns a new array where every element of the original array is multiplied by 2.
def doubler(numbers) doubled_nums = [] i = 0 while i < numbers.length doubled_nums << numbers[i] * 2 i += 1 end return doubled_nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doubler(numbers)\n\ti = 0\n \tarry = []\n while i < numbers.length\n arry[i] = (numbers[i] * 2)\n i += 1\n end\n return arry\nend", "def doubler(numbers)\n i = 0\n while i < numbers.length\n numbers[i] = numbers[i] * 2\n i += 1\n end\n return numbers\nend", "def doub...
[ "0.8544068", "0.85198617", "0.85107803", "0.8459087", "0.83800817", "0.8373827", "0.8373827", "0.83418983", "0.8328115", "0.8132092", "0.8119067", "0.8060372", "0.80574507", "0.8053874", "0.80297416", "0.80140805", "0.7959082", "0.793654", "0.7861548", "0.7848901", "0.7845293...
0.8254606
9
=> [14, 2, 16] Write a method yell(words) that takes in an array of words and returns a new array where every word from the original array has an exclamation point after it.
def yell(words) yelling = [] i = 0 while i < words.length yelling << words[i] +"!" i += 1 end return yelling end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yell(words)\n newArr = []\n i = 0\n while i<words.length\n newWord = words[i] + \"!\"\n newArr << newWord\n i += 1\n end\n return newArr\n end", "def yell(words)\n words.map{|word| word + \"!\"}\nend", "def yell(words)\n\tnew_words = []\n\n\ti = 0\n\twhile i < words.length...
[ "0.85442436", "0.84850955", "0.8454126", "0.8415345", "0.84119195", "0.83760923", "0.83200216", "0.8319819", "0.8315429", "0.81978536", "0.81382865", "0.8119441", "0.79875094", "0.72255605", "0.7192674", "0.7025836", "0.6979372", "0.69189495", "0.6791463", "0.6691257", "0.666...
0.80553526
12
=> ["code!", "is!", "cool!"] Write a method element_times_index(nums) that takes in an array of numbers and returns a new array containing every number of the original array multiplied with its index.
def element_times_index(numbers) multiplied_numbers = [] i = 0 while i < numbers.length multiplied_numbers << numbers[i] * i i += 1 end return multiplied_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_times_index(nums)\n nums.map.with_index{|num, idx| num * idx}\nend", "def element_times_index(numbers)\n new_nums = []\n \n i = 0\n while i < numbers.length\n new_nums << numbers[i] * i\n \n i += 1\n end\n \n return new_nums\n end", "def element_times_index(numbers)\...
[ "0.88128895", "0.877469", "0.86873794", "0.8684222", "0.8648496", "0.85788333", "0.8555744", "0.85370755", "0.8356008", "0.82508194", "0.81271106", "0.77979726", "0.7594599", "0.7171028", "0.70664185", "0.6996002", "0.69915086", "0.6989563", "0.690942", "0.6873601", "0.686652...
0.8736496
2
=> [0, 1, 2, 3, 4, 5] Write a method even_nums(max) that takes in a number max and returns an array containing all even numbers from 0 to max
def even_nums(max) even_array = [] i = 0 while i <= max if i % 2 == 0 even_array << i end i +=1 end return even_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_nums(max)\n result = []\n\tfor i in 0..max\n \tif i % 2 == 0 \n result << i\n end\n end\n return result\nend", "def even_nums(max)\n\tnums = []\n \n\ti = 0\n\twhile i <= max\n\t\tif i % 2 == 0\n\t\t\tnums << i\n\t\tend\n\t\ti += 1\n end\n \n\treturn nums\nend", "def even_num...
[ "0.9067875", "0.89841413", "0.8923583", "0.8878501", "0.88447464", "0.8799376", "0.8776776", "0.85215807", "0.8484866", "0.84827894", "0.8294991", "0.78435254", "0.7835373", "0.78196234", "0.7701161", "0.76634043", "0.76189035", "0.75562525", "0.7471052", "0.7428187", "0.7411...
0.8870188
4
=> [0, 2, 4] Write a method range(min, max) that takes in two numbers min and max. The method should return an array containing all numbers from min to max inclusive.
def range(min, max) all_numbers = [] i = min while i <= max all_numbers << i i += 1 end return all_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range(min, max)\n \tarr = []\n\tfor i in min..max\n arr << i\n end\n return arr\nend", "def range(min, max)\n\trange = []\n\n\ti = min\n\twhile i <= max\n\t\trange << i\n\t\ti += 1\n end\n \n\treturn range\nend", "def range(min, max)\n range_array = []\n\n i = min\n while i <= max\n range...
[ "0.90833986", "0.8846146", "0.8749249", "0.87382203", "0.8671359", "0.86059767", "0.8597013", "0.8540312", "0.85039866", "0.85038763", "0.8485602", "0.84588224", "0.84510124", "0.84508586", "0.8404562", "0.831112", "0.82558984", "0.81977856", "0.81887454", "0.8183083", "0.813...
0.82341385
17
=> [13, 14, 15, 16, 17, 18, 19, 20] Write a method odd_range(min, max) that takes in two numbers min and max. The method should return an array containing all odd numbers from min to max (inclusive).
def odd_range(min, max) odd_numbers = [] i = min while i <= max if i % 2 == 1 odd_numbers << i end i += 1 end return odd_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odd_range(min, max)\n\tarr = []\n \tfor i in min..max\n if i % 2 != 0 \n arr << i\n end\n end\n return arr\n \nend", "def odd_range(min, max)\n odd_array = []\n\n i = min\n while i <= max\n if !(i % 2 == 0)\n odd_array << i\n end\n i += 1\n end\n return odd_array...
[ "0.9209184", "0.9162004", "0.9149287", "0.91039807", "0.91037154", "0.9075583", "0.9058965", "0.9054758", "0.9052844", "0.90457594", "0.899631", "0.8859076", "0.8699788", "0.75631", "0.75410354", "0.7454027", "0.7453614", "0.7441717", "0.74353075", "0.74082655", "0.73972285",...
0.89737517
11
=> [3, 5, 7] Write a method reverse_range(min, max) that takes in two numbers min and max. The function should return an array containing all numbers from min to max in reverse order. The min and max should be excluded from the array
def reverse_range(min, max) reverse_numbers = [] i = max - 1 while i > min reverse_numbers << i i -= 1 end return reverse_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_range(min, max)\n newArr = []\n i = max - 1\n while i >= min +1\n newArr << i\n i -= 1\n end\n return newArr\n end", "def reverse_range(min, max)\n reverse_arr = []\n\n i = max -1\n while i > min\n reverse_arr << i\n i -= 1\n end\n return reverse_arr\nend", "def...
[ "0.9115727", "0.9102495", "0.90958613", "0.90462005", "0.9044425", "0.9042474", "0.90132123", "0.89482915", "0.887216", "0.88383776", "0.84119976", "0.7526046", "0.7499354", "0.7499354", "0.7473436", "0.74729466", "0.74548584", "0.74163216", "0.7415935", "0.73531467", "0.7347...
0.89615154
7
Write a method first_half(array) that takes in an array and returns a new array containing the first half of the elements in the array. If there is an odd number of elements, return the first half including the middle element.
def first_half(array) elements = [] i = 0 while i <= array.length / 2.0 elements << array[i] i += 1 end return elements end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_half(array)\n half = []\n i = 0\n max = array.length - (array.length / 2)\n while i < max\n half << array[i]\n i += 1\n end\n return half\n \n end", "def first_half(array)\n i = 0\n newArr = []\n while i < array.length / 2.0\n newArr << array[i]\n i +=...
[ "0.89168674", "0.8901931", "0.8897018", "0.8859798", "0.8844798", "0.88344145", "0.8767708", "0.87370896", "0.86561155", "0.8371895", "0.8349211", "0.8230315", "0.8109591", "0.79780036", "0.795436", "0.7932967", "0.7921305", "0.7921305", "0.7921305", "0.7921305", "0.7921305",...
0.86987424
8
=> ["a", "b", "c"] Write a method factors_of(num) that takes in a num and returns an array of all positive numbers less than or equal to num that can divide num.
def factors_of(num) divide_by = [] i = 1 while i <= num if num % i == 0 divide_by << i end i += 1 end return divide_by end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factors_of(num)\n\tnewArray = []\n \tfor i in 1..num\n if num % i == 0\n \tnewArray << i\n end\n end\n return newArray\nend", "def factors(num)\n arr = []\n (1..num).each do |el|\n arr << el if num % el == 0\n end\n arr\nend", "def get_factors(num)\n factors = []\n (1..num)...
[ "0.8552711", "0.8510035", "0.84082955", "0.8405078", "0.84026206", "0.8399948", "0.83926326", "0.83675873", "0.834719", "0.83185184", "0.8310829", "0.8290436", "0.828832", "0.82834744", "0.828202", "0.82608885", "0.8252084", "0.8242867", "0.82422864", "0.8208134", "0.82026404...
0.82721907
15
=> [1, 2, 4, 8, 16] Write a method select_odds(numbers) that takes in an array of numbers and returns a new array containing the odd numbers of the original array.
def select_odds(numbers) odd_numbers = [] i = 0 while i < numbers.length if numbers [i] % 2 == 1 odd_numbers << numbers [i] end i += 1 end return odd_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_odds(numbers)\n i = 0\n newArr = []\n while i < numbers.length\n if numbers[i] % 2 != 0\n newArr << numbers[i]\n end\n i += 1\n end\n return newArr\n end", "def select_odds(numbers)\n\todds = []\n \tfor i in 0..numbers.length-1\n number = numbers[i]\n i...
[ "0.86825013", "0.8680338", "0.86660427", "0.8598955", "0.8576908", "0.85561585", "0.8540328", "0.8538837", "0.8505671", "0.849656", "0.8309381", "0.7950985", "0.78067964", "0.7768132", "0.7726571", "0.77172726", "0.76135784", "0.7580138", "0.75437385", "0.7535364", "0.7526116...
0.8600734
3
=> [] Write a method select_long_words(words) that takes in an array of words and returns a new array containing all of the words of the original array that are longer than 4 characters.
def select_long_words(words) long_words = [] i = 0 while i < words.length if words[i].length > 4 long_words << words[i] end i += 1 end return long_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_long_words(words)\n i = 0\n newArr = []\n while i < words.length\n if words[i].length > 4\n newArr << words[i]\n end\n i += 1\n end\n return newArr\n end", "def select_long_words(words)\n\tlongWords = []\n\n\ti = 0\n\twhile i <= words.length\n\t\ttemp = words[i]\n...
[ "0.9028068", "0.887041", "0.8821048", "0.8768229", "0.87003446", "0.8679341", "0.841685", "0.7920679", "0.7468648", "0.7429365", "0.7194489", "0.70954406", "0.7071393", "0.7032126", "0.70172715", "0.6992385", "0.6990367", "0.693177", "0.6777086", "0.6772927", "0.67547137", ...
0.8605037
6
Write a method sum_elements(arr1, arr2) that takes in two arrays. The method should return a new array containing the results of adding together corresponding elements of the original arrays. You can assume the arrays have the same length.
def sum_elements(arr1, arr2) sum_array = [] i = 0 while i < arr1.length sum_array << arr1[i] + arr2[i] i += 1 end return sum_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_elements(arr1, arr2)\n i = 0\n newArr = []\n while i < arr1.length\n newArr << arr1[i] + arr2[i]\n i += 1\n end\n return newArr\n end", "def sum_elements(arr1, arr2)\n\tsum_array = []\n\n\ti = 0\n\twhile i < arr1.length && i < arr2.length\n\t\ttemp = arr1[i] + arr2[i]\n\t\tsum_a...
[ "0.8677476", "0.8588339", "0.84316534", "0.83635175", "0.82985175", "0.82025844", "0.8146496", "0.7803349", "0.74449944", "0.737208", "0.73266494", "0.7164209", "0.70864975", "0.70556927", "0.6882617", "0.684472", "0.68426806", "0.68328524", "0.6809613", "0.6805533", "0.67443...
0.8213883
5
=> ["catdog", "pizzapie", "bootcamp"] Write a method fizz_buzz(max) that takes in a number max and returns an array containing all numbers greater than 0 and less than max that are divisible by either 4 or 6, but not both.
def fizz_buzz(max) new_array = [] i = 0 while i <= max if (i % 4 == 0 && i % 6 != 0) || (i % 6 == 0 && i % 4 != 0) new_array << i end i += 1 end return new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizz_buzz(max)\n\ti = 0\n\tnewArr = []\n \twhile i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n newArr << i\n end\n i += 1\n end\n return newArr\nend", "def fizz_buzz(max)\n newArray = []\n for i in 0..max\n if (i > 0) && (i < max)\n \tif (i % 4 ==...
[ "0.8574363", "0.8525464", "0.8524907", "0.85022736", "0.85012686", "0.8487289", "0.843154", "0.8414174", "0.8403754", "0.8380657", "0.83456427", "0.8312499", "0.8302073", "0.8302073", "0.8302073", "0.8287547", "0.8282474", "0.8260349", "0.82200503", "0.8136856", "0.784098", ...
0.8474855
6
=> [4, 6, 8] OR
def fizz_buzz(max) nums = [] i = 0 while (i < max) if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0) nums << i end i += 1 end return nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given\n [6,5,3,1,8,7,2,3]\nend", "def f6; return *['a','b'] &['a','Y','Z'] end", "def one_or_more\n -2\n end", "def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end", "def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.em...
[ "0.6470851", "0.5815163", "0.58083475", "0.56690866", "0.56690866", "0.56690866", "0.56690866", "0.56690866", "0.56690866", "0.5650667", "0.56363505", "0.5631987", "0.56197464", "0.55988127", "0.5591854", "0.5581907", "0.5560254", "0.55558735", "0.55517375", "0.55264735", "0....
0.0
-1
Enumerables& Ranges Write a method to_initials that takes in a person's name string and returns a string representing their initials.
def to_initials(name) parts = name.split(" ") initials = "" parts.each { |part| initials += part[0] } return initials end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_initials(name)\n\tinitials = []\n\n\tname.split(\" \")\n\nend", "def to_initials(name)\n initials = \"\"\n arrName = name.split(' ')\n arrName.each { | name | initials += name[0] }\n return initials\nend", "def to_initials(name)\r\n\tnames = name.split(\" \")\r\n initials = \"\"\r\n \tna...
[ "0.71784645", "0.70650166", "0.70322335", "0.7001594", "0.69948995", "0.6990443", "0.6957641", "0.6957641", "0.69496787", "0.6917187", "0.6773492", "0.67489976", "0.6717535", "0.67043626", "0.6640151", "0.6611679", "0.6572246", "0.65641373", "0.652057", "0.6496517", "0.649196...
0.68135977
10
=> "MLG" Write a method abbreviate_sentence that takes in a sentence string and returns a new sentence where every word longer than 4 characters has all of it's vowels removed.
def abbreviate_sentence(sent) words = sent.split(" ") new_words = [] words.each do |word| if word.length > 4 new_word = abbreviate_word(word) new_words << new_word else new_words << word end end return new_words.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abbreviate_sentence(sent)\n\tarrSent = sent.split(\" \")\n \tarrSent.each_with_index do |word, i|\n \tif (word.length > 4)\n \t\tarrSent[i] = removeVowels(word)\n \tend\n end\n \treturn arrSent.join(\" \")\nend", "def abbreviate_sentence(sent)\n abbreviated = \"\"\n sent.split.each do |word|\...
[ "0.8498821", "0.8478384", "0.8457458", "0.83892477", "0.82340974", "0.822833", "0.820921", "0.813703", "0.8075075", "0.7959866", "0.7744472", "0.7031754", "0.6951532", "0.6695215", "0.662089", "0.65870214", "0.6581826", "0.65334916", "0.6531998", "0.64207727", "0.63792634", ...
0.8238271
4
=> "what a wndrfl life" Write a method format_name that takes in a name string and returns the name properly capitalized.
def format_name(str) names = str.split(" ") formatted_names = [] names.each do |name| formatted_names << name[0].upcase + name[1..-1].downcase end return formatted_names.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_name(name)\n name.split.map(&:capitalize)\n .join(' ')\nend", "def format_name(name)\n properly_formatted_name = name.split(\" \").map { |n| n.capitalize }\n properly_formatted_name.join(' ')\n end", "def format_name(name)\n names = name.split(\" \")\n formatted_names = []\n names.each d...
[ "0.89386255", "0.8863682", "0.86059594", "0.83824325", "0.83824325", "0.83756244", "0.83518606", "0.82632697", "0.8156403", "0.8136502", "0.80661356", "0.8038632", "0.8007519", "0.79864156", "0.79834884", "0.79756963", "0.79602575", "0.7913058", "0.7862037", "0.7814136", "0.7...
0.8048923
11
=> "Brian Crawford Scott" Write a method is_valid_name that takes in a string and returns a boolean indicating whether or not it is a valid name.
def is_valid_name(str) parts = str.split(" ") if parts.length < 2 return false end parts.each do |part| if !(part[0] == part[0].upcase && part[1..-1] == part[1..-1].downcase) return false end end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_name?(name)\n return name.class == String && name.match(/[a-zA-Z]+?/)\n end", "def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend", "def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend", "def valid_name?(nam...
[ "0.8568123", "0.8566268", "0.84886676", "0.843814", "0.83215594", "0.8313037", "0.8231069", "0.8126254", "0.8016632", "0.80115074", "0.799978", "0.79659045", "0.79659045", "0.78852415", "0.78334004", "0.7722403", "0.7713994", "0.7658024", "0.76535714", "0.7602219", "0.7591039...
0.81662303
7
=> false Write a method is_valid_email that takes in a string and returns a boolean indicating whether or not it is a valid email address.
def is_valid_email(str) parts = str.split("@") if parts.length != 2 return false end first = parts[0] second = parts[1] alpha = "abcdefghijklmnopqrstuvwxyz" first.each_char do |char| if !alpha.include?(char) return false end end if second.split('.').length == 2 return true ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_is_valid?(email)\n email =~ /[^@ \\t\\n\\r]+@[a-zA-Z0-9\\.-]{3,}$/\n end", "def is_valid_email? email\n\temail =~ VALID_EMAIL_REGEX\nend", "def valid_email?(email)\n (email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i)\n end", "def valid_email?(email)\n email =~ /\\A[\...
[ "0.8775225", "0.875996", "0.87068677", "0.8692853", "0.866142", "0.85524344", "0.83881634", "0.83357435", "0.83194554", "0.82576853", "0.8240365", "0.8239101", "0.8212063", "0.82016397", "0.81792784", "0.81633615", "0.8135081", "0.8120385", "0.80755204", "0.805457", "0.805243...
0.7511402
54
=> false Write a method reverse_words that takes in a sentence string and returns the sentence with the order of the characters in each word reversed. Note that we need to reverse the order of characters in the words, do not reverse the order of words in the sentence.
def reverse_words(sent) letters = sent.split("") sent_array = [] sent_array += letters reverse_sent_array = sent_array.reverse! new_sent = reverse_sent_array.join new_words = new_sent.split(" ") final_sent = new_words.reverse! print final_sent.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_words(sentence)\n\tsentence.split.map! { |word| word.reverse }.join(\" \")\nend", "def reverse_words sentence\n sentence.split(\" \").map{ |x| x.reverse }.join(\" \")\nend", "def reverse_words(sentence)\n\twords = sentence.split(' ')\n\twords.each do |word|\n\t\tword.reverse!\n\tend\n\treversed_se...
[ "0.84606266", "0.8431998", "0.8418343", "0.84019315", "0.83404154", "0.832933", "0.8325843", "0.8275815", "0.8269472", "0.8232683", "0.82089937", "0.8198866", "0.8197283", "0.8197044", "0.81920594", "0.81920594", "0.81897503", "0.81878597", "0.8178166", "0.8168534", "0.816853...
0.0
-1
=> 'yticilpmis si etisiuqererp rof ytilibailer' OR
def reverse_words(sent) words = sent.split(" ") new_words = [] words.each { |word| new_words << word.reverse } new_sent = new_words.join(" ") return new_sent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def pirates_say_arrrrrrrrr(string)\nz = \"\"\nstring.split(\"\").each_index{|x| z << string[x+1] if string.downcase[x] == \"r\" && string[x+1] != nil }\nz\nend", "def pirates_say_arrrrrrrrr(string)\n other_word = \"\"\n string.leng...
[ "0.60537976", "0.6003991", "0.59259963", "0.5919393", "0.59131044", "0.5854096", "0.5809206", "0.57720256", "0.5767181", "0.57633495", "0.5702282", "0.5691411", "0.5631143", "0.56268644", "0.56196916", "0.5611129", "0.5569181", "0.5556544", "0.5554531", "0.55366254", "0.55183...
0.0
-1
=> 'yticilpmis si etisiuqererp rof ytilibailer' Write a method rotate_array that takes in an array and a number. The method should return the array after rotating the elements the specified number of times. A single rotation takes the last element of the array and moves it to the front.
def rotate_array(arr, num) removed = arr.pop(num) new_arr = removed += arr print new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_array(array)\n array[1..-1] + [array[0]] # brackets added to array[0] to force it to an array from integer.\nend", "def array_rotation(arr, num)\n\tarr.rotate(num)\nend", "def rotate_array(array)\n array[1..-1] + [array[0]]\nend", "def rotate_array(array)\n array[1..-1] + [array[0]]\nend", ...
[ "0.8124734", "0.80713195", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8038943", "0.8029013", "0.802868", "0.8020541", "0.8010635", "0.8007615", "0.8007615", "...
0.0
-1
Nested Loops & 2d Arrays Write a method combinations that takes in an array of unique elements, the method should return a 2D array representing all possible combinations of 2 elements of the array.
def combinations(arr) new_array = [] arr.each_with_index do |ele1, idx1| arr.each_with_index do |ele2, idx2| if idx2 > idx1 new_array << [ele1, ele2] end end end return new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combinations(arr)\n pairs = [] # this is 1d\n\n arr.each_with_index do |ele1, idx1| # compare this element to others in the array via a nested loop\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 # make sure only looking at new things\n pairs << [ele1, ele2] # shov...
[ "0.7844721", "0.7709089", "0.7477455", "0.74694", "0.7439391", "0.7378575", "0.7249952", "0.71333885", "0.7129562", "0.7084605", "0.68655044", "0.68433535", "0.67740524", "0.6715462", "0.67052186", "0.6696975", "0.66840327", "0.6620692", "0.6620692", "0.6578074", "0.6576774",...
0.7362362
6
Write a method opposite_count that takes in an array of unique numbers. The method should return the number of pairs of elements that sum to 0.
def opposite_count(nums) count = 0 nums.each_with_index do |ele1, idx1| nums.each_with_index do |ele2, idx2| if idx2 > idx1 && ele1 + ele2 == 0 count +=1 end end end print count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opposite_count(array)\n count = 0 \n array.combination(2).to_a.each do |nums|\n count += 1 if nums.sum == 0\n end\n\n count\nend", "def opposite_count(arr)\n count = 0\n arr.each_with_index do |element1, idx1|\n arr.each_with_index do |element2, idx2|\n if idx2 > idx1 && element1 + element2 ...
[ "0.85279346", "0.82680535", "0.816757", "0.80478996", "0.80445695", "0.7999309", "0.79722786", "0.7913779", "0.78695697", "0.78220856", "0.7794164", "0.77864635", "0.7736995", "0.7714905", "0.7708483", "0.76984394", "0.7662042", "0.76582974", "0.75512356", "0.7028605", "0.684...
0.78804123
8
=> 1 Write a method two_d_Sum that takes in a two dimensional array and returns the sum of all elements in the array.
def two_d_sum(arr) total = 0 arr.each do |sub_array| sub_array.each do |num| total += num end end return total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend", "def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend", "def two_d_sum(arr)\n\ttotal = 0\...
[ "0.8496732", "0.84167224", "0.83244586", "0.82800084", "0.82800084", "0.8195205", "0.8163331", "0.815498", "0.8143694", "0.81267565", "0.78893256", "0.7832947", "0.7763655", "0.7738092", "0.76516277", "0.74724823", "0.7456397", "0.74520385", "0.7400452", "0.7365265", "0.72776...
0.82181907
5
=> 15 Write a method two_d_translate that takes in a 2 dimensional array and translates it into a 1 dimensional array. You can assume that the inner arrays always have 2 elements. See the examples.
def two_d_translate(arr) new_arr = [] arr.each do |subArray| ele = subArray[0] num = subArray[1] num.times { new_arr << ele } end return new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_d_translate(array)\n new_arr = []\n array.each do |arr|\n arr[1].times {new_arr << arr[0]}\n end\n new_arr\nend", "def two_d_translate(arr)\n result = []\n\tarr.each do |subArray|\n subArray[1].times do \n result.push(subArray[0])\n end\n end\n return result\nend", "def...
[ "0.8243166", "0.8136986", "0.81132674", "0.8007834", "0.771173", "0.6961116", "0.64715964", "0.6413906", "0.6257454", "0.61993784", "0.6195717", "0.6186435", "0.5947147", "0.58855987", "0.58710116", "0.5866817", "0.5848234", "0.5803276", "0.5734261", "0.57155013", "0.57144964...
0.7887182
4
Write a method array_translate that takes in an array whose elements alternate between words and numbers. The method should return a string where each word is repeated the number of times that immediately follows in the array.
def array_translate(array) new_arr = [] array.each_with_index do |subArray, idx| if idx % 2 == 1 subArray = ele else subArray = num #num.times { new_arr << ele } end end #return new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_translate(array)\n repeatedWords = \"\"\n i = 0\n while i < array.length-1\n word = array[i]\n num = array[i+1]\n num.times { repeatedWords += word }\n i += 2\n end\n return repeatedWords\nend", "def array_translate(array)\n translated = \"\"\n i = 0\n while i < array.length\n \tar...
[ "0.8533077", "0.8298503", "0.8109387", "0.8092245", "0.77157146", "0.7496298", "0.6715761", "0.6662481", "0.65517145", "0.6482596", "0.6476886", "0.646659", "0.6399239", "0.63461405", "0.63145864", "0.6290018", "0.6262872", "0.6232881", "0.61752516", "0.617121", "0.6163859", ...
0.6342424
14
=> 46 Write a method get_full_name that takes in a hash containing a first, last, and title. The method should return a string representing the hash's full name
def get_full_name(hash) first = hash["first"] last = hash["last"] title = hash ["title"] print first + " " + last + " " + title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(hash)\n return hash[\"first\"] + \" \" + hash[\"last\"] + \", the \" + hash[\"title\"]\nend", "def get_full_name(hash)\n \"#{hash[\"first\"]} #{hash[\"last\"]}, the #{hash[\"title\"]}\"\nend", "def full_name(person)\n name = person[\"first_name\"] + \" \" + person[\"last_name\"]\n return ...
[ "0.8894347", "0.8852395", "0.7650884", "0.74632925", "0.73869765", "0.7348665", "0.7218073", "0.71869457", "0.71249896", "0.71098685", "0.70992893", "0.70870095", "0.70857", "0.70846415", "0.7060753", "0.7060647", "0.7041574", "0.7041574", "0.7041574", "0.7033583", "0.7029283...
0.8649987
2
=> "Fido McDog, the Loyal" OR
def get_full_name(hash) return hash["first"] + " " + hash["last"] + ", the " + hash["title"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def film_producer(film)\n film[\"producer\"].split(', ').join(\" and \")\nend", "def titleize(par)\n littleWords = [\"and\",\"over\",\"the\"]\n par.capitalize.split.map do |x|\n /(and|over|the)/.match(x) ? x : x.capitalize\n end.join(' ')\nend", "def merica(str)\n # concatenating the st...
[ "0.6581464", "0.65108407", "0.6436276", "0.63321126", "0.6319654", "0.6279257", "0.62673044", "0.6261548", "0.6204167", "0.61983573", "0.6172423", "0.616065", "0.61573", "0.61492443", "0.6129737", "0.61156493", "0.6110643", "0.6104225", "0.6103879", "0.6093533", "0.6089131", ...
0.0
-1
=> "Fido McDog, the Loyal" Write a method word_lengths that takes in a sentence string and returns a hash where every key is a word of the sentence, and its' corresponding value is the length of that word.
def word_lengths(sentence) words = sentence.split(" ") lengths = {} words.each { |word| lengths[word] = word.length} return lengths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_lengths(sentence)\n split = sentence.split(\" \")\n hash = {}\n\n split.each do |word|\n hash[word] = word.length\n end\n\n return hash\nend", "def word_lengths(sentence)\n\twords = sentence.split(\" \")\n \thash = {}\n words.each {|word| hash[word] = word.length}\n return hash\n \nend", "...
[ "0.9012643", "0.8893866", "0.8819959", "0.867132", "0.864612", "0.8639951", "0.85792524", "0.85741806", "0.85712945", "0.8529336", "0.8477631", "0.8440655", "0.8396139", "0.8360966", "0.834797", "0.8318436", "0.82469445", "0.8128142", "0.81271386", "0.8115551", "0.8109386", ...
0.89925504
1
Write a method ae_count that takes in a string and returns a hash containing the number of a's and e's in the string. Assume the string contains only lowercase characters.
def ae_count(str) count = {"a"=>0, "e"=>0} str.each_char do |char| if (char == "a" || char == "e") count[char] += 1 end end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ae_count(string)\n hash = Hash.new(0)\n string.each_char do |char|\n if char == 'a' || char == 'e'\n hash[char] += 1 \n end\n end\n\n hash\nend", "def ae_count(str)\n ae_counter = Hash.new(0)\n my_hash = {}\n str.each_char do |char|\n if char == 'a' || char == 'e'\n ae_counter[char]...
[ "0.89527756", "0.8488196", "0.830471", "0.7638384", "0.7558106", "0.7547847", "0.7494948", "0.7478743", "0.7453919", "0.74425894", "0.74262106", "0.7417283", "0.74144435", "0.7391574", "0.73772913", "0.735024", "0.73160857", "0.7313276", "0.73059994", "0.7302044", "0.7289973"...
0.85898066
1
Write a method hand_score that takes in a string representing a hand of cards and returns it's total score. You can assume the letters in the string are only A, K, Q, J. A is worth 4 points, K is 3 points, Q is 2 points, and J is 1 point. The letters of the input string not necessarily uppercase.
def hand_score(hand) points = { "A"=>4, "K"=>3, "Q"=>2, "J"=>1 } score = 0 hand.each_char { |char| score += points[char.upcase] } return score end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hand_score(string)\n cards = { A: 4, K: 3, Q: 2, J: 1 }\n score = 0\n string.each_char do |char|\n score += cards[char.upcase.to_sym]\n end\n\n score\nend", "def hand_score(hand)\n\tcards= {\"A\"=>4, \"K\"=>3, \"Q\"=>2, \"J\"=>1}\n \tscore = 0\n \thand.each_char { |char| score += cards[char.upcase]...
[ "0.8643006", "0.8507565", "0.7475612", "0.7104659", "0.70459217", "0.7033271", "0.6977787", "0.6897964", "0.6838126", "0.6824618", "0.6778794", "0.6758938", "0.67581284", "0.6714983", "0.6707432", "0.6693049", "0.66845363", "0.66833925", "0.6655386", "0.66302925", "0.66122127...
0.8358767
2
=> 9 Write a method frequent_letters that takes in a string and returns an array containing the characters that appeared more than twice in the string.
def frequent_letters(string) count = Hash.new(0) string.each_char { |char| count[char] += 1 } frequents = [] count.each do |char, num| if num > 2 frequents << char end end return frequents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frequent_letters(string)\n array = []\n count = Hash.new(0)\n string.each_char { |c| count[c] += 1 }\n count.each { |k, v| array << k if v > 2}\n array\nend", "def frequent_letters(string)\n frequent = []\n letters_count = Hash.new(0)\n\n string.each_char { | char | letters_count[char] += 1 }\n lett...
[ "0.89604175", "0.88381344", "0.88366437", "0.8801573", "0.871509", "0.8683585", "0.86704963", "0.8396308", "0.76674867", "0.7627351", "0.76215774", "0.7559475", "0.7454797", "0.73588794", "0.73082733", "0.7307335", "0.7305884", "0.7297896", "0.72915715", "0.72912955", "0.7266...
0.87864417
4
Write a method hash_to_pairs that takes in a hash and returns a 2D array representing each keyvalue pair of the hash.
def hash_to_pairs(hash) a = hash.keys b = hash.values print a.zip(b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_to_pairs(hash)\n pairs = []\n hash.each { |k,v| pairs << [k,v] }\n return pairs\nend", "def hash_to_pairs(hash)\n hash.to_a\nend", "def hash_to_array(hash)\n # Using Enumerables\n # converted = []\n # hash.each_pair do |key, value|\n # converted << [key, value]\n # end\n # return converte...
[ "0.8402421", "0.8205813", "0.78985155", "0.7792454", "0.6952773", "0.69081676", "0.6902028", "0.6834621", "0.6768321", "0.64543635", "0.6452675", "0.6442399", "0.63982433", "0.6362147", "0.6187111", "0.6072553", "0.6063559", "0.6063559", "0.5956449", "0.5945545", "0.5941582",...
0.7739903
4
To validate weixin get request and return what's you should return to weixin server
def validate(params) if _validate?(params) { text: params[:echostr], status: 200 } else { text: 'Forbidden', status: 403 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verified_request?; end", "def get(_request, params)\n # Get the parameters from the query string\n signature = params['signature'] || ''\n timestamp = params['timestamp'] || ''\n nonce = params['nonce'] || ''\n echostr = params['echostr'] || ''\n\n # Compute the signature (note that the sha...
[ "0.66592", "0.6243842", "0.61921847", "0.6183761", "0.61037964", "0.6101533", "0.5976016", "0.5966657", "0.5934678", "0.5925936", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.59221697", "0.592...
0.0
-1
To confirm whether the message is sent by weixin
def validate?(params) _validate?(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg_sent?\n true\n end", "def sent?\n status == \"sent\"\n end", "def sent?\n self.status == 'sent'\n end", "def message_sent?\n message.state == 'sent'\n end", "def message_sent?\n message.state == 'sent'\n end", "def sent?\n sender_id.present?\n end", "def ...
[ "0.7737036", "0.7268925", "0.7154451", "0.7053973", "0.7053973", "0.70300174", "0.69946706", "0.6936979", "0.684068", "0.68093616", "0.6671855", "0.66474915", "0.6603661", "0.6597211", "0.6594363", "0.6573225", "0.6553182", "0.6553182", "0.6543424", "0.6533389", "0.65314424",...
0.0
-1
To fetch user info from weixin by snsapi_base of weixin o_auth
def fetch_user_info_by_base_oauth(code) open_id = _oauth_get_open_id(code) _fetch_user_info(open_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['p...
[ "0.6589783", "0.6549732", "0.6519442", "0.6385417", "0.63394153", "0.63217556", "0.63215214", "0.62523645", "0.62466", "0.6185456", "0.6117085", "0.6107798", "0.6088575", "0.6085389", "0.6067594", "0.60569054", "0.602754", "0.6015443", "0.60102165", "0.6009201", "0.6007076", ...
0.59856576
21
To generate temporary qrcode
def generate_temporary_qrcode(scene_id) _generate_qrcode(scene_id, 'QR_SCENE') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrgen\n end", "def generateQRCode\n id = params[:id]\n\n #on recherche l'enregistrement correspondant\n query = Qrmodel.find(id)\n query_string = query.to_s\n\n #on commence le processus de rendu du qrcode\n qrcode = RQRCode::QRCode.new(query_string)\n qrmodel.qrcode.attach(\n qrco...
[ "0.81278926", "0.7654706", "0.75076836", "0.7469735", "0.7454409", "0.7369964", "0.727855", "0.7233877", "0.70574385", "0.70347357", "0.70230615", "0.70159054", "0.68911713", "0.68506205", "0.66594183", "0.6629577", "0.6546067", "0.6529417", "0.65194434", "0.6448583", "0.6364...
0.7466865
4
To generate forever qrcode
def generate_forever_qrcode(scene_id) _generate_qrcode(scene_id, 'QR_LIMIT_SCENE') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrgen\n end", "def qr_code\n @patient = Patient.find(params[:id])\n @record_url = vacc_rec_patient_url(@patient)\n @qr = RQRCode::QRCode.new(@record_url, size: 10, level: :h)\n @png = @qr.as_png(\n bit_depth: 1,\n border_modules: 4,\n color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n ...
[ "0.8209533", "0.72614646", "0.72285724", "0.7207704", "0.7193825", "0.69992715", "0.6911961", "0.68649673", "0.6863102", "0.6849946", "0.6781885", "0.6661516", "0.65566045", "0.65496284", "0.65394247", "0.6423948", "0.63559866", "0.6337642", "0.63099855", "0.62639934", "0.623...
0.6693522
11
Override to_param. This method is used when we go and get a particular purchase and we try to get that as a value, usually the to_param will return the id. We are going to ask it to return a uuid instead.
def to_param uuid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_param\n uuid\n end", "def to_param\n uuid\n end", "def to_param\n if uuid_changed? and uuid_was and !Vidibus::Uuid.validate(uuid)\n uuid_was\n else\n uuid\n end\n end", "def to_param\n self.id.to_s\n end", "def to_param\n ...
[ "0.76551", "0.760493", "0.7385889", "0.6575193", "0.64574265", "0.6387368", "0.6387368", "0.6386886", "0.63713706", "0.6318185", "0.63151395", "0.6310743", "0.6309838", "0.62992644", "0.6233186", "0.62262493", "0.6190866", "0.61673516", "0.61673516", "0.61306393", "0.6118109"...
0.75644636
3
Given n nonnegative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with xaxis forms a container, such that the container contains the most water. Note: You may not sl...
def container_with_most_water(height) max_area = 0 left = 0 right = height.length - 1 until right - left == 0 do length = height[left] < height[right] ? height[left] : height[right] width = right - left area = length * width max_area = area if max_area < area ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines\n raise 'invalid polygon' unless valid?\n 0.upto(points.size - 1).collect do |i|\n Line.new(points[i % n], points[(i + 1) % n])\n end\n end", "def contour_line_search_mod(n,lines,arrays)\n line_1 = get_next_line(arrays.first,lines[0],n)\n line_2 = get_next_line(arrays.last,line...
[ "0.5822739", "0.57284904", "0.5557941", "0.5557941", "0.5509601", "0.5499738", "0.5496192", "0.5442191", "0.5418024", "0.53967977", "0.5381596", "0.5377548", "0.53755724", "0.5372776", "0.5352439", "0.5340399", "0.5285345", "0.5282516", "0.5221274", "0.5220591", "0.5209433", ...
0.0
-1
The padrino logger logs these for us. If this is enabled we get duplicate logging.
def base_url # Using the X-Forwarded headers in the UI can leave the app vulnerable # https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/ # Either use the explicitly configured base url or an empty string, # rather than request.base_url, which uses ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logging_prefs; end", "def on_request(env)\n env['sinatra.commonlogger'] = true\n super\n end", "def autoflush_log; end", "def autoflush_log; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger...
[ "0.66161466", "0.65480524", "0.65117615", "0.65117615", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026", "0.63046026"...
0.0
-1
dstr contains the result of the haml compilation. haml compilation results in one or more junks of HTML strings. The strings are splitted by any call to ruby code we have in the file. node[1] contains all the html from the top of the file till some ruby code is used in that page The rest of the html code is written in ...
def start_dstr(node) texts_to_check = [] texts_to_check << node[1] node.grep_nodes(:sexp_type => :str) do |child| if child.sexp_type == :str texts_to_check << child[1].inspect end end texts_to_check.each do |text| if t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haml_element(str, indent_size=2)\n raise ArgumentError, \"#{str.inspect} is not String.\" unless str.kind_of?(String)\n lines = str.split(/\\n/)\n case str\n when /\\Ar>\\s*(.*?)\\Z/\n \"= #$1\"\n when /^[-%]/\n \"\\n\" + lines.map{|line| \" \"*(indent_size+2) + line.to_s}.join(\"\\n\"...
[ "0.59543157", "0.55812293", "0.54301995", "0.5394441", "0.5353031", "0.5331471", "0.52037936", "0.51974314", "0.51809174", "0.5172645", "0.51667327", "0.5117671", "0.5117289", "0.510403", "0.5078726", "0.5054967", "0.50487715", "0.50386536", "0.5037195", "0.5033631", "0.50121...
0.6336394
0
return title on a perpage basis
def title base_title = "Digital Library Management Tool" if @title.nil? base_title else "#{base_title}|#{@title}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def page_title\n end", "def page_title\n page.title\n end", "def pagetitle(page)\n \"Page #{page}\"\nend", "def page_title; end", "def page_title(title)\n content_for_wrapper(:page_title, ti...
[ "0.76816577", "0.7667089", "0.7577209", "0.7543051", "0.7443079", "0.7416506", "0.72406274", "0.7224069", "0.7222802", "0.71767503", "0.71727544", "0.71187645", "0.71027446", "0.7092385", "0.7091743", "0.7085928", "0.7071863", "0.7046725", "0.7018573", "0.7013919", "0.7009771...
0.0
-1
GET /admin/shipping_fees GET /admin/shipping_fees.json
def index @shipping_fees = ShippingFee.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 44) \n end", "def list_fees(opts = {})\n data, _status_code, _headers = list_fees_with_http_info(opts)\n data\n end", "def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options)...
[ "0.69473016", "0.66889095", "0.6650915", "0.6650915", "0.6650915", "0.65171266", "0.64818835", "0.647513", "0.6412403", "0.63381135", "0.63134223", "0.6288373", "0.6223909", "0.6222247", "0.6151918", "0.6143985", "0.60944194", "0.6064025", "0.60534304", "0.604425", "0.6035357...
0.72786057
0
GET /admin/shipping_fees/1 GET /admin/shipping_fees/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shipping_fees = ShippingFee.all\n end", "def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 44) \n end", "def shipping\n @data[:shipping]\n end", "def shipping_scope\n fee_adjustments.shipping\n end", "def shipping\n adjustments.find { |a| a.ty...
[ "0.7150204", "0.7069021", "0.6456133", "0.64300877", "0.6429175", "0.64176595", "0.63976216", "0.63976216", "0.63976216", "0.6325775", "0.63185126", "0.6291122", "0.62881887", "0.62632966", "0.62602687", "0.6236077", "0.61188954", "0.6105577", "0.60928994", "0.6072603", "0.60...
0.0
-1
POST /admin/shipping_fees POST /admin/shipping_fees.json
def create @shipping_fee = ShippingFee.new(shipping_fee_params) respond_to do |format| if @shipping_fee.save format.html { redirect_to action: :index, notice: 'Create Success.' } format.json { render action: :index, status: :created } else format.html { render action: :new }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shipping_fees = ShippingFee.all\n end", "def create\n @add_shipping = AddShipping.new(add_shipping_params)\n\n respond_to do |format|\n if @add_shipping.save\n format.html { redirect_to @add_shipping, notice: 'Add shipping was successfully created.' }\n format.json { ren...
[ "0.63637227", "0.6271825", "0.6184845", "0.6184845", "0.6184845", "0.61077", "0.6075621", "0.60552067", "0.60547423", "0.60527825", "0.6042806", "0.6022845", "0.60000294", "0.59857124", "0.5975989", "0.5947587", "0.5945016", "0.59422255", "0.5908852", "0.5884766", "0.5872482"...
0.6671586
0
PATCH/PUT /admin/shipping_fees/1 PATCH/PUT /admin/shipping_fees/1.json
def update respond_to do |format| if @shipping_fee.update_attributes(shipping_fee_params) format.html { redirect_to action: :index, notice: 'Update Success.' } format.json { render action: :index, status: :accepted } else format.html { render action: :edit } format.json {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @shipping_method.update(shipping_method_params)\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\...
[ "0.6919053", "0.6803043", "0.6715605", "0.6688881", "0.6679894", "0.6608025", "0.65239006", "0.6481014", "0.6444775", "0.64068264", "0.6392", "0.63374454", "0.62919074", "0.6284153", "0.6271065", "0.62548196", "0.62481844", "0.62481844", "0.62466645", "0.6200945", "0.61702305...
0.7202625
0
DELETE /admin/shipping_fees/1 DELETE /admin/shipping_fees/1.json
def destroy respond_to do |format| if @shipping_fee.destroy format.html { redirect_to action: :index } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @shipping_fee = ShippingFee.find(params[:id])\n @shipping_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_fees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shipping_method.destroy\n respond_to do |format|\n format.html...
[ "0.7456322", "0.73845977", "0.716927", "0.7136862", "0.7125006", "0.7063183", "0.6948425", "0.6942339", "0.6879918", "0.6879279", "0.68731445", "0.68691605", "0.6854643", "0.6836358", "0.6819573", "0.68150145", "0.6801017", "0.6786405", "0.67840624", "0.6780377", "0.67754716"...
0.73395056
2
take a word on initialization
def initialize(word) @word = word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(word) # initialize with the arguement word\n @name = word # set the name = to the word that is paaed\n end", "def word=(_arg0); end", "def initialize(word)\n @word=word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def in...
[ "0.8047148", "0.7691556", "0.76622224", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.7623014", "0.75403816", "0.7528135", "0.751921", "0.74698144", "0.73539835", "0.73338294", "0.72948164", "0.70127773...
0.7504482
16
compare letters and find matches
def match(possible_anagrams) result = [] splitted_word = @word.downcase.split("").sort possible_anagrams.each do |element| if splitted_word == element.downcase.split("").sort result << element end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_match()\n $match_index_arr = $display_word_arr.each_index.select{|i| $display_word_arr[i] == \"#{$input}\"}\n end", "def match_letters \n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@result_array[x] = @guess\n\t\ten...
[ "0.7415307", "0.733501", "0.72540754", "0.7149807", "0.70955443", "0.70924217", "0.69497216", "0.6933628", "0.69227713", "0.68513435", "0.6847689", "0.68437994", "0.6842337", "0.683221", "0.683221", "0.6826118", "0.68085337", "0.6801333", "0.6780429", "0.67795146", "0.6770074...
0.0
-1
Create all files and directories related to an environment
def create create_checkpoints create_config_base generate_deploy_files generate_hiera_template end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end...
[ "0.698521", "0.6841782", "0.67652166", "0.6761156", "0.6742809", "0.6732956", "0.671358", "0.65482455", "0.6547986", "0.6449562", "0.6440174", "0.6427191", "0.6398669", "0.6369526", "0.6354517", "0.6349885", "0.6345946", "0.63404655", "0.633362", "0.6327008", "0.631801", "0...
0.6222784
30
Delete all files and directories related to an environment
def remove remove_checkpoints remove_config remove_hiera_template end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy!\n fail \"Can not destroy a running stone\" if running?\n rm_rf system_config_filename\n rm_rf extent_directory\n rm_rf log_directory\n rm_rf tranlog_directories\n end", "def clean\n (config.keys - ['image']).each { |name|\n env = env(name, name)\n ...
[ "0.7165308", "0.7130311", "0.7129361", "0.69931936", "0.68364614", "0.67268765", "0.6720926", "0.6694011", "0.66710734", "0.666455", "0.6660535", "0.66495377", "0.66346157", "0.66242206", "0.6606729", "0.6601207", "0.6584005", "0.65513813", "0.6521652", "0.6512306", "0.651084...
0.0
-1
Create checkpoints base directories
def create_checkpoints FileUtils.cd(self.project_root) { FileUtils.mkdir_p ".checkpoints/environments/#{self.name}/phases" } FileUtils.cd("#{project_root}/.checkpoints/environments/#{self.name}/phases") { FileUtils.mkdir_p %w{phase-0 phase-1 phase-2} } (0..3).each{ |i| FileUtils.cd(self.project_root) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_base_dirs\n BASE_DIR.each do |dir|\n FileUtils.mkdir \"#{@project_name}/#{dir}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n end\n FileUtils.mkdir \"#{@project_name}/app/apis/#{@project_name}\"\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\tapp/apis/#{@project...
[ "0.65042055", "0.6468339", "0.63841903", "0.63431317", "0.632317", "0.6292783", "0.62788594", "0.6218354", "0.6218354", "0.61863345", "0.616715", "0.6160644", "0.61419106", "0.61274534", "0.6124568", "0.6022926", "0.6022354", "0.6021437", "0.60114145", "0.60114145", "0.600168...
0.69520175
0
Remove checkpoints base directories
def remove_checkpoints FileUtils.cd(self.project_root) { FileUtils.rm_rf ".checkpoints/environments/#{self.name}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_checkpoints\n `cd #{self.project_root} && rm -rf .checkpoints/environments/#{self.environment}/{nodes,prepared_nodes,steps/step-{0..3}}/#{self.hostname}.yml`\n end", "def clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do ...
[ "0.7047334", "0.66709274", "0.6543765", "0.6445904", "0.6401164", "0.6344087", "0.6336104", "0.6322997", "0.6301236", "0.6232584", "0.62313366", "0.62246364", "0.6224436", "0.62076956", "0.620708", "0.6178597", "0.6162959", "0.61589295", "0.61570007", "0.61489207", "0.6146716...
0.70276606
1
Create config base for environment
def create_config_base # Create keys directory for environment FileUtils.cd(self.project_root) { FileUtils.mkdir_p "config/environments/#{self.name}" } FileUtils.cd("#{project_root}/config/environments/#{self.name}") { FileUtils.mkdir_p %w{steps keys} } # Create ssh key for puppet user if enviro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def base_config_path\n BASE_CONFIG_PATH\n end", "def generate_base_directory_environments(tmpdir)\n puppet_conf = \"#{tmpdir}/puppet2.conf\"\n dir_envs = \"#{tmpdir}/environments\"\n\n ...
[ "0.7266271", "0.7266271", "0.7266271", "0.7266271", "0.6970728", "0.6846313", "0.66026783", "0.6497283", "0.6476225", "0.6449314", "0.642767", "0.63688844", "0.6343828", "0.6338572", "0.6335934", "0.6331107", "0.6276607", "0.62728363", "0.6264072", "0.62171143", "0.6216634", ...
0.824837
0
Remove config for environment
def remove_config FileUtils.cd(self.project_root) { FileUtils.rm_rf "config/environments/#{self.name}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end", "def remove_config(name)\n\t\tend", "def remove_config(name)\n variables[name] = nil\n end", "def clean\n (config.keys - ['image']).each { |...
[ "0.7838808", "0.7552504", "0.73455256", "0.71205246", "0.710118", "0.6989668", "0.68069935", "0.67642355", "0.67639667", "0.6700335", "0.66311204", "0.6625602", "0.65968007", "0.6583672", "0.6577304", "0.6532425", "0.6532425", "0.65207875", "0.65089965", "0.64791703", "0.6475...
0.84456044
0
Generate the deploy files for the environment
def generate_deploy_files template_name = (self.name == 'vagrant') ? 'vagrant' : "environment" # Generate capistrano specific steps recipes Bebox::PROVISION_STEPS.each do |step| generate_file_from_template("#{Bebox::FilesHelper.templates_path}/project/config/deploy/steps/#{step}.erb", "#{self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_deploy\n @@tpl = CapistranoDeployGenerator.source_root\n empty_directory \"config/deploy\"\n\n say <<-EOF\n\nconfig/deploy.rb generator\n\nThis menu will help you creating deployment configuration file\ndeploy.rb for Capistrano. It is safe to acceppt defulat values for\nmost or all questions. J...
[ "0.72844625", "0.6807853", "0.65494597", "0.654537", "0.6450788", "0.6416187", "0.64055216", "0.6371031", "0.6338301", "0.62870085", "0.62693894", "0.62531495", "0.61832815", "0.61803925", "0.6155815", "0.61409384", "0.6139896", "0.6134975", "0.611434", "0.61058223", "0.60698...
0.8304686
0
Generate the hiera data template for the environment
def generate_hiera_template ssh_key = Bebox::Project.public_ssh_key_from_file(self.project_root, self.name) project_name = Bebox::Project.shortname_from_file(self.project_root) Bebox::PROVISION_STEPS.each do |step| step_dir = Bebox::Provision.step_name(step) generate_file_from_template...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hiera_template\n options = {ssh_key: Bebox::Project.public_ssh_key_from_file(project_root, environment), project_name: Bebox::Project.shortname_from_file(project_root)}\n Bebox::Provision.generate_hiera_for_steps(self.project_root, \"node.yaml.erb\", self.hostname, options)\n end", "def g...
[ "0.74349606", "0.6342216", "0.6199129", "0.60793614", "0.6001953", "0.59904796", "0.5975523", "0.5952716", "0.5854395", "0.58099276", "0.5793824", "0.56284994", "0.5573742", "0.55586725", "0.55544204", "0.55544204", "0.55520004", "0.554996", "0.5547382", "0.5525744", "0.54802...
0.7894061
0
Remove the hiera data template file for the environment
def remove_hiera_template Bebox::PROVISION_STEP_NAMES.each {|step| FileUtils.cd(self.project_root) { FileUtils.rm_rf "puppet/steps/#{step}/hiera/data/#{self.name}.yaml" } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_hiera_template\n Bebox::Provision.remove_hiera_for_steps(self.project_root, self.hostname)\n end", "def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end", "def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job =...
[ "0.74871624", "0.70043504", "0.6641661", "0.66243106", "0.6496719", "0.6459069", "0.64212245", "0.6407542", "0.63984215", "0.63756937", "0.6266138", "0.621598", "0.61540544", "0.61423403", "0.6135789", "0.6049932", "0.5980431", "0.5954191", "0.59525675", "0.59525675", "0.5918...
0.7994565
0
Generate ssh keys for connection with puppet user in environment
def generate_puppet_user_keys(environment) require 'sshkey' FileUtils.cd("#{self.project_root}/config/environments/#{environment}/keys") { FileUtils.rm Dir.glob('*') } sshkey = SSHKey.generate(:type => "RSA", :bits => 1024) FileUtils.cd("#{self.project_root}/config/environments/#{environment}/ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_fil...
[ "0.72682434", "0.7026531", "0.69164354", "0.68640476", "0.6810232", "0.6794752", "0.67246747", "0.66866815", "0.6669182", "0.66140586", "0.657315", "0.6565918", "0.64737886", "0.6473615", "0.64319146", "0.6403709", "0.6402421", "0.6402072", "0.6394115", "0.6383409", "0.637738...
0.82080495
0
These aren't nonterminals, but I think we should pretend they are so that we can encapsulate thier values
def id(iter) until iter.peek.token == :ID puts "UNHAPPY: ignored #{iter.peek.token}: \"#{iter.peek.value}\", expecting id" iter.next end result = ParseNode.new result.type = :id result.value = iter.next.value result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 62 )\n\n\n return_value = ValorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __DecimalLiteral330...
[ "0.62315583", "0.6157092", "0.6114912", "0.6080841", "0.6080841", "0.6080841", "0.6079151", "0.6031216", "0.60157996", "0.5938269", "0.5916659", "0.5878586", "0.5865288", "0.58607304", "0.5843078", "0.5816188", "0.57935107", "0.5778563", "0.5739309", "0.57117903", "0.57074106...
0.0
-1
skip_before_action :authenticate_user!, only: :search, show
def index @cars = Car.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n skip_authorization\n end", "def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorize...
[ "0.71124005", "0.6845715", "0.68042946", "0.6660307", "0.6648094", "0.66000396", "0.64835", "0.6482548", "0.6458795", "0.6449014", "0.64439493", "0.64282846", "0.63971394", "0.63659996", "0.63068426", "0.62714946", "0.6255232", "0.6242204", "0.62390393", "0.6226984", "0.62128...
0.0
-1
GET /area_codes GET /area_codes.json
def index @area_codes = AreaCode.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @zip_code_area_codes = ZipCodeAreaCode.all\n end", "def index\n @area_code_details = AreaCodeDetail.all\n end", "def index\n @areas = Area.with_ordered_countries\n respond_with(@areas)\n end", "def areas\n self.areacodes.map{|areacode| Area.find areacode}\n end", "def sea...
[ "0.7173284", "0.66669405", "0.6552383", "0.6534788", "0.6353687", "0.6348341", "0.6348341", "0.62761563", "0.62683177", "0.6241306", "0.6224006", "0.6213743", "0.6136249", "0.6128154", "0.6121812", "0.6114743", "0.6099243", "0.60939467", "0.60916257", "0.6045627", "0.60454875...
0.75871235
0
GET /area_codes/1 GET /area_codes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @area_codes = AreaCode.all\n end", "def index\n @zip_code_area_codes = ZipCodeAreaCode.all\n end", "def index\n @area_code_details = AreaCodeDetail.all\n end", "def show\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.7480287", "0.6958489", "0.6791434", "0.64955425", "0.6460255", "0.64363384", "0.64071935", "0.6382708", "0.637891", "0.6341612", "0.6341612", "0.6338081", "0.63319045", "0.6225543", "0.62243044", "0.6211076", "0.61750907", "0.6137558", "0.6135881", "0.6130167", "0.612802",...
0.0
-1
POST /area_codes POST /area_codes.json
def create @area_code = AreaCode.new(area_code_params) respond_to do |format| if @area_code.save format.html { redirect_to @area_code, notice: 'Area code was successfully created.' } format.json { render :show, status: :created, location: @area_code } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_code_params\n params.require(:area_code).permit(:code)\n end", "def create\n @area_code_detail = AreaCodeDetail.new(area_code_detail_params)\n\n respond_to do |format|\n if @area_code_detail.save\n format.html { redirect_to @area_code_detail, notice: 'Area code detail was succe...
[ "0.71057576", "0.6915743", "0.67011493", "0.6469413", "0.6406941", "0.6254584", "0.6191912", "0.60629576", "0.6062339", "0.60578954", "0.605513", "0.60349786", "0.60247916", "0.60247916", "0.60092866", "0.60012794", "0.5934887", "0.5858389", "0.58307403", "0.5780541", "0.5768...
0.7370552
0
PATCH/PUT /area_codes/1 PATCH/PUT /area_codes/1.json
def update respond_to do |format| if @area_code.update(area_code_params) format.html { redirect_to @area_code, notice: 'Area code was successfully updated.' } format.json { render :show, status: :ok, location: @area_code } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @area_code_detail.update(area_code_detail_params)\n format.html { redirect_to @area_code_detail, notice: 'Area code detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_code_detail }\n else\n format...
[ "0.72439176", "0.6753395", "0.6600692", "0.6540392", "0.6540392", "0.6540392", "0.6393512", "0.6389876", "0.6385067", "0.63689077", "0.63186294", "0.62086076", "0.6208277", "0.62019837", "0.6196517", "0.61927366", "0.61731565", "0.6135689", "0.6135689", "0.6135689", "0.613568...
0.74891496
0
DELETE /area_codes/1 DELETE /area_codes/1.json
def destroy @area_code.destroy respond_to do |format| format.html { redirect_to area_codes_url, notice: 'Area code was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @area_code_detail.destroy\n respond_to do |format|\n format.html { redirect_to area_code_details_url, notice: 'Area code detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @country_area = CountryArea.find(params[:id])\n @c...
[ "0.7515848", "0.7221423", "0.7183086", "0.7183086", "0.7183086", "0.7160536", "0.71062416", "0.7088732", "0.7013401", "0.6997108", "0.6962949", "0.69578487", "0.6934555", "0.690483", "0.690483", "0.68778396", "0.6868414", "0.686211", "0.686211", "0.68101496", "0.6808247", "...
0.7750918
0
Use callbacks to share common setup or constraints between actions.
def set_area_code @area_code = AreaCode.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1