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
The path used after confirmation.
def after_confirmation_path_for(resource_name, resource) dm_cms.showpage_path(:locale => DmCore::Language.locale, :slug => 'confirmation_success') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_confirmation_path_for(resource_name, resource)\n root_path\n end", "def after_confirmation_path_for(resource_name, resource)\n '/'\n end", "def after_confirmation_path_for(resource_name, resource) \n send(\"edit_#{resource.class.name.underscore}_path\",resource)\n end", "def after_confi...
[ "0.66349876", "0.66043603", "0.6573877", "0.6555062", "0.65253043", "0.6417593", "0.64080113", "0.6401703", "0.63872176", "0.6336483", "0.6322352", "0.6284309", "0.6257149", "0.6255734", "0.6243767", "0.6235097", "0.6198236", "0.6198236", "0.6198236", "0.618294", "0.618294", ...
0.6119095
31
Escapes a series of chars in the current string. NOTE: A new string is returned.
def escape(*chars) gsub(/(?<!\\)(#{chars.join("|")})/) do |char| "\\" + char end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(string); end", "def escape(str); end", "def escape_string(s)\n retval = StringBuffer.new\n i = 0\n while i < s.length\n retval.append(escape_char(s.char_at(i)))\n i += 1\n end\n return retval.to_s\n end", "def escape(string)\n #This is a stub, u...
[ "0.74392956", "0.7372446", "0.72223914", "0.7173459", "0.71363205", "0.7098222", "0.6987517", "0.69501776", "0.69364226", "0.69232005", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953", "0.6904953...
0.7388102
1
Converts a word with underscores into a sentance with a capitalized first word.
def humanize self.downcase.gsub(/_/, " ").capitalize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camelise(a_word)\n return a_word.split('_').collect(&:capitalize).join\nend", "def to_camel\n words = self.split('_')\n capitalized_words = words.map { |word| word.capitalize }\n capitalized_words.join('')\n end", "def titleize(word)\n humanize(underscore(word)).gsub(/\\b('?[a-z])/){ $1.capit...
[ "0.8122154", "0.7895261", "0.7741239", "0.77220935", "0.76803076", "0.76803076", "0.7656923", "0.7656634", "0.762562", "0.7615135", "0.76064044", "0.76062673", "0.75964427", "0.75635237", "0.75621146", "0.7556614", "0.75367075", "0.75271326", "0.7519074", "0.7494625", "0.7487...
0.7811559
2
Similar to humanize but it capitalizes each word
def titleize self.gsub(/\s/, "_").split('_').map(&:capitalize).join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize() end", "def capitalize_each_word(phrase)\r\n\r\nend", "def capitalize_words\n self.split.collect{ |s| s.capitalize_first }.join(\" \")\n end", "def capitalize!() end", "def titleize(s)\n my_words = s.split(\" \")\n cap_sentence = \"\"\n my_words.each {|w| cap_sentence << w.capitalize...
[ "0.8318817", "0.8154664", "0.8133834", "0.8120654", "0.810877", "0.810235", "0.80224526", "0.8011737", "0.7975393", "0.79361326", "0.79171133", "0.79166317", "0.78918284", "0.7891778", "0.7889045", "0.7888138", "0.7871195", "0.7863558", "0.78576714", "0.78417736", "0.7815024"...
0.0
-1
Indicates if this string represents a number.
def numeric? !!(self =~ /\A[0-9]+\.*[0-9]*\z/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def number?(string)\n string.to_i.to_s == string\n end", "def is_number...
[ "0.8133674", "0.80558306", "0.79175615", "0.7909579", "0.7902084", "0.78247565", "0.78247565", "0.77551085", "0.7647744", "0.752018", "0.75168175", "0.74832386", "0.7483152", "0.74595684", "0.74595684", "0.74496305", "0.7416324", "0.7415913", "0.7400229", "0.73990804", "0.736...
0.75458944
9
Indicates if this string represents a boolean value.
def boolean? !!(self =~ /\A(true|false)\z/i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_is_boolean?(string)\n return %w[true false yes no y n].include?(string.downcase)\n end", "def to_boolean\r\n\t !!(self.to_s =~ /^(true|t|yes|y|1)$/i)\r\n\tend", "def boolean\n Util.from_bytes :boolean, value\n end", "def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/...
[ "0.79268646", "0.77996147", "0.7750523", "0.7706909", "0.76266825", "0.76144135", "0.7583767", "0.7545969", "0.75249934", "0.7499541", "0.7481812", "0.7461448", "0.74387264", "0.7381649", "0.73577315", "0.73508734", "0.73485196", "0.73446363", "0.73148286", "0.7311612", "0.72...
0.7518059
9
Casts this string to another datatype. Supported datatypes: Integer Float Boolean
def cast return to_f if numeric? && index(".") return to_i if numeric? if boolean? return true if self =~ /\Atrue\z/i return false if self =~ /\Afalse\z/i end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_data_type_from_string(type, value)\n case type\n when \"boolean\"\n # Since we've determined this is a boolean data type, we can assume that:\n # If the value as an int is 1, return true\n # If the value as an int is 0 (not 1), return false\n value.t...
[ "0.73251724", "0.7257708", "0.7208175", "0.71202284", "0.69673324", "0.68310356", "0.67765373", "0.67622775", "0.66054034", "0.6598709", "0.65918285", "0.6528267", "0.65102655", "0.6472909", "0.6457137", "0.632346", "0.6304073", "0.621983", "0.621393", "0.62120116", "0.617372...
0.6373313
15
alex_stat = Stat.create(game_id: game1.id, question_id: question1_3.id, answer_id: answer3_1_3.id, correct: 0)
def deck_options(deck_option) case deck_option when 1 result = [] counter = 0 answer1 = Question.find(1).answers[0] answer2 = Question.find(1).answers[1] answer3 = Question.find(1).answers[2] puts Deck.find(1).questions[0].question puts "a) #{answer1.name}" puts "b) #{answer2.name}" puts "c) #{answer3.name}" answer1_user = gets.chomp if answer1_user == "a" answer1_user = answer1 elsif answer1_user == "b" answer1_user = answer2 elsif answer1_user == "c" answer1_user = answer3 end a = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[0].id, answer_id: answer1_user.id, correct: answer1_user.correct) result << a.correct # # answer4 = Question.find(2).answers[0] answer5 = Question.find(2).answers[1] answer6 = Question.find(2).answers[2] puts Deck.find(1).questions[1].question puts "a) #{answer4.name}" puts "b) #{answer5.name}" puts "c) #{answer6.name}" answer2_user = gets.chomp if answer2_user == "a" answer2_user = answer4 elsif answer2_user == "b" answer2_user = answer5 elsif answer2_user == "c" answer2_user = answer6 end b = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[1].id, answer_id: answer2_user.id, correct: answer2_user.correct) result << b.correct # # answer7 = Question.find(3).answers[0] answer8 = Question.find(3).answers[1] answer9 = Question.find(3).answers[2] puts Deck.find(1).questions[2].question puts "a) #{answer7.name}" puts "b) #{answer8.name}" puts "c) #{answer9.name}" answer3_user = gets.chomp if answer3_user == "a" answer3_user = answer7 elsif answer3_user == "b" answer3_user = answer8 elsif answer3_user == "c" answer3_user = answer9 end c = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[2].id, answer_id: answer3_user.id, correct: answer3_user.correct) result << c.correct # # answer10 = Question.find(4).answers[0] answer11 = Question.find(4).answers[1] answer12 = Question.find(4).answers[2] puts Deck.find(1).questions[3].question puts "a) #{answer10.name}" puts "b) #{answer11.name}" puts "c) #{answer12.name}" answer4_user = gets.chomp if answer4_user == "a" answer4_user = answer10 elsif answer4_user == "b" answer4_user = answer11 elsif answer4_user == "c" answer4_user = answer12 end d = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[3].id, answer_id: answer4_user.id, correct: answer4_user.correct) result << d.correct # # answer13 = Question.find(5).answers[0] answer14 = Question.find(5).answers[1] answer15 = Question.find(5).answers[2] puts Deck.find(1).questions[4].question puts "a) #{answer13.name}" puts "b) #{answer14.name}" puts "c) #{answer15.name}" answer5_user = gets.chomp if answer5_user == "a" answer5_user = answer13 elsif answer5_user == "b" answer5_user = answer14 elsif answer5_user == "c" answer5_user = answer15 end e = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[4].id, answer_id: answer5_user.id, correct: answer5_user.correct) result << e.correct # # answer16 = Question.find(6).answers[0] answer17 = Question.find(6).answers[1] answer18 = Question.find(6).answers[2] puts Deck.find(1).questions[5].question puts "a) #{answer16.name}" puts "b) #{answer17.name}" puts "c) #{answer18.name}" answer6_user = gets.chomp if answer6_user == "a" answer6_user = answer16 elsif answer6_user == "b" answer6_user = answer17 elsif answer6_user == "c" answer6_user = answer18 end f = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[5].id, answer_id: answer6_user.id, correct: answer6_user.correct) result << f.correct # # answer19 = Question.find(7).answers[0] answer20 = Question.find(7).answers[1] answer21 = Question.find(7).answers[2] puts Deck.find(1).questions[6].question puts "a) #{answer19.name}" puts "b) #{answer20.name}" puts "c) #{answer21.name}" answer7_user = gets.chomp if answer7_user == "a" answer7_user = answer19 elsif answer7_user == "b" answer7_user = answer20 elsif answer7_user == "c" answer7_user = answer21 end g = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[6].id, answer_id: answer7_user.id, correct: answer7_user.correct) result << g.correct # # answer22 = Question.find(8).answers[0] answer23 = Question.find(8).answers[1] answer24 = Question.find(8).answers[2] puts Deck.find(1).questions[7].question puts "a) #{answer22.name}" puts "b) #{answer23.name}" puts "c) #{answer24.name}" answer8_user = gets.chomp if answer8_user == "a" answer8_user = answer22 elsif answer8_user == "b" answer8_user = answer23 elsif answer8_user == "c" answer8_user = answer24 end h = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[7].id, answer_id: answer8_user.id, correct: answer8_user.correct) result << h.correct # # answer25 = Question.find(9).answers[0] answer26 = Question.find(9).answers[1] answer27 = Question.find(9).answers[2] puts Deck.find(1).questions[8].question puts "a) #{answer25.name}" puts "b) #{answer26.name}" puts "c) #{answer27.name}" answer9_user = gets.chomp if answer9_user == "a" answer9_user = answer25 elsif answer9_user == "b" answer9_user = answer26 elsif answer9_user == "c" answer9_user = answer27 end i = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[8].id, answer_id: answer9_user.id, correct: answer9_user.correct) result << i.correct # # answer28 = Question.find(10).answers[0] answer29 = Question.find(10).answers[1] answer30 = Question.find(10).answers[2] puts Deck.find(1).questions[9].question puts "a) #{answer28.name}" puts "b) #{answer29.name}" puts "c) #{answer30.name}" answer10_user = gets.chomp if answer10_user == "a" answer10_user = answer28 elsif answer10_user == "b" answer10_user = answer29 elsif answer10_user == "c" answer10_user = answer30 end j = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[9].id, answer_id: answer10_user.id, correct: answer10_user.correct) result << j.correct pp Stat.where(game_id: @new_game.id) result.each do |answers_do| if answers_do == 1 counter += 1 end end puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" puts "Yor result was: #{counter} correct answers and #{10-counter} incorrect answers" puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" options(@view.menu) when 2 result_2 = [] counter_2 = 0 answer1_1 = Question.find(11).answers[0] answer2_1 = Question.find(11).answers[1] answer3_1 = Question.find(11).answers[2] puts Deck.find(2).questions[0].question puts "a) #{answer1_1.name}" puts "b) #{answer2_1.name}" puts "c) #{answer3_1.name}" answer1_1user = gets.chomp if answer1_1user == "a" answer1_1user = answer1_1 elsif answer1_1user == "b" answer1_1user = answer2_1 elsif answer1_1user == "c" answer1_1user = answer3_1 end k = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[0].id, answer_id: answer1_1user.id, correct: answer1_1user.correct) result_2 << k.correct # # answer4_1 = Question.find(12).answers[0] answer5_1 = Question.find(12).answers[1] answer6_1 = Question.find(12).answers[2] puts Deck.find(2).questions[1].question puts "a) #{answer4_1.name}" puts "b) #{answer5_1.name}" puts "c) #{answer6_1.name}" answer2_1user = gets.chomp if answer2_1user == "a" answer2_1user = answer4_1 elsif answer2_1user == "b" answer2_1user = answer5_1 elsif answer2_1user == "c" answer2_1user = answer6_1 end m = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[1].id, answer_id: answer2_1user.id, correct: answer2_1user.correct) result_2 << m.correct # # answer7_1 = Question.find(13).answers[0] answer8_1 = Question.find(13).answers[1] answer9_1 = Question.find(13).answers[2] puts Deck.find(2).questions[2].question puts "a) #{answer7_1.name}" puts "b) #{answer8_1.name}" puts "c) #{answer9_1.name}" answer3_1user = gets.chomp if answer3_1user == "a" answer3_1user = answer7_1 elsif answer3_1user == "b" answer3_1user = answer8_1 elsif answer3_1user == "c" answer3_1user = answer9_1 end n = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[2].id, answer_id: answer3_1user.id, correct: answer3_1user.correct) result_2 << n.correct # # answer10_1 = Question.find(14).answers[0] answer11_1 = Question.find(14).answers[1] answer12_1 = Question.find(14).answers[2] puts Deck.find(2).questions[3].question puts "a) #{answer10_1.name}" puts "b) #{answer11_1.name}" puts "c) #{answer12_1.name}" answer4_1user = gets.chomp if answer4_1user == "a" answer4_1user = answer10_1 elsif answer4_1user == "b" answer4_1user = answer11_1 elsif answer4_1user == "c" answer4_1user = answer12_1 end l = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[3].id, answer_id: answer4_1user.id, correct: answer4_1user.correct) result_2 << l.correct # # answer13_1 = Question.find(15).answers[0] answer14_1 = Question.find(15).answers[1] answer15_1 = Question.find(15).answers[2] puts Deck.find(2).questions[4].question puts "a) #{answer13_1.name}" puts "b) #{answer14_1.name}" puts "c) #{answer15_1.name}" answer5_1user = gets.chomp if answer5_1user == "a" answer5_1user = answer13_1 elsif answer5_1user == "b" answer5_1user = answer14_1 elsif answer5_1user == "c" answer5_1user = answer15_1 end o = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[4].id, answer_id: answer5_1user.id, correct: answer5_1user.correct) result_2 << o.correct # # answer16_1 = Question.find(16).answers[0] answer17_1 = Question.find(16).answers[1] answer18_1 = Question.find(16).answers[2] puts Deck.find(2).questions[5].question puts "a) #{answer16_1.name}" puts "b) #{answer17_1.name}" puts "c) #{answer18_1.name}" answer6_1user = gets.chomp if answer6_1user == "a" answer6_1user = answer16_1 elsif answer6_1user == "b" answer6_1user = answer17_1 elsif answer6_1user == "c" answer6_1user = answer18_1 end p = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[5].id, answer_id: answer6_1user.id, correct: answer6_1user.correct) result_2 << p.correct # # answer19_1 = Question.find(17).answers[0] answer20_1 = Question.find(17).answers[1] answer21_1 = Question.find(17).answers[2] puts Deck.find(2).questions[6].question puts "a) #{answer19_1.name}" puts "b) #{answer20_1.name}" puts "c) #{answer21_1.name}" answer7_1user = gets.chomp if answer7_1user == "a" answer7_1user = answer19_1 elsif answer7_1user == "b" answer7_1user = answer20_1 elsif answer7_1user == "c" answer7_1user = answer21_1 end q = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[6].id, answer_id: answer7_1user.id, correct: answer7_1user.correct) result_2 << q.correct # # answer22_1 = Question.find(18).answers[0] answer23_1 = Question.find(18).answers[1] answer24_1 = Question.find(18).answers[2] puts Deck.find(2).questions[7].question puts "a) #{answer22_1.name}" puts "b) #{answer23_1.name}" puts "c) #{answer24_1.name}" answer8_1user = gets.chomp if answer8_1user == "a" answer8_1user = answer22_1 elsif answer8_1user == "b" answer8_1user = answer23_1 elsif answer8_1user == "c" answer8_1user = answer24_1 end r = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[7].id, answer_id: answer8_1user.id, correct: answer8_1user.correct) result_2 << r.correct # # answer25_1 = Question.find(19).answers[0] answer26_1 = Question.find(19).answers[1] answer27_1 = Question.find(19).answers[2] puts Deck.find(2).questions[8].question puts "a) #{answer25_1.name}" puts "b) #{answer26_1.name}" puts "c) #{answer27_1.name}" answer9_1user = gets.chomp if answer9_1user == "a" answer9_1user = answer25_1 elsif answer9_1user == "b" answer9_1user = answer26_1 elsif answer9_1user == "c" answer9_1user = answer27_1 end s = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[8].id, answer_id: answer9_1user.id, correct: answer9_1user.correct) result_2 << s.correct # # answer28_1 = Question.find(20).answers[0] answer29_1 = Question.find(20).answers[1] answer30_1 = Question.find(20).answers[2] puts Deck.find(2).questions[9].question puts "a) #{answer28_1.name}" puts "b) #{answer29_1.name}" puts "c) #{answer30_1.name}" answer10_1user = gets.chomp if answer10_1user == "a" answer10_1user = answer28_1 elsif answer10_1user == "b" answer10_1user = answer29_1 elsif answer10_1user == "c" answer10_1user = answer30_1 end y = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[9].id, answer_id: answer10_1user.id, correct: answer10_1user.correct) result_2 << y.correct result_2 result_2.each do |answers_do| if answers_do == 1 counter_2 += 1 end end pp Stat.where(game_id: @new_game.id) puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" puts "Yor result was: #{counter_2} correct answers and #{10-counter_2} incorrect answers" puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" options(@view.menu) when 3 counter_3 = 0 result_3 = [] answer1_2 = Question.find(21).answers[0] answer2_2 = Question.find(21).answers[1] answer3_2 = Question.find(21).answers[2] puts Deck.find(3).questions[0].question puts "a) #{answer1_2.name}" puts "b) #{answer2_2.name}" puts "c) #{answer3_2.name}" answer1_2user = gets.chomp if answer1_2user == "a" answer1_2user = answer1_2 elsif answer1_2user == "b" answer1_2user = answer2_2 elsif answer1_2user == "c" answer1_2user = answer3_2 end a_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[0].id, answer_id: answer1_2user.id, correct: answer1_2user.correct) result_3 << a_1.correct # # answer4_2 = Question.find(22).answers[0] answer5_2 = Question.find(22).answers[1] answer6_2 = Question.find(22).answers[2] puts Deck.find(3).questions[1].question puts "a) #{answer4_2.name}" puts "b) #{answer5_2.name}" puts "c) #{answer6_2.name}" answer2_2user = gets.chomp if answer2_2user == "a" answer2_2user = answer4_2 elsif answer2_2user == "b" answer2_2user = answer5_2 elsif answer2_2user == "c" answer2_2user = answer6_2 end b_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[1].id, answer_id: answer2_2user.id, correct: answer2_2user.correct) result_3 << b_1.correct # # answer7_2 = Question.find(23).answers[0] answer8_2 = Question.find(23).answers[1] answer9_2 = Question.find(23).answers[2] puts Deck.find(3).questions[2].question puts "a) #{answer7_2.name}" puts "b) #{answer8_2.name}" puts "c) #{answer9_2.name}" answer3_2user = gets.chomp if answer3_2user == "a" answer3_2user = answer7_2 elsif answer3_2user == "b" answer3_2user = answer8_2 elsif answer3_2user == "c" answer3_2user = answer9_2 end c_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[2].id, answer_id: answer3_2user.id, correct: answer3_2user.correct) result_3 << c_1.correct # # answer10_2 = Question.find(24).answers[0] answer11_2 = Question.find(24).answers[1] answer12_2 = Question.find(24).answers[2] puts Deck.find(3).questions[3].question puts "a) #{answer10_2.name}" puts "b) #{answer11_2.name}" puts "c) #{answer12_2.name}" answer4_2user = gets.chomp if answer4_2user == "a" answer4_2user = answer10_2 elsif answer4_2user == "b" answer4_2user = answer11_2 elsif answer4_2user == "c" answer4_2user = answer12_2 end d_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[3].id, answer_id: answer4_2user.id, correct: answer4_2user.correct) result_3 << d_1.correct # # answer13_2 = Question.find(25).answers[0] answer14_2 = Question.find(25).answers[1] answer15_2 = Question.find(25).answers[2] puts Deck.find(3).questions[4].question puts "a) #{answer13_2.name}" puts "b) #{answer14_2.name}" puts "c) #{answer15_2.name}" answer5_2user = gets.chomp if answer5_2user == "a" answer5_2user = answer13_2 elsif answer5_2user == "b" answer5_2user = answer14_2 elsif answer5_2user == "c" answer5_2user = answer15_2 end f_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[4].id, answer_id: answer5_2user.id, correct: answer5_2user.correct) result_3 << f_1.correct # # answer16_2 = Question.find(26).answers[0] answer17_2 = Question.find(26).answers[1] answer18_2 = Question.find(26).answers[2] puts Deck.find(3).questions[5].question puts "a) #{answer16_2.name}" puts "b) #{answer17_2.name}" puts "c) #{answer18_2.name}" answer6_2user = gets.chomp if answer6_2user == "a" answer6_2user = answer16_2 elsif answer6_2user == "b" answer6_2user = answer17_2 elsif answer6_2user == "c" answer6_2user = answer18_2 end g_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[5].id, answer_id: answer6_2user.id, correct: answer6_2user.correct) result_3 << g_1.correct # # answer19_2 = Question.find(27).answers[0] answer20_2 = Question.find(27).answers[1] answer21_2 = Question.find(27).answers[2] puts Deck.find(3).questions[6].question puts "a) #{answer19_2.name}" puts "b) #{answer20_2.name}" puts "c) #{answer21_2.name}" answer7_2user = gets.chomp if answer7_2user == "a" answer7_2user = answer19_2 elsif answer7_2user == "b" answer7_2user = answer20_2 elsif answer7_2user == "c" answer7_2user = answer21_2 end h_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[6].id, answer_id: answer7_2user.id, correct: answer7_2user.correct) result_3 << h_1.correct # # answer22_2 = Question.find(28).answers[0] answer23_2 = Question.find(28).answers[1] answer24_2 = Question.find(28).answers[2] puts Deck.find(3).questions[7].question puts "a) #{answer22_2.name}" puts "b) #{answer23_2.name}" puts "c) #{answer24_2.name}" answer8_2user = gets.chomp if answer8_2user == "a" answer8_2user = answer22_2 elsif answer8_2user == "b" answer8_2user = answer23_2 elsif answer8_2user == "c" answer8_2user = answer24_2 end i_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[7].id, answer_id: answer8_2user.id, correct: answer8_2user.correct) result_3 << i_1.correct # # answer25_2 = Question.find(29).answers[0] answer26_2 = Question.find(29).answers[1] answer27_2 = Question.find(29).answers[2] puts Deck.find(3).questions[8].question puts "a) #{answer25_2.name}" puts "b) #{answer26_2.name}" puts "c) #{answer27_2.name}" answer9_2user = gets.chomp if answer9_2user == "a" answer9_2user = answer25_2 elsif answer9_2user == "b" answer9_2user = answer26_2 elsif answer9_2user == "c" answer9_2user = answer27_2 end j_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[8].id, answer_id: answer9_2user.id, correct: answer9_2user.correct) result_3 << j_1.correct # # answer28_2 = Question.find(30).answers[0] answer29_2 = Question.find(30).answers[1] answer30_2 = Question.find(30).answers[2] puts Deck.find(3).questions[9].question puts "a) #{answer28_2.name}" puts "b) #{answer29_2.name}" puts "c) #{answer30_2.name}" answer10_2user = gets.chomp if answer10_2user == "a" answer10_2user = answer28_2 elsif answer10_2user == "b" answer10_2user = answer29_2 elsif answer10_2user == "c" answer10_2user = answer30_2 end k_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[9].id, answer_id: answer10_2user.id, correct: answer10_2user.correct) result_3 << k_1.correct pp Stat.where(game_id: @new_game.id) result_3 result_3.each do |answers_do| if answers_do == 1 counter_3 += 1 end end puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" puts "Yor result was: #{counter_3} correct answers and #{10-counter_3} incorrect answers" puts "----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------" options(@view.menu) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_game round,id1,id2,result,pgn\n\tgame = Game.new\n\tround_date = Round.find(round).round_date\n\t\n\tgame.round_id = round\n\tgame.player1_id = id1\n\tgame.player2_id = id2\n game.result = result\n\tgame.round_date = round_date\n\tgame.pgn_file = pgn\n\t\n\tround_date ||= Date.today\n\t\nif Game....
[ "0.6810299", "0.6455195", "0.6436729", "0.6269342", "0.62460965", "0.62112325", "0.616146", "0.61435574", "0.6127811", "0.61210716", "0.61207753", "0.6092634", "0.60806286", "0.60625374", "0.6047503", "0.6042674", "0.6014108", "0.59663385", "0.59658533", "0.59509784", "0.5936...
0.0
-1
GET /cinemas GET /cinemas.xml
def index if Auth.is_admin_logged(session[:worker]) @cinemas = Cinema.paginate(:page => params[:page], :per_page => 5) else @cinemas = Cinema.paginate(:page => params[:page], :per_page => 5, :conditions => ['id = ?', session[:worker].cinema_id]) end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @cinemas } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @cinema = Cinema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cinema }\n end\n end", "def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { r...
[ "0.73092324", "0.6703334", "0.65904117", "0.6565245", "0.652987", "0.6471016", "0.6455045", "0.64202476", "0.64104056", "0.6394964", "0.6325308", "0.6306354", "0.63057536", "0.6292229", "0.62866503", "0.6274145", "0.626587", "0.6253584", "0.62514156", "0.6232575", "0.62236464...
0.6060191
45
GET /cinemas/1 GET /cinemas/1.xml
def show Auth.is_admin_logged(session[:worker]) == true ? @cinema = Cinema.find(params[:id]) : @cinema = Cinema.find(session[:worker].cinema_id) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cinema } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @cinema = Cinema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cinema }\n end\n end", "def show\n @crianca = Crianca.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format...
[ "0.7317321", "0.674541", "0.66820943", "0.6597996", "0.6596927", "0.6593301", "0.65690136", "0.6550835", "0.6539983", "0.6523994", "0.65102404", "0.6500255", "0.64885294", "0.6443266", "0.64405775", "0.6440241", "0.6438517", "0.6430498", "0.6391953", "0.63696617", "0.63696617...
0.61623615
60
GET /cinemas/new GET /cinemas/new.xml
def new @cities = City.find(:all) @cinema = Cinema.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cinema } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cinema = Cinema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cinema }\n end\n end", "def new\n @crianca = Crianca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crianca }\n ...
[ "0.7708261", "0.7409467", "0.740385", "0.72540706", "0.72463745", "0.7216857", "0.72010416", "0.7188681", "0.71826124", "0.71817267", "0.71817267", "0.71653295", "0.71653295", "0.7132017", "0.712814", "0.7123144", "0.71179837", "0.7105226", "0.7101852", "0.7097479", "0.709354...
0.7507221
1
POST /cinemas POST /cinemas.xml
def create @cinema = Cinema.new(params[:cinema]) @cities = City.all respond_to do |format| if @cinema.save # adding new cinema at the end of app/data/cinemas.xml create_cinemas_xml() unless FileTest.exists?("app/data/cinemas.xml") add_cinema_to_xml() format.html { redirect_to(@cinema, :notice => 'Utworzono kino o następujących danych:') } format.xml { render :xml => @cinema, :status => :created, :location => @cinema } else format.html { render :action => "new" } format.xml { render :xml => @cinema.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cinema = Cinema.new(params[:cinema])\n\n respond_to do |format|\n if @cinema.save\n format.html { redirect_to(@cinema, :notice => 'Cinema was successfully created.') }\n format.xml { render :xml => @cinema, :status => :created, :location => @cinema }\n else\n for...
[ "0.65827113", "0.6170485", "0.61432636", "0.60474515", "0.5988601", "0.59809744", "0.5829974", "0.57911944", "0.57317054", "0.5692122", "0.5686685", "0.56602967", "0.56222093", "0.5588719", "0.5580683", "0.5569354", "0.55499244", "0.5530064", "0.5528941", "0.55112576", "0.550...
0.7168806
0
PUT /cinemas/1 PUT /cinemas/1.xml
def update @cinema = Cinema.find(params[:id]) @cities = City.find(:all) respond_to do |format| if @cinema.update_attributes(params[:cinema]) update_cinemas_xml() format.html { redirect_to(@cinema, :notice => 'Kino zostało pomyślnie zaktualizowane.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cinema.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @cinema = Cinema.find(params[:id])\n\n respond_to do |format|\n if @cinema.update_attributes(params[:cinema])\n format.html { redirect_to(@cinema, :notice => 'Cinema was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \...
[ "0.6491838", "0.629699", "0.622177", "0.608655", "0.5960576", "0.5886934", "0.57623446", "0.57623446", "0.5730885", "0.56897837", "0.56604934", "0.56362474", "0.5628383", "0.55941975", "0.5574383", "0.55602825", "0.5557982", "0.5553805", "0.5551672", "0.5534522", "0.5516411",...
0.6854174
0
DELETE /cinemas/1 DELETE /cinemas/1.xml
def destroy @cinema = Cinema.find(params[:id]) @cinema.destroy respond_to do |format| format.html { redirect_to(cinemas_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cinema = Cinema.find(params[:id])\n @cinema.destroy\n\n respond_to do |format|\n format.html { redirect_to(cinemas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n ...
[ "0.72829205", "0.6815071", "0.66453296", "0.66452986", "0.6630297", "0.66259944", "0.65903366", "0.6589713", "0.65872926", "0.65805435", "0.6576331", "0.6551834", "0.65445995", "0.6544427", "0.65319395", "0.6526974", "0.6512174", "0.6496952", "0.6496452", "0.6486925", "0.6478...
0.7113023
1
GET /bills GET /bills.json
def index @query_date = DateTime.current unless params[:query_date].nil? || params[:query_date] == '' @query_date = DateTime.strptime(params[:query_date], '%m/%d/%Y') end startdate = @query_date.beginning_of_month enddate = @query_date.end_of_month @bills = Bill.where("created_at >= :start_date AND created_at <= :end_date", {start_date: startdate, end_date: enddate}) @bills.each do |bill| cid = bill.customer_id begin c = Customer.find(cid).customer_id bill.customer_id = c rescue ActiveRecord::RecordNotFound bill.customer_id = '' end end @bills.each do |bill| vid = bill.vendor_id begin v = Vendor.find(vid).vendor_id bill.vendor_id = v rescue ActiveRecord::RecordNotFound bill.vendor_id = '' end end return @bills end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bills(options = {})\n get('/bills', options)\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def show\n @bills = Bill.find(params[:id])\n end", "def index\n @bil...
[ "0.8692078", "0.77364695", "0.7332992", "0.73158085", "0.7181724", "0.7146255", "0.7081283", "0.7070294", "0.7058532", "0.6986106", "0.6985961", "0.6985961", "0.6985961", "0.6985961", "0.6985961", "0.6985961", "0.6985961", "0.6936153", "0.6929862", "0.6928304", "0.67958415", ...
0.0
-1
GET /bills/1 GET /bills/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bills(options = {})\n get('/bills', options)\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def show\n @bills = Bill.find(params[:id])\n end", "def index\n @bil...
[ "0.8076198", "0.7603362", "0.737852", "0.73270726", "0.70013297", "0.6975696", "0.6915615", "0.686869", "0.686869", "0.686869", "0.686869", "0.686869", "0.686869", "0.686869", "0.6858016", "0.68127185", "0.6776848", "0.673052", "0.66707236", "0.66707236", "0.666124", "0.665...
0.0
-1
POST /bills POST /bills.json
def create date_format_transform(:bill_date) date_format_transform(:paid_date) @bill = Bill.new(bill_params) respond_to do |format| if @bill.save format.html { redirect_to bills_url, notice: 'Bill was successfully created.' } format.json { render :show, status: :created, location: @bill } else format.html { render :new } format.json { render json: @bill.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bills(options = {})\n get('/bills', options)\n end", "def create_bill(params)\n build_header_auth('/bills', API_VERSION_1, 'POST')\n build_request()\n p_hash = {}\n p_hash[\"bill\"] = {\"identifier\" => params['id'],\n \"amount_cents\" => params['amount_cents'],\n \"...
[ "0.72973865", "0.68661875", "0.6617874", "0.65570045", "0.6420465", "0.64193606", "0.64034045", "0.6384447", "0.6361635", "0.63452613", "0.6319223", "0.63057256", "0.6169659", "0.616133", "0.6143651", "0.60879487", "0.6085655", "0.604085", "0.604085", "0.604085", "0.60158694"...
0.0
-1
PATCH/PUT /bills/1 PATCH/PUT /bills/1.json
def update date_format_transform(:bill_date) date_format_transform(:paid_date) respond_to do |format| if @bill.update(bill_params) format.html { redirect_to bills_url, notice: 'Bill was successfully updated.' } format.json { render :show, status: :ok, location: @bill } else format.html { render :edit } format.json { render json: @bill.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bill = current_user_or_guest.bills.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(bill_params)\n format.html { redirect_to(@bill, notice: t('bill.updated')) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.h...
[ "0.6769954", "0.6757892", "0.6695659", "0.6695659", "0.66545784", "0.6643154", "0.6563542", "0.6540618", "0.65239173", "0.6507168", "0.6507168", "0.64929086", "0.6472251", "0.6454841", "0.6434032", "0.6434032", "0.6434032", "0.6434032", "0.6434032", "0.6434032", "0.6434032", ...
0.0
-1
DELETE /bills/1 DELETE /bills/1.json
def destroy @bill.destroy respond_to do |format| format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respo...
[ "0.7335965", "0.7247269", "0.7247269", "0.7247269", "0.7232676", "0.7159659", "0.7159659", "0.7151687", "0.71199983", "0.7067449", "0.69734913", "0.69077295", "0.6855672", "0.68515855", "0.6848189", "0.6833698", "0.6817472", "0.6814117", "0.6803732", "0.6793541", "0.6772637",...
0.67758113
29
Use callbacks to share common setup or constraints between actions.
def set_bill @bill = Bill.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
Never trust parameters from the scary internet, only allow the white list through.
def bill_params params.require(:bill).permit(:bill_no, :customer_id, :billable, :bill_date, :paid_date, :freight, :memo, :vendor_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
Transform datepicker format 'mm/dd/yyyy' to rails format 'dd/mm/yyyy'
def date_format_transform (sym) unless params[:bill][sym].nil? || params[:bill][sym] == '' date = DateTime.strptime(params[:bill][sym], '%m/%d/%Y') params[:bill][sym] = date.strftime("%d/%m/%Y") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_date_to_s(val)\n Date.parse(val.to_s).strftime('%m/%d/%Y')\n end", "def date_format t\n t.strftime \"%Y/%m/%d\"\n end", "def format_date date\n date.strftime('%m/%d/%y')\n end", "def formatted_date(dt, format=\"%m/%d/%Y\")\n\t\tDate.strptime(dt, '%Y-%m-%d').strftime(format)\n\tend", ...
[ "0.7117311", "0.7113117", "0.70520693", "0.6969718", "0.6937136", "0.6908145", "0.6908145", "0.6885201", "0.68217224", "0.6811083", "0.6776117", "0.6695676", "0.66799736", "0.66488516", "0.66457915", "0.6612883", "0.6589123", "0.6585363", "0.6559422", "0.6549083", "0.6537335"...
0.6173582
44
codes are like 5H (5 of Hearts), TC (10 of Clubs), etc
def initialize(code) @value = Face_values[code[0]] @suit = code[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def codes; end", "def layover_codes\n %w[ATL ORD DFW DEN]\n end", "def codegroup(code)\n if code < 97 \n 65\n else \n 97\n end\n end", "def decode_code(text)\n #strip the x in the biginning!\n text = text[1..-1]\n id, ench = text.split ':'\n return [TSM...
[ "0.67782414", "0.65727514", "0.6445479", "0.64095134", "0.63717324", "0.635229", "0.6325893", "0.62961185", "0.61701673", "0.61198074", "0.60986036", "0.6098555", "0.60944164", "0.60606706", "0.60541004", "0.604584", "0.6039497", "0.60279983", "0.60244256", "0.59972674", "0.5...
0.0
-1
e.g. "3D 6D 7H QD QS"
def initialize(codes) @cards = codes.split(" ").map { |s| Card.new(s) }.sort {|a,b| a <=> b}.reverse distinct_suits = Set.new.merge @cards.map{|card| card.suit} is_straight = @cards[0].value-1 == @cards[1].value && @cards[0].value-2 == @cards[2].value && @cards[0].value-3 == @cards[3].value && @cards[0].value-4 == @cards[4].value if @is_straight && @cards[0].value == 14 && distinct_suits.size == 1 @hand = 'ROYAL_FLUSH' return end if is_straight && distinct_suits.size == 1 @hand = 'STRAIGHT_FLUSH' set_ranking_cards([0]) return end # Four of a kind if equal_values([0,1,2,3]) @hand = 'FOUR_OF_KIND' set_ranking_cards([0]) return end if equal_values([1,2,3,4]) @hand = 'FOUR_OF_KIND' set_ranking_cards([1]) return end # Full house if equal_values([0,1,2],[3,4]) @hand = 'FULL_HOUSE' @ranking_cards = [@cards[0]] return end if equal_values([0,1],[2,3,4]) @hand = 'FULL_HOUSE' set_ranking_cards([2]) return end # Flush if distinct_suits.size == 1 @hand = 'FLUSH' set_ranking_cards([0,1,2,3,4]) return end # Straight if is_straight @hand = 'STRAIGHT' set_ranking_cards([0]) return end # 3 of a kind if equal_values([0,1,2]) @hand = 'THREE_OF_KIND' set_ranking_cards([0,3,4]) return end if equal_values([1,2,3]) @hand = 'THREE_OF_KIND' set_ranking_cards([1,0,4]) return end if equal_values([2,3,4]) @hand = 'THREE_OF_KIND' set_ranking_cards([2,0,1]) return end # 2 pair if equal_values([0,1],[2,3]) @hand = 'TWO_PAIR' set_ranking_cards([0,2,4]) return end if equal_values([0,1],[3,4]) @hand = 'TWO_PAIR' set_ranking_cards([0,3,2]) return end if equal_values([1,2],[3,4]) @hand = 'TWO_PAIR' set_ranking_cards([1,3,0]) return end # pair if equal_values([0,1]) @hand = 'PAIR' set_ranking_cards([0,2,3,4]) return end if equal_values([1,2]) @hand = 'PAIR' set_ranking_cards([1,0,3,4]) return end if equal_values([2,3]) @hand = 'PAIR' set_ranking_cards([2,0,1,4]) return end if equal_values([3,4]) @hand = 'PAIR' set_ranking_cards([3,0,1,2]) return end @hand = 'HIGH_CARD' set_ranking_cards([0,1,2,3,4]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_q(s)\n return s.scan(/\\d+/).join('-')\nend", "def letters_and_digits\n self.to_s.scan(/\\w/).join\n end", "def st(value)\n value = value.to_s\n while (value =~ /\\d{4,}\\b/)\n value = value.sub(/(\\d{3})\\b/, \" \\\\1\")\n end\n value.lstrip\nend", "def spinWords(string)\n string.s...
[ "0.633108", "0.6273285", "0.6082166", "0.5992617", "0.597668", "0.59705806", "0.591524", "0.58593595", "0.5842316", "0.5801362", "0.57287323", "0.5722357", "0.57193553", "0.5710042", "0.5709676", "0.57043976", "0.56971085", "0.56967866", "0.56824094", "0.567305", "0.5664723",...
0.0
-1
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.76501393", "0.76501393", "0.76501393", "0.76501393", "0.7638085", "0.7638085", "0.7638085", "0.7638085", "0.7638085", "0.7638085", "0.7638085", "0.7638085", "0.73567617", "0.7335319", "0.72686815", "0.72389865", "0.7231783", "0.7226007", "0.72084755", "0.7176415" ]
0.0
-1
Check to see if the all the properties in the model are valid
def valid? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :...
[ "0.78989387", "0.78989387", "0.7097542", "0.7077744", "0.7031459", "0.703038", "0.69501424", "0.6869871", "0.68576187", "0.68576187", "0.68280154", "0.68235457", "0.682004", "0.6814453", "0.67930245", "0.67521733", "0.66832304", "0.6675793", "0.66681546", "0.6629595", "0.6617...
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && id == o.id && timestamp == o.timestamp && local_timestamp == o.local_timestamp && local_timezone == o.local_timezone && caller_id == o.caller_id && service_url == o.service_url && channel_id == o.channel_id && from == o.from && conversation == o.conversation && recipient == o.recipient && text_format == o.text_format && attachment_layout == o.attachment_layout && members_added == o.members_added && members_removed == o.members_removed && reactions_added == o.reactions_added && reactions_removed == o.reactions_removed && topic_name == o.topic_name && history_disclosed == o.history_disclosed && locale == o.locale && text == o.text && speak == o.speak && input_hint == o.input_hint && summary == o.summary && suggested_actions == o.suggested_actions && attachments == o.attachments && entities == o.entities && channel_data == o.channel_data && action == o.action && reply_to_id == o.reply_to_id && label == o.label && value_type == o.value_type && value == o.value && name == o.name && relates_to == o.relates_to && code == o.code && expiration == o.expiration && importance == o.importance && delivery_mode == o.delivery_mode && listen_for == o.listen_for && text_highlights == o.text_highlights && semantic_action == o.semantic_action end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en...
[ "0.7291717", "0.7188103", "0.70395297", "0.7007927", "0.68874705", "0.6861532", "0.6707156", "0.6660597", "0.66147524", "0.658478", "0.6584619", "0.6580019", "0.65543133", "0.6543933", "0.65068495", "0.6479513", "0.6456241", "0.6415999", "0.6412208", "0.6412208", "0.6412208",...
0.0
-1
Calculates hash code according to all attributes.
def hash [type, id, timestamp, local_timestamp, local_timezone, caller_id, service_url, channel_id, from, conversation, recipient, text_format, attachment_layout, members_added, members_removed, reactions_added, reactions_removed, topic_name, history_disclosed, locale, text, speak, input_hint, summary, suggested_actions, attachments, entities, channel_data, action, reply_to_id, label, value_type, value, name, relates_to, code, expiration, importance, delivery_mode, listen_for, text_highlights, semantic_action].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ...
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.638...
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ...
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.666...
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model BotFramework.const_get(type).build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s...
[ "0.7330926", "0.7274019", "0.72504056", "0.7245751", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", ...
0.0
-1
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "de...
[ "0.901024", "0.89506465", "0.84703195", "0.83409667", "0.8337169", "0.8337169", "0.8332247", "0.82546586", "0.8145818", "0.8144667", "0.81357557", "0.812714", "0.8093436", "0.8086725", "0.8073356", "0.8039774", "0.80308646", "0.80064154", "0.80064154", "0.80064154", "0.800641...
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n ...
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916",...
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @va...
[ "0.6721064", "0.6721064", "0.66705114", "0.66585946", "0.65890485", "0.6454646", "0.6417013", "0.6417013", "0.6384306", "0.6348656", "0.630476", "0.6225539", "0.6153802", "0.6104665", "0.6081452", "0.6081452", "0.6072844", "0.6038052", "0.60226446", "0.5938669", "0.5903004", ...
0.0
-1
sync a directory to guarantee it's on disk. have to recurse to the root to guarantee sync for newly created directories.
def fdirsync(d) while d != '/' Dir.open(d) do |dh| io = IO.for_fd(dh.fileno) io.fsync end d = File.dirname(d) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fdirsync(d)\n while d != \"/\"\n Dir.open(d) do |dh|\n io = IO.for_fd(dh.fileno)\n io.fsync\n end\n d = File.dirname(d)\n end\nend", "def sync_dir(dir=Dir.getwd)\n @r.cmd \"setwd('#{dir}')\"\n end", "def sync(srcDir, dstDir)\n end", "def sync_dir dir\n # TODO: think of a bett...
[ "0.7371037", "0.7248147", "0.6587227", "0.6587052", "0.64471954", "0.6276868", "0.62623477", "0.61649245", "0.61433256", "0.6039297", "0.59813744", "0.5943492", "0.586092", "0.5753617", "0.57438904", "0.57431716", "0.5733266", "0.5658715", "0.56452715", "0.56314504", "0.56188...
0.7336265
1
exec_transaction locks the state file, parses it and provides it to the database. the database should then update the state and return it, and exec_transaction writes it safely back to disk.
def exec_transaction(state_file, database) backup_file = state_file + '.bak' double_buf = DoubleBuffer.new(State, backup_file) File.open(state_file, File::RDWR) do |fh| # rather than blocking and waiting for the file to become available, we # should just return with an error, which probably isn't really a big # problem unless there's a _lot_ of them and it causes replication to # lag behind. fh.flock(File::LOCK_EX | File::LOCK_NB) || (return :state_file_in_use) # read state from file, or from backup file if it's available. state = double_buf.from_file(fh) return state unless state.is_a?(State) # get the changes from the database and write the OSC file, returning # the new state (or an error) new_state = database.write_diff(state) return new_state unless new_state.is_a?(State) # write the backup and new state double_buf.to_file(new_state, fh) # catchup, let the database know that we've successfully written the changes # and it should advance the replication slot position. database.catchup(new_state) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction\n File.open(lock_file_path, File::RDWR | File::CREAT, 0644) do |file|\n # Get lock\n file.sync = true\n file.flock(File::LOCK_EX)\n\n # Execute block\n yield\n\n # Push all changes\n apply\n\n # Release lock\n f...
[ "0.656168", "0.652048", "0.64618266", "0.62239194", "0.6180253", "0.61781603", "0.6053346", "0.60023165", "0.5947664", "0.59377897", "0.59377307", "0.58939826", "0.58839494", "0.58234656", "0.58234656", "0.57778275", "0.5754524", "0.5720982", "0.5720982", "0.5713245", "0.5713...
0.7351949
0
GET /tour_packages GET /tour_packages.json
def index @tour_packages = TourPackage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end", "def get_all_packages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_all_packages ...\"\n end\n # resource path\n loc...
[ "0.65118456", "0.6110879", "0.60470665", "0.60469675", "0.5872627", "0.5867744", "0.57979643", "0.57979643", "0.57979643", "0.57979643", "0.5793894", "0.5756991", "0.57412094", "0.57287073", "0.5713093", "0.5705326", "0.5674175", "0.56712914", "0.56575483", "0.56436336", "0.5...
0.71417904
0
GET /tour_packages/1 GET /tour_packages/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tour_packages = TourPackage.all\n end", "def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end", "def index\n @imei_packages = ImeiPackage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imei_packag...
[ "0.69279456", "0.6454634", "0.6210304", "0.61273515", "0.6048989", "0.6030214", "0.60133964", "0.5937665", "0.59322816", "0.59253657", "0.5884767", "0.5884767", "0.5884767", "0.5884767", "0.5837072", "0.581494", "0.581225", "0.5806869", "0.58003134", "0.57698697", "0.57691425...
0.0
-1
POST /tour_packages POST /tour_packages.json
def create @tour_package = TourPackage.new(tour_package_params) @tour_package.agency_id = current_user.agency.id respond_to do |format| if @tour_package.save manage_uploads(@tour_package.id) format.html { redirect_to "/tour_packages/#{@tour_package.id}", notice: 'Tour package was successfully created.' } format.json { render :show, status: :created, location: @tour_package } else format.html { render :new } format.json { render json: @tour_package.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @package = Package.create(package_params)\n\n render json: @package\n end", "def create\n api_service = Api.find_by(status: true).name\n result_hash = RouteCalculator.call(package_params.merge(service: api_service))\n @package = current_user.packages.new(result_hash.merge(package_par...
[ "0.6309953", "0.62544596", "0.6131927", "0.5994192", "0.5916894", "0.5893216", "0.58448863", "0.5838656", "0.5836286", "0.58055514", "0.57430404", "0.5721203", "0.5721203", "0.5700642", "0.56953424", "0.5670331", "0.5659047", "0.56313723", "0.5617595", "0.5611871", "0.5562063...
0.67097497
0
PATCH/PUT /tour_packages/1 PATCH/PUT /tour_packages/1.json
def update handle_chkbox respond_to do |format| if @tour_package.update(tour_package_params) if params['upload'].blank? format.html { redirect_to @tour_package, notice: 'Tour package was successfully updated.' } else format.html { redirect_to "/tour_packages", notice: 'Tour package was successfully updated.' } end format.json { render :show, status: :ok, location: @tour_package } else format.html { render :edit } format.json { render json: @tour_package.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n update_special_attributes\n...
[ "0.6399258", "0.63483346", "0.6336191", "0.62630963", "0.62272257", "0.62172115", "0.61972725", "0.6162844", "0.6088557", "0.6088557", "0.6070682", "0.606179", "0.6061391", "0.6036888", "0.60156494", "0.601432", "0.6009991", "0.60081613", "0.59887904", "0.5986178", "0.5958347...
0.6255842
4
DELETE /tour_packages/1 DELETE /tour_packages/1.json
def destroy @tour_package.destroy respond_to do |format| format.html { redirect_to tour_packages_url, notice: 'Tour package was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tour_package = @tour.tour_package\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to @tour_package, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n p...
[ "0.7277278", "0.68964565", "0.6881014", "0.6868278", "0.6862352", "0.6805305", "0.67839885", "0.6726546", "0.6726218", "0.6682082", "0.6661773", "0.66591346", "0.6653798", "0.6649115", "0.6647882", "0.6647844", "0.6647844", "0.6592172", "0.6592172", "0.6592172", "0.6592172", ...
0.74106383
0
Use callbacks to share common setup or constraints between actions.
def set_tour_package @tour_package = TourPackage.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
Never trust parameters from the scary internet, only allow the white list through.
def tour_package_params params.require(:tour_package).permit(:title, :days, :nights, :details, :uuid, :father_name_field, :birthdate_field, :place_of_birth_field,:passport_no_field, :en_name_field,:en_surename_field, :en_father_name_field, :attachment_field, :attachment_message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
detect if drawing area include point
def point_in_canvas(x, y) [*1..canvas.size - 2].include?(y) && [*1..canvas.first.size - 2].include?(x) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end", "def contains_point(point, include_border=false)\n point.x.between?(@x, self.right) && point.y.between?(y, self.bottom) unless include_border\n (point.x >= @x) && (point.x <= sel...
[ "0.7484856", "0.7360143", "0.7316158", "0.72291106", "0.7207719", "0.71716326", "0.7054883", "0.7052371", "0.7007506", "0.6948353", "0.6942294", "0.6901686", "0.6886281", "0.68750894", "0.6865567", "0.68600047", "0.6833738", "0.6809434", "0.6807573", "0.6769941", "0.6745252",...
0.699897
9
Returns an array of tag listings that includes the number of requests and offers each tag has in this challenge, sorted by leastoffered and mostrequested
def summary @summary ||= tags.map { |tag| tag_summary(tag) }.compact.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_by_tag_count_with_random_buckets\n end", "def requested_tags\n @requested_tags ||= []\n end", "def requests_per_hour\n group_by_hour.map { |hour, ents|\n [hour, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end", "def used_offers\n if @used_offer...
[ "0.5861117", "0.5774854", "0.5714956", "0.5641798", "0.5633485", "0.5629665", "0.5574301", "0.55488724", "0.55204445", "0.55204445", "0.5438824", "0.543738", "0.53837013", "0.5344122", "0.5311002", "0.52446944", "0.52085036", "0.52056867", "0.51898444", "0.5182879", "0.517299...
0.0
-1
The class of tags to be summarized For a multifandom challenge, this is probably Fandom, but for a singlefandom challenge, it may be something else
def tag_class challenge.topmost_tag_type.classify.constantize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_for_tag(tag)\n case Post.tag(tag)\n when 0.0...0.02\n 'tiny'\n when 0.02...0.04\n 'small'\n when 0.04...0.06\n 'medium'\n when 0.06...0.08\n 'large'\n when 0.08..1.0\n 'enormous'\n end\n end", "def tag_classes(tag)\n classes = ...
[ "0.64298", "0.6352971", "0.6336338", "0.6168968", "0.6052367", "0.5941552", "0.59069645", "0.587179", "0.58711493", "0.5853023", "0.58436006", "0.58140606", "0.58140606", "0.5812629", "0.58110106", "0.573563", "0.5723682", "0.57167244", "0.5678993", "0.56748474", "0.5671758",...
0.71844214
0
All of the tags of the desired type that have been used in requests or offers for this challenge
def tags @tags ||= tag_class.in_challenge(collection).group(:id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags\n @result.keys\n end", "def requested_tags\n @requested_tags ||= []\n end", "def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end", "def collect_tags\n tags = []\n\n # Chef Tags\n node['boundary_meter']['tags'].each do |tag|\n t...
[ "0.68388635", "0.6821442", "0.6803582", "0.6761828", "0.6729862", "0.6728692", "0.6728692", "0.6617366", "0.66141737", "0.66141737", "0.66141737", "0.66141737", "0.66141737", "0.6566171", "0.6566171", "0.6542078", "0.6527533", "0.6506466", "0.6492372", "0.64717317", "0.647159...
0.67441016
4
Initializes a new parser instance with given log format.
def initialize(format) @regexp = nil @names = [] @format = parse_format(format) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(log, time_format=\"%Y-%m-%d %H:%M:%S\")\n @log = log\n @time_format = time_format\n end", "def initialize(format)\n @regexp = nil\n @names = []\n @format = parse_format(format)\n end", "def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:\n\t\t\t@logger = logge...
[ "0.71699023", "0.7053299", "0.6828822", "0.6480899", "0.6416201", "0.63282615", "0.6325626", "0.6199078", "0.60822886", "0.6065607", "0.6042697", "0.6029971", "0.60087377", "0.5997041", "0.5990249", "0.5961339", "0.5959749", "0.59364295", "0.5889686", "0.5880896", "0.58691764...
0.7077009
1
Parses line according to current log format and returns an hash of log field => value on success. Returns nil if line doesn't match current log format.
def parse(line) row = line.to_s row.chomp! row.strip! return unless match = regexp.match(row) data = {} names.each_with_index { |field, index| data[field] = match[index + 1] } # [0] == line data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_logline(line) \n line.strip!\n split_line = line.split(/\\|/)\n addr = split_line[0].split(',').last.strip\n\n unless (addr =~ /[\\s|\\-]+/) \n @dns_map.synchronize do\n addr = @dns_map[addr] if @dns_map.include? addr\n end\n details = {}\n ...
[ "0.72720605", "0.6927214", "0.68737346", "0.6688976", "0.66865367", "0.66843075", "0.65443885", "0.6503072", "0.6447622", "0.6326857", "0.6253793", "0.6178813", "0.60570663", "0.60559624", "0.6011754", "0.5992637", "0.59796834", "0.59603804", "0.5950317", "0.59401536", "0.588...
0.61552864
12
Parses line according to current log format and returns an hash of log field => typed value on success. Returns nil if line doesn't match current log format.
def handle(line) parsed = parse(line) return unless parsed handle_parsed(parsed) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_line(line)\n return true if line.empty?\n\n chunks = line.split(SPLIT_PATTERN, fmt.length)\n enough_fields?(line) # can raise exception\n\n point = { path: extract_path(chunks),\n value: extract_value(chunks) }\n\n tags = line_tags(chunks)\n\n point.tap do |...
[ "0.6874157", "0.68010366", "0.6753877", "0.6704183", "0.6590128", "0.64883995", "0.64330554", "0.63994634", "0.6394865", "0.6370389", "0.63107365", "0.62860036", "0.6213519", "0.61722577", "0.60879415", "0.59699166", "0.5947355", "0.59325546", "0.5921136", "0.5901241", "0.584...
0.5376451
43
Overwrite this method if you want to use some humanreadable name for log fields. This method is called only once at parse_format time.
def rename_this_name(name) name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\...
[ "0.6287645", "0.6287362", "0.6281433", "0.6246751", "0.62115353", "0.6186144", "0.6135012", "0.61186075", "0.6112589", "0.6071269", "0.60194975", "0.59957", "0.5994767", "0.5986379", "0.59822637", "0.5957048", "0.5956037", "0.5956037", "0.5945023", "0.5939478", "0.5930599", ...
0.0
-1
Parse log format into a suitable Regexp instance.
def parse_format(format) format = format.to_s format.chomp! # remove carriage return format.strip! # remove leading and trailing space format.gsub!(/[ \t]+/, ' ') # replace tabulations or spaces with a space pattern = format.split(' ').map do |element| has_quotes = element =~ /^\\"/ element = element.gsub(/^\\"/, '').gsub(/\\"$/, '') if has_quotes self.names << rename_this_name(element) case when has_quotes if element == '%r' || element =~ /^%{Referer}/ || element =~ /^%{User-agent}/ /"([^"\\]*(?:\\.[^"\\]*)*)"/ else '\"([^\"]*)\"' end when element =~ /^%.*t$/ '(\[[^\]]+\])' when element == '%U' '(.+?)' else '(\S*)' end end.join(' ') @regexp = Regexp.new("^#{pattern}$") format end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_entry(log_entry)\n @column = {}; i = 1;\n if attributes = log_entry.match(regexp)\n @args.each {|f| @column[f] = attributes[i]; i += 1}\n parse_datetime! if @column[:time]\n parse_request! if @column[:request]\n end\n @column\n end", "def setup_regex\n @to_from_match = ...
[ "0.6417531", "0.601951", "0.58831006", "0.58634424", "0.5825628", "0.57838964", "0.57746226", "0.5709523", "0.5662661", "0.5610963", "0.5557845", "0.5517172", "0.5507211", "0.54933214", "0.54933214", "0.5462221", "0.5462221", "0.54614305", "0.5408453", "0.5344566", "0.5327748...
0.6316992
1
For debug output formatting
def format; :n3; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug1(text) debug text, 1 end", "def build_debug_msg\n message = []\n stds = { @stdout => \"Standard output: \", @stderr => \"Standard error: \" }\n stds.each do |std, name|\n message << tabify(name) << tabify(std) unless std.blank?\n end\n message.join(\"\\n\")\n...
[ "0.73147464", "0.7143252", "0.70897347", "0.70315206", "0.6987856", "0.69099706", "0.6882698", "0.687829", "0.687829", "0.687829", "0.687829", "0.6875327", "0.6857567", "0.6828876", "0.6750129", "0.67268616", "0.6704771", "0.6692747", "0.6685571", "0.6685571", "0.6685571", ...
0.0
-1
Alias data and query
def input @input ||= RDF::Util::File.open_file(action) {|f| f.read} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases!\n @schema.aliases!\n end", "def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end", "def aliases\n\n end", "def aliases\n end", "def aliases; end", "def ali...
[ "0.62500376", "0.6177104", "0.61533713", "0.6110781", "0.60484743", "0.60484743", "0.60484743", "0.6019526", "0.5870023", "0.5795758", "0.5795758", "0.5772502", "0.5760656", "0.5746278", "0.5701832", "0.5687505", "0.56649333", "0.56525385", "0.560545", "0.5598718", "0.5550663...
0.0
-1
Some interfaces are actually defined in different specs (for example, clipPath), so we ignore them for now.
def external_interface?(id) id !~ /^#.+/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def included_interfaces; end", "def extended_interfaces; end", "def interface; end", "def interface; end", "def interface_methods; end", "def interface_decls; end", "def interface; self.class.interface; end", "def implemented_in; end", "def interface_cache; end", "def test_interface_apis\n int...
[ "0.7305698", "0.71471375", "0.7085339", "0.7085339", "0.68166435", "0.6671306", "0.6280029", "0.62782264", "0.6003887", "0.5907174", "0.5905671", "0.58346564", "0.5816816", "0.5794289", "0.5789628", "0.5776484", "0.5771742", "0.5746168", "0.5710246", "0.56930625", "0.56511784...
0.570115
19
GET /sport_odds GET /sport_odds.json
def index @sport_odds = SportOdd.search_and_paginate(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sport(sport_id, **options) = get(\"/sports/#{sport_id}\", **options)", "def stod2sport\n Apis.client.get('/tv/stod2sport')\n end", "def index\n if params[:sport_id] == \"all\"\n @events = Event.all\n render json: @events.to_json(include: :sport)\n else\n @events = Event.where(s...
[ "0.72967887", "0.6768125", "0.63695", "0.6311401", "0.62494177", "0.6226461", "0.6220646", "0.6186209", "0.61461556", "0.60913634", "0.6023078", "0.6001335", "0.59936875", "0.5957102", "0.5946743", "0.5942136", "0.5931259", "0.5923626", "0.5914506", "0.59123874", "0.5907985",...
0.70875955
1
GET /sport_odds/1 GET /sport_odds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sport(sport_id, **options) = get(\"/sports/#{sport_id}\", **options)", "def index\n @sport_odds = SportOdd.search_and_paginate(params)\n end", "def stod2sport\n Apis.client.get('/tv/stod2sport')\n end", "def stod2sport2\n Apis.client.get('/tv/stod2sport2')\n end", "def index\n if...
[ "0.7320623", "0.68525064", "0.6675856", "0.6275572", "0.6255146", "0.62026876", "0.6201465", "0.6162889", "0.61318266", "0.6092054", "0.60761416", "0.606907", "0.60095525", "0.6003199", "0.5979821", "0.59788865", "0.59759057", "0.5964701", "0.59592617", "0.5953065", "0.592486...
0.0
-1
POST /sport_odds POST /sport_odds.json
def create @sport_odd = SportOdd.new(sport_odd_params) respond_to do |format| if @sport_odd.save format.html { redirect_to @sport_odd, notice: 'Sport odd was successfully created.' } format.json { render :show, status: :created, location: @sport_odd } else format.html { render :new } format.json { render json: @sport_odd.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sport = Sport.new(sport_params)\n\n respond_to do |format|\n if @sport.save\n format.html { redirect_to @sport, notice: 'Sport was successfully created.' }\n format.json { render :show, status: :created, location: @sport }\n else\n format.html { render :new }\n ...
[ "0.61002535", "0.59602916", "0.5931635", "0.585401", "0.58483076", "0.58328503", "0.5782736", "0.56647384", "0.5615835", "0.56116426", "0.5602464", "0.56016934", "0.5580331", "0.55767167", "0.5490263", "0.54291916", "0.54244775", "0.54114276", "0.5371385", "0.53649825", "0.53...
0.6781136
0
PATCH/PUT /sport_odds/1 PATCH/PUT /sport_odds/1.json
def update respond_to do |format| if @sport_odd.update(sport_odd_params) format.html { redirect_to @sport_odd, notice: 'Sport odd was successfully updated.' } format.json { render :show, status: :ok, location: @sport_odd } else format.html { render :edit } format.json { render json: @sport_odd.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end...
[ "0.64824075", "0.6278879", "0.6268396", "0.62241536", "0.62176543", "0.6183958", "0.6175293", "0.61299723", "0.61115044", "0.6109371", "0.60871005", "0.607703", "0.6076808", "0.60438657", "0.60401034", "0.6036588", "0.60327536", "0.6025733", "0.60204387", "0.6013136", "0.5993...
0.6891506
0
DELETE /sport_odds/1 DELETE /sport_odds/1.json
def destroy @sport_odd.destroy respond_to do |format| format.html { redirect_to sport_odds_url, notice: 'Sport odd was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n ...
[ "0.71794355", "0.6944274", "0.68092656", "0.67563385", "0.67377716", "0.6714643", "0.6673295", "0.66727155", "0.66715354", "0.66715354", "0.66700137", "0.66628736", "0.66628736", "0.66618305", "0.6655591", "0.66060275", "0.6604137", "0.6597605", "0.65939456", "0.65821564", "0...
0.7201168
0
Use callbacks to share common setup or constraints between actions.
def set_sport_odd @sport_odd = SportOdd.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sport_odd_params params.require(:sport_odd).permit(:sport_trade_id, :name, :value, :last_update, :description, :scenario_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
GET /cart_items/1 GET /cart_items/1.json
def show @cart_item = CartItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @cart_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cart_items = CartItem.all\n\n render json: @cart_items\n end", "def show\n render json: @cart_item\n end", "def show\n\t\trender json: @cart_item\n\tend", "def index\n\t@cart_items = CartItem.all\n\n\trender json: @cart_items\n\tend", "def index\n respond_to do |format|\n fo...
[ "0.7769855", "0.7608788", "0.75968546", "0.7593721", "0.7384345", "0.7379109", "0.7352747", "0.73462725", "0.73137695", "0.72800833", "0.72466755", "0.7174546", "0.7071415", "0.7070208", "0.7070208", "0.70121604", "0.70121604", "0.69788265", "0.6967014", "0.6967014", "0.69670...
0.7565653
4
GET /cart_items/new GET /cart_items/new.json
def new @cart_item = CartItem.new respond_to do |format| format.html # new.html.erb format.json { render json: @cart_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart_item }\n end\n end", "def new\n @cart = Cart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart }\n end\n end", "def new\n @cart =...
[ "0.8292654", "0.79152095", "0.79152095", "0.79152095", "0.79152095", "0.79152095", "0.79152095", "0.79152095", "0.79152095", "0.7606635", "0.7501058", "0.7493053", "0.7442047", "0.7413839", "0.7413839", "0.7384727", "0.7360698", "0.73575294", "0.73426926", "0.73426926", "0.73...
0.82764703
1
POST /cart_items POST /cart_items.json
def create @cart = current_cart update_flag = false @cart.cart_items.each do | cart_item| # p cart_item.item.id.to_s # p params[:cart_item][:item_id].to_s if cart_item.item.id.to_s == params[:cart_item][:item_id].to_s update_flag = true CartItem.update(cart_item.id,:count => cart_item.count + Integer(params[:cart_item][:count])) end end if !update_flag item = Item.find(params[:cart_item][:item_id]) @cart_item = @cart.cart_items.build(:item => item) @cart_item.count = params[:cart_item][:count] @cart_item.save end redirect_to cart_items_url, notice: '添加成功' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cart_item = CartItem.new(cart_item_params)\n\n if @cart_item.save\n render json: @cart_item, status: :created, location: @cart_item\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end", "def create\n if @cart_item = CartItem.find_by(cart_id: ...
[ "0.77883536", "0.77516586", "0.772565", "0.7596021", "0.73011714", "0.7280398", "0.7280398", "0.7280398", "0.71960115", "0.7194269", "0.71383953", "0.7113272", "0.7107254", "0.7042629", "0.70221955", "0.700675", "0.69212365", "0.69212365", "0.6916978", "0.6908995", "0.6899366...
0.0
-1
PUT /cart_items/1 PUT /cart_items/1.json
def update @cart_item = CartItem.find(params[:id]) respond_to do |format| if @cart_item.update_attributes(params[:cart_item]) format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @cart_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n cart_item = current_user.cart.cart_items.where(\"item_id = ?\", cart_items_params[:item_id]).first\n cart_item.quantity += cart_items_params[:quantity].to_i\n if cart_item.quantity < 1\n if cart_item.delete\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: ...
[ "0.7579612", "0.7571464", "0.7434649", "0.72522235", "0.7226245", "0.7205163", "0.7205163", "0.71621114", "0.710992", "0.7059712", "0.6976485", "0.6962395", "0.6930561", "0.68756634", "0.6804994", "0.6804994", "0.6804994", "0.6804994", "0.6804994", "0.6804994", "0.6804994", ...
0.7288656
3
DELETE /cart_items/1 DELETE /cart_items/1.json
def destroy @cart_item = CartItem.find(params[:id]) @cart_item.destroy respond_to do |format| format.html { redirect_to cart_items_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n li = @cart.line_items.find_by_id!(params[:id])\n li.destroy\n render json: {}, status: :ok\n end", "def delete\n\t\t@cart.delete(:item_id)\n end", "def destroy\n @cart_item.destroy\n respond_to do |format|\n format.html { redirect_to cart_items_url }\n for...
[ "0.7826282", "0.7811302", "0.7737364", "0.7704081", "0.76895976", "0.7639902", "0.7606099", "0.7572695", "0.7559782", "0.7534176", "0.74823505", "0.74665534", "0.74553066", "0.7439142", "0.7426214", "0.7425348", "0.7407861", "0.73222256", "0.73222256", "0.73222256", "0.732222...
0.77748275
2
Runs the predicted_deaths and speed_of_spread methods.
def virus_effects predicted_deaths speed_of_spread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def virus_effects #HINT: What is the SCOPE of instance variables? these methods can only be used within a virusPredictor class, its scope.\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects \n predicted_deaths(@popula...
[ "0.6736006", "0.6683997", "0.6622512", "0.66206944", "0.6611255", "0.6588967", "0.6552845", "0.6525862", "0.65011144", "0.6451929", "0.64275426", "0.6380657", "0.6367738", "0.6362875", "0.6362527", "0.6362527", "0.6344384", "0.6334278", "0.6321268", "0.63122296", "0.6290165",...
0.0
-1
Uses the population density and population to calculate the number of deaths in the state, then prints a message to the user of a prediction of how many deaths would occur in the state from the outbreak.
def predicted_deaths # predicted deaths is solely based on population density if @population_density >= 200 number_of_deaths = (@population * 0.4).floor elsif @population_density >= 150 number_of_deaths = (@population * 0.3).floor elsif @population_density >= 100 number_of_deaths = (@population * 0.2).floor elsif @population_density >= 50 number_of_deaths = (@population * 0.1).floor else number_of_deaths = (@population * 0.05).floor end print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths # this is going to print out the deaths for each state on the outbreak which is going to be based on population and population density\n \n death_percent = 0.1 if @population_density >= 50\n death_percent = 0.2 if @population_density >= 100\n death_percent = 0.3 if ...
[ "0.8813882", "0.8576305", "0.8576305", "0.8570788", "0.8561775", "0.85524374", "0.8536526", "0.8531148", "0.8520209", "0.8520209", "0.8520209", "0.8520209", "0.8520209", "0.8520209", "0.8519668", "0.8503044", "0.84994274", "0.84950924", "0.8494108", "0.84932137", "0.8489204",...
0.84620523
58
Uses the population density to predict the number of months in which the predicted deaths would occur, and prints this information to the console.
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. if @population_density >= 200 speed = 0.5 elsif @population_density >= 150 speed = 1 elsif @population_density >= 100 speed = 1.5 elsif @population_density >= 50 speed = 2 else speed = 2.5 end puts " and will spread across the state in #{speed} months.\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n ...
[ "0.7958089", "0.7903635", "0.788043", "0.787438", "0.7866441", "0.7863479", "0.78594613", "0.7850024", "0.7845152", "0.7845152", "0.7838068", "0.78350365", "0.7834352", "0.7830438", "0.7825056", "0.7820413", "0.78174436", "0.7814223", "0.7813635", "0.78106433", "0.78059274", ...
0.0
-1
GET /member_of_parliaments GET /member_of_parliaments.json
def index @member_of_parliaments = MemberOfParliament.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @parliaments = Parliament.sorted_start_year\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parliaments }\n end\n end", "def show\n @parliament = Parliament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.er...
[ "0.607824", "0.6038479", "0.58646333", "0.5684758", "0.56767637", "0.5628131", "0.5620427", "0.55985373", "0.5593201", "0.55576617", "0.555597", "0.55260766", "0.55150104", "0.551032", "0.5508015", "0.5486278", "0.54814863", "0.54814863", "0.54797864", "0.54604936", "0.545784...
0.71204084
0
GET /member_of_parliaments/1 GET /member_of_parliaments/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @member_of_parliaments = MemberOfParliament.all\n end", "def show\n @parliament = Parliament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parliament }\n end\n end", "def index\n @parliaments = Parliament.sorted_s...
[ "0.6993584", "0.63826036", "0.6110096", "0.60399264", "0.5979455", "0.5934113", "0.5877525", "0.57967705", "0.5742483", "0.57333493", "0.56239486", "0.55988795", "0.55530393", "0.5545633", "0.55347115", "0.5528944", "0.5528098", "0.55273277", "0.5520608", "0.55162287", "0.550...
0.0
-1
POST /member_of_parliaments POST /member_of_parliaments.json
def create @member_of_parliament = MemberOfParliament.new(member_of_parliament_params) respond_to do |format| if @member_of_parliament.save format.html { redirect_to @member_of_parliament, notice: 'Member of parliament was successfully created.' } format.json { render :show, status: :created, location: @member_of_parliament } else format.html { render :new } format.json { render json: @member_of_parliament.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_of_parliament_params\n params.require(:member_of_parliament).permit(:first_name, :last_name, :email, :electorate_id)\n end", "def index\n @member_of_parliaments = MemberOfParliament.all\n end", "def create\n @parliament = Parliament.new(params[:parliament])\n\n respond_to do |forma...
[ "0.64608425", "0.5950028", "0.585389", "0.5816333", "0.57890755", "0.56652415", "0.5603583", "0.5563021", "0.54461205", "0.5434024", "0.540496", "0.5395752", "0.5380408", "0.5329758", "0.5322569", "0.5313854", "0.5299524", "0.5293077", "0.52913785", "0.5260508", "0.5241508", ...
0.6694746
0
PATCH/PUT /member_of_parliaments/1 PATCH/PUT /member_of_parliaments/1.json
def update respond_to do |format| if @member_of_parliament.update(member_of_parliament_params) format.html { redirect_to @member_of_parliament, notice: 'Member of parliament was successfully updated.' } format.json { render :show, status: :ok, location: @member_of_parliament } else format.html { render :edit } format.json { render json: @member_of_parliament.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @parliament = Parliament.find(params[:id])\n\n respond_to do |format|\n if @parliament.update_attributes(params[:parliament])\n format.html { redirect_to admin_parliaments_path, notice: t('app.msgs.success_updated', :obj => t('activerecord.models.parliament')) }\n format.json ...
[ "0.6223034", "0.61904407", "0.6066302", "0.6042884", "0.5978449", "0.5947449", "0.5939296", "0.59034234", "0.58924437", "0.58913964", "0.58548063", "0.5847453", "0.5841899", "0.58324623", "0.58231544", "0.58186954", "0.58168936", "0.57792616", "0.57781327", "0.57758355", "0.5...
0.66692585
0
DELETE /member_of_parliaments/1 DELETE /member_of_parliaments/1.json
def destroy @member_of_parliament.destroy respond_to do |format| format.html { redirect_to member_of_parliaments_url, notice: 'Member of parliament was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @parliament = Parliament.find(params[:id])\n @parliament.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_parliaments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dotsmember = Dotsmember.find(params[:id])\n @dotsmember.destroy\n\n ...
[ "0.7285707", "0.7008471", "0.6787361", "0.67625195", "0.6653302", "0.6644159", "0.6644159", "0.662174", "0.662174", "0.662174", "0.662174", "0.662174", "0.662174", "0.662174", "0.6613521", "0.6613521", "0.6595599", "0.6595599", "0.6569122", "0.6557754", "0.6541978", "0.6530...
0.7498477
0
Use callbacks to share common setup or constraints between actions.
def set_member_of_parliament @member_of_parliament = MemberOfParliament.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
Never trust parameters from the scary internet, only allow the white list through.
def member_of_parliament_params params.require(:member_of_parliament).permit(:first_name, :last_name, :email, :electorate_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
Encodes the directory to avoid naming conflicts
def encode_dir(path) path.gsub(".hg/",".hg.hg/").gsub(".i/",".i.hg/").gsub(".d/",".d.hg/") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_to_dir(name)\n name.gsub(/[^-A-Za-z0-9_|\\[\\]]/, \"_\")\n end", "def decode_dir(path)\n path.gsub(\".d.hg/\",\".d/\").gsub(\".i.hg/\",\".i/\").gsub(\".hg.hg/\",\".hg/\")\n end", "def dirname\n transliterate(super).downcase\n end", "def format_directory(dir)\n...
[ "0.64887077", "0.6446442", "0.64386034", "0.6433811", "0.63259107", "0.62930405", "0.6245122", "0.6202941", "0.6193966", "0.61865175", "0.61714816", "0.61706704", "0.6168765", "0.6133023", "0.6133023", "0.61237216", "0.61138636", "0.60750055", "0.6058729", "0.60507697", "0.60...
0.7586184
0
Decodes the directory to avoid naming conflicts
def decode_dir(path) path.gsub(".d.hg/",".d/").gsub(".i.hg/",".i/").gsub(".hg.hg/",".hg/") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir\n calc_dir(@basename)\n end", "def name_to_dir(name)\n name.gsub(/[^-A-Za-z0-9_|\\[\\]]/, \"_\")\n end", "def encode_dir(path)\n path.gsub(\".hg/\",\".hg.hg/\").gsub(\".i/\",\".i.hg/\").gsub(\".d/\",\".d.hg/\")\n end", "def getDir(dir)\n return dirByName.fetch(dir...
[ "0.63915926", "0.6360455", "0.6155635", "0.6099844", "0.60603666", "0.6019964", "0.59393734", "0.5854079", "0.5793648", "0.57879317", "0.5777583", "0.5755546", "0.57465076", "0.5739249", "0.573871", "0.5677653", "0.56749046", "0.5671517", "0.56416756", "0.56416756", "0.560382...
0.7232317
0
Returns whether the given text from a decompressed node has metadata encoded in it. Not for public use.
def has_metadata?(data) return data.start_with?("\1\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_metadata? str\n match = [KVP,DELIM]\n return true if match.any? {|w| str.include? w}\n return false\n end", "def text?\n @contents[0] == :text\n end", "def text_content?\n @node.children.all? {|c| c.text?}\n end", "def cda...
[ "0.6537554", "0.6528294", "0.63924414", "0.6370345", "0.6297752", "0.6284308", "0.6219425", "0.6211999", "0.61186326", "0.6076484", "0.58774793", "0.5851079", "0.58346725", "0.58316684", "0.58316684", "0.58103323", "0.58083", "0.57974833", "0.5793964", "0.57238823", "0.570257...
0.7009811
0
Returns the location of the end of the metadata. Metadata prefixes the data in the block.
def normal_data_start(text) text.index("\1\n", 2) + 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata_end(text)\n text.index(\"\\1\\n\", 2)\n end", "def metadata_start\n 2\n end", "def last\n trailer_data\n end", "def end_line\n attributes.fetch(:endLine)\n end", "def skip_meta_data\n return if @meta_end.nil? \n return if tell >= @m...
[ "0.7174621", "0.6648511", "0.5957033", "0.5875952", "0.5847262", "0.5807441", "0.57632715", "0.57479113", "0.57348555", "0.5699148", "0.5612767", "0.5573526", "0.5537641", "0.5533848", "0.5533491", "0.55312884", "0.55253786", "0.55032015", "0.55032015", "0.55032015", "0.55032...
0.0
-1
Returns the location of the end of the metadata. Metadata prefixes the data in the block.
def metadata_end(text) text.index("\1\n", 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata_start\n 2\n end", "def last\n trailer_data\n end", "def end_line\n attributes.fetch(:endLine)\n end", "def skip_meta_data\n return if @meta_end.nil? \n return if tell >= @meta_end\n seek @meta_end\n end", "def metadata\n return \"\"\n end",...
[ "0.66460675", "0.59579915", "0.5876981", "0.58466643", "0.5807136", "0.57646996", "0.5748667", "0.57341886", "0.56983393", "0.56115556", "0.55728555", "0.55381733", "0.5534966", "0.5534566", "0.55310374", "0.5523728", "0.5503658", "0.5503658", "0.5503658", "0.5503658", "0.550...
0.7174122
0
Returns the start of the metadata in the text
def metadata_start 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_data_start(text)\n text.index(\"\\1\\n\", 2) + 2\n end", "def metadata_end(text)\n text.index(\"\\1\\n\", 2)\n end", "def summary(content)\n content[0, content.index('<!-- more -->') || content.length]\nend", "def start_of_word(text,n)\n\treturn text[0,n]\nend", ...
[ "0.6973851", "0.6785318", "0.6016277", "0.5968093", "0.59484726", "0.58946204", "0.585046", "0.58350533", "0.5833489", "0.5798689", "0.578425", "0.5778104", "0.5739653", "0.5739653", "0.5739653", "0.5739653", "0.5739653", "0.5739653", "0.5739653", "0.5739653", "0.5739653", ...
0.7217526
0
Reads the data of the revision, ignoring the meta data for copied files
def read(node) text = decompress_revision(node) return text unless has_metadata?(text) text[normal_data_start(text)..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content(revision)\n line = get_indexfile_with_revision(revision)\n if line.nil?\n raise \"Revision does not exist: #{revision} for #{@fname}\"\n end\n parse = parse_indexfile_line line\n offset = parse[1]\n length = parse[2]\n str = \"\"\n\n # ...
[ "0.61287445", "0.59923977", "0.5829551", "0.58220154", "0.5770342", "0.5686709", "0.5652829", "0.56387544", "0.558123", "0.5575242", "0.55386764", "0.5530057", "0.5509102", "0.54933256", "0.54613525", "0.5453264", "0.54405034", "0.54334843", "0.5429562", "0.54077387", "0.5366...
0.6500598
0
Reads the meta data in the node
def read_meta(node) t = decompress_revision(node) return {} unless has_metadata?(t) mt = t[metadata_start..(metadata_end(t) - 1)] mt.split("\n").inject({}) do |hash, line| k, v = line.split(": ", 2) hash[k] = v hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def read_metadata; end", "def meta\n @d[:meta]\n end", "def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = ...
[ "0.7263874", "0.7260111", "0.7077188", "0.70283955", "0.69813234", "0.69813234", "0.6978866", "0.69535685", "0.6830755", "0.68004155", "0.6757584", "0.67347497", "0.67157924", "0.6662498", "0.662809", "0.66226614", "0.66226614", "0.65373987", "0.65268624", "0.6501247", "0.649...
0.744567
0
Combines the revision data and the metadata into one text blob. Uses Mercurial's encoding method.
def inject_metadata(text, meta) if (meta && meta.any?) || text.start_with?("\1\n") mt = meta ? meta.map {|k, v| "#{k}: #{v}\n"} : "" text = "\1\n" + mt.join + "\1\n" + text end text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contents(revision=nil, cmd_options={})\n revision ||= 'tip'\n hg(manifest_cmd(revision), cmd_options).tap do |res|\n if RUBY_VERSION >= '1.9.1'\n res.force_encoding('utf-8')\n end\n end\n end", "def content(revision)\n line = get_indexfile_with_revision(revisio...
[ "0.623552", "0.5944422", "0.57414114", "0.5665892", "0.5588097", "0.5566273", "0.54552495", "0.53470457", "0.5344269", "0.53404623", "0.5333286", "0.5325121", "0.5283487", "0.5240466", "0.5231857", "0.5150592", "0.51493526", "0.511777", "0.5077811", "0.5064963", "0.4999027", ...
0.45649987
94
Adds a revision to the file's history. Overridden for special metadata
def add(text, meta, journal, link, p1=nil, p2=nil) text = inject_metadata(text, meta) add_revision(text, journal, link, p1, p2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_revision(revision)\n revision.p_node = @current[1]\n # TODO: using manifest_accessor to create a new manifest\n # TODO: using changeset_accessor to create a new changeset\n # sync_manifest(manifest)\n @current[1] = revision\n @heads.store(current[0], current[1])\n ...
[ "0.709184", "0.70438117", "0.6866852", "0.668617", "0.65481013", "0.6382832", "0.6314702", "0.6184066", "0.61811244", "0.6138261", "0.6103612", "0.60640365", "0.60595137", "0.6050122", "0.5991308", "0.59876406", "0.59754205", "0.5920318", "0.59059066", "0.59020066", "0.589430...
0.6160264
9
Returns whether or not the file at _node_ has been renamed or copied in the immediate revision.
def renamed?(node) return false if parents_for_node(node).first != NULL_ID m = read_meta node if m["copy"] [m["copy"], m["copyrev"].unhexlify] else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renamed?\n renamed = file_log.renamed?(file_node)\n return renamed unless renamed\n \n return renamed if rev == link_rev\n \n name = path\n fnode = file_node\n changeset.parents.each do |p|\n pnode = p.filenode(name)\n next if pnode.nil?...
[ "0.7817528", "0.6683098", "0.6664506", "0.66637915", "0.654646", "0.65404713", "0.64998454", "0.63871515", "0.63698834", "0.63691187", "0.63649064", "0.63533336", "0.63493496", "0.6276605", "0.6265341", "0.6232698", "0.6223159", "0.618357", "0.6182502", "0.6181601", "0.614382...
0.79995733
0
Gets the size of the file. Overridden because of the metadata for copied files.
def size(rev) node = self.node rev if renamed? node read(node).size else self[rev].compressed_len end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n file.content_length\n end", "def size\n # return @file.size if @file.respond_to?(:size)\n File.size(self.path) rescue 0\n end", "def file_size\n stream.size\n end", "def size\n @size ||= File.size(file)\n end", "def size\n file.size\n e...
[ "0.85264045", "0.8447442", "0.8389241", "0.83863956", "0.83803964", "0.8274122", "0.82407343", "0.8225912", "0.81060797", "0.80732447", "0.80687404", "0.80647343", "0.79851836", "0.79851836", "0.7940065", "0.7940065", "0.7940065", "0.7940065", "0.79123133", "0.7907269", "0.78...
0.0
-1
Converts a given node in this revision with the text provided. overridden because it handles renamed files.
def cmp(thenode, text) if renamed? thenode t2 = read thenode return t2 != text end super(thenode, text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_text(node, opts)\n opts[:xml].text(node.text)\n end", "def text(node); end", "def text(node); end", "def convert name, node, newname, replace = true\n wrap_up name, node, { name: newname, role: node.name }, node.children, replace\nend", "def node_text(node)\n node.content.gsub('<...
[ "0.64642704", "0.62415904", "0.62415904", "0.5931032", "0.583684", "0.575906", "0.5729516", "0.57204974", "0.5656669", "0.5589782", "0.5579907", "0.5571138", "0.55315286", "0.5516321", "0.5511903", "0.5501959", "0.54757994", "0.54710704", "0.5438189", "0.54304355", "0.5417872...
0.0
-1
This method is called to configure the connection to the cache store.
def configure(host = 'localhost', port = 6379, db = 0, password = nil, driver: nil, url: nil, connect_timeout: 0.5, read_timeout: 1, write_timeout: 0.5) if !url.nil? @config = {} @config[:url] = url @config[:db] = db else @config = { host: host, port: port, db: db } end @config[:password] = password unless password.nil? @config[:driver] = driver unless driver.nil? @config[:connect_timeout] = connect_timeout @config[:read_timeout] = read_timeout @config[:write_timeout] = write_timeout connection_pool.config = @config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_cache; end", "def configure_connection\n end", "def configure_connection\n end", "def cache(&block)\n if ActiveRecord::Base.configurations.blank?\n yield\n else\n self.connection_proxy.cache(&block)\n end\n end", "def cache_setup(hostnam...
[ "0.71884674", "0.7109603", "0.70161647", "0.6507498", "0.6345914", "0.61536497", "0.6149839", "0.610991", "0.60670805", "0.60361916", "0.5990634", "0.59801", "0.5893048", "0.5886162", "0.5886065", "0.5886065", "0.58780646", "0.587594", "0.58704185", "0.5852019", "0.58161885",...
0.633857
5
This method is called to set a value within this cache store by it's key.
def set(key, value, expires_in = DEFAULT_TTL) k = build_key(key) v = if value.nil? || (value.is_a?(String) && value.strip.empty?) nil else serialize(value) end expiry_int = Integer(expires_in) expire_value = expiry_int.positive? ? expiry_int : Integer(DEFAULT_TTL) with_client do |client| client.multi do client.set(k, v) client.expire(k, expire_value) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(key, value)\n @cache[key] = value\n end", "def set(key, value)\n @store[key] = value\n end", "def set_value(key, value)\n @store_[key] = value\n YakvdConstants.success\n end", "def cached_set(key, value)\n return unless h = self[:cache]\n Sequel.synchr...
[ "0.7785932", "0.77734464", "0.76251346", "0.7454498", "0.7440143", "0.7440143", "0.7413474", "0.7394765", "0.7366588", "0.7359506", "0.7351031", "0.7349359", "0.73484725", "0.733907", "0.7331445", "0.7299079", "0.727812", "0.7277165", "0.72558194", "0.7246271", "0.72193325", ...
0.0
-1
This method is called to get a value from this cache store by it's unique key.
def get(key, expires_in = 0) k = build_key(key) value = with_client do |client| client.get(k) end if !value.nil? && value.strip.empty? value = nil else value = deserialize(value) unless value.nil? end if value.nil? && block_given? value = yield set(key, value, expires_in) end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value (key)\r\n @redis.get key\r\n end", "def get\n @cached_value ||= RedisModel::Base.connection.get(key_label)\n end", "def get(key)\n @cache[key]\n end", "def get(key)\n @cache[key]\n end", "def get!(key)\n record = object(key)\n return nil unless re...
[ "0.79871774", "0.7651432", "0.7649658", "0.7626373", "0.759692", "0.75755537", "0.7557187", "0.74095285", "0.7407877", "0.73537666", "0.7317074", "0.72934264", "0.7292658", "0.7205961", "0.71564025", "0.7136865", "0.7091513", "0.70832753", "0.7079635", "0.7052038", "0.7038625...
0.0
-1
This method is called to remove a value from this cache store by it's unique key.
def remove(key) with_client do |client| client.del(build_key(key)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(value)\n connection.zrem(key_label, value)\n end", "def unset_value(key)\n database.delete(key)\n removed_keys << key\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def remove_from_cache\n redis.hdel '...
[ "0.7921222", "0.7703949", "0.7455196", "0.7311475", "0.7311066", "0.7296619", "0.72749627", "0.7250886", "0.71998763", "0.7192245", "0.7157579", "0.71438986", "0.70888895", "0.70694196", "0.7060772", "0.70584077", "0.7003729", "0.6998718", "0.6972647", "0.6934703", "0.6888172...
0.0
-1
This method is called to check if a value exists within this cache store for a specific key.
def exist?(key) with_client do |client| !client.exists(build_key(key)).zero? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end", "def has_key?(key)\n @cache.has_key?(key)\n end", "def exists?(key)\n key.present? && manager.key?(key)\n end", "def exist?(key)\n store.key?(key)\n end", "def exists?\n ...
[ "0.7861938", "0.77610683", "0.7511878", "0.7504676", "0.7502807", "0.74125737", "0.7386069", "0.7376883", "0.73469603", "0.73157364", "0.7243367", "0.72289336", "0.72280806", "0.7220401", "0.72122127", "0.7198737", "0.71036285", "0.71027863", "0.70840585", "0.70759785", "0.70...
0.685735
37
Ping the cache store.
def ping with_client do |client| client.ping end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ping\n @redis.ping\n end", "def update_ping\n result = false\n 3.times do\n command =\n \"ping -c 1 -W #{PING_MIN_INTERVAL} #{@hostname} 2> /dev/null 1> /dev/null\"\n if system(command)\n result = true\n break\n end\n end\n\n write_cache(\"ping\", resul...
[ "0.7026689", "0.6554461", "0.6373376", "0.6369257", "0.6312584", "0.6263494", "0.62389964", "0.6166301", "0.6055502", "0.60440665", "0.5969492", "0.5960105", "0.5891644", "0.588362", "0.5844903", "0.58237743", "0.5780455", "0.57750994", "0.57656556", "0.5760834", "0.57219625"...
0.5522412
37
Used to store Internet ...Function used to transform string in seconds
def ReturnSeconds(value) result = value.split(/m|s/) result = result[0].to_i*60 + result[1].to_i return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CountingMinutesI(str)\n\n # code goes here\n return str \n \nend", "def server_timing=(_arg0); end", "def slow\n 'http://parley.rubyrogues.com/'.gsub(%r{\\Ahttp://}, 'https://')\nend", "def encode62 arg\n SmallUrl.send(:encode62, arg)\nend", "def calc_url_tps(tps_type)\r\n Digest::MD5.he...
[ "0.5520663", "0.5283581", "0.5220913", "0.5173784", "0.5161965", "0.5161965", "0.5154348", "0.51504725", "0.5130722", "0.51224256", "0.5115792", "0.5109567", "0.51063204", "0.509988", "0.5094649", "0.50921816", "0.5079043", "0.5074956", "0.50737774", "0.50730115", "0.5060935"...
0.48098058
52
GET /xmt/passwords GET /xmt/passwords.json
def index @xmt_mgr_passwords = Xmt::Password.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end", "def index\n @passwords = current_user.passwords\n end", "def index\n @passwords = Password.all;\n end", "def form_passwords(form) # Implement this in Form c...
[ "0.7016483", "0.6856877", "0.6592133", "0.6293092", "0.6147178", "0.6120993", "0.6073042", "0.6059177", "0.60457736", "0.6003679", "0.5961811", "0.5932631", "0.5909405", "0.5882437", "0.5865646", "0.58163947", "0.5815736", "0.579059", "0.5771223", "0.5750392", "0.5744273", ...
0.72859013
0
GET /xmt/passwords/1 GET /xmt/passwords/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end", "def index\n @xmt_mgr_passwords = Xmt::Password.all\n end", "def index\n @passwords = current_user.passwords\n end", "def index\n @passwords = Password.al...
[ "0.7084344", "0.68983704", "0.657954", "0.6393148", "0.62873", "0.60193765", "0.60059327", "0.59976715", "0.59624285", "0.5938227", "0.59220046", "0.5916236", "0.5911179", "0.59087634", "0.5869414", "0.58403796", "0.5801594", "0.5767065", "0.5764908", "0.5760403", "0.5751292"...
0.0
-1
POST /xmt/passwords POST /xmt/passwords.json
def create @xmt_mgr_password = Xmt::Password.new(xmt_mgr_password_params) respond_to do |format| if @xmt_mgr_password.save format.html { redirect_to @xmt_mgr_password, notice: 'Password was successfully created.' } format.json { render :show, status: :created, location: @xmt_mgr_password } else format.html { render :new } format.json { render json: @xmt_mgr_password.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end", "def form_passwords(form) # Implement this in Form class\r\n { \r\n :passwords => [ \r\n form['password'],\r\n form['confirm_passwo...
[ "0.637381", "0.62016594", "0.6171739", "0.6145866", "0.6123537", "0.60018975", "0.5964736", "0.5962582", "0.5949278", "0.5928287", "0.5878484", "0.58396155", "0.5832325", "0.5799699", "0.5782942", "0.5782571", "0.5771616", "0.5760222", "0.5757893", "0.57533705", "0.56982887",...
0.6893904
0