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
Compute the number of words that a letter appears in Because this is an expensive operation, cache the results. The cache is invalidated when the list of Words changes
def letter_count(letter) @letter_counts ||= compute_counts @letter_counts[letter[0] - ?a] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }", "def words_that_contain(letter)\n letter_count(letter)\n end", "def letter_counts(w...
[ "0.7564061", "0.73660606", "0.72831446", "0.72173786", "0.7146906", "0.7132058", "0.7124142", "0.7103139", "0.7078919", "0.70704675", "0.7043042", "0.70237833", "0.70049113", "0.7003284", "0.6988094", "0.69697964", "0.6966417", "0.6939389", "0.6929861", "0.69005555", "0.69004...
0.0
-1
Create a HangMan Solver puzzle should be a string of '' as long as the word to guess dictionary is a Dictionary. The solver can find words that are not in the dictionary strategy is an optional parameter to determine the letter choosing strategy a Strategy object should implement one method score_for(letter,dictionary) => numeric score the lowest scoring letter is chosen
def initialize(puzzle,dictionary,strategy=MostFrequentStrategy.new) @solution = puzzle.dup @dictionary = dictionary.with_only_words_of_size(puzzle.length) @possible_letters = ('a'..'z').to_a @strategy = strategy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word,...
[ "0.6470329", "0.6167698", "0.61333984", "0.60663444", "0.60628045", "0.60478956", "0.5945501", "0.5944362", "0.5918582", "0.5893982", "0.58792496", "0.5876002", "0.58553874", "0.5844523", "0.5811667", "0.58113146", "0.5804311", "0.57754457", "0.575519", "0.575519", "0.575519"...
0.6951928
0
Returns true if the solution is known
def solved? @solution !~ /-/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solvable?\n find_solution > 0\n end", "def solved?\n @solution != nil\n end", "def solved?\n end", "def solution_exists?\n ! @solved_node.nil?\n end", "def solved?\n unknown_count == 0\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def solved?\n first_em...
[ "0.84955007", "0.81102115", "0.7680278", "0.7619418", "0.75706595", "0.7540106", "0.7427209", "0.7371596", "0.73556125", "0.72861457", "0.7272406", "0.7228054", "0.7219366", "0.7217833", "0.71855605", "0.71657884", "0.7137711", "0.70877004", "0.7023573", "0.70227915", "0.7018...
0.7299594
9
How many more Words in the dictionary are candidates?
def possibilities @dictionary.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_count\n @tried_solutions.length\n end", "def number_of_unique_words\n @frequencies.keys.length\n end", "def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end", "def num_unique_words\n @frequencies.keys.length\n end", ...
[ "0.72568667", "0.7204654", "0.71964574", "0.70637035", "0.6987363", "0.69575816", "0.6952126", "0.6943471", "0.6933816", "0.69300556", "0.6913659", "0.690781", "0.6889534", "0.6889459", "0.68821585", "0.6879063", "0.6877012", "0.6874214", "0.685833", "0.68466985", "0.68408954...
0.70758224
3
Returns the letter that the solver guesses Uses the strategy to determine the letter with the lowest score
def guess letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]} letter = letters.min {|letter1,letter2| letter1 <=> letter2 } letter[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_letter\n\t\t# move the 'a' and 'b' jokers \n\t\tmove_joker_a\n\t\tmove_joker_b\n\n\t\t# get their new positons\n\t\tnew_a = @deck_of_cards.index(Card.new(:joker, 1))\n\t\tnew_b = @deck_of_cards.index(Card.new(:joker, 2))\n\n\t\t# perform a triple split around the positions of the jokers\n\t\ttriple_split(n...
[ "0.6716559", "0.6707428", "0.6695332", "0.6690874", "0.66757935", "0.66717863", "0.66715163", "0.66393197", "0.6610986", "0.65861034", "0.65775305", "0.65690815", "0.65652484", "0.65220696", "0.6504551", "0.647341", "0.6461107", "0.6450771", "0.6450236", "0.64088917", "0.6381...
0.8592044
0
Tell the solver that the letter does not appear in the solution
def wrong_guess(letter) @possible_letters.delete(letter) @dictionary.reject_words_that_contain(letter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end", "def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end", "def no_indices(guess)\n @candidate_words.reject! { ...
[ "0.69877553", "0.69462293", "0.6907651", "0.64770323", "0.64410424", "0.64104825", "0.6355883", "0.63545567", "0.63487494", "0.634209", "0.62722474", "0.62282974", "0.62254494", "0.6211572", "0.6199264", "0.6196783", "0.6166386", "0.61600214", "0.6124472", "0.6095786", "0.606...
0.7322945
0
Tell the solver that the letter was a good guess, by placing the letter in the solution e.g. to indicate that 'a' is a good guess for 'hangman' pass 'aa'
def good_guess(pattern) merge(pattern) @dictionary.keep_only_words_that_match(@solution) @possible_letters.delete(letter_in(pattern)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_letter(letter)\n\t\tif @ans_word.include?(letter)\n\t\t\ti = @ans_word.index(letter)\n\t\t\t@guess.insert(i, letter)\n\t\t\t@guess.pop\n\t\t\tputs \"Good! You are getting closer: #{@guess*\"\"}\"\n\t\telse\n\t\t\tputs \"sorry, guess again\"\n\t\tend\n\tend", "def guess(letter)\r\n if word_has?(lette...
[ "0.8103037", "0.80593646", "0.798573", "0.7870861", "0.7827445", "0.78170556", "0.78134185", "0.7810618", "0.7770833", "0.77543175", "0.77365285", "0.77143675", "0.77130395", "0.7702382", "0.76999325", "0.7684928", "0.7657378", "0.7634103", "0.7627849", "0.7557668", "0.752945...
0.68511397
87
GET /ramais GET /ramais.json
def index @ramais = Ramal.all respond_to do |format| format.html # index.html.erb format.json { render json: @ramais } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ramal }\n end\n end", "def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n form...
[ "0.6646255", "0.6568274", "0.6403144", "0.6287112", "0.6228843", "0.6134788", "0.61119664", "0.6027192", "0.5993213", "0.59868544", "0.59693426", "0.5902116", "0.5892363", "0.58351934", "0.58291405", "0.57919765", "0.57794243", "0.5742897", "0.57412696", "0.57402396", "0.5735...
0.7563953
0
GET /ramais/1 GET /ramais/1.json
def show @ramal = Ramal.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @ramal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end", "def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\...
[ "0.7652828", "0.67463803", "0.67453396", "0.6592756", "0.6397033", "0.6381231", "0.63730806", "0.6246838", "0.61505014", "0.61438894", "0.6119072", "0.6096222", "0.6085872", "0.6079914", "0.6038352", "0.6031311", "0.60115117", "0.5999089", "0.5972969", "0.59366596", "0.591651...
0.7124369
1
GET /ramais/new GET /ramais/new.json
def new @ramal = Ramal.new respond_to do |format| format.html # new.html.erb format.json { render json: @ramal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "d...
[ "0.7631171", "0.74667746", "0.7383068", "0.72372484", "0.71745837", "0.7076995", "0.70463544", "0.70446837", "0.7036847", "0.7028083", "0.70137024", "0.70087147", "0.70011216", "0.6983756", "0.69739485", "0.6967141", "0.6957078", "0.69258124", "0.6918733", "0.6918733", "0.690...
0.76395696
0
POST /ramais POST /ramais.json
def create @ramal = Ramal.new(params[:ramal]) respond_to do |format| if @ramal.save format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' } format.json { render json: @ramal, status: :created, location: @ramal } else format.html { render action: "new" } format.json { render json: @ramal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @alram_test = AlramTest.new(alram_test_params)\n\n respond_to do |format|\n if @alram_test.save\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully created.' }\n format.json { render :show, status: :created, location: @alram_test }\n else\n ...
[ "0.62647176", "0.6159127", "0.6139747", "0.5904928", "0.58909833", "0.57144237", "0.5689884", "0.56723607", "0.56678516", "0.56566787", "0.5625265", "0.56249714", "0.5581306", "0.5573407", "0.55617315", "0.55544114", "0.55317545", "0.55237716", "0.55073404", "0.5501883", "0.5...
0.6398049
0
PUT /ramais/1 PUT /ramais/1.json
def update @ramal = Ramal.find(params[:id]) respond_to do |format| if @ramal.update_attributes(params[:ramal]) format.html { redirect_to @ramal, notice: 'Ramal alterado com sucesso!' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @ramal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.63633907", "0.62695473", "0.60082513", "0.5815193", "0.5811508", "0.5806587", "0.5780349", "0.575386", "0.5732287", "0.56992644", "0.5680876", "0.5667151", "0.56266034", "0.5614791", "0.56132", "0.55970705", "0.55903393", "0.55894816", "0.5581456", "0.55806786", "0.5567762...
0.64180064
0
DELETE /ramais/1 DELETE /ramais/1.json
def destroy @ramal = Ramal.find(params[:id]) @ramal.destroy respond_to do |format| format.html { redirect_to ramais_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @ram = Ram.find(params[:id])\n @ram.destroy\n\n respond_to do |format|\n format.html { redirect_to rams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agronomiaquimica = Agronomia...
[ "0.6928334", "0.68618", "0.6830498", "0.6805777", "0.67912847", "0.6765914", "0.67633367", "0.67621964", "0.6705493", "0.6700462", "0.6693336", "0.6690087", "0.66743857", "0.66685414", "0.6666086", "0.6650989", "0.6650645", "0.6637559", "0.6612084", "0.6610384", "0.6609764", ...
0.71264106
0
Roundcurrent_card returns the current card to be answered.
def current_card @deck.cards[@turns.count] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_card\n deck.cards[@number_correct]\n end", "def current_card\n @deck.cards[0]\n end", "def current_card\n @deck.cards[count]\n end", "def current_value\n @top_card.value\n end", "def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}...
[ "0.71274006", "0.684506", "0.67001146", "0.6378743", "0.6365905", "0.626723", "0.6143609", "0.6140993", "0.6101522", "0.6064676", "0.5985079", "0.59462166", "0.59124285", "0.5901385", "0.58638436", "0.5729679", "0.5653972", "0.56150085", "0.5512238", "0.54952383", "0.5477524"...
0.6961884
1
Roundnumber_correct returns the amount of correct turns.
def number_correct @turns.count do |turn| turn.correct? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def number_correct\n number_correct = 0\n if current_card.answer == turns[turn...
[ "0.757332", "0.7473761", "0.7086687", "0.69440126", "0.6674602", "0.6547134", "0.64087373", "0.628252", "0.6149824", "0.60328215", "0.5950912", "0.5891189", "0.58656573", "0.58065164", "0.5745382", "0.5727601", "0.5712349", "0.5680065", "0.5617594", "0.5581847", "0.5558201", ...
0.7239176
2
Roundnumber_correct_by_category returns the amount of correct turns for a category.
def number_correct_by_category(category_select) # Count the cards that are in the selected category and are guessed correct. @turns.count do |turn| turn.correct? && turn.card.category == category_select end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_correct_by_category(category)\n correct_count = 0\n @turns.each do |turn|\n if turn.correct? == true && turn.card.category == category\n correct_count = correct_count + 1\n end\n end\n correct_count\n end", "def number_correct_by_category(card_category)\n ...
[ "0.8018888", "0.72253853", "0.7200633", "0.70389026", "0.69238466", "0.6730223", "0.63557994", "0.58161545", "0.5798303", "0.57859015", "0.5777151", "0.5755112", "0.5684646", "0.55789167", "0.51984125", "0.5192126", "0.51919246", "0.51919246", "0.50753385", "0.50016093", "0.4...
0.7555791
1
Roundpercent_correct returns the percentage of correct turns.
def percent_correct # Check for divide by zero. Than calculate the percentage otherwise. if @turns.size == 0 0.0 else # Calculate percentage, truncate value to one decimal place. ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end", "def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "def percent_answered\n percent_answered_int.to_s + \"%\"\n end...
[ "0.77676356", "0.67909825", "0.6737275", "0.6528511", "0.6500005", "0.6500005", "0.64801145", "0.6464098", "0.6437641", "0.6375033", "0.6352013", "0.631339", "0.62854767", "0.6267044", "0.6248026", "0.62446785", "0.62335867", "0.62019515", "0.61555326", "0.60859907", "0.60759...
0.80640006
0
Roundpercent_correct_by_category returns the percentage of correct turns for a category.
def percent_correct_by_category(category_select) # Count the current cards in the turns that match the category selected. current_cards_category = @turns.count do |element| element.card.category == category_select end # Check for divide by zero. Than calculate the percentage otherwise. if @turns.size == 0 || current_cards_category == 0 0.0 else # Create numerator and denominator values. numerator = number_correct_by_category(category_select).to_f denominator = current_cards_category.to_f # Calculate percentage, truncate value to one decimal place. ((numerator / denominator) * 100.0).truncate(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_correct_by_category(category)\n if deck.cards_in_category(category).length == 0\n return 0.0\n end\n ((number_correct_by_category(category) / deck.cards_in_category(category).length) * 100).to_f\n end", "def percent_correct_by_category(card_category)\n total_by_category = ...
[ "0.82706606", "0.7738678", "0.6609322", "0.64624184", "0.6341366", "0.62558246", "0.6051206", "0.5940056", "0.5759027", "0.5612803", "0.5532513", "0.5471883", "0.5471883", "0.54557925", "0.5402993", "0.53510064", "0.5346117", "0.534532", "0.52232945", "0.5217081", "0.5202821"...
0.8068352
1
GET a single time entry Return Teamwork::Thing
def time_entry(id) object_from_response(:get, "time_entries/#{id}", "time-entry") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end", "def get_time_entry(xero_tenant_id, project_id, time_entry_id, opts = {})\n data, _status_code, _headers = get_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, opts)\n data\n end", "def show\n @time_entry = Ti...
[ "0.7216528", "0.64349455", "0.6427085", "0.6427085", "0.63918823", "0.6325323", "0.6172379", "0.61543095", "0.59591186", "0.59591186", "0.58810145", "0.5852485", "0.5812675", "0.5774139", "0.57509845", "0.57247037", "0.5698036", "0.5691419", "0.5677621", "0.56744087", "0.5661...
0.74449736
0
PUT a single time entry Return Teamwork::Thing
def update_time_entry(options = {}) object_from_response(:put, "time_entries/#{id}", "time-entry", "time-entry" => options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.6965347", "0.6965347", "0.6869413", "0.6804477", "0.67620814", "0.67620814", "0.6738317", "0.67042065", "0.66030246", "0.65654945", "0.64484155", "0.6312628", "0.6235547", "0.622376", "0.62197775", "0.6194042", "0.61843306", "0.6176379", "0.61600506", "0.6133451", "0.60666...
0.70273554
0
DELETE a single time entry Return boolean
def delete_time_entry(id) send(:delete, "time_entries/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_time_entry(time_entry_id)\n response = basecamp_connection.delete(\"/time_entries/#{time_entry_id}.xml\")\n if response.code == '200'\n return true\n else\n return false\n end\n end", "def delete?(entry)\n not(entry.exist?) or model[:older].nil? or model[:older] >= entry...
[ "0.7285286", "0.7218297", "0.6979128", "0.6944081", "0.6913666", "0.68569213", "0.6728075", "0.6710097", "0.6662161", "0.6651253", "0.6624753", "0.66049844", "0.65162534", "0.65148455", "0.65144026", "0.65035063", "0.64845365", "0.64588827", "0.6442789", "0.64325124", "0.6424...
0.65562683
12
Assumption price data starts on 1/1/1993
def call @swings = [{swing_start_date: Date.new(1993,1,8), swing_start_value: 426.88, change_percent: nil}] @trend_direction = :up @swing_start_value = 426.88 # 1/8/93 bottom @swing_start_date = Date.new(1993,1,8) # 1/8/93 bottom @mark = price_history.first[:high] set_threshold(price_history.first) price_history.each do |ph| binding.pry if ph[:timestamp].to_date == Date.new(2009,3,3) || $stop if @trend_direction == :up record_swing(ph) if ph[:low] < @threshold_value elsif @trend_direction == :down record_swing(ph) if ph[:high] > @threshold_value end set_threshold(ph) end swings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_price\n populate_price_data unless @average_price\n @average_price\n end", "def list_price\n support_product_number = type == 'hw' ? 'HA104A' : 'HA107A'\n year1 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 1, :option_number => option_number)\n...
[ "0.60944486", "0.5973674", "0.59684974", "0.59417224", "0.59039927", "0.5892129", "0.58712965", "0.58702964", "0.5860345", "0.585219", "0.5847461", "0.5839834", "0.5825041", "0.58137023", "0.5777448", "0.5762498", "0.57554483", "0.57260656", "0.57260656", "0.57260656", "0.570...
0.0
-1
Note can be updated w.r.t. scoped attributes combination
def validate_unique_nested_attributes(parent, collection, attribute, options = {}) return true if collection.empty? build_default_options(options) validate_unique_attribute_in_collection(parent, attribute, collection, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes(attrs)\n nattrs = attrs.reduce({}) do |acc, a|\n ak, av = a\n case ak\n when :list, :listed_object, :owner\n else\n acc[ak] = av\n end\n\n acc\n end\n\n super(nattrs)\n end", "def allowed_attributes=(_arg0); end", "def a...
[ "0.64899004", "0.641244", "0.641244", "0.6333127", "0.6332756", "0.63292086", "0.63237935", "0.63237935", "0.63237935", "0.63237935", "0.63027376", "0.6299845", "0.62622494", "0.624722", "0.62281346", "0.62134427", "0.6192202", "0.6165199", "0.6165199", "0.6165199", "0.616519...
0.0
-1
Note can be updated w.r.t. scoped attributes combination
def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {}) types_with_collection = find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name) return true if types_with_collection.blank? build_default_options(options) # Maintains unique values for complete collection hash = {} types_with_collection.each do |component, collection| validate_unique_attribute_in_collection(parent, attribute, collection, options, hash) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes(attrs)\n nattrs = attrs.reduce({}) do |acc, a|\n ak, av = a\n case ak\n when :list, :listed_object, :owner\n else\n acc[ak] = av\n end\n\n acc\n end\n\n super(nattrs)\n end", "def allowed_attributes=(_arg0); end", "def a...
[ "0.64899004", "0.641244", "0.641244", "0.6333127", "0.6332756", "0.63292086", "0.63237935", "0.63237935", "0.63237935", "0.63237935", "0.63027376", "0.6299845", "0.62622494", "0.624722", "0.62281346", "0.62134427", "0.6192202", "0.6165199", "0.6165199", "0.6165199", "0.616519...
0.0
-1
Returns a hash with component as key and its collection as value. component can be at any level but in hash, it is at root level
def find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name) components = find_desired_components(parent, polymorphic_association_name, type.to_s.camelize.constantize) components_with_collection = {} components.each do |component| components_with_collection[component] = component.send(collection_name) components_with_collection[component].each do |collection_element| components_with_collection.merge!(find_types_and_all_collections(collection_element, polymorphic_association_name, type, collection_name)) end end components_with_collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_component_hash(item=nil)\n hash = {}\n items = []\n if(!item.nil?)\n items = item.components\n else\n for comp in @all_components\n if(comp.component_parents.empty?)\n items.push(comp)\n end\n end\n end\n for comp in items\n hash[comp] = all_com...
[ "0.7067134", "0.6437694", "0.6353984", "0.62929446", "0.6229039", "0.61670494", "0.60478646", "0.6025765", "0.5885588", "0.5747066", "0.57324773", "0.5726092", "0.5709676", "0.5709676", "0.56744725", "0.5565158", "0.55234265", "0.5518212", "0.55058384", "0.5493041", "0.545942...
0.0
-1
This method adds an +after_validation+ callback. ==== Parameters +polymorphic_association_name+ Name of the tree polumorphic association with container and component as the name of polymorphic attributes +type+ The component type in which to look for collection +collection_name+ The association name that should be used for fetching collection. +attribute+ The attribute name on the association that should be validated. +options+ It accepts all options that `UniqunessValidator` accepts. Defaults to no options. Supports scope and case_sensitive options
def validates_uniqueness_in_memory_for_tree_polymorphism(polymorphic_association_name, type, collection_name, attribute, options = {}) after_validation do validate_unique_nested_attributes_for_tree_polymorphism self, polymorphic_association_name, type, collection_name, attribute, options end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {})\n types_with_collection = find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name)\n return true if types_with_collectio...
[ "0.58034647", "0.54024005", "0.5094982", "0.4961085", "0.48483062", "0.480316", "0.4736302", "0.46594498", "0.4463328", "0.4432931", "0.4426734", "0.4411381", "0.43567568", "0.43483585", "0.43428823", "0.43267116", "0.43225652", "0.42918825", "0.42668375", "0.426508", "0.4246...
0.70403355
0
GET /managers GET /managers.json
def index query = [] unless params[:key].blank? query << { name: /.*#{params[:key]}.*/ } end query << {} if query.blank? @managers = paginate(Manager.app.and('$or' => query)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn...
[ "0.7909397", "0.7275918", "0.72303885", "0.7041812", "0.70305485", "0.701412", "0.6797675", "0.6748071", "0.6738564", "0.6678143", "0.6617074", "0.6565927", "0.6426277", "0.64221853", "0.6407861", "0.63928187", "0.63652194", "0.62316644", "0.6187057", "0.616267", "0.61027235"...
0.6048514
22
GET /managers/1 GET /managers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @manager = Manager.find(params[:id])\n end", "def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.73483473", "0.73277146", "0.7317662", "0.7131971", "0.7016169", "0.69423395", "0.691309", "0.68484384", "0.6818025", "0.67499816", "0.6664031", "0.66622746", "0.6649192", "0.65549284", "0.6439817", "0.63730985", "0.6346791", "0.6341102", "0.6292437", "0.6277915", "0.625280...
0.0
-1
POST /managers POST /managers.json
def create @manager = Manager.new(manager_params) if @manager.save render :show, status: :created, location: @manager else render json: @manager.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format...
[ "0.721417", "0.67620224", "0.66251385", "0.655345", "0.6453598", "0.63925993", "0.6375221", "0.63662505", "0.6348309", "0.63447255", "0.6299406", "0.629245", "0.6257339", "0.6234327", "0.62203383", "0.61756915", "0.6146879", "0.6106687", "0.6087594", "0.60547906", "0.6016857"...
0.71298426
1
PATCH/PUT /managers/1 PATCH/PUT /managers/1.json
def update if @manager.update(manager_params) render :show, status: :ok, location: @manager else render json: @manager.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render action: \...
[ "0.7064366", "0.6836373", "0.6717311", "0.6465882", "0.6377686", "0.61917645", "0.6190939", "0.6180217", "0.6164062", "0.60747576", "0.6058564", "0.6055788", "0.60408944", "0.5949687", "0.5901606", "0.5883272", "0.5869366", "0.583059", "0.58106047", "0.5810209", "0.5802248", ...
0.67525965
2
DELETE /managers/1 DELETE /managers/1.json
def destroy @manager.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |fo...
[ "0.7904788", "0.78689444", "0.74837434", "0.7243191", "0.72422427", "0.7089869", "0.70372486", "0.701016", "0.70077926", "0.6970911", "0.6880537", "0.6847453", "0.68360025", "0.6789581", "0.67398727", "0.6734186", "0.6712372", "0.66943264", "0.66681415", "0.66623986", "0.6647...
0.6961436
10
Use callbacks to share common setup or constraints between actions.
def set_manager @manager = Manager.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 manager_params params.fetch(:manager, {}).permit! 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
GET /brothers GET /brothers.xml
def index @brothers = Brother.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @brothers } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # ...
[ "0.73023427", "0.64718395", "0.619665", "0.6172347", "0.61217886", "0.6118232", "0.6065591", "0.6045527", "0.6019558", "0.59852296", "0.59852296", "0.59692013", "0.5957953", "0.59242517", "0.59165835", "0.58907324", "0.58901817", "0.58817494", "0.58806276", "0.5870787", "0.58...
0.7340559
0
GET /brothers/1 GET /brothers/1.xml
def show @brothers = Brother.all @brother = Brother.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @brother } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rend...
[ "0.7219056", "0.63309246", "0.6278176", "0.6262042", "0.6239098", "0.611427", "0.6110006", "0.6108222", "0.6091106", "0.609063", "0.60477924", "0.60189563", "0.6010542", "0.6006859", "0.6006859", "0.5982755", "0.5959786", "0.5951936", "0.59075636", "0.59024906", "0.5885215", ...
0.7269294
0
GET /brothers/new GET /brothers/new.xml
def new @brother = Brother.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @brother } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bro...
[ "0.71615607", "0.71490526", "0.71388006", "0.7043233", "0.7028396", "0.70106125", "0.70029837", "0.69805753", "0.6937177", "0.691787", "0.69136286", "0.68756163", "0.6863917", "0.68307054", "0.68270946", "0.6811362", "0.6790906", "0.6787047", "0.67855257", "0.6775386", "0.677...
0.78451896
0
POST /brothers POST /brothers.xml
def create @brother = Brother.new(params[:brother]) respond_to do |format| if @brother.save flash[:notice] = 'Brother was successfully created.' format.html { render :back } format.xml { render :xml => @brother, :status => :created, :location => @brother } else format.html { render :action => "new" } format.xml { render :xml => @brother.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r...
[ "0.61392224", "0.6081564", "0.58604574", "0.5848659", "0.55267984", "0.5439152", "0.54050064", "0.5393558", "0.53862566", "0.53813714", "0.5363521", "0.5346834", "0.5332638", "0.5318381", "0.5315566", "0.53073955", "0.5303928", "0.5262948", "0.5262113", "0.52343315", "0.52331...
0.6692793
0
PUT /brothers/1 PUT /brothers/1.xml
def update @brother = Brother.find(params[:id]) respond_to do |format| if @brother.update_attributes(params[:brother]) flash[:notice] = 'Brother was successfully updated.' format.html { redirect_to roster_show_path(@brother) } format.xml { head :ok } else #debugger format.html { render :action => "edit" } format.xml { render :xml => @brother.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def upd...
[ "0.61944085", "0.61622566", "0.6067706", "0.60124433", "0.587071", "0.5719319", "0.55922663", "0.55847657", "0.55485606", "0.54673594", "0.5457736", "0.5447154", "0.5438106", "0.54122555", "0.5402323", "0.53718936", "0.5357636", "0.5349355", "0.5331841", "0.53261787", "0.5319...
0.6233822
0
DELETE /brothers/1 DELETE /brothers/1.xml
def destroy @brother = Brother.find(params[:id]) @brother.destroy respond_to do |format| format.html { redirect_to(brothers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(brow...
[ "0.6724334", "0.6706081", "0.6682589", "0.6617006", "0.64082694", "0.6338538", "0.63118607", "0.6292326", "0.62902135", "0.6250445", "0.62392855", "0.62373847", "0.6232365", "0.6214394", "0.62100387", "0.62057966", "0.61704373", "0.61657697", "0.6152545", "0.61333907", "0.612...
0.7327873
0
GET /questionnaires/1 GET /questionnaires/1.json
def show @questionnaire = Questionnaire.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @questionnaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n ...
[ "0.742471", "0.7290521", "0.6979919", "0.68588394", "0.68273973", "0.670289", "0.667116", "0.6660555", "0.6644325", "0.662616", "0.6584409", "0.6584409", "0.6584409", "0.65730816", "0.65534264", "0.65438294", "0.6525332", "0.65009725", "0.6489891", "0.6481722", "0.646325", ...
0.7089278
3
author ahmed jihad called to show answer view for questionnaires finds the selected questionnaire Args :
def answer_show @questionnaire = Questionnaire.find(params[:id]) answer = @questionnaire.answer_questionnaires.build render 'answer_show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n idx = params[:id]\n @question = Question.find(params[:id])\n @newAnswer = Answer.new(:question_id => params[:id])\n @Answers = Answer.where(question_id: idx)\n @answer = Answer.all\n end", "def show\n @question = Question.find(params[:id])\n @answerlist = Answer.where(\"question_...
[ "0.7262069", "0.72015166", "0.69205433", "0.68985146", "0.68927073", "0.6833385", "0.67852485", "0.67852485", "0.67852485", "0.6750978", "0.6734262", "0.6731386", "0.67247146", "0.6673209", "0.6656468", "0.6646929", "0.6636093", "0.6631575", "0.65606964", "0.6538327", "0.6537...
0.75555646
0
Send to reviewer Questionnaire Args :
def sendQuestionnaire email=params[:email] emails=email.split(",") description=params[:description] questionnaire_id = params[:questionnaire_id] emails.each do |one| ReviewerInviter.task_invitation(one, description, "http://localhost:3000/questionnaires/answer_show?id="+questionnaire_id).deliver() end respond_to do |format| format.html { redirect_to(:back) } #, flash[:success] = "holder updated") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rreply_params\n params.require(:rreply).permit(:text, :user_id, :relpy_id)\n end", "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @descriptio...
[ "0.64253783", "0.64250964", "0.6405494", "0.6399295", "0.6331919", "0.629761", "0.62583584", "0.6222392", "0.61396784", "0.6128877", "0.6072317", "0.604679", "0.60286707", "0.6027854", "0.6021975", "0.5994871", "0.59911704", "0.5988208", "0.5962552", "0.59617734", "0.595377",...
0.65418077
0
GET /questionnaires/new GET /questionnaires/new.json
def new @project = Project.find(params[:project_id]) @questionnaire = Questionnaire.new question = @questionnaire.qquestions.build respond_to do |format| format.html # new.html.erb format.json { render json: @questionnaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render j...
[ "0.7892105", "0.76516545", "0.76516545", "0.76516545", "0.76516545", "0.76516545", "0.76293546", "0.76174647", "0.7589048", "0.7588852", "0.7582643", "0.75260043", "0.7442386", "0.7421873", "0.74044603", "0.7374837", "0.73635507", "0.736207", "0.73514986", "0.73323613", "0.73...
0.7293158
28
POST /questionnaires POST /questionnaires.json
def create @project = Project.find(params[:questionnaire][:project_id]) @questionnaire = Questionnaire.new(params[:questionnaire]) respond_to do |format| if @questionnaire.save format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' } format.json { render json: @questionnaire, status: :created, location: @questionnaire } format.js { render "redirect" } else format.html { render action: "new" } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } format.js {render "validation_error"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redire...
[ "0.6628127", "0.6585721", "0.6516484", "0.6485117", "0.6454647", "0.6394063", "0.6381477", "0.63798666", "0.63659567", "0.63437366", "0.6333206", "0.63324606", "0.62913746", "0.6288558", "0.6235486", "0.6231012", "0.6214164", "0.6159615", "0.614689", "0.6143025", "0.61364704"...
0.59409505
47
author ahmed jihad called to update questionnaire questions or answers finds the selected questionnaire Args :
def update @questionnaire = Questionnaire.find(params[:id]) respond_to do |format| if @questionnaire.update_attributes(params[:questionnaire]) format.html { redirect_to "http://localhost:3000/questionnaires/finish"} format.json { head :no_content } format.js { render "redirect" } else format.html { render "http://localhost:3000/questionnaires/finish" } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } format.js {render "validation_error"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(questionnaire_params)\n for qid in params[:question].keys\n @q...
[ "0.74206066", "0.710176", "0.6869177", "0.67881596", "0.6744114", "0.6714786", "0.6694838", "0.6653741", "0.6587967", "0.65695393", "0.6559974", "0.65345615", "0.65164286", "0.64954233", "0.64361286", "0.6400128", "0.6400128", "0.6400128", "0.6399558", "0.6358398", "0.6351486...
0.0
-1
DELETE /questionnaires/1 DELETE /questionnaires/1.json
def destroy @questionnaire = Questionnaire.find(params[:id]) @questionnaire.destroy respond_to do |format| format.html { redirect_to questionnaires_url(:project_id =>@questionnaire.project_id) } format.json { head :no_content } format.js {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n f...
[ "0.7898324", "0.7862014", "0.7862014", "0.7656997", "0.75277", "0.7525976", "0.74903286", "0.74424833", "0.742435", "0.73963", "0.7379923", "0.7351437", "0.73412085", "0.73230916", "0.7314", "0.7314", "0.7314", "0.7314", "0.7314", "0.7314", "0.7312036", "0.72998637", "0.7...
0.72889656
22
Question 3: Refactor this code to make the code easier to predict and easier to maintain
def tricky_method(a_string_param, an_array_param) a_string_param += 'rutabaga' an_array_param << 'rutabaga' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def suivre; end", "def schubert; end", "def king_richard_iii; end", "def operations; end", "def operations; end", "def checks; end", "def intensifier; end", "def corrections; end", "def romeo_and_juliet; end", "def the_lineup #in ...
[ "0.58899784", "0.5832999", "0.5825437", "0.5734952", "0.5607078", "0.5379304", "0.53591335", "0.53591335", "0.53446674", "0.53311086", "0.53199476", "0.53168017", "0.5308121", "0.52303857", "0.5219724", "0.52077264", "0.5207246", "0.5196998", "0.51668805", "0.5161702", "0.515...
0.0
-1
Yep, the munsters are in trouble. The param is sent as a pointer Their data is toasted Question: 7 Method calls and expressions as arguments
def rps(fist1, fist2) if fist1 == 'rock' (fist2 == 'paper') ? 'paper' : 'rock' elsif fist1 == 'paper' (fist2 == 'scissors') ? 'scissors' : 'paper' else (fist2 == 'rock') ? 'rock' : 'scissors' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method(p0) end", "def probers=(_arg0); end", "def PO114=(arg)", "def PO105=(arg)", "def PO104=(arg)", "def PO109=(arg)", "def PO110=(arg)", "def mech=(_arg0); end", "def mech=(_arg0); end", "def PO113=(arg)", "def PO115=(arg)", "def PO107=(arg)", "def call(*args); end", "def PO101=(ar...
[ "0.69950706", "0.68640774", "0.6839202", "0.6766216", "0.6753842", "0.6682509", "0.667608", "0.6633849", "0.6633849", "0.6625599", "0.66199726", "0.6606844", "0.6606266", "0.6594485", "0.6583766", "0.6583766", "0.6579545", "0.65688384", "0.65301424", "0.65045786", "0.650179",...
0.0
-1
=> I expect paper Question 8: Consider these two methods
def foo(param = 'no') 'yes' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def probers; end", "def same; end", "def private; end", "def offences_by; end", "def silly_adjective; end", "def internship_passed; end", "def schubert; end", "def p15\n\t\nend", "def king_richard_iii; end", "def specie; end", "def specie; end", "def specie; end", "de...
[ "0.6544556", "0.63925976", "0.6364433", "0.632286", "0.618429", "0.6174567", "0.6070858", "0.60633785", "0.60516167", "0.58584106", "0.57876784", "0.57876784", "0.57876784", "0.57876784", "0.57749796", "0.5757714", "0.57507384", "0.5699419", "0.56896853", "0.5680971", "0.5674...
0.0
-1
def display_html html = ""
def find_and_mark_done(name) item = items.find{|e| e.name == name} puts "finding |#{name}|" if item item.mark_done! else puts "item not found: #{name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html *args\n @html = true if args.size > 0\n @html\n end", "def html?; end", "def html?; end", "def html?; end", "def html=(b); end", "def html_markup_html(text); end", "def inner_html(*args); end", "def inner_html(*args); end", "def html\n @html ||= process_html!\n end", ...
[ "0.7678645", "0.7624033", "0.7624033", "0.7624033", "0.7325592", "0.73001677", "0.728522", "0.728522", "0.7198892", "0.7196845", "0.7144725", "0.7139788", "0.71388805", "0.71388805", "0.71388805", "0.71388805", "0.7114885", "0.70977515", "0.70740926", "0.703106", "0.7012978",...
0.0
-1
GET /test_results/1 GET /test_results/1.json
def show @test_result = TestResult.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @test_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_results(test_id)\n if !(/\\A\\d+\\z/ === test_id.to_s)\n print \"ERROR: get_results called with non-numeric :test_id = '#{test_id}'\\n\"\n exit -1\n end\n uri = \"get_results/#{test_id}\"\n begin\n @all_results = @tr_con.send_get(uri)\n rescue Exception => ex\n pr...
[ "0.7090772", "0.7015706", "0.69446945", "0.6914466", "0.69076174", "0.68909407", "0.6815277", "0.6809064", "0.67920184", "0.67350894", "0.6675372", "0.6635104", "0.66128606", "0.6562649", "0.6532864", "0.6493189", "0.6473844", "0.6472095", "0.6424695", "0.63957787", "0.635841...
0.7047055
1
GET /test_results/new GET /test_results/new.json
def new @test_result = TestResult.new respond_to do |format| format.html # new.html.erb format.json { render json: @test_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render jso...
[ "0.7486512", "0.7464759", "0.7310779", "0.7304909", "0.71513826", "0.7114189", "0.7114189", "0.71105796", "0.70877385", "0.70877385", "0.70877385", "0.70877385", "0.70831954", "0.70797867", "0.70424134", "0.7036366", "0.6900908", "0.68955636", "0.68915385", "0.68748975", "0.6...
0.78427535
0
POST /test_results POST /test_results.json
def create @test_result = TestResult.new(params[:test_result]) respond_to do |format| if @test_result.save format.html { redirect_to @test_result, notice: 'Test result was successfully created.' } format.json { render json: @test_result, status: :created, location: @test_result } else format.html { render action: "new" } format.json { render json: @test_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @test_result = TestResult.new(test_result_params)\n\n respond_to do |format|\n if @test_result.save\n format.html { redi...
[ "0.752083", "0.6911543", "0.6891898", "0.664816", "0.65713704", "0.6549887", "0.653845", "0.6536352", "0.6436746", "0.6381427", "0.6362798", "0.63226426", "0.62948805", "0.6285781", "0.62823325", "0.6278133", "0.6271401", "0.62658215", "0.62624955", "0.6257092", "0.6234423", ...
0.679325
3
PUT /test_results/1 PUT /test_results/1.json
def update @test_result = TestResult.find(params[:id]) respond_to do |format| if @test_result.update_attributes(params[:test_result]) format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @test_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit, sta...
[ "0.6577382", "0.65503144", "0.6545797", "0.6506658", "0.63523626", "0.6328727", "0.63231087", "0.6296146", "0.62795126", "0.61922", "0.6187594", "0.61627996", "0.6160539", "0.61596817", "0.61444026", "0.61444026", "0.61444026", "0.6138076", "0.6122951", "0.6120557", "0.608582...
0.6770564
0
DELETE /test_results/1 DELETE /test_results/1.json
def destroy @test_result = TestResult.find(params[:id]) @test_result.destroy respond_to do |format| format.html { redirect_to test_results_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\...
[ "0.7386734", "0.7290677", "0.72806805", "0.7278433", "0.7278433", "0.72536355", "0.7250621", "0.721006", "0.72016776", "0.72016776", "0.7165767", "0.71167696", "0.70826536", "0.7032146", "0.70120174", "0.7005103", "0.6998391", "0.6984183", "0.6984183", "0.6984183", "0.6984183...
0.7513926
0
Adding a Constructor here!
def initialize(name, color, mass_kg, distance_from_the_sun_km, fun_fact) unless mass_kg > 0 raise ArgumentError 'Mass must be a number greater than zero.' end unless distance_from_the_sun_km > 0 raise ArgumentError 'Distance from sun must be a number greater than zero.' end @name = name @color = color @mass_kg = mass_kg @distance_from_the_sun_km = distance_from_the_sun_km @fun_fact = fun_fact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constructor; end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def construct\n end", "def initialize() end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "de...
[ "0.8899815", "0.81922567", "0.81922567", "0.81922567", "0.81922567", "0.81922567", "0.81420296", "0.8036487", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7928958", "0.7842268...
0.0
-1
You probably want to override this method to return a realistic date
def soonest_delivery_date_for_order(order) Date.today end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date; end", "def date; end", "def date; end", "def date; end", "def get_date()\n @date\n end", "def get_date()\n @date\n end", "def to_date()\n #This is a stub, used for indexing\n end", "def date() self[:date]; end", "def easy_date; date; end", "def get_date\n format_dat...
[ "0.81774956", "0.81774956", "0.81774956", "0.81774956", "0.7845115", "0.7845115", "0.77335334", "0.77163243", "0.770608", "0.7659976", "0.7540777", "0.7540777", "0.7504187", "0.7501587", "0.7501587", "0.7485098", "0.7485098", "0.74611413", "0.73561656", "0.7317922", "0.731398...
0.0
-1
GET /schools GET /schools.xml
def index @countries = Country.has_cities @country = @countries.first @states = @country.states @state = @states.first @cities = @state.cities @city = @cities.first if params[:school] @school = School.new(params[:school]) if params[:state] country_id = params[:state][:country_id] end if params[:city] state_id = params[:city][:state_id] end city_id = params[:school][:city_id] end if country_id country = Country.find_by_id(country_id) @states = country.states @state = State.new @state.country_id = country_id end if state_id state = State.find_by_id(state_id) @cities = state.cities @city = City.new @city.state_id = state_id end cond = School.paginated_schools_conditions_with_search(params) @schools = School.paginate :include => [{:city => {:state => :country}}], :conditions => cond.to_sql, :page => params[:page], :per_page => 10 respond_to do |format| format.html # index.html.erb format.xml { render :xml => @schools } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { rend...
[ "0.74211276", "0.68780357", "0.68492496", "0.68069446", "0.66417164", "0.6547339", "0.6533931", "0.64007646", "0.6354918", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.62600386", "0.62482214", "0.62381995", "0.6223732", "0.6195...
0.0
-1
GET /schools/1 GET /schools/1.xml
def show @school = School.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @school } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @school }\n end\n end", "...
[ "0.7350768", "0.69110984", "0.679336", "0.6679314", "0.6603744", "0.65010524", "0.633042", "0.6311579", "0.62451464", "0.62447923", "0.6243469", "0.6231281", "0.623046", "0.6227592", "0.61801016", "0.617874", "0.61722845", "0.61722845", "0.61722845", "0.61722845", "0.61722845...
0.70818865
1
GET /schools/new GET /schools/new.xml
def new @countries = Country.has_cities @country = @countries.first @states = @country.states @state = @states.first @cities = @state.cities @city = @cities.first @school = School.new @school.type_school = "University" @department_categories = DepartmentCategory.find(:all) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @school } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def new\n ...
[ "0.76038694", "0.75779456", "0.75358725", "0.72791266", "0.7045811", "0.6938775", "0.69360745", "0.69360745", "0.6888402", "0.68505174", "0.6841738", "0.68319005", "0.68319005", "0.68319005", "0.68319005", "0.6770987", "0.6739526", "0.6737027", "0.6721689", "0.67190343", "0.6...
0.0
-1
POST /schools POST /schools.xml
def create params[:school][:department_ids] = params[:department_select] @school = School.new(params[:school]) respond_to do |format| if @school.save flash[:notice] = 'School was successfully created.' format.html { redirect_to(@school) } format.xml { render :xml => @school, :status => :created, :location => @school } else format.html { render :action => "new" } format.xml { render :xml => @school.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n respond_to do |format|\n if @school.save\n flash[:notice] = 'School was successfully created.'\n format.html { redirect_to(@school) }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => ...
[ "0.62098026", "0.61278695", "0.6075107", "0.6022573", "0.6015177", "0.5993964", "0.5993964", "0.5993964", "0.59937733", "0.5983247", "0.5975131", "0.5913685", "0.58924127", "0.5887726", "0.5885334", "0.58570224", "0.5855509", "0.5842103", "0.58084106", "0.576172", "0.5755077"...
0.5934205
11
PUT /schools/1 PUT /schools/1.xml
def update params[:school][:department_ids] = params[:department_select] params[:school][:department_ids] ||= [] @school = School.find(params[:id]) respond_to do |format| if @school.update_attributes(params[:school]) flash[:notice] = 'School was successfully updated.' format.html { redirect_to(@school) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @school.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = 'School was successfully updated.'\n format.html { redirect_to(@school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.x...
[ "0.6344708", "0.62049484", "0.61586577", "0.60317445", "0.60317445", "0.59912884", "0.5926353", "0.5900351", "0.58999753", "0.5894096", "0.5848122", "0.58429426", "0.58210665", "0.57818854", "0.5775242", "0.5775242", "0.5775242", "0.5775242", "0.57613486", "0.5742668", "0.573...
0.5356405
89
DELETE /schools/1 DELETE /schools/1.xml
def destroy @school = School.find(params[:id]) @school.destroy respond_to do |format| format.html { redirect_to(schools_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school_rec = SchoolRec.find(params[:id])\n @school_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(scho...
[ "0.7277967", "0.69591266", "0.6726892", "0.6639786", "0.6625366", "0.66029966", "0.65740836", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.65432864", "0.65332454", "0.65332454", "0.65231234", "0.6508441", "0.65078074", "0.6503284", "0.64849...
0.7190573
1
Create a new Session object.
def initialize ext_initialize @headers = {} @timeout = 5 @connect_timeout = 1 @max_redirects = 5 @auth_type = :basic end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session\n @connection.create_session(@config || {})\n end", "def new\n @session = Session.new\n end", "def new\n @session = Session.new('')\n end", "def new\n @session = Session.new\n end", "def create!(*args)\n session = new(*args)\n session.s...
[ "0.81259", "0.8082606", "0.80345243", "0.78859913", "0.7856406", "0.76827085", "0.7644303", "0.7644303", "0.7546965", "0.7520553", "0.7477961", "0.7416137", "0.7335377", "0.72374004", "0.72347605", "0.7223382", "0.70416176", "0.7013106", "0.6928517", "0.68244666", "0.6803797"...
0.0
-1
Makes this session handle cookies and store them in in +file+. If file is nil they will be stored in memory. Otherwise the +file+ must be readable and writable. Calling multiple times will add more files.
def handle_cookies(file = nil) if file path = Pathname(file).expand_path unless File.exists?(file) and File.writable?(path.dirname) raise ArgumentError, "Can't create file #{path} (permission error)" end unless File.readable?(file) or File.writable?(path) raise ArgumentError, "Cant read or write file #{path} (permission error)" end end enable_cookie_session(path.to_s) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_cookies(file_path = nil)\n if file_path\n path = Pathname(file_path).expand_path\n \n if !File.exist?(file_path) && !File.writable?(path.dirname)\n raise ArgumentError, \"Can't create file #{path} (permission error)\"\n elsif File.exist?(file_path) && !File.writ...
[ "0.7640086", "0.6427692", "0.5976608", "0.58384496", "0.5711887", "0.5650596", "0.5573927", "0.5558675", "0.5527936", "0.54916537", "0.54678315", "0.54678315", "0.54677385", "0.5453353", "0.5447955", "0.54229385", "0.53891724", "0.5345292", "0.5298096", "0.5278311", "0.526418...
0.7927546
0
Enable debug output to stderr or to specified +file+.
def enable_debug(file = nil) set_debug_file(file.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_debug(file = nil)\n set_debug_file(file.to_s)\n self\n end", "def debug_output_file\n \"debug.log\"\nend", "def toggle_debug!\n stream = @config[:debug]\n\n if stream.respond_to?(:<<)\n self.class.debug_output(stream)\n else\n self.class.debug_output\n ...
[ "0.82929975", "0.62470144", "0.6213392", "0.60847056", "0.6025371", "0.6018709", "0.6002329", "0.59215146", "0.5903736", "0.58767444", "0.58767444", "0.57986104", "0.57913", "0.57783", "0.5774603", "0.5730017", "0.5712333", "0.5695378", "0.5695378", "0.5695378", "0.5693432", ...
0.8562488
0
Standard HTTP methods Retrieve the contents of the specified +url+ optionally sending the specified headers. If the +base_url+ varaible is set then it is prepended to the +url+ parameter. Any custom headers are merged with the contents of the +headers+ instance variable. The results are returned in a Response object.
def get(url, headers = {}) request(:get, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_get(url, headers = nil)\r\n if @debug\r\n puts \"Url:\"\r\n puts url\r\n puts \"Headers:\"\r\n puts headers\r\n puts \"Method: get\"\r\n end\r\n return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)\r\n end", "d...
[ "0.7283731", "0.71932936", "0.7192051", "0.71860546", "0.7093546", "0.703312", "0.6989699", "0.69417363", "0.682362", "0.6663895", "0.65506315", "0.65404683", "0.64748234", "0.6418373", "0.6376168", "0.6369659", "0.63430905", "0.63385147", "0.63332516", "0.63318837", "0.63154...
0.70560026
6
Retrieve the contents of the specified +url+ as with get, but the content at the URL is downloaded directly into the specified file.
def get_file(url, filename, headers = {}) request(:get, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(url)\n get(url).body\n end", "def download(url)\n base.get(url, @file_path)\n end", "def get_file(url); end", "def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[...
[ "0.79038", "0.7791441", "0.769305", "0.75306726", "0.74581724", "0.73947024", "0.73778355", "0.7324321", "0.7290571", "0.7229452", "0.72261715", "0.71676457", "0.71401834", "0.71383923", "0.71097827", "0.7089557", "0.7012982", "0.7004438", "0.6993213", "0.6952971", "0.6941649...
0.7537253
4
As get but sends an HTTP HEAD request.
def head(url, headers = {}) request(:head, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_head(uri)\n http(uri, :http_method => 'head')\n end", "def head(path)\n request 'HEAD', path\n end", "def http_head\n return @head if defined?(@head)\n begin\n @head = conn.request(http_request(:head, resource[:source]))\n fail \"#{resource[:http_verb].to_s.upcase} #{resour...
[ "0.837392", "0.8187441", "0.79853916", "0.79156905", "0.79047054", "0.7839666", "0.78246075", "0.7803132", "0.7708244", "0.76019067", "0.75893474", "0.757676", "0.7562139", "0.7516168", "0.74991333", "0.7486548", "0.74862504", "0.74763346", "0.7430044", "0.7418557", "0.738630...
0.78779715
6
As get but sends an HTTP DELETE request.
def delete(url, headers = {}) request(:delete, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n request(:delete)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n ur...
[ "0.83651096", "0.83651096", "0.83648396", "0.8294889", "0.8294889", "0.81782633", "0.8162452", "0.8137911", "0.8127244", "0.80570513", "0.802647", "0.8014162", "0.7993609", "0.79910666", "0.79335636", "0.79335636", "0.79335636", "0.79335636", "0.78423196", "0.7830619", "0.778...
0.7492192
33
Uploads the passed +data+ to the specified +url+ using HTTP PUT. +data+ must be a string.
def put(url, data, headers = {}) request(:put, url, headers, :data => data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n ...
[ "0.77118224", "0.7607027", "0.7374744", "0.7371776", "0.73673177", "0.7344699", "0.73156166", "0.73110235", "0.7270493", "0.72618616", "0.7184285", "0.70555466", "0.7042689", "0.6990701", "0.698433", "0.69083244", "0.6903627", "0.6879228", "0.68719953", "0.68228966", "0.68113...
0.8293644
1
Uploads the contents of a file to the specified +url+ using HTTP PUT.
def put_file(url, filename, headers = {}) request(:put, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put url, body, headers = {}\n http_requ...
[ "0.7282661", "0.7282661", "0.7264141", "0.7235265", "0.7119471", "0.693486", "0.6930544", "0.6883299", "0.6877091", "0.68665636", "0.68636316", "0.68402976", "0.68169767", "0.6750699", "0.66450846", "0.6615274", "0.65965635", "0.6585323", "0.64565015", "0.6437783", "0.6432159...
0.8358026
1
Uploads the passed +data+ to the specified +url+ using HTTP POST. +data+ must be a string.
def post(url, data, headers = {}) request(:post, url, headers, :data => data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n ...
[ "0.73014164", "0.710283", "0.6953084", "0.6922987", "0.681095", "0.6749596", "0.67080754", "0.66812557", "0.66390383", "0.6630966", "0.6600273", "0.65825564", "0.6553531", "0.65181434", "0.64601964", "0.644824", "0.64291996", "0.6427009", "0.6342407", "0.6341938", "0.6328047"...
0.71998215
1
Uploads the contents of a file to the specified +url+ using HTTP POST.
def post_file(url, filename, headers = {}) request(:post, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n fil...
[ "0.72392786", "0.72392786", "0.7205245", "0.7163972", "0.68863684", "0.6812116", "0.67100185", "0.67100185", "0.6650342", "0.6631915", "0.66068155", "0.65517277", "0.6490836", "0.64717126", "0.6429676", "0.6407607", "0.63749534", "0.63616776", "0.6282497", "0.6279639", "0.627...
0.78589755
1
WebDAV methods Sends a WebDAV COPY request to the specified +url+.
def copy(url, dest, headers = {}) headers['Destination'] = dest request(:copy, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_copy(src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/fileops/copy/\",data).body_str\n end", "def http_copy(request, response)\n path = request.path\n\n copy_info = @server.copy_and_move_info(request)\n\n return false unless @server.emit('beforeBind', [copy...
[ "0.632978", "0.6106217", "0.5981723", "0.5804542", "0.5715317", "0.5651573", "0.5603437", "0.55654824", "0.55093294", "0.5505272", "0.54435843", "0.5443364", "0.54273534", "0.5416223", "0.5378505", "0.53065944", "0.5273033", "0.5161088", "0.5085909", "0.5072235", "0.50692123"...
0.66529083
0
Basic API methods Send an HTTP request to the specified +url+.
def request(action, url, headers, options = {}) # If the Expect header isn't set uploads are really slow headers['Expect'] ||= '' req = Request.new req.action = action req.timeout = self.timeout req.connect_timeout = self.connect_timeout req.max_redirects = self.max_redirects req.headers = self.headers.merge(headers) req.username = self.username req.password = self.password req.upload_data = options[:data] req.file_name = options[:file] req.proxy = proxy req.auth_type = auth_type req.insecure = insecure req.url = self.base_url.to_s + url.to_s raise ArgumentError, "Empty URL" if req.url.empty? handle_request(req) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request(url)\n verify_credentials!\n\n api_response = nil\n\n complete_url = Applitrack.api_base + url\n uri = URI(complete_url)\n\n Net::HTTP.start(uri.host, uri.port,\n use_ssl: uri.scheme == 'https') do |http|\n\n request = Net::HTTP::Get.new(uri.request_uri)\n ...
[ "0.79592663", "0.7614962", "0.7466754", "0.7462733", "0.7396056", "0.73940516", "0.72606236", "0.721372", "0.7203003", "0.71396554", "0.7120782", "0.7119559", "0.7089201", "0.7065934", "0.7027009", "0.70258313", "0.70136625", "0.70115995", "0.698858", "0.69823205", "0.6959145...
0.0
-1
Look for relevent nodes only
def parse_for_relevant_nodes @relevant_nodes = Array.new reduce(params[:api_response].to_hash)['data'].each do | node | if node[1]['from']['id'] == params[:friend_id] @relevant_nodes << node[1] elsif node[1]['tags'] node[1]['tags']['data'].each do |tagged_person| if tagged_person['id'] == params[:friend_id] @relevant_nodes << node[1] end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scanned_node?(node); end", "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def find_nodes\...
[ "0.67313445", "0.6549524", "0.6465936", "0.63065237", "0.6198803", "0.61699826", "0.60993725", "0.6084471", "0.5930449", "0.5846096", "0.58442694", "0.58442694", "0.58442694", "0.5839834", "0.58339185", "0.57709146", "0.5754333", "0.571414", "0.57138354", "0.57138354", "0.568...
0.5916563
9
For some reason Facebook's JavaScript SDK behaves differently when making API calls to OpenGraph This does a depth first traversal on the API response, look for the data key, and raises its contents by one depth
def reduce(nodes) for node in nodes if node.class==ActiveSupport::HashWithIndifferentAccess && node['data'] data_array = Array.new node['data'].map{|element| data_array << element[1]} node['data'] = data_array end if node.class==Array || node.class == ActiveSupport::HashWithIndifferentAccess reduce (node) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_data_about(item, keys = {})\n begin\n res = JSON.parse(token_get(item) || \"{}\") \n keys[:as] ? res[keys[:as]] : res\n rescue SocketError, Errno::ECONNRESET, OAuth2::HTTPError, EOFError => e\n # TODO :: hoptoad\n nil\n end\n end", "def test_relationship_influenced_by_s...
[ "0.5702398", "0.5528554", "0.53503996", "0.5350021", "0.5340665", "0.52850944", "0.5276702", "0.52592266", "0.51877254", "0.5162874", "0.5088703", "0.5076619", "0.5071235", "0.5067893", "0.50149167", "0.4974086", "0.4971136", "0.49441186", "0.49012846", "0.48938686", "0.48807...
0.0
-1
Looking for all Helper checks, which by convention start with attribute 'helper_start_with' value. Returns a array of strings, method names.
def __list_helper_methods # avoiding '__self__' and '__id__' symbols with last regex part methods.grep(/^#{@@helper_start_with}.*?[^__]$/) do |method| method.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_helper_methods\n @helper_methods ||= __list_helper_methods\n @check_methods ||= __list_check_methods\n end", "def __list_check_methods\n methods.grep(/^#{@@checks_start_with}/) do |method|\n method.to_s\n end\n end", "def all_application_helpers\n extract =...
[ "0.7056782", "0.65636903", "0.64053917", "0.6373913", "0.6370293", "0.63323843", "0.6151387", "0.60207075", "0.59538853", "0.58915854", "0.58915854", "0.58915854", "0.58915854", "0.5873438", "0.585504", "0.5682456", "0.5680701", "0.56630313", "0.5651014", "0.55674255", "0.555...
0.7836861
0
Look for method names that start with attribute 'checks_start_with' value. Returns a array of strings.
def __list_check_methods methods.grep(/^#{@@checks_start_with}/) do |method| method.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_methods_matching_orig name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n...
[ "0.57357746", "0.5697502", "0.5663597", "0.5624484", "0.55450225", "0.55113536", "0.5456413", "0.5442157", "0.54063785", "0.53691465", "0.53523296", "0.53294444", "0.532096", "0.5291416", "0.52908707", "0.52880853", "0.527789", "0.5270463", "0.5265387", "0.5263434", "0.525366...
0.7139151
0
Similar to match_at, but returns true/false instead of MatchData.
def match_at? rexp, pos = 0 MatchAt.match_at? self, rexp, pos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_at? str, pos = 0\n MatchAt.match_at? str, self, pos\n end", "def match\n true\n end", "def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(match,...
[ "0.6808222", "0.65436393", "0.6475774", "0.6337492", "0.6333967", "0.6198542", "0.6183951", "0.61207825", "0.61140245", "0.60911065", "0.6012992", "0.5974394", "0.5970091", "0.5938045", "0.59349865", "0.59241116", "0.5920414", "0.5920414", "0.58675194", "0.58136535", "0.58136...
0.71745735
0
Similar to match_at, but returns true/false instead of MatchData.
def match_at? str, pos = 0 MatchAt.match_at? str, self, pos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_at? rexp, pos = 0\n MatchAt.match_at? self, rexp, pos\n end", "def match\n true\n end", "def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(matc...
[ "0.7175366", "0.6542506", "0.64755857", "0.633668", "0.63326687", "0.6198063", "0.61816543", "0.6119996", "0.6113595", "0.6090158", "0.6011942", "0.5973166", "0.59689164", "0.5936663", "0.59348756", "0.5923703", "0.5919135", "0.5919135", "0.586688", "0.5812098", "0.5812098", ...
0.6807798
1
I worked on this challenge by myself. longest_string is a method that takes an array of strings as its input and returns the longest string +list_of_words+ is an array of strings longest_string(list_of_words) should return the longest string in +list_of_words+ If +list_of_words+ is empty the method should return nil Input: an array of strings of varying lengths Output: either the longest string in the array, or nil (if there are no strings in the array) IF there are strings in the array Create a container object, largest_string, with the contents of the first string in the array FOR each string in the array IF the string is longer than the largest_word container Save this string as the new value of the largest_word container RETURN the value of largest_word Your Solution Below
def longest_string(list_of_words) if list_of_words.length > 0 longest_word = list_of_words[0] for word in list_of_words if word.length > longest_word.length longest_word = word end end return longest_word end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n ...
[ "0.8686293", "0.85057205", "0.8470234", "0.8446541", "0.84464157", "0.8362378", "0.83612466", "0.83458966", "0.83437854", "0.83410996", "0.8329575", "0.83033985", "0.8294679", "0.825028", "0.82484376", "0.8204588", "0.8162662", "0.815339", "0.81285286", "0.81212443", "0.81044...
0.85164124
1
GET /item_types/1 GET /item_types/1.xml
def show @item_type = ItemType.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @item_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def index\n @itemtypes = Itemtype.all\n end", "def index\n @recipe_types = RecipeType.all\n\n respond_to do |forma...
[ "0.7195215", "0.65795684", "0.6447344", "0.6431036", "0.63674945", "0.63319886", "0.63209176", "0.6313038", "0.62947434", "0.6290185", "0.6276911", "0.6197157", "0.61479974", "0.61471194", "0.611879", "0.61072236", "0.6104964", "0.61011845", "0.6089136", "0.60825175", "0.6074...
0.7143822
1
GET /item_types/new GET /item_types/new.xml
def new @item_type = ItemType.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @item_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render...
[ "0.7940502", "0.7273418", "0.7221853", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7191246", "0.7184084", "0.7169594", "0.71622723", "0.7156774", "0.7074482", "0.70645607", "0.7010892", "0.7006894", "0.7006165", ...
0.7870722
1
POST /item_types POST /item_types.xml
def create @item_type = ItemType.new(params[:item_type]) respond_to do |format| if @item_type.save flash[:notice] = 'ItemType was successfully created.' format.html { redirect_to(@item_type) } format.xml { render :xml => @item_type, :status => :created, :location => @item_type } else format.html { render :action => "new" } format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html...
[ "0.6534142", "0.63591176", "0.6292417", "0.6156293", "0.6115572", "0.60752225", "0.59194267", "0.58974105", "0.5886337", "0.58673686", "0.58271915", "0.5824956", "0.5822386", "0.5808868", "0.5792994", "0.57809806", "0.5780694", "0.57783705", "0.5767671", "0.5733091", "0.56925...
0.637711
1
PUT /item_types/1 PUT /item_types/1.xml
def update @item_type = ItemType.find(params[:id]) respond_to do |format| if @item_type.update_attributes(params[:item_type]) flash[:notice] = 'ItemType was successfully updated.' format.html { redirect_to(@item_type) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { r...
[ "0.71110517", "0.6520673", "0.64976186", "0.64485735", "0.64379025", "0.6312937", "0.62140137", "0.61865044", "0.61409885", "0.61078036", "0.6091348", "0.6023158", "0.5976565", "0.59679115", "0.5936291", "0.5933633", "0.5870948", "0.5834867", "0.5795623", "0.5759428", "0.5748...
0.68993264
1
DELETE /item_types/1 DELETE /item_types/1.xml
def destroy @item_type = ItemType.find(params[:id]) @item_type.destroy respond_to do |format| format.html { redirect_to(item_types_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @item_type = ItemType.find(params[:id])\n # You cannot destroy item types\n respond_to do |format|\n format.html { redirect_to(item_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redi...
[ "0.7154503", "0.6880605", "0.675248", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.65828943", "0.65648097", "0.6552533", "0.6535749", "0.6530758", "0.6519838", "0.65167946", "0.65074176", "0.65044165", "0.64941686", "0.6457169", "0.6430654"...
0.7449789
0
GET /computer_cases GET /computer_cases.json
def index @computer_cases = ComputerCase.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n en...
[ "0.6782567", "0.67478627", "0.65031207", "0.634706", "0.634706", "0.63232917", "0.61729354", "0.6007817", "0.59757996", "0.59757996", "0.5956582", "0.593697", "0.5898582", "0.5896633", "0.58709645", "0.5781257", "0.57515156", "0.5704119", "0.56831974", "0.5677729", "0.5672228...
0.7167471
0
GET /computer_cases/1 GET /computer_cases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @computer_cases = ComputerCase.all\n end", "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @case...
[ "0.67735845", "0.6582313", "0.63812923", "0.63812923", "0.63805693", "0.6357106", "0.6154711", "0.6067852", "0.60589045", "0.6058863", "0.6058863", "0.6042911", "0.6042426", "0.6006772", "0.5984496", "0.59654015", "0.59426546", "0.59426546", "0.59343797", "0.59231365", "0.591...
0.0
-1
POST /computer_cases POST /computer_cases.json
def create @computer_case = ComputerCase.new(computer_case_params) respond_to do |format| if @computer_case.save format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' } format.json { render :show, status: :created, location: @computer_case } else format.html { render :new } format.json { render json: @computer_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { ren...
[ "0.6467076", "0.6266084", "0.6266084", "0.6186823", "0.6148943", "0.5934998", "0.5881844", "0.587662", "0.587662", "0.58539176", "0.5840979", "0.5798991", "0.57792073", "0.5759277", "0.5684881", "0.5684881", "0.5684881", "0.56545305", "0.5653701", "0.56327206", "0.56313896", ...
0.6972714
0
PATCH/PUT /computer_cases/1 PATCH/PUT /computer_cases/1.json
def update respond_to do |format| if @computer_case.update(computer_case_params) format.html { redirect_to @computer_case, notice: 'Computer case was successfully updated.' } format.json { render :show, status: :ok, location: @computer_case } else format.html { render :edit } format.json { render json: @computer_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.htm...
[ "0.66333616", "0.6458671", "0.64299965", "0.6353033", "0.6353004", "0.6338028", "0.63350564", "0.6300484", "0.6285271", "0.6266507", "0.62547123", "0.62547123", "0.62513596", "0.62374556", "0.62067026", "0.61962", "0.6183611", "0.61707747", "0.61301947", "0.6126106", "0.61261...
0.6847098
0
DELETE /computer_cases/1 DELETE /computer_cases/1.json
def destroy @computer_case.destroy respond_to do |format| format.html { redirect_to computer_cases_url, notice: 'Computer case was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @case.destroy\n re...
[ "0.71422833", "0.69885117", "0.69159096", "0.67867106", "0.6781758", "0.6777597", "0.6732555", "0.6691837", "0.6690607", "0.6681213", "0.6681213", "0.6681213", "0.6681213", "0.66681045", "0.66646785", "0.6655183", "0.664974", "0.664533", "0.6638623", "0.663419", "0.6623732", ...
0.710179
1
Use callbacks to share common setup or constraints between actions.
def set_computer_case @computer_case = ComputerCase.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 computer_case_params params.require(:computer_case).permit(:name, :link, :dollar_price, :euro_price, :size, :performance, :picture) 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
value > value_quantity, value_integer lab_test_value > value_codeable_concept also_numeric > multiple_results_allowed range > value_range ratio > value_ratio fraction > value_ratio text_length > value_string
def result_types?(lab_test) lab_test.also_numeric? || lab_test.ratio? || lab_test.range? || lab_test.fraction? || lab_test.text_length.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_value(value)\r\n\t\tvalue\r\n\tend", "def describe_value(value)\r\n\t\t\tvalue\r\n\t\tend", "def ok_values\n %i(decimal upperRoman lowerRoman upperLetter lowerLetter ordinal\n cardinalText ordinalText hex chicago ideographDigital japaneseCounting\n aiueo iroha decima...
[ "0.61506253", "0.6057433", "0.59969974", "0.5910375", "0.5868922", "0.5801855", "0.57974946", "0.56969607", "0.56969607", "0.5694714", "0.5651178", "0.5544404", "0.5544404", "0.5498453", "0.54752845", "0.5474397", "0.54580843", "0.54580843", "0.54580843", "0.54580843", "0.545...
0.0
-1
Single background block of colour for a symbolic letter. Useful in Lego based projects...
def char_to_block c c = bg_white " " if c == "W" c = bg_red " " if c == "R" c = bg_green " " if c == "G" c = bg_yellow " " if c == "Y" c = bg_purple " " if c == "P" c = bg_fuscia " " if c == "F" c = bg_blue " " if c == "B" c = bg_grey " " if c == "E" c = " " if c == "x" c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background(pos, string)\n $background = \"\"\n if pos[0]\n background = pos[1].even? ? \"\\e[1;100m\" : \"\\e[47m\"\n else\n background = pos[1].odd? ? \"\\e[1;100m\" : \"\\e[47m\"\n end\n background + string\n end", "def background_color(color); end", "def simple(color_name, back...
[ "0.7145825", "0.6976453", "0.6910981", "0.6910981", "0.6910981", "0.6879282", "0.6626079", "0.6568976", "0.653981", "0.6409608", "0.63920957", "0.6378888", "0.63753265", "0.6338858", "0.63060105", "0.6299998", "0.62906903", "0.62566376", "0.62543094", "0.6245054", "0.6216481"...
0.68734765
6
Identify a user with an option to push immediately or allow a later track event to be associated
def identify(user, push=true) analytics_provider_instance.identify(user) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end", "def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if o...
[ "0.6180918", "0.59001356", "0.5869519", "0.58484894", "0.58067536", "0.5787249", "0.5783064", "0.57659817", "0.57608", "0.57014245", "0.5698843", "0.56888914", "0.5673755", "0.5673755", "0.5673755", "0.567198", "0.56612545", "0.5658074", "0.56430125", "0.56401193", "0.5637051...
0.55434847
28
Track an event for a previously identified user
def track_event(event, membership=nil, application=nil, props=nil) analytics_provider_instance.track_event(event, membership, application, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_user_event(event, user, props=nil)\n analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last...
[ "0.7105728", "0.6900716", "0.6708107", "0.6690832", "0.66451657", "0.6464324", "0.63249314", "0.63192886", "0.62284917", "0.62187856", "0.61510795", "0.6131353", "0.61215115", "0.61215115", "0.61215115", "0.6061356", "0.6057039", "0.60425735", "0.60139596", "0.6008025", "0.60...
0.548468
80
Track an event for a previously identified user
def track_user_event(event, user, props=nil) analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last_event = { name: name, user_id: user_id, properties: properties }\n\n if enabled?\n @segment_io.track(\n user_id: user_id,\n event: name,\n properties: properties\n ...
[ "0.6900716", "0.6708107", "0.6690832", "0.66451657", "0.6464324", "0.63249314", "0.63192886", "0.62284917", "0.62187856", "0.61510795", "0.6131353", "0.61215115", "0.61215115", "0.61215115", "0.6061356", "0.6057039", "0.60425735", "0.60139596", "0.6008025", "0.60079294", "0.5...
0.7105728
0