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 |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through. | def area_code_params
params.require(:area_code).permit(:code)
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
Constructor for Syncano::Packets::Base object | def initialize(attributes)
super()
self.timestamp = attributes[:timestamp]
self.object = attributes[:object]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @type = ''\n @destination = ''\n @tag = ''\n @data = ''\n @timeout = 10000\n end",
"def initialize(options)\n\n opt_str = \"\"\n\n #Get specified options in printable form\n options.each {|a,b|\n \n if b.is_a?(Array)\n ##print \"#{a} ... | [
"0.6429996",
"0.6271713",
"0.6199637",
"0.6199637",
"0.6143562",
"0.6143562",
"0.6127635",
"0.6108039",
"0.60975224",
"0.60919905",
"0.60919905",
"0.60672873",
"0.6057084",
"0.6038698",
"0.6011702",
"0.59894764",
"0.5977554",
"0.5957356",
"0.5947725",
"0.59357166",
"0.5927535... | 0.56869596 | 45 |
Returns true if is a notification packet | def notification?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification?\n kind == 'notification'\n end",
"def notification?\n @json['id'].nil?\n end",
"def allow_notification?\n true\n end",
"def udp?\n @udp_header\n end",
"def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend",
"def friendship_notifications?\n notif... | [
"0.7820547",
"0.63556886",
"0.6330426",
"0.6246617",
"0.6142659",
"0.6142063",
"0.60941476",
"0.6074626",
"0.60601264",
"0.6039299",
"0.5985128",
"0.59694934",
"0.5960704",
"0.59589005",
"0.5956025",
"0.5882465",
"0.5852316",
"0.5840322",
"0.58218324",
"0.5809942",
"0.5789987... | 0.6832108 | 1 |
Returns true if is a ping packet | def ping?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping?\n @raw.start_with? 'PING'\n end",
"def ping?\n tcp_ping.ping?\n end",
"def ping?\n rpc.request Util::MessageCode::PING_REQUEST\n\n return rpc.status\n end",
"def ping?\n response = perform_request\n !!(response =~ Regexp.union(%r(<str name=\"st... | [
"0.82806236",
"0.77972007",
"0.74729055",
"0.73849183",
"0.72346616",
"0.7212288",
"0.706508",
"0.7055969",
"0.70301926",
"0.70032275",
"0.69709426",
"0.6875882",
"0.6854909",
"0.68226606",
"0.67382634",
"0.6708133",
"0.66350913",
"0.66277856",
"0.66277856",
"0.65858537",
"0.... | 0.74166745 | 3 |
Returns true if is a call response packet | def call_response?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def command_response?\n type == :command... | [
"0.78532434",
"0.78532434",
"0.71381855",
"0.7045822",
"0.68794703",
"0.6874006",
"0.6849076",
"0.6609914",
"0.6543379",
"0.6343651",
"0.6343651",
"0.63149416",
"0.6304239",
"0.62955034",
"0.62280345",
"0.6207359",
"0.61819005",
"0.6170639",
"0.61604077",
"0.6148683",
"0.6127... | 0.6683878 | 7 |
Returns true if is a message packet | def message?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message?(object)\n object.kind_of?(MIDIMessage)\n end",
"def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"def type_match? message\n return false if message.direction == :in && @ingoing == false\n return false if message.direction == :out && @outgoing == false... | [
"0.67686766",
"0.67534125",
"0.6631161",
"0.6501823",
"0.6472807",
"0.63800555",
"0.6365781",
"0.63134015",
"0.6234916",
"0.6188063",
"0.6152071",
"0.6107533",
"0.6107533",
"0.60821897",
"0.60819536",
"0.6049718",
"0.6009235",
"0.600843",
"0.59606755",
"0.5940841",
"0.5906607... | 0.6448125 | 5 |
Returns true if is an auth packet | def auth?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @connection.authok\n end",
"def authok?\n @connection.authok\n end",
"def authok?\n @connection.authok\n end"... | [
"0.69881696",
"0.69881696",
"0.69881696",
"0.69881696",
"0.6922646",
"0.6922646",
"0.6922646",
"0.6922469",
"0.66786593",
"0.6640213",
"0.65054196",
"0.6477761",
"0.6446643",
"0.6441972",
"0.6414218",
"0.63802654",
"0.6341464",
"0.6338288",
"0.6335953",
"0.631669",
"0.6253164... | 0.65196425 | 10 |
setCard canAnswer PURPOSE: Lists and lets the player choose which card to answer, automatically answer if there are no or one card PARAMETERS: index i > unused Guess g > compare hand with guesses | def canAnswer(i, g)
print "Player #{i} asked you about #{g.to_s}"
answers = [] #array
if @cards.include? g.person
answers.push(g.person)
end
if @cards.include? g.place
answers.push(g.place)
end
if @cards.include? g.weapon
answers.push(g.weapon)
end
if answers.le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canAnswer(askerIndex, guess)\n\t\t#create a temp hand\n\t\ttempHand = Hash.new\n\t\t#storage for the return card\n\t\treturnCard = nil\n\n\t\t####### check if player has any of the guessed cards ######\n\t\tif(@hand[guess.person.value] != nil)\n\t\t\t#add it to the temp hand\n\t\t\ttempHand[0] = guess.person.v... | [
"0.6213712",
"0.61122257",
"0.59810513",
"0.597278",
"0.5933689",
"0.5848995",
"0.5778411",
"0.5723267",
"0.56750333",
"0.5660787",
"0.5657398",
"0.564177",
"0.5623054",
"0.5586809",
"0.5582162",
"0.5549967",
"0.5548718",
"0.55476487",
"0.5534109",
"0.5499805",
"0.54866683",
... | 0.55605954 | 15 |
canAnswer getGuess PURPOSE: Prompts the player for their guess and create it implementing proper error checking in helper method Returns: a Guess object | def getGuess
puts "It is your turn."
puts "Which person do you want to suggest?"
guessSuspect = getUserInputFromArray(@suspects)
puts "Which location do you want to suggest?"
guessLocation = getUserInputFromArray(@locations)
puts "Which weapon do you want to suggest?"
guessWeapon = getUserIn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getguess guess\r\n\t\t\t\t\t@spin_flag = false\r\n\t\t\t\t if guess.length == 1\r\n\t\t\t\t if check_repeated_choice guess\r\n\t\t\t\t @message = \"Already guessed this letter!\"\r\n\t\t\t\t if @console\r\n\t\t\t\t\t\t\t\t@output.puts \"#{@message}\"\r\n\t\t\t\t\t\t\t\tword_input = take_user_word_... | [
"0.7192255",
"0.70790476",
"0.6965958",
"0.6804125",
"0.6624974",
"0.66157395",
"0.65788114",
"0.6568288",
"0.65604895",
"0.6556395",
"0.65549326",
"0.6517044",
"0.6512524",
"0.6504793",
"0.649562",
"0.6495458",
"0.6470318",
"0.6470023",
"0.6462135",
"0.64325356",
"0.642417",... | 0.72254837 | 0 |
getGuess receiveInfo PURPOSE: Shows the player a card c from player i PARAMETERS: index i > for printing Card c > for printing | def receiveInfo(i, c)
puts "Player #{i} refuted your suggestion by showing you "+c.to_s+"."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receiveInfo(playerIndex, card)\n\t\t#if no one could answer\n\t\tif(playerIndex == -1 && card == nil)\n\t\t\t#then the guess was correct \n\t\t\t@isCorrect = true\n\t\t\tputs \"No one could answer\"\n\t\telse\n\t\t\t#otherwise show this player a card the refute their guess\n\t\t\tputs \"Player #{playerIndex} s... | [
"0.6886493",
"0.65362626",
"0.601042",
"0.5898738",
"0.58913124",
"0.5832685",
"0.58164513",
"0.58058953",
"0.58038974",
"0.5705627",
"0.5620333",
"0.5601643",
"0.5600373",
"0.55941457",
"0.5570865",
"0.5548815",
"0.5543547",
"0.55383426",
"0.5533316",
"0.55329806",
"0.552309... | 0.7393361 | 0 |
Try to focus on using correct technical vocabulary. Use the to create a new comment Build a Bear declare a new function that takes 5 arguments | def build_a_bear(name, age, fur, clothes, special_power)
# declares the local variable <greeting> and assigns it to a string value with the function argument <name> interpolated.
greeting = "Hey partner! My name is #{name} - will you be my friend?!"
# declares the local variable <demographics> and sets it equal t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe function\n\t\t\tYARD::Registry.load!(YARD::Registry.yardoc_file_for_gem('sense'))\n\t\t\tdoc = YARD::Registry[\"#{self.class}##{function}\"]\n\t\t\treturn nil unless doc\n\t\t\tdescr = \"\\n#{doc.name(true)}(#{doc.tags(:param).inject([]){|a,p| a.push(p.name)}.join(\" \")}) : #{doc.docstring}\\n\\n\"\n... | [
"0.6439389",
"0.603313",
"0.60156316",
"0.5927276",
"0.58893675",
"0.58803904",
"0.5875498",
"0.5875498",
"0.5875498",
"0.5849188",
"0.5849188",
"0.58363014",
"0.5815032",
"0.57499224",
"0.5733915",
"0.5724381",
"0.5714698",
"0.56942797",
"0.56784195",
"0.56547695",
"0.563520... | 0.0 | -1 |
FizzBuzz declare a new function that takes 3 arguments | def fizzbuzz(num_1, num_2, range)
# for...in loop executes through the range with <1> beginning and the function argument <range> ending.
(1..range).each do |i|
# if local variable <i> modulo, fuction argument <num_1> === 0 and <i> modulo function argument <num_2> === 0, returns <true> the code beneath executes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fizz_buzz number\nend",
"def fizz_buzz number\nend",
"def fizz_buzz number \nend",
"def fizzbuzz\nend",
"def super_fizzbuzz(array)\n\n\nend",
"def fizzbuzz(n) n%15==0 ? \"FizzBuzz\" : n%3==0 ? \"Fizz\" : n%5==0 ? \"Buzz\" : nil end",
"def fizz(int)\n int % 3 == 0\nend",
"def fizzbuzz(number)\nif... | [
"0.7792474",
"0.7792474",
"0.7736542",
"0.7537141",
"0.7302957",
"0.71511066",
"0.7127727",
"0.7066612",
"0.70405054",
"0.70399934",
"0.70230246",
"0.70184445",
"0.7016214",
"0.7005783",
"0.6993537",
"0.6992658",
"0.69817096",
"0.69597614",
"0.6958558",
"0.69510055",
"0.69509... | 0.0 | -1 |
Delete all responses Reset all tests to their original condition | def clear_all
Test.all.each do |test|
test.clear_all
test.save
end
redirect_to admin_root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset()\n @result = false\n @tests = 0\n end",
"def reset!\n @last_response = nil\n @last_exit_code = nil\n end",
"def reset()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def reset\n @results = {}\n @success = false\n end... | [
"0.67206633",
"0.67145175",
"0.65337163",
"0.6485908",
"0.64630324",
"0.6349156",
"0.6349156",
"0.634245",
"0.615487",
"0.61476475",
"0.61404335",
"0.6100766",
"0.60855365",
"0.6085033",
"0.6025514",
"0.5998779",
"0.59950036",
"0.5945998",
"0.594396",
"0.59352124",
"0.5935212... | 0.61886513 | 8 |
Functions to generate some random GPS coordinates in the oslo fjord lat 59.74 > 59.94 long 10.46 > 10.81 Generate a random latitude in the Oslo area | def lat_range (min, max)
lat = rand(0..(max - min)) + min
lat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomLatLng()\n max_north=18.8\n min_north=14\n max_east=122\n min_east=121.5\n puts \"#{rand(min_north..max_north)},#{rand(min_east..max_east)}\"\nend",
"def rand_location\n {lat: rand_in(40, 50), lon: rand_in(40, 80) * -1, ele: rand_in(200, 400)}\nend",
"def nearby(lat=37.332, lng=-122.031)\n ... | [
"0.80160254",
"0.7528231",
"0.7501554",
"0.72758955",
"0.70972",
"0.7076143",
"0.7012386",
"0.6853151",
"0.6771",
"0.6462707",
"0.6403838",
"0.6398686",
"0.62832093",
"0.6247729",
"0.62467664",
"0.62233734",
"0.6144324",
"0.60646546",
"0.60594213",
"0.6049392",
"0.604251",
... | 0.710555 | 4 |
Generate a random longditude in the Oslo area | def long_range (min, max)
long = rand(0..(max - min)) + min
long
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomLatLng()\n max_north=18.8\n min_north=14\n max_east=122\n min_east=121.5\n puts \"#{rand(min_north..max_north)},#{rand(min_east..max_east)}\"\nend",
"def random_coord(min, max)\n rand * (max-min) + min\nend",
"def rand_location\n {lat: rand_in(40, 50), lon: rand_in(40, 80) * -1, ele: rand_in(20... | [
"0.749339",
"0.72632194",
"0.70842206",
"0.7004137",
"0.6937956",
"0.6888243",
"0.679511",
"0.6726092",
"0.6637852",
"0.65338284",
"0.6494958",
"0.6460382",
"0.6416583",
"0.6404191",
"0.63156337",
"0.6310966",
"0.6301708",
"0.6279891",
"0.6229924",
"0.6222217",
"0.61979604",
... | 0.6137696 | 22 |
Returns the results of a specific uploaded piece of media. | def get_media_by_id id
# the base uri for api requests
query_builder = Configuration.BASE_URI.dup
# prepare query string for API call
query_builder << "/media/{id}"
# process optional query parameters
query_builder = APIHelper.append_url_with_template_parameters query_bui... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_search\n\t\tcase_media = media_list(params[:searchterm])\n\t\t# check condition for case media is present or not.\n\t\tif case_media.present?\n\t\t# response to the JSON\n\t render json: { success: true, response: case_media.map(&:attachment).as_json }\n\t else\n\t render :json=> { success: ... | [
"0.65886927",
"0.63471293",
"0.62099063",
"0.6183983",
"0.6169806",
"0.6160342",
"0.6123446",
"0.6084314",
"0.60782754",
"0.607406",
"0.6016682",
"0.6016667",
"0.59788257",
"0.59430707",
"0.59220415",
"0.590655",
"0.5850693",
"0.5784819",
"0.5724946",
"0.5724804",
"0.5722102"... | 0.59377193 | 14 |
invoke the API call request to fetch the response | def process_response query_url,headers,id
response = Unirest.get query_url, headers:headers
# Error handling using HTTP status codes
if !(response.code.between?(200,206)) # [200,206] = HTTP OK
raise APIException.new "HTTP Response Not OK", response.code, response.raw_body
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call()\n json = do_request()\n parse(json)\n end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response... | [
"0.70835227",
"0.7015304",
"0.69829106",
"0.69758666",
"0.69726515",
"0.69654965",
"0.69515306",
"0.67937315",
"0.6782168",
"0.6757582",
"0.6732322",
"0.67093587",
"0.6696316",
"0.6636614",
"0.6636418",
"0.6635529",
"0.66348386",
"0.65841186",
"0.6553169",
"0.6520539",
"0.648... | 0.0 | -1 |
Delete media results. It returns the status of the operation. | def delete_media_by_id id
# the base uri for api requests
query_builder = Configuration.BASE_URI.dup
# prepare query string for API call
query_builder << "/media/{id}"
# process optional query parameters
query_builder = APIHelper.append_url_with_template_parameters query_bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @media = Media.find(params[:id])\n @media.destroy\n\n respond_to do |format|\n format.html { redirect_to(medias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @media_item.destroy\n respond_to do |format|\n format.html { redirect_to media_items_url, ... | [
"0.6859735",
"0.68094784",
"0.67566323",
"0.67566323",
"0.67461514",
"0.6666772",
"0.65627134",
"0.65627134",
"0.65627134",
"0.65627134",
"0.65627134",
"0.65543014",
"0.65443015",
"0.65443015",
"0.65443015",
"0.652253",
"0.6498198",
"0.6495013",
"0.6485958",
"0.64577836",
"0.... | 0.65328336 | 15 |
== Class Methods ======================================================== == Instance Methods ===================================================== | def to_s
"#{preference} #{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n e... | [
"0.8202466",
"0.76844466",
"0.76844466",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.76378053",
"0.7605466",
"0.75888705",
"0.7563451",
"0.7554143",
"0.7554143",
"0.7554143",
"0.7554143",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. def set_article | def set_artist
# @artist = Artist.find(params[:id])
# @artist = Artist.find_by(artist_name: params[:artist_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_article\n @article = Article.find(params[:article_id])\n end",
"def set_article\n @article = Article.find(params[:article_id])\n end",
"def set_article\n @article = Article.find(params[:article_id])\n end",
"def set_article\n @article = params[:id] ? Article.find(params[:id])... | [
"0.7334168",
"0.7334168",
"0.73224825",
"0.7232805",
"0.7173571",
"0.7173571",
"0.71708524",
"0.71676964",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
"0.7152521",
... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def article_params
params.require(:article).permit(:title, :content, :photo, :body, :slug, :photo_cache, tag_list: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7122899",
"0.7054107",
"0.69478",
"0.6902101",
"0.67359334",
"0.67178756",
"0.66889167",
"0.6677724",
"0.6661157",
"0.6555896",
"0.6527207",
"0.64584696",
"0.64517015",
"0.6450208",
"0.644749",
"0.6435074",
"0.6413329",
"0.6413329",
"0.6391818",
"0.6380081",
"0.6380081",
... | 0.0 | -1 |
collect gravity into the velocity (update velocity). | def collect_gravity(moon_pairs, positions, velocity)
moon_pairs.map { |to, from|
positions[to].map.with_index { |pos, index| positions[from][index] <=> pos }
}.each_with_object(velocity) {|e, acc| 3.times { |i| acc[i] += e[i] }}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_gravity_to_velocity\n\t\tgravity_change = gravity_change_hash\n\t\tlast_idx = @moons.length - 1\n\t\tlast_idx.times do |x|\n\t\t\t((x + 1)...(@moons.length)).each do |y|\n\t\t\t\tupdate_gravity_hash(@moons[x], @moons[y], gravity_change)\n\t\t\tend\n\t\tend\n\t\tchange_gravity(gravity_change)\n\tend",
"... | [
"0.7777039",
"0.69249505",
"0.6892802",
"0.6805103",
"0.6798678",
"0.6798678",
"0.6773511",
"0.6613279",
"0.65368503",
"0.65176576",
"0.64825827",
"0.63562834",
"0.63246185",
"0.62925285",
"0.6261373",
"0.6250025",
"0.6226443",
"0.62091076",
"0.61897963",
"0.6147927",
"0.6141... | 0.6504527 | 10 |
Uses the Akismet API to decide whether or not this is spam. | def spam_check
CommentSpamCheckWorker.perform_in(5.seconds, id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_spam? \n # You'll need to get your own Akismet API key from www.akismet.com\n \n #return false;\n \n @akismet = Akismet.new('key', 'webpage') \n \n return nil unless @akismet.verifyAPIKey\n \n return self.spam!(:exempt => true) if @akismet.commentCheck(\n self.author... | [
"0.8067783",
"0.7529526",
"0.73636496",
"0.7330233",
"0.7301227",
"0.7161802",
"0.7018792",
"0.6991745",
"0.6978555",
"0.6937919",
"0.6934129",
"0.69318163",
"0.6908266",
"0.6888465",
"0.68681246",
"0.6830416",
"0.6673551",
"0.6669467",
"0.66329336",
"0.6610911",
"0.6600348",... | 0.57854867 | 42 |
implement in class into which it is included | def fragment
<<~HTML
my html here
HTML
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def included(klass); end",
"def included(klass); end",
"def included; end",
"def include; end",
"def include; end",
"def implementation; end",
"def implementation; end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def included(descendant)\n ... | [
"0.7626993",
"0.7626993",
"0.74050283",
"0.7323279",
"0.7323279",
"0.6992463",
"0.6992463",
"0.6727247",
"0.6727247",
"0.65950245",
"0.65903455",
"0.65744597",
"0.65407616",
"0.6531424",
"0.6507765",
"0.6459611",
"0.6434082",
"0.6326661",
"0.6326661",
"0.63247347",
"0.630788"... | 0.0 | -1 |
GET /data_files/1 GET /data_files/1.json Function for show page | def show
@data_file = DataFile.find(params[:id])
@all_products = Product.all
@all_components = Component.all
@all_valuefields = Valuefield.all
@all_properties = Property.all
respond_to do |format|
format.html # show.html.erbml.erb
format.json { render json: @data_file }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end",
"def show\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.7515754",
"0.7288502",
"0.7276473",
"0.72638744",
"0.7260602",
"0.724842",
"0.7246163",
"0.72064734",
"0.7205978",
"0.7203464",
"0.7161134",
"0.7152122",
"0.7061727",
"0.70564216",
"0.70499957",
"0.70284915",
"0.70186347",
"0.69963914",
"0.69921994",
"0.6983979",
"0.696585... | 0.7215208 | 7 |
GET /data_files/new GET /data_files/new.json Function for new page | def new
#creates a new data file
@data_file = DataFile.new
#creates an array for all components
@all_components = Component.all
#creates an array for all products
@all_products = Product.all
#creates an array for all valuefields
@all_valuefields = Valuefield.all
@all_properties = Pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end",
"def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @f... | [
"0.7264157",
"0.7076348",
"0.70399296",
"0.7022769",
"0.701317",
"0.69954735",
"0.6977383",
"0.68496096",
"0.6800407",
"0.6789391",
"0.6782069",
"0.67763036",
"0.67712885",
"0.6759941",
"0.67500913",
"0.6716324",
"0.67006207",
"0.6695763",
"0.66656405",
"0.6658033",
"0.665700... | 0.0 | -1 |
GET /data_files/1/edit Function for edit page | def edit
#Finds selected datafile
@data_file = DataFile.find(params[:id])
#creates an array of all products
@all_products = Product.all
#creates an array of all components
@all_components = Component.all
#creates an array of all valuefields
@all_valuefields = Valuefield.all
@all_prop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n load_data\n end",
"def edit\n\n end",
"def edit\r\n \r\n end",
"def edit\r\n end",
"def edit\n \n end",
"def edit\n\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"de... | [
"0.7439035",
"0.732026",
"0.7249877",
"0.72474945",
"0.72467744",
"0.7214854",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7169954",
"0.7133683",
"0.7133683",
... | 0.0 | -1 |
POST /data_files POST /data_files.json Function to create a new data file | def create
#Creates a new data file to be saved
@data_file = DataFile.new(params[:data_file])
#creates an array of all components
@all_components = Component.all
#creates an array of all products
@all_products = Product.all
#creates an array of all valuefields
@all_valuefields = Valuefie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n data =params[:data]\n\n resource = ActiveSupport::JSON.decode(data)\n @repo = Repository.find(resource[\"repo_id\"])\n dir_path = resource[\"dirPath\"];\n post = DataFile.save(params['file'], @repo.path+dir_path)\n\n\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.... | [
"0.7199084",
"0.7195085",
"0.68593043",
"0.6733253",
"0.6604775",
"0.64981496",
"0.64842856",
"0.64677364",
"0.64233476",
"0.63871247",
"0.6335375",
"0.63191026",
"0.6303955",
"0.629836",
"0.62978196",
"0.62822354",
"0.6281391",
"0.62595123",
"0.6255863",
"0.6243314",
"0.6220... | 0.64289796 | 8 |
PUT /data_files/1 PUT /data_files/1.json Function to update a data file | def update
#Finds selected data file
@data_file = DataFile.find(params[:id])
#Components
#Checks if the data file is attached to any components - if so clears them
if(!@data_file.components.nil?)
@data_file.components.clear
end
#Sets Data Files Components
if(!params[:component_par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @data = args[:data] if args.key?(:data)\n @file_name = args[:file_name] if args.key?(:file_name)\n @size = args[:size] if args.key?(:size)\n end",
"def update\n respond_to do |format|\n if @datafile.update(datafile_params)\n format.html { red... | [
"0.70962596",
"0.7041276",
"0.7006163",
"0.68639004",
"0.68402356",
"0.6779962",
"0.675364",
"0.6748395",
"0.6729438",
"0.6699725",
"0.6699725",
"0.6681349",
"0.6637946",
"0.66234523",
"0.6605256",
"0.65819484",
"0.65675783",
"0.65411204",
"0.65392953",
"0.64571434",
"0.64523... | 0.66538537 | 12 |
DELETE /data_files/1 DELETE /data_files/1.json Function to destroy a data file | def destroy
#Finds selected data file
@data_file = DataFile.find(params[:id])
#destroys data file
@data_file.destroy
respond_to do |format|
format.html { redirect_to '/admin' }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n... | [
"0.7787395",
"0.77527153",
"0.76203156",
"0.73605835",
"0.7299579",
"0.72942317",
"0.72213006",
"0.7210914",
"0.7200962",
"0.7200962",
"0.7186056",
"0.71791977",
"0.7177637",
"0.7104116",
"0.7093943",
"0.7083409",
"0.7048622",
"0.70221764",
"0.7004051",
"0.6998196",
"0.699819... | 0.72879696 | 6 |
Copy a static file from the template into the new application | def copy_static_file(path)
# puts "Installing #{path}...".magenta
remove_file path
file path, File.read(File.join(@static_files, path))
# puts "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_static\n FileUtils.cp_r 'static/.', 'output/', :preserve => true\nend",
"def copy_static\n FileUtils.cp_r 'static/.', 'output/' \nend",
"def copy_static\n puts \" - \\033[32mCopying\\033[0m static content\"\n static_folder = File.join(@proj_dir, @static_folder)\n FileUtils.cp_r(File.j... | [
"0.7711274",
"0.76080567",
"0.75439364",
"0.7524859",
"0.72829396",
"0.71910787",
"0.7171324",
"0.6718478",
"0.6558777",
"0.6517096",
"0.63493335",
"0.6222023",
"0.62095684",
"0.61963016",
"0.6173919",
"0.6154852",
"0.6117464",
"0.6116314",
"0.6103559",
"0.6103248",
"0.610267... | 0.7114889 | 7 |
field :status, :type => Symbol, :default => :unknown | def time_frame_str=(time_start_str, time_end_str)
super.time_frame = { start: DateTime.parse(time_start_str), end: DateTime.parse(time_end_str) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_type_char; end",
"def status\n value_for('status')\n end",
"def status_sym\n (status || :off).to_sym\n end",
"def default_status\n\t\tself.status = \"Pending\"\n end",
"def defaults\n self.status ||= UNKNOWN\n end",
"def status\n ActiveSupport::StringInquirer.new(self[:stat... | [
"0.71775484",
"0.71098316",
"0.7017542",
"0.6994822",
"0.6977176",
"0.69735885",
"0.69687057",
"0.69157",
"0.68805724",
"0.6802374",
"0.6781459",
"0.67747754",
"0.6760402",
"0.67508787",
"0.67231196",
"0.67154104",
"0.6702599",
"0.6702599",
"0.6702599",
"0.6702599",
"0.667424... | 0.0 | -1 |
override the devise method for where to go after signing out because theirs always goes to the root path. Because devise uses a session variable and the session is destroyed on log out, we need to use request.referrer root_path is there as a backup | def store_current_location
store_location_for(:user, request.url) if request.get?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource)\n request.referrer || root_path\n end",
"def after_sign_out_path_for(resource)\n request.referrer || root_path\n end",
"def after_sign_out_path_for(resource)\n request.referrer || root_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n requ... | [
"0.81434536",
"0.81434536",
"0.8088249",
"0.80668813",
"0.79561216",
"0.78899205",
"0.7883043",
"0.785386",
"0.7853714",
"0.7853714",
"0.7850769",
"0.78207463",
"0.7750311",
"0.7723102",
"0.7719405",
"0.7701811",
"0.76794523",
"0.76730984",
"0.76729316",
"0.76726574",
"0.7664... | 0.0 | -1 |
validates_uniqueness_of :shorturl, :allow_blank=>true validates_length_of :shorturl, :minimum=>3, :maximum=>20 validates_format_of :shorturl, :with=>/\A(?!(invoices|invoice|bill|bills|product|products|item|items)\Z).\Z/i | def validate
errors.add_to_base "Enter atleast one product" if items.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url_validation\n errors.add(:url, I18n.t('url_not_proper')) unless UrlShort.is_valid? (url)\n end",
"def is_url_valid\n\t\tunless self.long_url.starts_with?(\"http://\", \"https://\")\n\t\t\terrors.add(:long_url, \"invalid format\")\n\t\tend\n\tend",
"def clean_url\n self.url = self.title.cl... | [
"0.7128086",
"0.65796155",
"0.64529866",
"0.633047",
"0.6323344",
"0.6309912",
"0.6288639",
"0.6285327",
"0.625751",
"0.62526864",
"0.62417215",
"0.6213385",
"0.621108",
"0.6210015",
"0.6200819",
"0.6200029",
"0.60862124",
"0.6027801",
"0.59829533",
"0.59669596",
"0.5958301",... | 0.0 | -1 |
GET /visions GET /visions.json | def index
@visions = Vision.order("created_at DESC").limit(1).where(:user == current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def index\n @visions = Vision.all.order(\"created_at DESC\")\n end",
"def show\n @page ... | [
"0.6882001",
"0.66304576",
"0.6578313",
"0.6504514",
"0.6437637",
"0.61689925",
"0.6167733",
"0.61568177",
"0.61455667",
"0.61193913",
"0.6084472",
"0.60722506",
"0.602079",
"0.6006305",
"0.60018206",
"0.5987137",
"0.59452844",
"0.5900829",
"0.58617234",
"0.5860969",
"0.58577... | 0.6622857 | 2 |
GET /visions/1 GET /visions/1.json | def show
#track visits with AHOY
#render modals
@jobs= Job.order("created_at DESC").limit(0).where(:industry => @vision.industry)
@tips= Tip.order("created_at DESC").where(:prep => @vision.prep).limit(5)
@influencer_hangout= Event.order("created_at DESC").where(:org ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end",
"def show\n @page = Page.find(params[:page_id])\n @revision = @page.revisions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @revision }\n end... | [
"0.71318567",
"0.69838595",
"0.691027",
"0.6632692",
"0.66158384",
"0.65469193",
"0.6514434",
"0.64308023",
"0.6248973",
"0.62485874",
"0.62383664",
"0.6223267",
"0.62147605",
"0.61806446",
"0.61806446",
"0.61806446",
"0.618021",
"0.60833645",
"0.6077638",
"0.60589874",
"0.60... | 0.0 | -1 |
GET /visions/1 GET /visions/1.json | def myprofile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end",
"def show\n @page = Page.find(params[:page_id])\n @revision = @page.revisions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @revision }\n end... | [
"0.71316266",
"0.6983499",
"0.69107366",
"0.6634096",
"0.66155773",
"0.6546498",
"0.65158737",
"0.64306927",
"0.6249091",
"0.6248096",
"0.62388515",
"0.62243295",
"0.6213698",
"0.6181399",
"0.6181399",
"0.6181399",
"0.61806345",
"0.6084909",
"0.6077717",
"0.60597354",
"0.6047... | 0.0 | -1 |
POST /visions POST /visions.json | def create
@vision = current_user.visions.build(vision_params)
@username = current_user.name
current_user.update_attribute(:profileurl, @username.gsub(/\s+/, "").delete('.') + rand(10..50).to_s)
respond_to do |format|
if @vision.save
format.html
format.json { render :show, status:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @revision = Revision.new(params[:revision])\n\n if @revision.save\n render json: @revision, status: :created, location: @revision\n else\n render json: @revision.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vet = Vet.new(params[:vet])\n\n respond_to... | [
"0.64343107",
"0.60573226",
"0.6000883",
"0.5897744",
"0.58410275",
"0.580438",
"0.57294077",
"0.57165956",
"0.5664223",
"0.5624301",
"0.5581596",
"0.55770034",
"0.5538854",
"0.55357194",
"0.55141556",
"0.55141556",
"0.5513257",
"0.55097425",
"0.54978234",
"0.54879117",
"0.54... | 0.53415513 | 32 |
PATCH/PUT /visions/1 PATCH/PUT /visions/1.json | def update
respond_to do |format|
if @vision.update(vision_params)
format.html
format.json { render :show, status: :ok, location: @vision }
#if can't pull user info from FB, update info from visions form
current_user.update_attribute(:major, @vision.major)
current_user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @revision = Revision.find(params[:id])\n\n if @revisio... | [
"0.62934536",
"0.6269438",
"0.62474996",
"0.61922854",
"0.6181076",
"0.6043208",
"0.60314655",
"0.60226935",
"0.601401",
"0.60136527",
"0.5978515",
"0.5935922",
"0.5935552",
"0.59289086",
"0.5894444",
"0.5873995",
"0.58629817",
"0.5862863",
"0.58548933",
"0.58151805",
"0.5815... | 0.0 | -1 |
DELETE /visions/1 DELETE /visions/1.json | def destroy
@vision.destroy
respond_to do |format|
format.html { redirect_to visions_url, notice: 'Vision was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @revision = Revision.find(params[:id])\n @revision.destroy\n\n respond_to do |format|\n format.html { redirect_to @revision.page }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)... | [
"0.7112533",
"0.705186",
"0.6990245",
"0.6958072",
"0.69398004",
"0.6893908",
"0.6878855",
"0.6826206",
"0.67816603",
"0.67754996",
"0.67590374",
"0.6725955",
"0.67257357",
"0.66838866",
"0.6681334",
"0.665326",
"0.6648125",
"0.66466045",
"0.66458505",
"0.664268",
"0.66320616... | 0.68217474 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_vision
@vision = Vision.order("created_at DESC").where(:user_id == params[:id]).last
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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def vision_params
params.require(:vision).permit(:industry, :firstjob, :style, :prep, :career_services, :linkedin, :gradschool, :school, :companies, :username, :gradyear, :email, :image, :age, :gender, :timezone, :major)
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 |
Further Given the length of a side of a cube calculate the volume | def test_volume_of_cube()
first_volume = cube_volume(1)
second_volume = cube_volume(3)
third_volume = cube_volume(5)
assert_equal(1, first_volume)
assert_equal(27, second_volume)
assert_equal(125, third_volume)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_of_cube(length_of_side)\n return length_of_side ** 3\nend",
"def volume_of_cube(side_length)\n return side_length ** 3\nend",
"def volume_of_cube(side_length)\n return (side_length ** 3)\nend",
"def volume_of_cube(side_length)\n volume = side_length **3\n #return volume\nend",
"def hollow_c... | [
"0.89266425",
"0.88223684",
"0.88169426",
"0.8760551",
"0.8655145",
"0.8649615",
"0.8562521",
"0.8454144",
"0.83627635",
"0.8335101",
"0.8335101",
"0.7975641",
"0.79640913",
"0.79247403",
"0.79200184",
"0.7837115",
"0.78206646",
"0.7773292",
"0.7767657",
"0.76469904",
"0.7645... | 0.69862926 | 32 |
Given the radius of a sphere calculate the volume | def test_volume_of_sphere()
first_volume = sphere_volume(1)
second_volume = sphere_volume(3)
third_volume = sphere_volume(5)
assert_equal(4/3 * Math::PI * 1 ** 3, first_volume)
assert_equal(4/3 * Math::PI * 3 ** 3, second_volume)
assert_equal(4/3 * Math::PI * 5 ** 3, third_volume)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_sphere_volume(radius)\n answer = (4.0/3.0)*Math::PI*(radius**3)\n return answer.round(1)\nend",
"def volume_of_sphere(radius)\n volume = Math::PI * radius ** 3 * 4 / 3\n return volume.round(3)\nend",
"def volume_of_sphere(radius)\n volume = (4.0/3.0) * Math::PI * (radius ** 3)\n return volume.ro... | [
"0.89304364",
"0.8741866",
"0.87015307",
"0.86771065",
"0.86301273",
"0.8485845",
"0.8469577",
"0.8454772",
"0.84301436",
"0.8375659",
"0.8200204",
"0.7765682",
"0.76119107",
"0.6747734",
"0.6739601",
"0.6696612",
"0.6679414",
"0.6657556",
"0.6433824",
"0.6318382",
"0.6310195... | 0.7133138 | 13 |
Given a value in farenheit, convert this into celsius. | def test_fahrenheit_to_celsius()
first_temp = fahrenheit_to_celsius(1)
second_temp = fahrenheit_to_celsius(3)
third_temp = fahrenheit_to_celsius(5)
assert_equal(1 - 32 * 5 / 9, first_temp)
assert_equal(3 - 32 * 5 / 9, second_temp)
assert_equal(5 - 32 * 5 / 9, third_temp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fahrenheit_to_celsius(fahrenheit)\n celsius = ((fahrenheit - 32) * 5.0 / 9.0).round\n end",
"def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend",
"def to_celsius\n if @scale == KELVIN\n return Temperature.new(@value + ABSOLUTE_ZERO, CELSI... | [
"0.7565631",
"0.7490471",
"0.7434012",
"0.73744655",
"0.7374153",
"0.7358606",
"0.72270006",
"0.72135985",
"0.72073585",
"0.7206793",
"0.7179985",
"0.71269333",
"0.71037966",
"0.7090294",
"0.7072726",
"0.70709974",
"0.7066549",
"0.70464706",
"0.70303273",
"0.7022046",
"0.7001... | 0.62785554 | 59 |
for access through postman extension | def show
tagging = Tagging.find(params[:id])
tag = tagging.tag
render json: {status: 'SUCCESS', message:'Loaded tagging', data:tagging, tag:tag},status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preflight; end",
"def rest_token_endpoint; end",
"def host_authorization; end",
"def host_authorization; end",
"def api; end",
"def api; end",
"def auth_param; end",
"def req\n \n end",
"def rest_token_endpoint=(_arg0); end",
"def rest_endpoint; end",
"def rest_token_end_point; end",
... | [
"0.6600139",
"0.6133569",
"0.5945502",
"0.5945502",
"0.5943973",
"0.5943973",
"0.5936787",
"0.5909062",
"0.5908991",
"0.5873059",
"0.5844321",
"0.5836761",
"0.58224785",
"0.5808697",
"0.5764413",
"0.5725715",
"0.5712736",
"0.5712736",
"0.5712736",
"0.5712736",
"0.5709096",
... | 0.0 | -1 |
rubocop:disable Naming/MethodName helper function to extract the affected location ID based on the locationMode | def locationId
if locationMode == Yext::Api::Enumerations::AddRequestLocationMode::NEW
newLocationId
else
existingLocationId
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_id\n @location.id if @location.present?\n end",
"def locate_id\n @config[:locate_id]\n end",
"def location_type_id\n addr_type = ALF::AddressType.where('address_type_id', self.address_type).first\n return if addr_type.nil?\n\n location_type = CIVICRM::LocationType.where(name: ... | [
"0.69620186",
"0.63978016",
"0.62858063",
"0.6178155",
"0.61572134",
"0.61292386",
"0.6105053",
"0.60509557",
"0.5978034",
"0.5959343",
"0.59103596",
"0.58916235",
"0.5878021",
"0.58141094",
"0.581008",
"0.57659894",
"0.5761653",
"0.5726784",
"0.5726784",
"0.5726784",
"0.5726... | 0.72409594 | 0 |
After successfully creating a new add request, the object attributes will be updated/ changed to the values of the created add request. | def save
if persisted?
change_status
else
create_new_location
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_object(object)\n\t\t\t\tfname=\"ArWorkitem.\"+__method__.to_s\n\t\t\t\tret=0\n\t\t\t\ttype_object=object.model_name\n\t\t\t\tfields = self.field_hash\n\t\t\t\tif fields == nil\n\t\t\t\t\tfields = {}\n\t\t\t\t\tfields[\"params\"] = {}\n\t\t\t\tend\n\t\t\t\turl=\"/\"+type_object+\"s\"\n\t\t\t\turl+=\"/\"+obj... | [
"0.5900444",
"0.5876675",
"0.5855764",
"0.5794718",
"0.57423896",
"0.57409346",
"0.5683199",
"0.5653611",
"0.5642516",
"0.5639469",
"0.562795",
"0.5586972",
"0.5560522",
"0.5551634",
"0.5538115",
"0.55227023",
"0.5520156",
"0.55029464",
"0.5464424",
"0.54401684",
"0.54378414"... | 0.0 | -1 |
Convert the usage error to a string that contains help information about commandline arguments and options. | def to_s
@option_parser.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage_string\n result = [full_name]\n result << \"[command]\" if commands.any?\n args.each do |arg|\n result << arg.usage_string\n end\n result << \"[options]\" unless flags.empty?\n result << catch_all_usage if catch_all\n result.join \" \"\n end"... | [
"0.7585948",
"0.7179587",
"0.70689297",
"0.6900897",
"0.6890556",
"0.6782013",
"0.67708707",
"0.6769579",
"0.6769516",
"0.67081964",
"0.65938133",
"0.65625286",
"0.6519377",
"0.6465783",
"0.64185387",
"0.64081997",
"0.63985896",
"0.63895214",
"0.63766664",
"0.63657844",
"0.63... | 0.0 | -1 |
Parse commandline arguments and perform the requested operation. | def run(*args)
options, args = parse_command_line_options!(args)
timelog = ::Timelog::load_stream(@stream)
unless args.empty? || args[0].strip.empty?
timelog.record_activity(args[0])
end
DailyReport::render(timelog, @output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end",
"def process_args\n args = @args.dup\n @options[:operands] = nil\n unless args.length >= 2\n puts @opts\n exit 1\n ... | [
"0.71265024",
"0.7114227",
"0.70834166",
"0.6983608",
"0.68085486",
"0.6704989",
"0.66329503",
"0.6602228",
"0.65571177",
"0.6549488",
"0.65373355",
"0.6532512",
"0.65122145",
"0.6500468",
"0.64866954",
"0.64694005",
"0.64661425",
"0.6459244",
"0.6451642",
"0.6380836",
"0.638... | 0.0 | -1 |
Parse commandline arguments and return an options object and a list of remaining arguments. | def parse_command_line_options!(args)
OptionParser.new do |opts|
opts.on('-h', '--help', 'Display this screen') do
raise UsageError.new(opts)
end
end.parse!(args)
return {}, args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse arguments\n begin\n @option_parser.parse! arguments\n rescue StandardError => e\n puts @option_parser\n puts\n puts e.message\n exit(-1)\n end\n\n @options\n end",
"def parse\n # The options specified on the command line will be collected in *options*.\n ... | [
"0.8012497",
"0.79867584",
"0.78720653",
"0.7717879",
"0.7595034",
"0.7499981",
"0.7464806",
"0.742795",
"0.740118",
"0.73472476",
"0.7342941",
"0.7311901",
"0.7308399",
"0.7307366",
"0.7292165",
"0.72698003",
"0.7244778",
"0.71822166",
"0.7152583",
"0.7133818",
"0.71197563",... | 0.72613406 | 16 |
index action to display current users art plans | def index
@art_plans = current_user.art_plans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if current_user.is_admin?\n @plans = Plan.all\n else\n @plans = Plan.where(user_id: current_user.id)\n end\n end",
"def index\n @plans = Plan.where(user_id: current_user.id)\n end",
"def index\n @plans = Plan.all\n if not (current_user.role? :faculty) || (current_user.... | [
"0.74015945",
"0.7331604",
"0.72184134",
"0.7186098",
"0.7080265",
"0.703605",
"0.7022653",
"0.7022653",
"0.6946888",
"0.6847918",
"0.6792557",
"0.6784625",
"0.678304",
"0.6754198",
"0.6754198",
"0.6751334",
"0.6747896",
"0.6668304",
"0.66538185",
"0.66243553",
"0.66090006",
... | 0.83848375 | 0 |
creating a new art plan and storing art projects/art schedules in our art plans new action: store art plan and art project record in an instance variable | def new
@art_plan = ArtPlan.new
@art_plan.art_schedules.build
@art_project = ArtProject.new
#byebug
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @art_plan = current_user.art_plans.build(art_plan_params)\n #byebug\n \n if @art_plan.save\n flash[:success] = \"Your art plan was created!\"\n as = ArtSchedule.new(art_schedule_params)\n as.art_plan = @art_plan\n as.save\n redirect_to art_plan_path(@... | [
"0.7823819",
"0.67243713",
"0.6681209",
"0.6479378",
"0.6478006",
"0.6355571",
"0.63134664",
"0.63095427",
"0.6259116",
"0.6252956",
"0.6250187",
"0.62047637",
"0.62035185",
"0.6166175",
"0.61452556",
"0.61407757",
"0.6140068",
"0.61206615",
"0.6119494",
"0.60953",
"0.6091768... | 0.7871451 | 0 |
create action to build an art plan if you are the current user save the art plan with the art schedule or the option to create a new one | def create
@art_plan = current_user.art_plans.build(art_plan_params)
#byebug
if @art_plan.save
flash[:success] = "Your art plan was created!"
as = ArtSchedule.new(art_schedule_params)
as.art_plan = @art_plan
as.save
redirect_to art_plan_path(@art_plan)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @art_plan = ArtPlan.new\n @art_plan.art_schedules.build\n @art_project = ArtProject.new\n #byebug\n end",
"def create_plan(plan:, params:)\n plan.visibility = if params['visibility'].blank?\n Rails.configuration.x.plans.default_visibility\n ... | [
"0.7673156",
"0.7099603",
"0.69003606",
"0.673794",
"0.672129",
"0.66799855",
"0.65708953",
"0.65696865",
"0.6544846",
"0.6525615",
"0.65052676",
"0.6468315",
"0.6465163",
"0.64615285",
"0.64528126",
"0.64476115",
"0.6439857",
"0.6417931",
"0.64161736",
"0.6406623",
"0.637631... | 0.82404494 | 0 |
art plan action store ArtPlan record in the instance variable art_plan | def update
if @art_plan.update(art_plan_params)
flash[:success] = "Your changes were saved!"
redirect_to art_plan_path(@art_plan)
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_art_plan\n @art_plan = ArtPlan.find(params[:id])\n #byebug\n if @art_plan.nil?\n flash[:danger] = \"ART PROJECT Plan not Found!\"\n redirect_to art_plans_path\n end\n end",
"def create\n @art_plan = current_user.art_plans.build(art_plan_params)\n #byebug\n ... | [
"0.7065355",
"0.6997579",
"0.65779173",
"0.6505579",
"0.6423719",
"0.6423719",
"0.6423719",
"0.6423719",
"0.63916445",
"0.638508",
"0.6377024",
"0.6196097",
"0.6109731",
"0.61020225",
"0.60345286",
"0.6033662",
"0.6020669",
"0.59869695",
"0.59869695",
"0.59869695",
"0.5975063... | 0.5990978 | 17 |
active record destroy method | def destroy
#@art_plan = ArtPlan.find(params[:id])
#if @art_plan.present?
#byebug
@art_plan.destroy
#end
flash[:success] = "Your art plan and all associated art plans were deleted!"
redirect_to art_plans_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy; delete end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy\n # delete object from the DB\n # DB.execute(\"D... | [
"0.8410139",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8266057",
"0.8174178",
"0.8163054",
"0.8163054",
"0.8109612",
"0.81015855",
"0.81015855",
"0.8096096",
"0.80650216",
"0.80644196",
"0.8023894",... | 0.0 | -1 |
art plan parameters (attributes), an art plan has a goal and description | def art_plan_params
params.require(:art_plan).permit(:goal, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plan_description\n end",
"def plan_params\n params.require(:plan).permit(:title, :description, :color_tag)\n end",
"def optimal_plan=(plans)\n @plans = plans\n @cost = 0.00\n @plans_name = \"\"\n @features_count = 0\n @plans.each do |plan|\n @cost += plan['cost']\n @plans_... | [
"0.6566753",
"0.646167",
"0.6311357",
"0.6181349",
"0.6132194",
"0.6076256",
"0.5985322",
"0.59433794",
"0.5931721",
"0.5919228",
"0.5874976",
"0.58551276",
"0.5853933",
"0.58433884",
"0.58368915",
"0.5834223",
"0.5797941",
"0.57413554",
"0.5737385",
"0.5734375",
"0.56854004"... | 0.76260084 | 0 |
these are the art schedule parameters set in the database schema an art schedule requires an art plan, art time, art type, and id an art schedule requries an art project: medium, day, idea, artist reference, content, and price | def art_schedule_params
params.require(:art_plan).require(:art_schedule).permit(:art_time, :art_type, :art_id,
art_project: [:medium, :day, :idea, :artist_reference, :content, :price])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_params\n params.require(:schedule).permit(:id, :date_init, :description)\n end",
"def schedule_params\n params.require(:schedule).permit(:construction_datum_id, :content_name, :estimated_start_date, :estimated_end_date, :work_start_date, :work_end_date)\n end",
"def schedule_params\n ... | [
"0.65149343",
"0.64963084",
"0.64574564",
"0.6409888",
"0.6400942",
"0.6354468",
"0.6274413",
"0.6249415",
"0.62285537",
"0.6211267",
"0.6197748",
"0.61716634",
"0.6166886",
"0.6122362",
"0.6115979",
"0.6115937",
"0.60949355",
"0.6081431",
"0.6061357",
"0.6054607",
"0.6047613... | 0.8142629 | 0 |
if art plan is empty or cannot be found by id, flash message and redirect | def set_art_plan
@art_plan = ArtPlan.find(params[:id])
#byebug
if @art_plan.nil?
flash[:danger] = "ART PROJECT Plan not Found!"
redirect_to art_plans_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_art_project \n @art_project = ArtProject.find_by(id: params[:id])\n if !@art_project \n flash[:dancer] = \"Art Project Not Found! Try Again!\"\n redirect_to art_projects_path \n end \n end",
"def fetch_plan\n @plan = Plan.find_by(id: params[:plan_id])\n ... | [
"0.7313823",
"0.69003236",
"0.69003236",
"0.6579175",
"0.6512066",
"0.63538337",
"0.63355154",
"0.62676364",
"0.6243554",
"0.6125287",
"0.6124756",
"0.6057391",
"0.6026667",
"0.6024486",
"0.6007352",
"0.5989497",
"0.5952234",
"0.59350884",
"0.5932614",
"0.5929398",
"0.5916653... | 0.7423502 | 0 |
can only be logged in as the current user to edit own art plans | def require_same_user
if current_user.id != @art_plan.user_id
flash[:danger] = "You can only edit or delete your own art project plan"
redirect_to art_plans_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end",
"def edit\n @user = current_user\n\n authorize! @tool\n end",
"def edit \n if @article.user !=... | [
"0.7206428",
"0.7100411",
"0.7005387",
"0.69386923",
"0.6923546",
"0.68516177",
"0.68465024",
"0.68465024",
"0.684353",
"0.67968774",
"0.6795541",
"0.6794802",
"0.6786347",
"0.6785845",
"0.6780118",
"0.67624104",
"0.6731273",
"0.67176586",
"0.67170846",
"0.6711754",
"0.671162... | 0.7551481 | 0 |
GET /command_parameters/1 GET /command_parameters/1.json | def show
@command_parameter = CommandParameter.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @command_parameter }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_params\n params[:command]\n end",
"def new\n @command_parameter = CommandParameter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @command_parameter }\n end\n end",
"def command_params\n params.fetch(:command, {})\n end",... | [
"0.6879717",
"0.68687",
"0.6573279",
"0.6374677",
"0.6304234",
"0.60919213",
"0.6046026",
"0.6034693",
"0.59123224",
"0.5868941",
"0.5868941",
"0.57867324",
"0.56736577",
"0.5666689",
"0.5659142",
"0.5655116",
"0.5653696",
"0.5613351",
"0.55622584",
"0.55423343",
"0.55320656"... | 0.74563754 | 0 |
GET /command_parameters/new GET /command_parameters/new.json | def new
@command_parameter = CommandParameter.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @command_parameter }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @command_parameter = CommandParameter.new(params[:command_parameter])\n\n respond_to do |format|\n if @command_parameter.save\n format.html { redirect_to @command_parameter, notice: 'Command parameter was successfully created.' }\n format.json { render json: @command_parameter... | [
"0.73390824",
"0.71598846",
"0.69816273",
"0.65837777",
"0.6550027",
"0.64970547",
"0.63235486",
"0.62696904",
"0.6152248",
"0.6147941",
"0.6139834",
"0.61262256",
"0.61161906",
"0.60835886",
"0.6067142",
"0.6064431",
"0.60471624",
"0.60471624",
"0.60237026",
"0.601743",
"0.5... | 0.83125854 | 0 |
POST /command_parameters POST /command_parameters.json | def create
@command_parameter = CommandParameter.new(params[:command_parameter])
respond_to do |format|
if @command_parameter.save
format.html { redirect_to @command_parameter, notice: 'Command parameter was successfully created.' }
format.json { render json: @command_parameter, status: :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_params\n params.require(:command).permit(:name, :json)\n end",
"def command_params\n params.fetch(:command, {}).permit(:name, :status, :executed_at)\n end",
"def command_params\n params.permit(:command_name, :post_id)\n end",
"def command_params\n params.require(:command).p... | [
"0.75956047",
"0.71817994",
"0.7158571",
"0.68257844",
"0.6771314",
"0.6765122",
"0.6763357",
"0.65723133",
"0.6471646",
"0.6233349",
"0.60681546",
"0.60567826",
"0.60031",
"0.5854232",
"0.58245224",
"0.57554835",
"0.57537574",
"0.56935006",
"0.5672908",
"0.5656424",
"0.56423... | 0.7052913 | 3 |
PUT /command_parameters/1 PUT /command_parameters/1.json | def update
@command_parameter = CommandParameter.find(params[:id])
respond_to do |format|
if @command_parameter.update_attributes(params[:command_parameter])
format.html { redirect_to @command_parameter, notice: 'Command parameter was successfully updated.' }
format.json { head :no_conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_params\n params.require(:command).permit(:name, :json)\n end",
"def update\n respond_to do |format|\n if @command.update(command_params)\n format.json { render :json => @command }\n else\n format.json { render json: @command.errors, status: 401 }\n end\n end\n ... | [
"0.6824579",
"0.65987974",
"0.6551761",
"0.63448983",
"0.6207192",
"0.61725247",
"0.6141093",
"0.6103272",
"0.6037208",
"0.6031478",
"0.6024112",
"0.6011249",
"0.59694105",
"0.5958925",
"0.5918514",
"0.58837265",
"0.5831635",
"0.582823",
"0.5747889",
"0.5747889",
"0.57207763"... | 0.72663325 | 0 |
DELETE /command_parameters/1 DELETE /command_parameters/1.json | def destroy
@command_parameter = CommandParameter.find(params[:id])
@command_parameter.destroy
respond_to do |format|
format.html { redirect_to command_parameters_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(data)\n params = self.params\n data['delete']['parameters'].each { |p|\n params.delete(p) if params.has_key?(p)\n }\n write(p... | [
"0.70826626",
"0.70656043",
"0.6728562",
"0.67054564",
"0.66659856",
"0.66470903",
"0.6642766",
"0.6625758",
"0.66070163",
"0.65789545",
"0.6514507",
"0.6496217",
"0.64624184",
"0.6428721",
"0.6404075",
"0.6393605",
"0.63853955",
"0.63656247",
"0.6348296",
"0.6321347",
"0.631... | 0.77355754 | 0 |
Override these defaults in a RC controller as needed | def human_model_name
model_name.humanize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"de... | [
"0.70586765",
"0.70586765",
"0.70586765",
"0.70586765",
"0.70586765",
"0.70586765",
"0.69841665",
"0.69841665",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.6780682",
"0.67669547",
"0.67669547",
"0.669... | 0.0 | -1 |
Handle checkboxes next to file upload widgets were there is an existing file | def handle_file_deletions(model)
record = instance_variable_get("@#{model}")
if params["#{model}_delete"]
params["#{model}_delete"].keys.each do |column|
if record.respond_to?(column) and record.send(column) and File.exists?(record.send(column))
File.delete(record.send(column))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_upload_question?\n hide_text\n end",
"def file_upload_question?\n hide_text\n end",
"def select_file(file_name, file_path=\"\")\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(file_path + file_name)\n @@file_number += 1\n end",
"def no_file_selected?\n... | [
"0.6023526",
"0.6023526",
"0.5982062",
"0.5721241",
"0.5720778",
"0.5705979",
"0.5705979",
"0.5661966",
"0.56540024",
"0.5650622",
"0.5646997",
"0.5646997",
"0.5646997",
"0.5646997",
"0.5646997",
"0.5646997",
"0.55959743",
"0.55944574",
"0.5594124",
"0.5585552",
"0.5524628",
... | 0.0 | -1 |
Render a csv file as a download supply array of arrays for data comma separated string for headers filename with no extension | def render_csv(data,headers,filename)
csv_writer = ::CSV::Writer.generate(output = '')
csv_writer << headers.split(',')
data.each {|row| csv_writer << row}
send_data(output, :type => "text/plain", :filename => "#{filename}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export\n headers = JSON[params[:column_array]]\n rows = JSON[params[:row_array]]\n column_names = Array.new\n headers.each do |col|\n column_names << col\n end\n csv_string = CSV.generate do |csv|\n csv << column_names\n rows.each do |row|\n csv << row\n end\n en... | [
"0.7269785",
"0.7262957",
"0.71179837",
"0.7111017",
"0.7102349",
"0.70529556",
"0.68676466",
"0.68552005",
"0.68552005",
"0.6766143",
"0.6765441",
"0.6753548",
"0.6678223",
"0.666859",
"0.6642194",
"0.6625652",
"0.6620021",
"0.6615484",
"0.6592515",
"0.6562835",
"0.6557526",... | 0.7462092 | 1 |
PUT /posts/1 PUT /posts/1.json | def update
@image = Image.find(params[:id])
@image.update_attributes(params[:images])
@memory = Memory.find(params[:images][:memory_id], :include => [:images, :categories])
if(params[:user_comment])
@direction = current_user.comments;
end
render :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body ... | [
"0.7310454",
"0.7124461",
"0.6816203",
"0.66437477",
"0.66198987",
"0.6607222",
"0.65832084",
"0.6565039",
"0.65546584",
"0.6531005",
"0.6512948",
"0.6488352",
"0.6447094",
"0.64326787",
"0.6416709",
"0.63858116",
"0.63825184",
"0.63680685",
"0.6365362",
"0.636389",
"0.636191... | 0.0 | -1 |
This method generates an array of all moves that can be made after the current move. | def children
childs = []
board.rows.each_with_index do |row, i|
print row
p i
row.each_with_index do |square, j|
if board.empty?([i, j])
new_board = @board.dup
new_board[i, j] = @next_mover_mark
new_mark = ((next_mover_mark == :x) ? :o : :x)
chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio... | [
"0.7453632",
"0.7447693",
"0.74052787",
"0.7375152",
"0.7236493",
"0.72341585",
"0.7214245",
"0.7211643",
"0.7203578",
"0.7178213",
"0.7139243",
"0.7115099",
"0.7087908",
"0.708",
"0.70719075",
"0.70602065",
"0.7032398",
"0.70249367",
"0.6983907",
"0.6974398",
"0.6951628",
... | 0.0 | -1 |
The user id if provided and valid, or nil otherwise | def user_id
if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)
if (id = id.to_s).size > 0 && id != '0'
return id
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id\n return nil unless success?\n\n @user_id\n end",
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def user_id\n\t\t@user_id || nil\n\tend",
"def user_id\n ... | [
"0.80495703",
"0.80387926",
"0.7822077",
"0.7728772",
"0.7718129",
"0.7705785",
"0.755227",
"0.7517375",
"0.7508529",
"0.75072587",
"0.7324624",
"0.72159964",
"0.72159964",
"0.7174092",
"0.7164828",
"0.7159818",
"0.71389115",
"0.71389115",
"0.71389115",
"0.71389115",
"0.71389... | 0.83427453 | 0 |
The hostname of Feeligo's API defaults to stickersapi.feeligo.com, or stickersapissl.feeligo.com if https | def feeligo_api_hostname
@opts[:feeligo_api_hostname] || if protocol.to_s == 'https'
'stickersapissl.feeligo.com'
else
'stickersapi.feeligo.com'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_host #:nodoc:\n API_URI\n end",
"def host\n @host || \"https://api.digitalriver.com/\"\n end",
"def host\n @host ||= 'api.postmarkapp.com'\n end",
"def host\n \"http://api.lvh.me:3000\"\n end",
"def host\n \"https://api.monzo.com/\"\n end",
"def host\n conf... | [
"0.72396207",
"0.71285176",
"0.7094778",
"0.69841826",
"0.695584",
"0.69452876",
"0.67306584",
"0.6719371",
"0.66691434",
"0.65660125",
"0.65385294",
"0.65103495",
"0.6501268",
"0.6479814",
"0.64460206",
"0.64421654",
"0.6356106",
"0.63556457",
"0.6329058",
"0.6323544",
"0.63... | 0.8812251 | 0 |
The protocol used to load the loader script defaults to http | def protocol
@opts[:protocol] || 'http'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocol\n @protocol.sub(\"://\",\"\")\n end",
"def protocol\n default_url_options.fetch(:protocol, 'http').to_sym\n end",
"def protocol; config[:protocol]; end",
"def local_proto\n local_https_enabled ? 'https' : 'http'\n end",
"def protocol\n if origin_url =~ /https?:\\... | [
"0.6989771",
"0.679255",
"0.6533386",
"0.64184034",
"0.6397265",
"0.62866646",
"0.61847776",
"0.61557925",
"0.6117261",
"0.60715383",
"0.60367805",
"0.60073376",
"0.5990853",
"0.5973781",
"0.59664255",
"0.5888268",
"0.58842784",
"0.5874665",
"0.58732253",
"0.58724356",
"0.583... | 0.7272931 | 0 |
The hostname of the client Community if unspecified will use the document.location.hostname JS variable | def client_hostname
@opts[:hostname]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end",
"def host_url\n proto = request.env['SERVER_PROTOCOL'].downcase.index(\"https\").nil? ? \"http\" : \"https\"\n return \"#{proto}://#{request.env['HTTP_HOST... | [
"0.791169",
"0.7877971",
"0.7871177",
"0.7683237",
"0.7550056",
"0.7548946",
"0.75423926",
"0.75333494",
"0.75275546",
"0.752108",
"0.7492345",
"0.7456276",
"0.7456276",
"0.7434922",
"0.7410368",
"0.73989785",
"0.7350311",
"0.73337597",
"0.73299557",
"0.73187023",
"0.7290248"... | 0.75821114 | 4 |
Flash error message and redirect | def access_denied(
message="You don't have permission to complete that action.",
default=root_path )
session[:return_to] = request.request_uri unless params[:format] == 'js'
flash[:error] = message
redirect_to default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failure\n flash[:error] = params[:message]\n redirect_to :action=>'login'\n end",
"def flash_error\n Rails.logger.info(\"INSIDE ERROR\");\n # flash_message :error, 'Something went wrong..' # _FLASH_\n # flash[:error] = \"#{exception.message} (Something went wrong..)\" # _FLASH_\n redir... | [
"0.8003087",
"0.78225046",
"0.78096944",
"0.7720187",
"0.7628846",
"0.7607153",
"0.75576985",
"0.74865574",
"0.74766016",
"0.74570656",
"0.74570656",
"0.74570656",
"0.74443334",
"0.74403954",
"0.736731",
"0.736731",
"0.73161465",
"0.7304682",
"0.7291077",
"0.72902316",
"0.728... | 0.0 | -1 |
I worked on this challenge [by myself, with: ]. shortest_string is a method that takes an array of strings as its input and returns the shortest string +list_of_words+ is an array of strings shortest_string(array) should return the shortest string in the +list_of_words+ If +list_of_words+ is empty the method should ret... | def shortest_string(list_of_words)
if list_of_words == []
return nil
end
i = 0
array_length = array_size(list_of_words)
smallest_index = 0
for i in 0..array_length - 1
if string_length(list_of_words[smallest_index]) > string_length(list_of_words[i])
smallest_index = i
end
end
return li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n # ... | [
"0.89293456",
"0.887371",
"0.8859793",
"0.8833634",
"0.8830613",
"0.87613",
"0.87562156",
"0.8723726",
"0.8708266",
"0.8707385",
"0.8683081",
"0.86545795",
"0.864819",
"0.8646638",
"0.8624431",
"0.86171454",
"0.8605628",
"0.85849667",
"0.8545254",
"0.85093117",
"0.8452691",
... | 0.8795021 | 5 |
permit non devise parameters | def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name, :role_id]
devise_parameter_sanitizer.for(:account_update) << [:first_name, :last_name, :role_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def backend_user_params\n params.permit!\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= ... | [
"0.8045199",
"0.7599419",
"0.75042766",
"0.74135214",
"0.7314874",
"0.7306869",
"0.72753394",
"0.7249848",
"0.7121715",
"0.7085468",
"0.7083155",
"0.7075788",
"0.70732224",
"0.70659655",
"0.70490944",
"0.7048586",
"0.70465904",
"0.70456547",
"0.70319515",
"0.70205784",
"0.700... | 0.0 | -1 |
Sometimes, you need a bit of extra help externalizing what all needs to be done and in what order. This very short program was written to help sort that in a simple interactive app. | def new_task(task)
loop do
puts "What do you need to do in order to #{task}?"
input = gets.chomp
if input == "nothing" || input == "done" || input == "next"
break
else
new_task(input)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help\n system 'clear'\n puts Rainbow(\"Here is a list of all available student names:\").blue\n puts \"\"\n @studentsArray.sort_by { |x| x[\"name\"] }.each { |x| print x[\"name\"].split.map(&:capitalize).join(' ') + \", \"}\n puts \"\"\n puts \"\"\n main\nend",
"def help\n puts \"To a... | [
"0.6637707",
"0.6436215",
"0.633377",
"0.631866",
"0.6266744",
"0.62626433",
"0.6128594",
"0.6120785",
"0.611698",
"0.61074704",
"0.61055905",
"0.6089374",
"0.60637176",
"0.6056976",
"0.6056976",
"0.6056976",
"0.6056976",
"0.6056976",
"0.6056976",
"0.6013552",
"0.5987823",
... | 0.0 | -1 |
kills the chef run if the iptables cookbook is NOT scheduled to run AFTER the one specified (in which case the new rules wouldn't be enforced!) | def ensure_iptables_will_run_after current_cookbook
Chef::Application.fatal!("The iptables resources declared in #{current_cookbook} can't be enforced since diptables doesn't run afterwards!") unless recipes.slice(recipes.index(current_cookbook), recipes.length).include?('diptables')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_kill\n\n return kill_when_ended if node_ended?\n #return kill_when_closed if node_closed? # nothing of the sort\n\n kill\n end",
"def kill\n\n close_node\n\n wrap_cancel_children('flavour' => 'kill') +\n wrap_cancelled\n end",
"def attempt_to_stop\n recipe.schedule.clean_up_task_j... | [
"0.5753037",
"0.5559708",
"0.55395925",
"0.5492888",
"0.54866964",
"0.5415094",
"0.5385699",
"0.5370739",
"0.53671515",
"0.53037906",
"0.529186",
"0.5274776",
"0.52219456",
"0.52179056",
"0.52179056",
"0.519775",
"0.51763535",
"0.5174647",
"0.5148175",
"0.5132405",
"0.5114859... | 0.6319491 | 0 |
GET /universes GET /universes.xml | def index
@universes = Universe.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @universes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @usrs = Usr.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml =... | [
"0.6808032",
"0.5847772",
"0.5791794",
"0.564781",
"0.55885947",
"0.55293274",
"0.55114067",
"0.5505591",
"0.54942983",
"0.54942125",
"0.548024",
"0.5475541",
"0.5463612",
"0.54490376",
"0.54337066",
"0.5418896",
"0.5417791",
"0.539003",
"0.5385885",
"0.5371568",
"0.53676444"... | 0.7451078 | 0 |
GET /universes/1 GET /universes/1.xml | def show
@universe = Universe.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @universe }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { r... | [
"0.7238921",
"0.631494",
"0.59896636",
"0.5766955",
"0.574536",
"0.56644934",
"0.5656682",
"0.5615524",
"0.55660284",
"0.554214",
"0.5530434",
"0.5512368",
"0.54915524",
"0.5484187",
"0.5453501",
"0.54321975",
"0.5430844",
"0.5423877",
"0.54192984",
"0.5418649",
"0.5418453",
... | 0.5976394 | 3 |
GET /universes/new GET /universes/new.xml | def new
@universe = Universe.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @universe }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @unidades = Unidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @unidades }\n end\n end",
"def new... | [
"0.703252",
"0.6687344",
"0.6663585",
"0.66455793",
"0.6641767",
"0.660338",
"0.6580019",
"0.65678436",
"0.6549313",
"0.6536497",
"0.65029114",
"0.65005624",
"0.6478365",
"0.64702564",
"0.64560056",
"0.64559776",
"0.64559776",
"0.6454788",
"0.64370275",
"0.6436383",
"0.642949... | 0.7123327 | 0 |
POST /universes POST /universes.xml | def create
@universe = Universe.new(params[:universe])
respond_to do |format|
if @universe.save
flash[:notice] = 'Universe was successfully created.'
format.html { redirect_to(@universe) }
format.xml { render :xml => @universe, :status => :created, :location => @universe }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.n... | [
"0.581656",
"0.5442081",
"0.5440965",
"0.52394426",
"0.520211",
"0.515422",
"0.5150656",
"0.51345843",
"0.5104756",
"0.50894976",
"0.5082004",
"0.5059605",
"0.50328803",
"0.48824403",
"0.48665264",
"0.48525542",
"0.48433563",
"0.48386696",
"0.48225856",
"0.48194763",
"0.48139... | 0.5231437 | 4 |
PUT /universes/1 PUT /universes/1.xml | def update
@universe = Universe.find(params[:id])
respond_to do |format|
if @universe.update_attributes(params[:universe])
flash[:notice] = 'Universe was successfully updated.'
format.html { redirect_to(@universe) }
format.xml { head :ok }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"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 upd... | [
"0.59951526",
"0.5894885",
"0.5603712",
"0.5532382",
"0.5527181",
"0.55249155",
"0.55102116",
"0.5506766",
"0.54822016",
"0.54557115",
"0.53944755",
"0.535674",
"0.5292211",
"0.5282174",
"0.52718633",
"0.5261803",
"0.5236202",
"0.5219384",
"0.5217981",
"0.5200736",
"0.5197812... | 0.57802206 | 2 |
DELETE /universes/1 DELETE /universes/1.xml | def destroy
@universe = Universe.find(params[:id])
@universe.destroy
respond_to do |format|
format.html { redirect_to(universes_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @survivor = Survivor.find(params[:id])\n @survivor.destroy\n \n respond_to do |format|\n format.fbml { redirect_to(survivors_url) }\n format.xml { head :ok }\n end\n end",
"de... | [
"0.6618308",
"0.63890964",
"0.6371797",
"0.6335503",
"0.628567",
"0.62637186",
"0.62360156",
"0.61962456",
"0.6194175",
"0.6186762",
"0.6184886",
"0.61644506",
"0.6148827",
"0.61479294",
"0.6147152",
"0.6143013",
"0.6135662",
"0.61314505",
"0.6124009",
"0.6109137",
"0.6108338... | 0.6594795 | 1 |
def s(x) ; xxxxxxx/((x+1)(x+1)(x+1)(x+1)(x+1)(x+1)(x+1)) ; end | def s(x); 1; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s1(n)\n (n*(n+1)/2)**2\nend",
"def s2(n)\n n*(n+1)*(2*n+1)/6\nend",
"def s(n)\n ((9*n-1)*(10**n)+1)/9\nend",
"def s(n)\n n.to_s.gsub(/\\d/) { |d| d.to_i**2 }.to_i\nend",
"def simpson_0_1(s)\n calc = (1)+4*(1.0/(1+s*0.25*0.25))+2*(1.0/(1+s*0.5*0.5))+4*(1.0/(1+s*0.75*0.75))+(1.0/(1+s)) \n re... | [
"0.78316736",
"0.7532334",
"0.7411413",
"0.71194863",
"0.6863063",
"0.65697443",
"0.6552318",
"0.6481058",
"0.6456562",
"0.6429927",
"0.638896",
"0.63377506",
"0.63220066",
"0.6315678",
"0.6315678",
"0.63108045",
"0.628892",
"0.62664264",
"0.6253885",
"0.6227003",
"0.6185843"... | 0.7444039 | 2 |
whether running the test file has been attempted, regardless of outcome | def attempted?
!!attempted
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_run?(test_case)\n test_case[:exec_status] == 'n'\n end",
"def test_file_exists?\n\t\tif @test_file_name.nil?\n\t\t\tputs \"No test data given to run. Exiting.\"\n\t\t\texit(0)\n\t\tend\n\tend",
"def failure?\n exit_code != 0\n end",
"def failed?\n not @ok\n end",
"def r... | [
"0.75058544",
"0.73606914",
"0.728815",
"0.7239883",
"0.7222077",
"0.72110224",
"0.7191435",
"0.71879804",
"0.71478355",
"0.7084903",
"0.7056273",
"0.7046391",
"0.7038572",
"0.70193434",
"0.69305867",
"0.69305867",
"0.6921462",
"0.6896308",
"0.6883698",
"0.68298477",
"0.68297... | 0.63622123 | 99 |
whether the test has run to completion and gotten results, regardless of outcome | def completed?
!!completed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ran?\n completed? || failed?\n end",
"def passed?\n return @test_passed\n end",
"def ok?\n run unless ran?\n\n @status.success?\n end",
"def finished?\n failed? or successful? or skipped?\n end",
"def passed?\n !failed?\n end",
"def passing?\n retur... | [
"0.79380727",
"0.749905",
"0.74103916",
"0.73621714",
"0.7338911",
"0.7258018",
"0.72399527",
"0.7212631",
"0.7200355",
"0.72000974",
"0.7179231",
"0.7151635",
"0.71203375",
"0.7081127",
"0.706405",
"0.70246506",
"0.7018863",
"0.70144254",
"0.70135236",
"0.6988018",
"0.698342... | 0.0 | -1 |
true if the unit has run to completion free of any test failures or errors | def passing?
completed? && !has_failures? && !has_errors?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passed?\n failures.empty?\n end",
"def flexmock_test_has_failed? # :nodoc:\n passed? == false\n end",
"def tests_contain_failures?\n $?.exitstatus == PHPUNIT_FAILURES_EXITCODE\n end",
"def passed?\n !failed?\n end",
"def ran?\n completed? || fail... | [
"0.7355184",
"0.7300119",
"0.72304726",
"0.71668243",
"0.711776",
"0.71027577",
"0.70624685",
"0.70435834",
"0.6999283",
"0.69952416",
"0.69509685",
"0.6932559",
"0.6931671",
"0.6923467",
"0.6921264",
"0.6912013",
"0.6912013",
"0.6883086",
"0.68522567",
"0.6845041",
"0.684251... | 0.7063734 | 6 |
true if the unit has run to completion and encountered failures and/or errors | def failing?
completed? && has_failures? || has_errors?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ran?\n completed? || failed?\n end",
"def passed?\n failures.empty?\n end",
"def ok?\n run unless ran?\n\n @status.success?\n end",
"def failing_with_errors?\n completed? && has_failures? && has_errors?\n end",
"def success?\n (@failures + @errors) == 0\n ... | [
"0.747838",
"0.73168784",
"0.7272565",
"0.7234516",
"0.72323596",
"0.7225293",
"0.71460843",
"0.70962584",
"0.70962584",
"0.70534164",
"0.7024653",
"0.70178246",
"0.6964114",
"0.6964114",
"0.69303536",
"0.692106",
"0.68828285",
"0.68567634",
"0.68549514",
"0.68482167",
"0.684... | 0.71579057 | 6 |
true if the unit has run to completion and encountered failures and/or errors | def failing_with_errors?
completed? && has_failures? && has_errors?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ran?\n completed? || failed?\n end",
"def passed?\n failures.empty?\n end",
"def ok?\n run unless ran?\n\n @status.success?\n end",
"def success?\n (@failures + @errors) == 0\n end",
"def finished?\n failed? or successful? or skipped?\n end",
"def fail... | [
"0.747838",
"0.73168784",
"0.7272565",
"0.72323596",
"0.7225293",
"0.71579057",
"0.71460843",
"0.70962584",
"0.70962584",
"0.70534164",
"0.7024653",
"0.70178246",
"0.6964114",
"0.6964114",
"0.69303536",
"0.692106",
"0.68828285",
"0.68567634",
"0.68549514",
"0.68482167",
"0.68... | 0.7234516 | 3 |
tests failed via unmet assertions | def has_failures?
completed? && @raw_result['failures'] != '0'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failures; end",
"def failures; end",
"def failures; end",
"def assertions; end",
"def assertions; end",
"def assert_error_occurred\n assert_not_exit_status 0\n end",
"def test_results_invalid\r\n assert_raises('rubies_found must be an integer!') { @g.results('a') }\r\n end",
"def test... | [
"0.7381998",
"0.7381998",
"0.7381998",
"0.7197381",
"0.7197381",
"0.7072239",
"0.70005053",
"0.6992915",
"0.6967247",
"0.69402397",
"0.68596095",
"0.68596095",
"0.6833605",
"0.6831504",
"0.6813329",
"0.6800338",
"0.67627156",
"0.6714945",
"0.6702529",
"0.66825014",
"0.6682501... | 0.0 | -1 |
Create a new transformer with tSNE. | def initialize(n_components: 2, perplexity: 30.0, metric: 'euclidean', init: 'random',
max_iter: 500, tol: nil, verbose: false, random_seed: nil)
super()
@params = {
n_components: n_components,
perplexity: perplexity,
max_iter: max_iter,
tol: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformer\n @transformer ||= Transformer.new self\n end",
"def create_node(t)\n raise NotImplementedError\n end",
"def prepare_network\n @neural_net = RubyFann::Standard.new(num_inputs: @nuerons_number,\n hidden_neurons: [(2 * @nuerons_number) / 3],\... | [
"0.5236486",
"0.47763625",
"0.47467253",
"0.4666929",
"0.46261674",
"0.45820633",
"0.4576399",
"0.45082912",
"0.44850308",
"0.44515967",
"0.44376108",
"0.4413137",
"0.43676317",
"0.43396097",
"0.43264017",
"0.43081132",
"0.42923805",
"0.42482466",
"0.4245618",
"0.4235524",
"0... | 0.0 | -1 |
Fit the model with given training data. | def fit(x, _not_used = nil)
x = ::Rumale::Validation.check_convert_sample_array(x)
if @params[:metric] == 'precomputed' && x.shape[0] != x.shape[1]
raise ArgumentError, 'Expect the input distance matrix to be square.'
end
# initialize some varibales.
@n_iter = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(x, y)\n x = Rumale::Validation.check_convert_sample_array(x)\n y = Rumale::Validation.check_convert_label_array(y)\n Rumale::Validation.check_sample_size(x, y)\n xx = fit_bias? ? expand_feature(x) : x\n @model = Numo::Liblinear.train(xx, y, liblinear_params)\n @wei... | [
"0.6924925",
"0.68151647",
"0.6707346",
"0.6380383",
"0.6327263",
"0.63124955",
"0.62570554",
"0.62546253",
"0.6231997",
"0.61450773",
"0.6088699",
"0.6060084",
"0.60080683",
"0.59948736",
"0.5990137",
"0.5990137",
"0.5966133",
"0.5919537",
"0.5836801",
"0.5803742",
"0.579635... | 0.53083146 | 51 |
Fit the model with training data, and then transform them with the learned model. | def fit_transform(x, _not_used = nil)
x = ::Rumale::Validation.check_convert_sample_array(x)
fit(x)
@embedding.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_transform(x, _y = nil)\n fit(x).transform(x)\n end",
"def fit_transform(x, y = nil)\n fit(x, y).transform(x)\n end",
"def fit_transform(x, y)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n y = ::Rumale::Validation.check_convert_label_array(y)\n :... | [
"0.65384334",
"0.6321322",
"0.63150316",
"0.6233392",
"0.6233392",
"0.6233392",
"0.6233392",
"0.6195593",
"0.6150664",
"0.6150664",
"0.61483896",
"0.60545814",
"0.59883815",
"0.57508945",
"0.57296574",
"0.5713993",
"0.5692568",
"0.5676928",
"0.56212294",
"0.5619347",
"0.56193... | 0.627912 | 3 |
update search query in session store | def search_params
if params[:q] == nil
params[:q] = session['search_key']
end
if params[:q]
session['search_key'] = params[:q]
end
params[:q]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n session[:search][:counter] = params[:counter]\n redirect_to :action => \"show\"\n end",
"def update\n if params[:counter] && session[:search][:counter] != params[:counter]\n session[:search][:counter] = params[:counter]\n end\n\n if params[:id]\n redirect_to action: \"show\... | [
"0.72319",
"0.71956617",
"0.717731",
"0.7158004",
"0.71560675",
"0.7034267",
"0.7017355",
"0.6960934",
"0.6950071",
"0.6926291",
"0.6779996",
"0.6772694",
"0.67034227",
"0.66888505",
"0.6663989",
"0.6605664",
"0.65314966",
"0.6430199",
"0.63866305",
"0.6366354",
"0.63454264",... | 0.6510457 | 17 |
delete search parameters from the session | def clear_search_params
if params[:search_cancel]
params.delete(:search_cancel)
unless search_params.nil?
search_params.each do |key, param|
search_params[key] = nil
end
end
# remove from session
session.delete('search_key')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort].each do |pname|\n params[pname].blank? ? session[:search].delete(pname) : session[:search][pname] = params[pname]\n end\n end",
"def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort, :... | [
"0.83076656",
"0.83034915",
"0.78902614",
"0.7780133",
"0.7361849",
"0.72684354",
"0.71445894",
"0.6695148",
"0.66818243",
"0.6661109",
"0.66349113",
"0.6617487",
"0.64771944",
"0.64232534",
"0.63984126",
"0.63944685",
"0.6365353",
"0.62626797",
"0.6241117",
"0.61913896",
"0.... | 0.7712001 | 4 |
GET /admin/water_types GET /admin/water_types.json | def index
@water_types = WaterType.all
new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_water_types\n @water_types = Fishery.friendly.find(params[:id]).water_types\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_type... | [
"0.7016876",
"0.69596654",
"0.66525596",
"0.66487056",
"0.65835613",
"0.6526954",
"0.6487691",
"0.6487691",
"0.6346502",
"0.63173264",
"0.6298047",
"0.6266981",
"0.62454224",
"0.62288964",
"0.62119406",
"0.6200789",
"0.61464655",
"0.6145372",
"0.61385024",
"0.6133042",
"0.613... | 0.6662744 | 2 |
GET /admin/water_types/1 GET /admin/water_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_water_types\n @water_types = Fishery.friendly.find(params[:id]).water_types\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @water_types = WaterType.all\n new\n end",
"def create\n @water_type = WaterType.new(water_type_params)\n... | [
"0.6964167",
"0.69485325",
"0.67216045",
"0.66220087",
"0.655052",
"0.6489389",
"0.64081806",
"0.64081806",
"0.6313831",
"0.62911636",
"0.62341595",
"0.62337756",
"0.6210858",
"0.6198609",
"0.61334556",
"0.6130531",
"0.61037034",
"0.60948",
"0.6092455",
"0.6058744",
"0.604826... | 0.0 | -1 |
POST /admin/water_types POST /admin/water_types.json | def create
@water_type = WaterType.new(water_type_params)
respond_to do |format|
if @water_type.save
format.html { redirect_to admin_water_types_path, notice: 'Water type was successfully created.' }
format.json { render action: 'show', status: :created, location: @water_type }
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_water_types\n @water_types = Fishery.friendly.find(params[:id]).water_types\n end",
"def index\n @water_types = WaterType.all\n new\n end",
"def water_type_params\n params.require(:water_type).permit(:category)\n end",
"def set_water_type\n @water_type = WaterType.find(params[:id])\... | [
"0.70203465",
"0.6532285",
"0.6458646",
"0.6254381",
"0.6110263",
"0.6110263",
"0.6088588",
"0.6088588",
"0.608073",
"0.6034403",
"0.6018526",
"0.59226924",
"0.5922258",
"0.58729005",
"0.5868495",
"0.58284533",
"0.58076364",
"0.5803343",
"0.5801944",
"0.57908654",
"0.57762444... | 0.7555161 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.