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 |
|---|---|---|---|---|---|---|
[PUT] Update a deal field | def update_deal_field(id:, **args)
params = parameters(args) do
required_params :name
optional_params :name, :options
end
request(:put, "dealFields/#{id}", params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end",
"def update\n @deal = Deal.find(params[:id])\n \n respond_to do |format|\n if @deal.update_attributes(params[:deal])\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n for... | [
"0.7555995",
"0.7215206",
"0.7157105",
"0.71557915",
"0.7120887",
"0.6909224",
"0.6879543",
"0.6872805",
"0.6856407",
"0.6838307",
"0.6773553",
"0.67612684",
"0.67288333",
"0.6692408",
"0.6627978",
"0.6605597",
"0.6507938",
"0.6496857",
"0.6415345",
"0.63888955",
"0.63832045"... | 0.7751553 | 0 |
[DELETE] Delete multiple deal fields in bulk | def delete_deal_fields(**args)
params = parameters(args) do
required_params :ids
optional_params :ids
end
request(:delete, 'dealFields', params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_person_fields(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'personFields', params)\n end",
"def destroy_bulk(list_of_native_records)\n #TODO: Investigate why mutiple ids may be returned for ... | [
"0.6720091",
"0.66966283",
"0.6642808",
"0.6519886",
"0.6514044",
"0.64666873",
"0.6457708",
"0.6452062",
"0.6441211",
"0.6373481",
"0.6369305",
"0.63209355",
"0.6297912",
"0.6279817",
"0.6248104",
"0.6187702",
"0.6179862",
"0.6172577",
"0.617193",
"0.61664563",
"0.6163232",
... | 0.7672739 | 0 |
[DELETE] Delete a deal field | def delete_deal_field(id:, **args)
params = parameters(args) do
optional_params
end
request(:delete, "dealFields/#{id}", params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_field!(field_name); end",
"def delete_deal_fields(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'dealFields', params)\n end",
"def delete_field(id)\n delete(\"fields/#{id}\")\n end... | [
"0.7740039",
"0.721596",
"0.71321756",
"0.7117631",
"0.7069949",
"0.6912615",
"0.6882183",
"0.6811621",
"0.6796978",
"0.6791165",
"0.674975",
"0.67335236",
"0.67335236",
"0.67328155",
"0.6727878",
"0.66991514",
"0.6632234",
"0.6621289",
"0.65912056",
"0.65835273",
"0.657252",... | 0.78146756 | 0 |
GET /ezii_robot_experiments GET /ezii_robot_experiments.json | def index
@ezii_robot_experiments = EziiRobotExperiment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def list_experiments\n @interface.list_experiments\n end",
"def fetch_experiments(page)\n puts page\n url = @base + \"/api/v1/experiments.json?token=#... | [
"0.7499914",
"0.738189",
"0.70021176",
"0.69794214",
"0.6956436",
"0.6753733",
"0.6646633",
"0.65768355",
"0.65546614",
"0.6482887",
"0.6443373",
"0.63696975",
"0.63696975",
"0.6239826",
"0.6228437",
"0.61700755",
"0.6034712",
"0.6026045",
"0.5952962",
"0.58981675",
"0.586413... | 0.7711424 | 0 |
GET /ezii_robot_experiments/1 GET /ezii_robot_experiments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def index\n @ezii_robot_experiments = EziiRobotExperiment.all\n end",
"def fetch_experiments(page)\n puts page\n url = @base + \"/api/v1/experiments.json?... | [
"0.79031485",
"0.7365801",
"0.709803",
"0.69331324",
"0.6763599",
"0.6657959",
"0.6626522",
"0.6626522",
"0.65615535",
"0.6539821",
"0.6413126",
"0.634713",
"0.6278173",
"0.6125601",
"0.60546315",
"0.60370064",
"0.6024213",
"0.60112774",
"0.60007834",
"0.60007834",
"0.5986669... | 0.0 | -1 |
POST /ezii_robot_experiments POST /ezii_robot_experiments.json | def create
@ezii_robot_experiment = EziiRobotExperiment.new(ezii_robot_experiment_params)
respond_to do |format|
if @ezii_robot_experiment.save
format.html { redirect_to @ezii_robot_experiment, notice: 'Ezii robot experiment was successfully created.' }
format.json { render :show, status:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @experiment = Experiment.new(experiment_params)\n\n respond_to do |format|\n if @experiment.save\n format.html { redirect_to @experiment, notice: 'Experiment was successfully created.' }\n format.json { render :show, status: :created, location: @experiment }\n else\n ... | [
"0.65698946",
"0.65698946",
"0.6542733",
"0.65310395",
"0.6525989",
"0.6524994",
"0.6338122",
"0.6318964",
"0.6305208",
"0.6196896",
"0.6156558",
"0.61134934",
"0.61102104",
"0.6057233",
"0.6044384",
"0.60282123",
"0.60051954",
"0.5994623",
"0.5992111",
"0.5966689",
"0.594341... | 0.70702726 | 0 |
PATCH/PUT /ezii_robot_experiments/1 PATCH/PUT /ezii_robot_experiments/1.json | def update
respond_to do |format|
if @ezii_robot_experiment.update(ezii_robot_experiment_params)
format.html { redirect_to @ezii_robot_experiment, notice: 'Ezii robot experiment was successfully updated.' }
format.json { render :show, status: :ok, location: @ezii_robot_experiment }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'experiment was successfully updated.' }\n format.json { head :no_content }\n else\n forma... | [
"0.6933732",
"0.6928924",
"0.6928924",
"0.6846997",
"0.6705858",
"0.6679624",
"0.6679624",
"0.659104",
"0.6439952",
"0.6363789",
"0.6215187",
"0.62150073",
"0.6206672",
"0.6206672",
"0.61178744",
"0.6076792",
"0.60767114",
"0.6059149",
"0.60152364",
"0.6014727",
"0.59763956",... | 0.69200265 | 3 |
DELETE /ezii_robot_experiments/1 DELETE /ezii_robot_experiments/1.json | def destroy
@ezii_robot_experiment.destroy
respond_to do |format|
format.html { redirect_to ezii_robot_experiments_url, notice: 'Ezii robot experiment was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n set_experiments\n @experiment.destroy\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n ... | [
"0.74689174",
"0.7450105",
"0.7450105",
"0.7450105",
"0.73298264",
"0.714162",
"0.714162",
"0.7100287",
"0.7100287",
"0.7043699",
"0.70022166",
"0.6929709",
"0.6852047",
"0.67553806",
"0.6707912",
"0.65959716",
"0.6581619",
"0.65645653",
"0.6563155",
"0.6543958",
"0.6541762",... | 0.75388265 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ezii_robot_experiment
@ezii_robot_experiment = EziiRobotExperiment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ezii_robot_experiment_params
params.fetch(:ezii_robot_experiment, {})
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 |
Creates all the necessary routes for the Elrte configurations Use this within the routes.rb file: Application.routes.draw do |map| Elrte.routes(self) end | def apply(router)
router.send(:get, {:elfinder => 'elfinder#connector', :as => 'elfinder_connector'})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inject_vlr_routes\n unless IO.read(\"config/routes.rb\").include?('CommonwealthVlrEngine::Engine')\n marker = 'Rails.application.routes.draw do'\n insert_into_file \"config/routes.rb\", :after => marker do\n %q{\n\n root :to => 'pages#home'\n\n # routes for CommonwealthVlrEngine\n... | [
"0.6922917",
"0.6848783",
"0.68431246",
"0.68270475",
"0.68270475",
"0.6803599",
"0.6718287",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.66030425",
"0.65198416",
"0.6514812",
"... | 0.0 | -1 |
returns the given string with all five or more letter words reversed | def reverse_long_words(sentence)
temp_array = []
sentence.split.each do |word|
word.length > 4 ? temp_array.push(word.reverse) : temp_array.push(word)
end
temp_array.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def reverse_words(string)\n words = string.split\n words.each { |word| word.reverse! if w... | [
"0.8415812",
"0.8415812",
"0.8406897",
"0.83709186",
"0.8364383",
"0.8348687",
"0.8326765",
"0.83096457",
"0.829775",
"0.8275973",
"0.8274583",
"0.825741",
"0.8255306",
"0.8252032",
"0.8219939",
"0.82085294",
"0.818546",
"0.8183675",
"0.8177951",
"0.8176677",
"0.8173297",
"... | 0.0 | -1 |
if the plan id has _business_ or _enterprise_ or _premium_ in it, we'll do premium transcripts | def has_premium_transcripts?
self.id.match(/_(business|enterprise|premium)_/) or self.id.match(/_(monthly|yearly)/) or self.is_community?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def premium?\n product == \"premium\"\n end",
"def purchase_sub_existing\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_m... | [
"0.6203865",
"0.61147565",
"0.5921678",
"0.5835523",
"0.5828185",
"0.57417893",
"0.5716532",
"0.56928873",
"0.5633887",
"0.5623223",
"0.5607448",
"0.5596905",
"0.55955786",
"0.55934733",
"0.5521015",
"0.54957265",
"0.54923296",
"0.5471645",
"0.54598975",
"0.5456924",
"0.54376... | 0.7769075 | 0 |
Wait for a result targeted to the named block and position to show up. When it does (there is in reality no real waiting because the result is sent before the messate to execute the output (receiver of the result). So far, there are two kinds of results: a binary confirmation and a displacement result which yeilds the ... | def take_results_for(name, position)
result = Backtest::Result.receive(name, position)
result.decode()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_type_wait(job_id,result_type)\n \n #wait for the result\n nr = 0\n stat = status(job_id)\n until stat == 'FINISHED'\n nr += 1\n puts \"status: #{stat}, nr: #{nr}\"\n sleep 30\n stat = status(job_id)\n end\n #return requested result_type\n\n ... | [
"0.64107305",
"0.6352893",
"0.606598",
"0.59295106",
"0.59295106",
"0.59295106",
"0.5905665",
"0.58906335",
"0.5866006",
"0.58409154",
"0.5837379",
"0.5837379",
"0.58229107",
"0.57222044",
"0.57145107",
"0.57089865",
"0.56826305",
"0.5667877",
"0.56068027",
"0.5598921",
"0.55... | 0.6174327 | 2 |
Copyright 2010, Geir Isene. Released under the GPL v. 2 Version 0.1 (20100308) | def help
puts <<HELPTEXT
NAME
lifasread - LIF ascii file read
SYNOPSIS
lifasread [-hv] [--help, --version] [lif-file] [destination file]
DESCRIPTION
lifasread is used as a tool for HP-41 or HP-71 connected to a PC.
lifasread reads an ascii file inside a lif formated file.
It reads only the first ascii fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def verdi; end",
"def berlioz; end",
"def terpene; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def blg; end",
"def dh; end",
"def stderrs; end",
"def gounod; end",
"def suivre; end",
"d... | [
"0.7077999",
"0.65841097",
"0.64610595",
"0.62889814",
"0.6255782",
"0.62356156",
"0.6150959",
"0.6150959",
"0.6150959",
"0.6150959",
"0.6104369",
"0.60419583",
"0.5996429",
"0.59522134",
"0.5903037",
"0.5858713",
"0.58535796",
"0.5828803",
"0.5816672",
"0.58051604",
"0.58051... | 0.0 | -1 |
north draw a line | calculate the angle and its remapping | def draw
frame_rate 10
background 0
stroke 255
stroke_weight 2
dx = width/2 - mouse_x
dy = height/2 - mouse_y
line(width/2, height/2, mouse_x, mouse_y)
angle = atan2(dy, dx)
#puts "angle in radians" + angle.to_s
deg = degrees(angle)
puts "degrees(angle) " + deg.to_s
mapped = north(deg)
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end",
"def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end",
"def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end",
"def rotate(angle)\n... | [
"0.75859606",
"0.71935916",
"0.6614269",
"0.6603177",
"0.651872",
"0.64734817",
"0.6443376",
"0.6438113",
"0.63113016",
"0.62544394",
"0.6209642",
"0.6162115",
"0.61100113",
"0.60748947",
"0.6046177",
"0.59974766",
"0.5994556",
"0.597396",
"0.59163254",
"0.58932966",
"0.58824... | 0.6680863 | 2 |
mount_base64_uploader :image, ImageUploader, file_name: 'key_feature' | def key_feature_type
KeyFeatureType.find_by_id(self.key_feature_type_id).try(:feature_type_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_uploader\n # TODO\n end",
"def upload(raw64)\n raise NotImplementedError\n end",
"def main_image_with_base64=(data)\n image = data\n\n if data.is_a?(String) && data.include?(\"data:image\")\n parts = data.split(',')\n\n meta = parts.first\n content_type = meta.split('... | [
"0.60201114",
"0.6017593",
"0.6013282",
"0.59689397",
"0.5928594",
"0.59080964",
"0.5898463",
"0.5874455",
"0.5867521",
"0.5860566",
"0.5828117",
"0.58267725",
"0.58226967",
"0.5802992",
"0.5802992",
"0.57977265",
"0.5780118",
"0.5631474",
"0.56267923",
"0.5626262",
"0.560889... | 0.0 | -1 |
this is quite an optimistic script as it both uses 3rd party sites and has very little in the way of error checking. | def get_score(user, module_name)
url = "https://forgeapi.puppetlabs.com/private/validations/#{user}-#{module_name}"
response = Typhoeus.get(url).body
meta_data = JSON.parse response
meta_data[-1]['score'] / 20.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apache_script_alias_rce_check(site)\n if $config['HTTP']['TOR_PROXY']\n print_error(\"Sorry - NO TOR Support for this module at this time!\")\n return nil\n end\n paths = [ '', '/backdoor', '/phppath', '/php_amon', '/local-bin', '/php', '/php3', '/php4', '/php5', '/bin', '/_php' ]\n paths.each do |p|... | [
"0.60416657",
"0.5710298",
"0.5660419",
"0.5522773",
"0.5502741",
"0.54940516",
"0.54908824",
"0.54907006",
"0.54441243",
"0.54317176",
"0.5409052",
"0.5388824",
"0.5386602",
"0.53712565",
"0.5367924",
"0.53611284",
"0.53438425",
"0.53393877",
"0.53370064",
"0.5334965",
"0.53... | 0.0 | -1 |
str2 = "hello cherry" | def my_method
str2 = "get some!"
puts str2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2; end",
"def str2; end",
"def str1\n 'from string'\nend",
"def str1; end",
"def str1; end",
"def str(str); end",
"def str(str); end",
"def from_phonetic(str)\n string = \"\"\n for word in str.split(\" \")\n string += word[0].upcase\n end\n return string\n end",
"def first... | [
"0.64447284",
"0.64447284",
"0.63762045",
"0.6281606",
"0.6281606",
"0.62347347",
"0.62347347",
"0.6185764",
"0.61317265",
"0.6129334",
"0.61117506",
"0.6100366",
"0.6046225",
"0.60322315",
"0.60209835",
"0.6017496",
"0.6013396",
"0.5995512",
"0.5995512",
"0.59788424",
"0.596... | 0.0 | -1 |
GET /specific_gravities GET /specific_gravities.json | def index
@specific_gravities = @batch.specific_gravities
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @gravities = Gravity.all\n end",
"def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
... | [
"0.6777786",
"0.61602175",
"0.6110726",
"0.603212",
"0.58275133",
"0.5734668",
"0.5649171",
"0.55825984",
"0.55636847",
"0.55467165",
"0.5535299",
"0.552829",
"0.5487836",
"0.5450128",
"0.54397005",
"0.541446",
"0.5407041",
"0.54022264",
"0.53940845",
"0.53582597",
"0.5352664... | 0.7328512 | 0 |
GET /specific_gravities/1 GET /specific_gravities/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @specific_gravities = @batch.specific_gravities\n end",
"def index\n @gravities = Gravity.all\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
... | [
"0.72550994",
"0.6775266",
"0.61647564",
"0.60834587",
"0.6057144",
"0.6050749",
"0.603101",
"0.59351",
"0.5924659",
"0.59048885",
"0.58721244",
"0.58270484",
"0.57750046",
"0.5734509",
"0.5673625",
"0.56312037",
"0.5627161",
"0.5621047",
"0.56187606",
"0.55795926",
"0.556834... | 0.0 | -1 |
POST /specific_gravities POST /specific_gravities.json | def create
@specific_gravity = SpecificGravity.new(specific_gravity_params)
respond_to do |format|
if @specific_gravity.save
format.html { redirect_to @batch, notice: 'Specific gravity was successfully created.' }
format.json { render :show, status: :created, location: @specific_gravity }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @specific_gravities = @batch.specific_gravities\n end",
"def rigging_params\n params.require(:rigging).permit(:rigging)\n end",
"def available_gravities\n {\n size: [\"grow\", \"shrink\", \"closest_fit\"],\n x: [\"left\", \"center\", \"right\"],\n y: [\... | [
"0.65532476",
"0.5747093",
"0.56812865",
"0.56514364",
"0.55992687",
"0.55188626",
"0.54954773",
"0.5474435",
"0.54664403",
"0.5465053",
"0.54371434",
"0.54186785",
"0.5416942",
"0.53918016",
"0.5381142",
"0.5354226",
"0.5334805",
"0.5307904",
"0.5305568",
"0.5268878",
"0.526... | 0.5575307 | 5 |
PATCH/PUT /specific_gravities/1 PATCH/PUT /specific_gravities/1.json | def update
respond_to do |format|
if @specific_gravity.update(specific_gravity_params)
format.html { redirect_to @batch, notice: 'Specific gravity was successfully updated.' }
format.json { render :show, status: :ok, location: @specific_gravity }
else
format.html { render :edit }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @rigging.update(rigging_params)\n format.html { redirect_to @rigging, notice: 'Rigging was successfully updated.' }\n format.json { render :show, status: :ok, location: @rigging }\n else\n format.html { render :edit }\n format.json {... | [
"0.61562836",
"0.6108678",
"0.608997",
"0.60109574",
"0.5976936",
"0.5957855",
"0.5947419",
"0.59468687",
"0.5924338",
"0.5924338",
"0.5916792",
"0.59036463",
"0.58914876",
"0.5867388",
"0.58634377",
"0.5840308",
"0.58351",
"0.5829322",
"0.58243245",
"0.5823949",
"0.5820671",... | 0.6138412 | 1 |
DELETE /specific_gravities/1 DELETE /specific_gravities/1.json | def destroy
@specific_gravity.destroy
respond_to do |format|
format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gravity = Gravity.find(params[:id])\n @gravity.destroy\n\n respond_to do |format|\n format.html { redirect_to gravities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dimgeom = Dimgeom.find(params[:id])\n @dimgeom.destroy\n\n respond_to do |f... | [
"0.69799507",
"0.693122",
"0.68169886",
"0.6815116",
"0.67891103",
"0.67066294",
"0.6641483",
"0.662692",
"0.6578167",
"0.65679073",
"0.6547395",
"0.6542563",
"0.6497685",
"0.6479397",
"0.6479397",
"0.64357585",
"0.64345133",
"0.64247686",
"0.64078045",
"0.6399601",
"0.639702... | 0.6610765 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_specific_gravity
@specific_gravity = SpecificGravity.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def specific_gravity_params
params.require(:specific_gravity).permit(:value, :temperature, :stage, :batch_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
level order, iteration going to do recursion and store the min answer in each call depth first could creat infinite loop (stack overflow) if it drills down on the left | def knight_moves start, target
raise StandardError.new("Invalid ending space") if validate_space(target)
root = Node.new(start, nil)
target_acquired = nil
queue = [root]
return queue if root.position == target
#build the structure to be searched
puts "I a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depth_min; depths.min end",
"def min_ops(n)\n\n # Step 1:\n # Create a table containing the minimum operations\n # needed to reach n given our permitted operators.\n all_parents = Array.new\n all_min_ops = [0] + [nil] * n\n\n (1..n+1).each do |k|\n curr_parent = k - 1\n curr_min_ops = all_min_ops... | [
"0.72050077",
"0.6944223",
"0.6809704",
"0.6808486",
"0.6695889",
"0.66577864",
"0.6610463",
"0.65944386",
"0.64937925",
"0.6481773",
"0.64002794",
"0.6372682",
"0.6366286",
"0.6365375",
"0.6299622",
"0.6295974",
"0.62925214",
"0.6253594",
"0.6244456",
"0.6234017",
"0.6233508... | 0.0 | -1 |
TODO: use Redis pipelining | def dashboard
@total_count = TimePilot.features.map do |feature_name|
counts = TimePilot.group_classes.map do |klass|
[klass.to_s, klass.pilot_feature_cardinality(feature_name)]
end.to_h
[feature_name, counts]
end.to_h
erb :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redis_pool; end",
"def pipelined\n if @pipelined\n @redis.pipelined do\n yield\n end\n else\n yield\n end\n end",
"def redis_pool=(_arg0); end",
"def redis_on_base\n on_base\n end",
"def redis(cmd, *args)\n fiber =... | [
"0.66645986",
"0.6391571",
"0.6263381",
"0.62112844",
"0.59813476",
"0.59774965",
"0.5972118",
"0.5949055",
"0.5939541",
"0.5890017",
"0.58351916",
"0.582702",
"0.5824222",
"0.58024067",
"0.57764846",
"0.57514405",
"0.5707721",
"0.5705047",
"0.5665729",
"0.5665729",
"0.566501... | 0.0 | -1 |
Program to output the english counterpart to a positive integer | def englishNumber number
if number < 0 # No negative numbers.
return 'Please enter a number that isn\'t negative.'
end
if number == 0
return 'zero'
end
numString = '' # This is the string we will return.
onesPlace = ['one', 'two', 'three', 'four', 'five',
'six', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def english_number number\n if number < 0 # No negative numbers.\n return 'Please enter a number that isn\\'t negative'\n end\n if number == 0\n return 'zero'\n end\n\n num_string = ''\n\n ones_place = ['one', 'two', 'three',\n 'four', 'five', 'six',\n ... | [
"0.67933214",
"0.67555547",
"0.6743123",
"0.6730089",
"0.66824317",
"0.66613775",
"0.6547415",
"0.65309316",
"0.64877796",
"0.644318",
"0.6437013",
"0.626814",
"0.62625086",
"0.6252161",
"0.6241603",
"0.6208691",
"0.6198472",
"0.61914605",
"0.6153304",
"0.6133031",
"0.6122169... | 0.6161577 | 18 |
Returns all users GET /users | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users\n get('get_users')\n end",
"def list_users\n self.class.get('/users')\n end",
"def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n ... | [
"0.873266",
"0.8592737",
"0.84376496",
"0.84313864",
"0.82865626",
"0.8276356",
"0.82578623",
"0.82164294",
"0.8208944",
"0.8205202",
"0.8190616",
"0.8154597",
"0.8141806",
"0.8121494",
"0.809059",
"0.80452704",
"0.80305713",
"0.8025438",
"0.7982683",
"0.79818416",
"0.7981841... | 0.7969646 | 26 |
Creates a new user and passes to show POST /users | def create
@user = User.find_by_phone(params[:phone])
if @user == nil
@user = User.new(query_param)
@user.add_cap_id(params[:cap_id].to_i - 1)
@user.encrypt_password(params[:password])
if params[:password] != nil && @user.save
render action: "show", id: @user.phone
else
render :json => {:bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def create\n if user.save\n redirect_to users_path\n else\n render 'new'\n end\n end",
"def create\n @user = User.new(params[:user])\n ... | [
"0.83516395",
"0.8299328",
"0.81906605",
"0.8180291",
"0.81546754",
"0.8120415",
"0.8110724",
"0.8087429",
"0.8078479",
"0.80583036",
"0.80520415",
"0.804993",
"0.80476785",
"0.8031686",
"0.80064994",
"0.80014056",
"0.79986924",
"0.7998255",
"0.79952157",
"0.79869515",
"0.798... | 0.0 | -1 |
Signs and verifies the users information GET /signin OR GET /users/signin | def signin
@user = User.authenticate(params[:phone], params[:password])
if @user
render action: "show", id: @user.phone
else
# Create an error message.
render :json => {:body => "Invalid phone or password"}, :status => 401
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signin_handle\n\t\t\tresult = User.check_signin params[:user][:account], params[:user][:password]\n\n\t\t\t# Return if not correct\n\t\t\tif result[:status] != 0\n\t\t\t\treturn respond_to do |format|\n\t\t\t\t\tformat.html { render '/users/signin' }\n\t\t\t\t\tformat.json { render json: result }\n\t\t\t\tend ... | [
"0.70476973",
"0.70110214",
"0.6857909",
"0.68552935",
"0.6826759",
"0.6823055",
"0.68100035",
"0.6807445",
"0.67751825",
"0.6759168",
"0.6731971",
"0.6706278",
"0.6702317",
"0.66829467",
"0.666715",
"0.66233647",
"0.66194564",
"0.65990984",
"0.6579754",
"0.65797395",
"0.6577... | 0.6844311 | 4 |
Parameters of a user | def query_param
params.permit(:first_name, :last_name, :phone)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_params\r\n end",
"def user_params\n end",
"def user_params\nend",
"def user(*eras); end",
"def user_params\r\n params[:user]\r\n end",
"def user_params\n params[:user]\n end",
"def user_params\n params[:user]\n end",
"def user_params\n params[:user]\n ... | [
"0.8094083",
"0.800515",
"0.7571583",
"0.73654985",
"0.7361527",
"0.73336166",
"0.73336166",
"0.73336166",
"0.73336166",
"0.73336166",
"0.73336166",
"0.73336166",
"0.7221188",
"0.7203539",
"0.71240264",
"0.7114502",
"0.7112612",
"0.7110926",
"0.710435",
"0.7088667",
"0.705177... | 0.0 | -1 |
TODO: Does this logic belong in TermQuery? | def blank_predicate_filters_must_search_any
@query.filters.each { |f| f.op = :is_any if f.pred_uri.blank? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term; end",
"def term\n @term\n end",
"def termsig(*) end",
"def term\n self.name\n end",
"def term_name\n self.content\n end",
"def fix_tsearch_query(query)\n terms = query_to_terms(clean_query(query))\n terms.flatten!\n terms.shift\n terms.join\n ... | [
"0.65762955",
"0.6359494",
"0.61660045",
"0.59553015",
"0.5904309",
"0.5882007",
"0.57256365",
"0.57212293",
"0.5716432",
"0.5713707",
"0.5688805",
"0.5682605",
"0.5682605",
"0.5666872",
"0.56647295",
"0.56647295",
"0.56188226",
"0.55396533",
"0.55361605",
"0.55272627",
"0.55... | 0.0 | -1 |
Helper method for bottomup implementation | def knapsack_table(weights, values, capacity)
return 0 if capacity == 0
solution = []
sum_val = 0
weights.each_with_index do |weight, idx|
if capacity - weight >= 0
sum_val += values[idx]
capacity -= weight
end
end
len = weights.length
sum_val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n ... | [
"0.70185775",
"0.6855966",
"0.6792547",
"0.66875625",
"0.66756815",
"0.6672704",
"0.66373646",
"0.663226",
"0.6596407",
"0.6587347",
"0.6516622",
"0.65097195",
"0.6507161",
"0.64792657",
"0.6440934",
"0.6431597",
"0.6431418",
"0.63186693",
"0.6293141",
"0.62752163",
"0.626493... | 0.0 | -1 |
GET /tests GET /tests.json | def index
render status: :ok, json: @tests
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"def listing\n tests = Test.where( use... | [
"0.77281153",
"0.77281153",
"0.73835593",
"0.73397875",
"0.69955796",
"0.69955796",
"0.6836035",
"0.67343783",
"0.66843206",
"0.6667517",
"0.6658951",
"0.6608686",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
... | 0.77513814 | 0 |
GET /tests/1 GET /tests/1.json | def show
render status: :ok, json: @test
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def index\n render status: :ok, json: @tests\n end",
"def index\n @tests = Test.all\n\n r... | [
"0.7404314",
"0.7404314",
"0.7304388",
"0.7279787",
"0.7125164",
"0.6878569",
"0.6878569",
"0.6849366",
"0.67718923",
"0.6757094",
"0.6624378",
"0.66209686",
"0.66169363",
"0.6546323",
"0.64791626",
"0.64788824",
"0.6474367",
"0.6439662",
"0.643125",
"0.6427616",
"0.6401213",... | 0.6669219 | 10 |
PATCH/PUT /tests/1 PATCH/PUT /tests/1.json | def update
if @test.update(test_params)
render status: :ok, json: @test
else
self.send(:edit)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.66269517",
"0.6461584",
"0.6460944",
"0.6390803",
"0.6390803",
"0.6390803",
"0.6390803",
"0.6390803",
"0.6390803",
"0.6390803",
"0.6353078",
"0.63520455",
"0.63488954",
"0.6342921",
"0.63106287",
"0.62812155",
"0.6267887",
"0.6244398",
"0.6235091",
"0.6209162",
"0.61947584... | 0.6410485 | 3 |
DELETE /tests/1 DELETE /tests/1.json | def destroy
@test.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n e... | [
"0.771419",
"0.771419",
"0.7699507",
"0.74376744",
"0.7418487",
"0.7418487",
"0.7418487",
"0.7418487",
"0.7418487",
"0.7418487",
"0.7418487",
"0.74170816",
"0.7390183",
"0.7322365",
"0.73147345",
"0.7270275",
"0.72675836",
"0.7227697",
"0.7193399",
"0.718793",
"0.7176366",
... | 0.6822839 | 67 |
Use callbacks to share common setup or constraints between actions. | def set_test
@test = Test.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def test_params
params.require(:test).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Assign the item on the yield by looking up the specified item ID. | def item_lookup_id=(item_lookup_id)
self.item = Item.find_or_load(item_lookup_id.to_i)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_item\n @item = Item.find_by(identifier: params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item ... | [
"0.71435285",
"0.6774303",
"0.6774303",
"0.6774303",
"0.6774303",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
"0.67310196",
... | 0.70350033 | 3 |
Returns the current item lookup id. | def item_lookup_id
item.blank? ? nil : item.item_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def live_lookup_item_id\n id || folio_item&.id || barcode\n end",
"def item_id\n item_hash.deep_find(:item_id)\n end",
"def item_id\n return @item_id\n end",
"def item_id\n return @item_id\n end",
"def item_id\n return @item... | [
"0.76606923",
"0.72688735",
"0.70206714",
"0.70206714",
"0.70206714",
"0.6918146",
"0.6702658",
"0.6702658",
"0.6680198",
"0.6615656",
"0.6615656",
"0.6615656",
"0.65904397",
"0.65904397",
"0.6573438",
"0.6562482",
"0.6466839",
"0.64198875",
"0.6396352",
"0.6396352",
"0.63826... | 0.7643773 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_user_phrasebook
@user_phrasebook = UserPhrasebook.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def user_phrasebook_params
params.require(:user_phrasebook).permit(:phrasebook_id, :user_id)
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.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
IMC = PESO / (ALTURAALTURA) IMC = PESO / (ALTURA 2) mensagem para mostrar para o usuario | def mensagemIMC(nome, peso, altura)
resultado = calculoIMC(peso, altura)
puts "Olá #{nome} seu IMC #{resultado} #{resposta(resultado)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imc \n\t\t@peso/(@talla*@talla)\n\tend",
"def imc(peso,talla)\n\t\t@imc = (peso/(talla*talla))\n\tend",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t... | [
"0.6794263",
"0.66753423",
"0.65932506",
"0.6585267",
"0.64873713",
"0.6205679",
"0.603488",
"0.5957939",
"0.58664644",
"0.58466107",
"0.5845887",
"0.55791765",
"0.5489748",
"0.54893625",
"0.54821706",
"0.5427079",
"0.5415727",
"0.5396053",
"0.53934854",
"0.5381999",
"0.53799... | 0.7094897 | 0 |
fazer o calculo do IMC | def calculoIMC(peso, altura)
return '%.2f' % (peso.to_f/(altura.to_f * altura.to_f))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imc(peso,talla)\n\t\t@imc = (peso/(talla*talla))\n\tend",
"def imc \n\t\t@peso/(@talla*@talla)\n\tend",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t... | [
"0.7447191",
"0.7444512",
"0.7112562",
"0.7031562",
"0.7009602",
"0.6935672",
"0.6830041",
"0.6287687",
"0.6252845",
"0.62383467",
"0.6227648",
"0.6190489",
"0.6068867",
"0.606698",
"0.6039972",
"0.6024467",
"0.5939208",
"0.5761359",
"0.57357746",
"0.5735601",
"0.5723865",
... | 0.6596353 | 7 |
Abaixo de 17 Muito abaixo do peso Entre 17 e 18,49 Abaixo do peso Entre 18,5 e 24,99 Peso normal Entre 25 e 29,99 Acima do peso Entre 30 e 34,99 Obesidade I Entre 35 e 39,99 Obesidade II (severa) Acima de 40 sesultado | def resposta(resultado)
resultado = resultado.to_f
if resultado < 17
return "Abaixo de 17 Muito abaixo do peso"
elsif resultado > 17 and resultado < 18.49
return "Entre 17 e 18,49 Abaixo do peso"
elsif resultado > 18.5 and resultado < 24.99
return "Entre 18,5 e 24,99 Peso normal"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend",
"def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend",
"def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end",
"def porc_grasa\n\t\t(1.2 * self... | [
"0.7149828",
"0.66084087",
"0.65342075",
"0.64888126",
"0.64869225",
"0.6466006",
"0.6444723",
"0.6286926",
"0.62832123",
"0.6278528",
"0.6261092",
"0.6247227",
"0.61913395",
"0.618677",
"0.61809534",
"0.6163933",
"0.61457133",
"0.61382353",
"0.61297494",
"0.60875744",
"0.608... | 0.5841572 | 54 |
Escribe valor en el campo de texto de nombre de usuario | def usuario= valor
usuario_element.send_keys valor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", valu... | [
"0.6713083",
"0.6713083",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"0.6712986",
"... | 0.6464989 | 36 |
Devuelve el texto del mensaje de error | def mensaje_error
mensaje_error_element.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message\n error.message\n end",
"def mensaje_error(mensaje)\n\t\tmostrar_mensaje 31, mensaje\n\tend",
"def error_msg\n name\n end",
"def message\n \"Telphin returned an error #{@error_code}: '#{@error_msg}'\"\n end",
"def errmsg(message)\n error.print(\"*** #{message}... | [
"0.7712476",
"0.771168",
"0.770707",
"0.7647639",
"0.7568788",
"0.7538305",
"0.7512832",
"0.749603",
"0.7492214",
"0.7463027",
"0.74561375",
"0.7439606",
"0.74378675",
"0.74283695",
"0.7417342",
"0.74038446",
"0.7400136",
"0.73809624",
"0.7373045",
"0.7348243",
"0.7343136",
... | 0.7555483 | 5 |
TODO: Too many lines. Need to DRY | def update
if @gathering.creator_id == current_user.id
if @gathering.update(gathering_params)
redirect_to @gathering
flash[:success] = "Updated #{@gathering.name}"
else
redirect_to edit_gathering_path(@gathering)
end
elsif privileged_member?
if @gathering.update(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def formation; end",
"def custom; end",
"def custom; end",
"def suivre; end",
"def common\n \n end",
"def offences_by; end",
"def operations; end",
... | [
"0.7074779",
"0.62493014",
"0.6025847",
"0.6025847",
"0.6025847",
"0.6025847",
"0.59982294",
"0.5843005",
"0.5768616",
"0.5768616",
"0.57038003",
"0.56648445",
"0.5602893",
"0.557763",
"0.557763",
"0.55707836",
"0.55424416",
"0.5501058",
"0.5501058",
"0.5501058",
"0.5492029",... | 0.0 | -1 |
Snapshot is a hash where key is a package name and value it's version. This function returns a snapshot of a system package status for a moment | def make_pkg_snapshot
snapshot = {}
query_output = `#{PKG_QUERY}`
query_output.lines.each do |line|
info = line.split
snapshot[info[1]] = info[2]
end
snapshot
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(params = {})\n response = client.get \"/_snapshot{/repository}{/snapshot}/_status\", update_params(params, action: \"snapshot.status\", rest_api: \"snapshot.status\")\n response.body\n end",
"def snapshotInfo(_refresh = false)\n sni = nil\n @cacheLock.synchronize(:SH) do\n ... | [
"0.6009674",
"0.589217",
"0.58755124",
"0.58647114",
"0.58128905",
"0.57878083",
"0.57015085",
"0.5556038",
"0.5556038",
"0.551879",
"0.5502016",
"0.54936486",
"0.54523736",
"0.5451052",
"0.5401306",
"0.53967243",
"0.5395213",
"0.5332113",
"0.53309596",
"0.5297055",
"0.528573... | 0.6741489 | 0 |
=begin rdoc Validates tax. =end | def initialise(params = nil)
super(params)
self.compound ||= 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_type_validation\n errors.add(:tax_type, \"Please choose one from given options\") unless [\"amount\", \"percent\"].include? tax_type\n end",
"def has_a_tax\n fields = %i[PST GST HST]\n\n errors.add(:base, \"Please specify a tax\") unless fields.any? { |field| send(field).present? }\n end",
"... | [
"0.61520046",
"0.61474836",
"0.6048849",
"0.5982139",
"0.58106023",
"0.58106023",
"0.57969064",
"0.5784559",
"0.5763731",
"0.5758721",
"0.57499635",
"0.5730665",
"0.56877464",
"0.5644667",
"0.5644667",
"0.5644667",
"0.5644667",
"0.5612781",
"0.5589549",
"0.5589549",
"0.556490... | 0.0 | -1 |
=begin rdoc Returns couns of enabled taxes. =end | def get_tax_count
self.tax1_enabled.to_i+self.tax2_enabled.to_i+self.tax3_enabled.to_i+self.tax4_enabled.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax1_enabled\n return 1\n end",
"def taxable?\n true\n end",
"def taxable?\n true\n end",
"def tax1_enabled\n return 1\n end",
"def tax\n 0.0\n end",
"def taxable?\n self.taxable\n end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def taxes\n... | [
"0.70222825",
"0.7002084",
"0.7002084",
"0.6876727",
"0.67951334",
"0.656255",
"0.6543531",
"0.64785266",
"0.64402467",
"0.6431153",
"0.64122987",
"0.6355034",
"0.6345233",
"0.63449264",
"0.62748677",
"0.6248366",
"0.6243113",
"0.6222463",
"0.6194774",
"0.61942136",
"0.618021... | 0.81764525 | 0 |
=begin rdoc Generates aaray of arrays [tax_name, tax_value] of all active taxes. =end | def to_active_array
array = []
array << [self.tax1_name, self.tax1_value] if self.tax1_enabled.to_i == 1
array << [self.tax2_name, self.tax2_value] if self.tax2_enabled.to_i == 1
array << [self.tax3_name, self.tax3_value] if self.tax3_enabled.to_i == 1
array << [self.tax4_name, self.tax4_value] if s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_rates\n @tax_rates ||= @api.get('TaxRates')['TaxRates'] || []\n end",
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.... | [
"0.6705043",
"0.660572",
"0.6597742",
"0.64367735",
"0.63196826",
"0.630142",
"0.62791675",
"0.6190026",
"0.61701065",
"0.60550296",
"0.6034811",
"0.60210454",
"0.5975991",
"0.5966075",
"0.59238154",
"0.59127396",
"0.5867975",
"0.5867239",
"0.5865899",
"0.5835672",
"0.5834689... | 0.7614693 | 0 |
=begin rdoc Dummy method to fake tax1_enabled option. Method always return 1. Returns 1 tax1 is always enabled. =end | def tax1_enabled
return 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax1_enabled\n return 1\n end",
"def tax1_enabled=(*args)\n end",
"def taxable?\n true\n end",
"def taxable?\n true\n end",
"def taxable?\n self.taxable\n end",
"def get_tax_count\n self.tax1_enabled.to_i+self.tax2_enabled.to_i+self.tax3_enabled.to_i+self.tax4_enabled.to_i\n ... | [
"0.8787081",
"0.7759417",
"0.71823174",
"0.71823174",
"0.68194807",
"0.66991144",
"0.65793616",
"0.63870996",
"0.6350707",
"0.6122558",
"0.6113712",
"0.6091662",
"0.6047447",
"0.60191023",
"0.5998732",
"0.59913933",
"0.59648174",
"0.5962901",
"0.5948127",
"0.59030914",
"0.578... | 0.8865322 | 0 |
=begin rdoc Dummy method to cover fact that tax1 is always enabled =end | def tax1_enabled=(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax1_enabled\n return 1\n end",
"def tax1_enabled\n return 1\n end",
"def taxable?\n true\n end",
"def taxable?\n true\n end",
"def test_switch_taxes_off_in_profile_and_check_new_invoice_has_taxes_disabled\r\n $test_ui.agree('continue?', true) if @debug\r\n update_profile_taxe... | [
"0.8483098",
"0.8278621",
"0.72014415",
"0.72014415",
"0.6807038",
"0.6701031",
"0.62585825",
"0.6196926",
"0.6169739",
"0.61636007",
"0.612726",
"0.612726",
"0.612726",
"0.612726",
"0.612726",
"0.61073834",
"0.61073834",
"0.61073834",
"0.61073834",
"0.608977",
"0.60879123",
... | 0.7753522 | 2 |
=begin rdoc Calculates amount with taxes applied. Params +amount+ Returns +amount+ float value representing the amount after taxes have been applied. =end | def apply_tax(amount, options = {})
opts = {}.merge(options)
amount = amount.to_d
if self.compound_tax.to_i == 1
if opts[:precision]
amount += format("%.#{opts[:precision].to_i}f", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1
amount += format("%.#{opts[:precision].to_i}f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end",
"def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend",
"def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_t... | [
"0.79977834",
"0.7940689",
"0.76448673",
"0.761718",
"0.75921047",
"0.74789804",
"0.7435319",
"0.74232215",
"0.7393151",
"0.73373604",
"0.7298151",
"0.7287101",
"0.7280581",
"0.7248978",
"0.7197119",
"0.71224546",
"0.7113112",
"0.7056599",
"0.70561516",
"0.7029192",
"0.702533... | 0.75631934 | 5 |
=begin rdoc Calculates amount of tax to be appliet do given amount. Params +amount+ Returns +amount+ float value representing the tax. =end | def count_tax_amount(amount, options = {})
opts = {}.merge(options)
amount = amount.to_d
tax = amount
if self.compound_tax.to_i == 1
if opts[:precision]
tax += format("%.#{opts[:precision].to_i}f", (tax* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1
tax += format("%.#{opts[:pre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend",
"def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end",
"def calc_high_tax(_amount)\n _amountret = _amount.to_f * 0.3\n return _amountret\n end",
"def ... | [
"0.83058256",
"0.81742465",
"0.7841894",
"0.7814252",
"0.7793498",
"0.77412987",
"0.77309376",
"0.7729748",
"0.7622217",
"0.76035607",
"0.75542694",
"0.7406385",
"0.7391128",
"0.7378225",
"0.7376939",
"0.73754334",
"0.7336562",
"0.73198",
"0.73101366",
"0.73065364",
"0.729320... | 0.7517855 | 11 |
=begin rdoc Calculates amount after applying all taxes in tax object. Params +amount+ amount with vat. Returns +amount+ float value representing the amount with taxes substracted. =end | def count_amount_without_tax(amount, options = {})
opts = {}.merge(options)
amount = amount.to_d
if self.compound_tax.to_i == 1
if opts[:precision]
amount = format("%.#{opts[:precision].to_i}f", (amount/(tax4_value.to_d+100)*100)).to_d if tax4_enabled.to_i == 1
amount = format("%.#{opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def taxable_amount()\n (self.amount - vat_amount())\n end",
"def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculate... | [
"0.7853335",
"0.7330501",
"0.71770775",
"0.71675086",
"0.71587265",
"0.7122126",
"0.7103623",
"0.7097942",
"0.7022969",
"0.70196354",
"0.68838876",
"0.6880332",
"0.6878427",
"0.68639827",
"0.6849986",
"0.6849696",
"0.68007964",
"0.67994",
"0.6774754",
"0.6766669",
"0.67498094... | 0.6467355 | 44 |
=begin rdoc Returns list with taxes applied to given amount. =end | def applied_tax_list(amount, options = {})
opts = {}.merge(options)
amount = amount.to_d
list = []
if self.compound_tax.to_i == 1
if opts[:precision]
list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format("%.#{opts[:precision].to_i}f", (amount*tax1_value).to_d/100.0), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*... | [
"0.7997611",
"0.734446",
"0.7201246",
"0.71907115",
"0.7189178",
"0.7157467",
"0.7146648",
"0.7122085",
"0.71215606",
"0.7094869",
"0.7046444",
"0.7044423",
"0.7020239",
"0.70155203",
"0.69998574",
"0.6988184",
"0.69791865",
"0.69759643",
"0.6949944",
"0.69275415",
"0.6889218... | 0.797325 | 1 |
GET /houses GET /houses.json | def index
@houses = House.all if admin_signed_in? || hunter_signed_in?
if realtor_signed_in?
@houses = House.where(real_estate_company_id: current_realtor.real_estate_company_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end",
"def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.h... | [
"0.7754989",
"0.7224801",
"0.7224801",
"0.7224801",
"0.704078",
"0.704078",
"0.704078",
"0.704078",
"0.70118964",
"0.68933946",
"0.6878175",
"0.68419677",
"0.68230927",
"0.67885566",
"0.67749745",
"0.6765291",
"0.67489445",
"0.67019176",
"0.66938287",
"0.65776193",
"0.6537392... | 0.0 | -1 |
GET /houses/1 GET /houses/1.json | def show
@house = House.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end",
"def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render... | [
"0.7757515",
"0.7757515",
"0.7757515",
"0.7454755",
"0.7165616",
"0.69945854",
"0.6888096",
"0.6836465",
"0.68340325",
"0.6821874",
"0.6821874",
"0.6821874",
"0.6821874",
"0.67988986",
"0.67411494",
"0.66795",
"0.6622453",
"0.6611221",
"0.6591484",
"0.65782493",
"0.6507443",
... | 0.703296 | 6 |
POST /houses POST /houses.json | def create
@house = House.new(house_params)
if (!admin_signed_in?)
@house.realtor_id=current_realtor.id
@house.real_estate_company_id=current_realtor.real_estate_company_id
else
respond_to do |format|
if @house.save
format.html { redirect_to @house, notice: 'House was successfully ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @house = House.new(house_params)\n\n if @house.save\n render :show, status: :created, location: @house\n else\n render json: @house.errors, status: :unprocessable_entity\n end\n end",
"def create\n @house = House.new(house_params)\n\n respond_to do |format|\n if @ho... | [
"0.71898353",
"0.71595514",
"0.70852405",
"0.6993376",
"0.67583257",
"0.667636",
"0.66742873",
"0.66742873",
"0.66664743",
"0.6618007",
"0.65094775",
"0.64636993",
"0.64609957",
"0.6450269",
"0.6448202",
"0.63951737",
"0.63854617",
"0.6384249",
"0.63433623",
"0.6325763",
"0.6... | 0.59438336 | 45 |
PATCH/PUT /houses/1 PATCH/PUT /houses/1.json | def update
respond_to do |format|
if @house.update(house_params)
format.html { redirect_to @house, notice: 'House was successfully updated.' }
format.json { render :show, status: :ok, location: @house }
else
format.html { render :edit }
format.json { render json: @house.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @house = House.find(params[:id])\n\n respond_to do |format|\n if @house.update_attributes(params[:house])\n format.html { redirect_to @house, notice: 'Gig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\"... | [
"0.69261503",
"0.6805382",
"0.6670072",
"0.66698754",
"0.66698754",
"0.66698754",
"0.65909415",
"0.6502367",
"0.6502367",
"0.6394609",
"0.6344746",
"0.6332867",
"0.62959087",
"0.62778616",
"0.6247158",
"0.6244188",
"0.6216352",
"0.61992884",
"0.6194022",
"0.61716557",
"0.6163... | 0.6693716 | 5 |
DELETE /houses/1 DELETE /houses/1.json | def destroy
@house.destroy
respond_to do |format|
format.html { redirect_to houses_url, notice: 'House was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n f... | [
"0.7754917",
"0.7754917",
"0.7703697",
"0.7703697",
"0.7672872",
"0.7645619",
"0.757718",
"0.7450463",
"0.7420255",
"0.7404233",
"0.73989093",
"0.727897",
"0.72183526",
"0.71645105",
"0.7153526",
"0.7116315",
"0.7108696",
"0.7088259",
"0.7074041",
"0.70479894",
"0.7012896",
... | 0.74775285 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_house
@house = House.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def house_params
params.require(:house).permit(:location, :sqft, :yearbuilt, :style, :price, :floors, :basement, :currentowner, :real_estate_company_id, :realtor_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
GET /ambulanceinfos GET /ambulanceinfos.json | def index
@ambulanceinfos = Ambulanceinfo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambiance }\n end\n end",
"def set_ambulanceinfo\n @ambulanceinfo = Ambulanceinfo.find(params[:id])\n end",
"def show\n p 'show?'\n @accept... | [
"0.6669721",
"0.6589296",
"0.6413107",
"0.64097136",
"0.6271458",
"0.6269093",
"0.622778",
"0.6176058",
"0.6145037",
"0.6143788",
"0.61225057",
"0.6120098",
"0.6117269",
"0.610594",
"0.6084319",
"0.60711247",
"0.60703933",
"0.606635",
"0.6066096",
"0.6060723",
"0.6046091",
... | 0.7619989 | 0 |
GET /ambulanceinfos/1 GET /ambulanceinfos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ambulanceinfos = Ambulanceinfo.all\n end",
"def show\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambiance }\n end\n end",
"def set_ambulanceinfo\n @ambulanceinfo = Ambulanceinfo.find(... | [
"0.74546325",
"0.68290985",
"0.6768176",
"0.6562977",
"0.64951867",
"0.6447528",
"0.6424276",
"0.64177215",
"0.63819623",
"0.6357673",
"0.6316137",
"0.6304957",
"0.6297835",
"0.6293409",
"0.62913734",
"0.6281344",
"0.6279627",
"0.62775564",
"0.6277105",
"0.62764764",
"0.62762... | 0.0 | -1 |
POST /ambulanceinfos POST /ambulanceinfos.json | def create
@ambulanceinfo = Ambulanceinfo.new(ambulanceinfo_params)
respond_to do |format|
if @ambulanceinfo.save
format.html { redirect_to @ambulanceinfo, notice: 'Ambulanceinfo was successfully created.' }
format.json { render :show, status: :created, location: @ambulanceinfo }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ambiance = Ambiance.new(params[:ambiance])\n\n respond_to do |format|\n if @ambiance.save\n format.html { redirect_to(@ambiance, :notice => 'L ambiance a ete creee.') }\n format.xml { render :xml => @ambiance, :status => :created, :location => @ambiance }\n else\n ... | [
"0.6471191",
"0.6396992",
"0.6287554",
"0.6225767",
"0.6217869",
"0.62156075",
"0.62067693",
"0.6171028",
"0.61540526",
"0.61010486",
"0.60980546",
"0.60113484",
"0.59613013",
"0.5958906",
"0.5955893",
"0.5944262",
"0.5939836",
"0.5938168",
"0.5928566",
"0.59237224",
"0.59235... | 0.7825383 | 0 |
PATCH/PUT /ambulanceinfos/1 PATCH/PUT /ambulanceinfos/1.json | def update
respond_to do |format|
if @ambulanceinfo.update(ambulanceinfo_params)
format.html { redirect_to @ambulanceinfo, notice: 'Ambulanceinfo was successfully updated.' }
format.json { render :show, status: :ok, location: @ambulanceinfo }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n if @ambiance.update_attributes(params[:ambiance])\n format.html { redirect_to(@ambiance, :notice => 'L ambiance a ete modifiee.') }\n format.xml { head :ok }\n else\n format.html { render :action ... | [
"0.6578657",
"0.6511168",
"0.64163035",
"0.63222605",
"0.6297692",
"0.6245937",
"0.6222208",
"0.6219611",
"0.620102",
"0.61367285",
"0.6130882",
"0.61169577",
"0.61088085",
"0.61080706",
"0.6101467",
"0.6090144",
"0.6082908",
"0.60780597",
"0.60742706",
"0.6071784",
"0.606811... | 0.7355907 | 0 |
DELETE /ambulanceinfos/1 DELETE /ambulanceinfos/1.json | def destroy
@ambulanceinfo.destroy
respond_to do |format|
format.html { redirect_to ambulanceinfos_url, notice: 'Ambulanceinfo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ambiance = Ambiance.find(params[:id])\n @ambiance.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambiances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url... | [
"0.71600366",
"0.7151346",
"0.69367343",
"0.69168895",
"0.6890261",
"0.6873222",
"0.68728715",
"0.68660367",
"0.6861128",
"0.6854349",
"0.685161",
"0.682547",
"0.6824303",
"0.68167365",
"0.68139607",
"0.6813331",
"0.6804661",
"0.6800166",
"0.6798627",
"0.678865",
"0.6782491",... | 0.7720516 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ambulanceinfo
@ambulanceinfo = Ambulanceinfo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.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 ambulanceinfo_params
params.require(:ambulanceinfo).permit(:name, :contact1, :contact2, :organization_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
Uses a MatchWrapper to run a match between the given players and send the results to the database | def run_match
if @number_of_players != @match_participants.count
puts " Match runner skipping match #" + @match_id.to_s +
" (" + @match_participants.count.to_s + "/" + @number_of_players.to_s + " in player_matches)"
return
end
#Call round wrapper which runs the executables and gener... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_results_to_db(round_runner)\n begin\n puts round_runner.status\n if round_runner.status[:error]\n report_error\n return\n else\n unless self.save_rounds(round_runner.rounds)\n report_error\n return\n end\n #Print and save results, sche... | [
"0.7354573",
"0.66930306",
"0.6676258",
"0.6631763",
"0.65721816",
"0.65487325",
"0.65280277",
"0.65029305",
"0.6488748",
"0.6439412",
"0.64344573",
"0.6396368",
"0.6344914",
"0.6344699",
"0.6342519",
"0.63002664",
"0.6250837",
"0.62226135",
"0.6208786",
"0.6201979",
"0.61984... | 0.81685555 | 0 |
Creates PlayerMatch objects for each player using the results dictionary we got back from the MatchWrapper | def send_results_to_db(round_runner)
begin
puts round_runner.status
if round_runner.status[:error]
report_error
return
else
unless self.save_rounds(round_runner.rounds)
report_error
return
end
#Print and save results, schedule follow-up m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_matches(matches)\n matches.each do |home_team, away_team|\n create_match(home_team, away_team)\n end\n end",
"def player_matches(player, playerdiv)\n result = Match.joins(:results).where(:results => {:player_id => player}).where(:division_id => playerdiv)\n @player_matches = ... | [
"0.7172684",
"0.6989785",
"0.6764886",
"0.67479306",
"0.6659764",
"0.6468582",
"0.6425948",
"0.64099973",
"0.6306383",
"0.62255925",
"0.61994046",
"0.6190135",
"0.618371",
"0.61801666",
"0.61706",
"0.6160965",
"0.6019443",
"0.59844995",
"0.5979225",
"0.5978591",
"0.5967674",
... | 0.52643454 | 98 |
Generate log files for playing back rounds | def save_round_json(slug, round)
#Check if the match directory exists already
match_directory = File.join(@logs_directory, @match.slug)
unless File.directory?(match_directory)
FileUtils.mkdir_p(match_directory)
end
filename = File.join(match_directory, slug + ".json")
#Write round hash to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_log_file_path\r\n log_dir = File.join(SAF::LOG, File.dirname(test_path))\r\n log_file_pre = File.join(log_dir,\r\n File.basename(test_path, \".*\"))\r\n \"#{log_file_pre}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.log\"\r\n end",
"def generate_log_file(npc_pa... | [
"0.6538894",
"0.6463553",
"0.6267588",
"0.624412",
"0.6127218",
"0.6098684",
"0.60834575",
"0.6033933",
"0.60172564",
"0.6005831",
"0.59805954",
"0.59605116",
"0.59474134",
"0.5946422",
"0.5945733",
"0.59139353",
"0.59104264",
"0.58985627",
"0.58693916",
"0.5862776",
"0.58229... | 0.0 | -1 |
Prints a name, result, and score | def print_results(name, result, score, separator = "\n")
print " " + name.ljust(24).slice(0, 23) +
" Result: " + result.ljust(10).slice(0, 9) +
" Score: " + score.to_s.ljust(10).slice(0, 9) +
separator
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_score\n puts \"Player Score: #{@player_score}\\tComputer Score: #{@computer_score}\"\n end",
"def print_details( result_counts, score )\n puts ('=' * 10) << \"\\n\"\n @groups.each_with_index { |group, index| group.each { |row| puts \"#{row} Group \" << (index + 1).to_s } }\n pu... | [
"0.744529",
"0.73962486",
"0.73684025",
"0.7217415",
"0.720656",
"0.7172552",
"0.7145581",
"0.7129244",
"0.71130836",
"0.68866163",
"0.68736905",
"0.68596995",
"0.6828795",
"0.6823284",
"0.6802994",
"0.67810935",
"0.6776423",
"0.6761251",
"0.66704375",
"0.6662129",
"0.6644872... | 0.863306 | 0 |
Creates player_match and updates the match status to waiting if necessary | def create_player_match(match, player)
#Create player_match
PlayerMatch.create!(
match: match,
player: player,
result: "Pending",
)
print "=> Match #" + match.id.to_s
#Change status of match if necessary
if match.players.count == @number_of_players
match.status = "waiting... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n reset_match_maker if (params['reset_match_maker'] == 'true')\n match_maker.start_timeout_seconds = params['match_maker_timeout'].to_f if (params['match_maker_timeout'])\n @number_of_players = params['number_of_opponents'].to_i + 1\n @user = current_user\n if match = match_maker.match(cu... | [
"0.71649265",
"0.71069425",
"0.6937709",
"0.6663202",
"0.6650368",
"0.65960306",
"0.65791494",
"0.6549135",
"0.65098774",
"0.6461929",
"0.6446511",
"0.6437794",
"0.6389527",
"0.6373383",
"0.6367027",
"0.6346203",
"0.6337429",
"0.6309933",
"0.6290512",
"0.62224907",
"0.620353"... | 0.87133425 | 0 |
Create a command line keywords parser | def initialize(keywords, check_invalid_params: true,
raise_on_parse_error: false)
@keywords = keywords
@check_invalid_params = check_invalid_params
@error_aggregator =
ErrorAggregator.new(raise_on_parse_error: raise_on_parse_error)
@required_che... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argument_parser\n keyword_arguments_parser > plain_arguments_parser\n end",
"def command_keywords\n dir_path = File.dirname(__FILE__)\n dirs = Dir.entries(dir_path)\n command_file_names = dirs.select{ |x| x.start_with?('_')}\n command_file_names.collect {|x| x.sub(/^_/, '')}\nend",
"def parse_c... | [
"0.6119091",
"0.6043271",
"0.597297",
"0.58417124",
"0.5799764",
"0.5776752",
"0.57501763",
"0.5744685",
"0.57174736",
"0.5703965",
"0.5687081",
"0.5680753",
"0.5662486",
"0.5622733",
"0.55965364",
"0.5563619",
"0.55303496",
"0.5527299",
"0.5527008",
"0.5522771",
"0.5522757",... | 0.60138416 | 2 |
Read keyword arguments from the command line | def parse(argv)
@argv = argv.dup
loop do
kwarg, value = next_keyword
if !kwarg.nil?
@required_check.delete(kwarg)
@arities[kwarg.key] += 1
if block_given?
yield(kwarg, value)
end
assign_ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(... | [
"0.6836962",
"0.6750548",
"0.6213172",
"0.62031",
"0.61904687",
"0.6166448",
"0.6047201",
"0.6046425",
"0.6036249",
"0.60294497",
"0.59862626",
"0.59587604",
"0.59408593",
"0.5907895",
"0.5898231",
"0.5887625",
"0.5870415",
"0.58644384",
"0.5862332",
"0.5859284",
"0.5857376",... | 0.5451794 | 76 |
this method applies the ceasar cipher encryption to as entence by shifting each letter in the string down the alphabet by the shift amount | def ceasar_cipher(phrase, shift)
phrase.downcase!
words = phrase.split(" ")
words.each do |word| #for each word in the sentence
word.split("").each_with_index do |letter, index| #for each letter in the word
asciiValue = letter.ord
if(asciiValue >= 97 && asciiValue <= 122) #if the value is a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def caesar_cipher(string, shift_factor)\n\n\n upc_alphabet_arr = ('A'..'Z').to_a\n downc_alphabet_arr = ('a'..'z').to_a\n\n\n string_chars_arr = string.chars\n\n new_chars_arr = []\n\n string_chars_arr.each do |char|\n if upc_alphabet_arr.include?(char)\n new_index = (upc_alphabet_arr.index(char) + sh... | [
"0.83589584",
"0.82613397",
"0.82308686",
"0.82275856",
"0.8205795",
"0.81968904",
"0.8165722",
"0.81636995",
"0.8156453",
"0.8153788",
"0.81526065",
"0.8124979",
"0.81181985",
"0.8106687",
"0.809719",
"0.8094961",
"0.8090987",
"0.8078325",
"0.80749995",
"0.80711174",
"0.8057... | 0.83569336 | 1 |
prepend_before_action :check_captcha, only: [:create] GET /resource/sign_up def new super end POST /resource | def create
if verify_recaptcha
super
else
build_resource(sign_up_params)
resource.validate
resource.errors.add(:recaptcha, 'Validation failed')
clean_up_passwords(resource)
set_minimum_password_length
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if simple_captcha_valid?\n puts session[\"devise.user_attributes\"]\n super\n else\n flash[:alert] = \"Captcha code is wrong, try again.\"\n self.resource = resource_class.new(sign_in_params)\n respond_with_navigational(resource) { render :new }\n end\n end",
"def ... | [
"0.7807279",
"0.7744781",
"0.76714474",
"0.71550274",
"0.6821261",
"0.68022823",
"0.6768372",
"0.6729342",
"0.67244583",
"0.6687184",
"0.6673652",
"0.66520065",
"0.66514194",
"0.65881133",
"0.65847814",
"0.65766925",
"0.6548497",
"0.652968",
"0.65109515",
"0.65109515",
"0.650... | 0.7381687 | 3 |
If you have extra params to permit, append them to the sanitizer. | def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, \
keys: %i[name date_of_birth username terms_of_service])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6904943",
"0.6835495",
"0.68306327",
"0.6789154",
"0.66753024",
"0.6652673",
"0.6642137",
"0.6594373",
"0.6558684",
"0.64922523",
"0.64897496",
"0.64762753",
"0.6446826",
"0.6438749",
"0.6419294",
"0.6416808",
"0.6400539",
"0.63998604",
"0.63998604",
"0.63935745",
"0.63786... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_account_update_params
devise_parameter_sanitizer.permit(:account_update, \
keys: %i[name date_of_birth username])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.69016063",
"0.68351924",
"0.6826926",
"0.67882454",
"0.6673018",
"0.6652377",
"0.66434634",
"0.6595344",
"0.6559352",
"0.649225",
"0.6488914",
"0.6476658",
"0.64474624",
"0.6437827",
"0.64186203",
"0.64166844",
"0.6396721",
"0.6396721",
"0.63963324",
"0.6393279",
"0.638030... | 0.0 | -1 |
The path used after sign up. | def after_sign_up_path_for(resource)
super(resource)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n root? ? boot_path : user_path\n end",
"def path\n root? ? boot_path : user_path\n end",
"def client_signed_up_path\n path_from_cookie(:after_account_signed_up_path) || path_from_cookie(:after_client_signed_up_path) || edit_user_client_path(current_user)\n end",
"def after_sign_... | [
"0.74486095",
"0.74486095",
"0.7348926",
"0.72428125",
"0.71978325",
"0.7191859",
"0.71229225",
"0.71229225",
"0.7114739",
"0.7110063",
"0.71050537",
"0.70890594",
"0.7078605",
"0.70710707",
"0.7039824",
"0.69836",
"0.69836",
"0.69836",
"0.69836",
"0.69687116",
"0.69687116",
... | 0.6811003 | 51 |
The method should return true if the only common divisor between the two numbers is 1. The method should return false otherwise. For example coprime?(25, 12) is true because 1 is the only number that divides both 25 and 12. | def coprime?(num_1, num_2)
arr = []
# pass in the smaller value first
# any factors past the smaller value will not matter since it won't be divisible by both
# could have called factors() twice to get two arrays containing factors of both numbers and compare
# this method would have taken longer s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coprime?(num1, num2)\n # div1 = get_divisors(num1)\n # div2 = get_divisors(num2)\n # # if num1.even? && num2.even?\n # # return false\n # if div1.one? { |ele| div2.include?(ele)}\n # return true\n # else\n # return false\n # end\n\n (2..num1).none? {|factor| num1 % fac... | [
"0.88572973",
"0.88287824",
"0.8813548",
"0.8790017",
"0.8786569",
"0.87486684",
"0.8719506",
"0.8711688",
"0.8691146",
"0.86886746",
"0.8671741",
"0.8655418",
"0.8635189",
"0.86297303",
"0.85978186",
"0.8556909",
"0.85249406",
"0.8489602",
"0.84753793",
"0.8446931",
"0.83538... | 0.8317422 | 22 |
helper function to find factors of both numbers neater than including this in main function | def factors(num1, num2)
arr = []
(1..num1).each do |ele|
# compare if ele is divisible for both numbers
arr << ele if num1 % ele == 0 && num2 % ele == 0
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factors() (1..self).select { |n| (self % n).zero? } end",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factors(num)\n (1..Math::sqrt(num)).each do |x|\n if num % x == 0\n puts x\n puts num/x\n end\n end\n nil\nend",
"def factors num\n if nu... | [
"0.8104046",
"0.7991935",
"0.7991935",
"0.7991935",
"0.7901611",
"0.78415614",
"0.7817687",
"0.78166944",
"0.77978647",
"0.77914554",
"0.7765924",
"0.7763665",
"0.77305627",
"0.7703719",
"0.7677612",
"0.7674213",
"0.76682967",
"0.76596105",
"0.76587075",
"0.7653659",
"0.76317... | 0.7597244 | 27 |
The X222 implementation guide places constraints on the interchange header and trailer that are not modeled in Guide::X222, because the scope is limited to the contents of the transaction set envelope. | def critique_isa(isa, acc)
edit(:ISA05) do
isa.element(5).tap do |e|
if e.node.present? and e.node.valid?
unless %w(27 28 ZZ).include?(e.node)
acc.ta105(e, "R", "005", "must be '27', '28', or 'ZZ'")
end
end
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coins_constraints\n { 'ctx_ver' => 'Z39.88-2004',\n 'rft_val_fmt' => 'info:ofi/fmt:kev:mtx:dc',\n 'rfr_id' => 'info:sid/en.wikipedia.org:article'\n }\n end",
"def transaction_set_header\n ['ST', '835', '0001'].join(@element_seperator)\n end",
"def read_837_trailer\r\... | [
"0.5060787",
"0.46369284",
"0.46127206",
"0.45814237",
"0.45800075",
"0.4555382",
"0.45414907",
"0.45132083",
"0.45094734",
"0.45094734",
"0.45094734",
"0.449976",
"0.44438463",
"0.44115007",
"0.4395204",
"0.43806574",
"0.4376897",
"0.43599254",
"0.43518728",
"0.43394497",
"0... | 0.0 | -1 |
The X222 implementation guide places constraints on the functional group header and trailer that are not modeled in Guide::X222, because the scope is limited to the contents of the transaction set envelope. | def critique_gs(gs, acc)
# ... However these are all handled generically in TransactionSetEd
# and are driven by the definition of the transaction set.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_group_x\n end",
"def functional_group_trailer(batch_id = nil)\n ['GE', checks_in_functional_group(batch_id), '2831'].join(@element_seperator)\n end",
"def functional_group_trailer(batch_id)\n ge_elements = []\n ge_elements << 'GE'\n ge_elements << checks_in_functional_group(batch_id)\... | [
"0.50204647",
"0.49796718",
"0.47782597",
"0.47616076",
"0.4746139",
"0.4725748",
"0.4725748",
"0.4725748",
"0.46529108",
"0.46330205",
"0.45905566",
"0.45570162",
"0.4506284",
"0.44704077",
"0.44234204",
"0.4422272",
"0.44142777",
"0.4391676",
"0.43618304",
"0.43503672",
"0.... | 0.0 | -1 |
IK403 "I10" element must not be present has action "E" X222.074.1000A.NM104.010 X222.074.1000A.NM105.020 X222.074.1000A.NM109.070 X222.076.1000A.PER02.020 X222.076.1000A.PER02.040 X222.076.1000A.PER05.020 X222.076.1000A.PER07.030 X222.074.1000B.NM109.050 X222.081.2000A.HL01.040 X222.083.2000A.PRV03.020 X222.084.2000A.C... | def critique_nm1(nm1, acc)
edit(:NM1) do
# Organization/last name
nm1.element(3).tap do |e|
if e.node.blank? and e.node.usage.optional?
acc.warn(e, "optional element is not present")
end
end
# Non-person entity
if nm1.eleme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def e_not_used\n ElementReqs_::NotUsed\n end",
"def checkCreatePV( elements )\n if ( elements[\"HouseFile/House/Generation/PhotovoltaicSystems\"] == nil )\n locationText = \"HouseFile/House/Generation\"\n elements[locationText].add_element(\"PhotovoltaicSystems\")\n locationText = \"HouseFil... | [
"0.59727305",
"0.54138607",
"0.5363605",
"0.5336798",
"0.53277254",
"0.51064485",
"0.5073369",
"0.49415344",
"0.48431212",
"0.4834309",
"0.48321864",
"0.47949314",
"0.4778582",
"0.4763738",
"0.4755294",
"0.47292957",
"0.47141925",
"0.47138435",
"0.469316",
"0.46685627",
"0.46... | 0.0 | -1 |
Fucntion to create success response | def create_success_response
response = {
body: {
status: "ok"
},
status: 200
}
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_response\n {:success => true}\n end",
"def success\n {:response=>:success}\n end",
"def build_success_output(data)\n\t \t{data: data, code: 200, result: \"success\"}\n\t end",
"def succes_response\n {\n status: 'success'\n }\n end",
"def success\n [200, { 'Content-T... | [
"0.80889153",
"0.78855956",
"0.7811125",
"0.7732349",
"0.7720158",
"0.7623292",
"0.7596357",
"0.7580237",
"0.7446023",
"0.74358046",
"0.7372508",
"0.7352003",
"0.72945553",
"0.72224116",
"0.72224116",
"0.71761876",
"0.7126533",
"0.7042269",
"0.70217514",
"0.7010861",
"0.69895... | 0.8146967 | 0 |
Fucntion to create success response with a message | def create_success_response(message='')
message = message.present? ? message : 'ok'
response = {
body: {
status: message
},
status: 200
}
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def succes_response\n {\n status: 'success'\n }\n end",
"def success\n [200, { 'Content-Type' => 'text/plain'}, ['OK']]\n end",
"def ... | [
"0.76744545",
"0.76459914",
"0.7634035",
"0.7627146",
"0.75414747",
"0.7536103",
"0.737623",
"0.7243592",
"0.7220082",
"0.7174962",
"0.7171294",
"0.71348953",
"0.712532",
"0.70610535",
"0.7055221",
"0.6904389",
"0.6893584",
"0.6878493",
"0.687186",
"0.6848343",
"0.68423635",
... | 0.8399889 | 0 |
Function to create response for all the connections timeout time | def create_server_status_response(status)
response = {
body: status,
status: 200
}
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def request_timeout(type, opti... | [
"0.65882766",
"0.65870893",
"0.6578919",
"0.6548802",
"0.6505151",
"0.64974904",
"0.6489299",
"0.6489299",
"0.6486597",
"0.64500785",
"0.6419805",
"0.6389696",
"0.6264751",
"0.6264751",
"0.6264751",
"0.62560946",
"0.61857426",
"0.61712676",
"0.61470115",
"0.61120045",
"0.6112... | 0.0 | -1 |
variant while loop with in function | def count(times)
i = 0
number = []
while i < times
puts "At the top i is #{i}"
number.push(i)
# iterate the loop
i += 1
puts "Numbers now: ", number
puts "At the bottom i is #{i}"
# print out the array
number.each { |num| puts num}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_while\n return unless block_given?\n @scope.push_while\n result = yield\n @scope.pop_while\n\n result\n end",
"def do_while(&blk)\n s = self.ensure_enum\n Enumerator.new do |out|\n while s.has_next?\n break unless blk.call(s.peek)\n out.yield s.next\n ... | [
"0.71104175",
"0.6940993",
"0.65495265",
"0.65082526",
"0.6368566",
"0.6301762",
"0.6269444",
"0.6186883",
"0.5988677",
"0.5972744",
"0.590868",
"0.58717763",
"0.5857916",
"0.5816158",
"0.5813227",
"0.5750972",
"0.57266355",
"0.57103086",
"0.57073385",
"0.5699935",
"0.5679152... | 0.0 | -1 |
Tests to make sure session registration functions properly | def test_registration
framework = Framework.new
manager = SessionManager.new(framework)
session = Class.new
session.extend(Session)
assert_equal(1, manager.register(session), "Did not get expected sid")
assert_equal(1, session.sid,
"Session sid was not initialized properly")
assert_equal(framewor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_session\n {:test => true}\n end",
"def test_notify\n\t\tframework = Framework.new\n\t\tmanager = SessionManager.new(framework)\n\t\thandler = UtSessionEvent.new\n\t\tsession = Class.new\n\t\tsession.extend(Session)\n\n\t\tframework.events.add_session_subscriber(handler)\n\n\t\tmanager.registe... | [
"0.6916483",
"0.6874547",
"0.6680187",
"0.6680187",
"0.6680187",
"0.6680187",
"0.665449",
"0.65957147",
"0.658942",
"0.65871114",
"0.65716696",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
"0.6557545",
... | 0.82321453 | 0 |
Test session notification events | def test_notify
framework = Framework.new
manager = SessionManager.new(framework)
handler = UtSessionEvent.new
session = Class.new
session.extend(Session)
framework.events.add_session_subscriber(handler)
manager.register(session)
assert_equal(handler.open_session, session,
"Open session handl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_session_open(session)\n\t\t\t\t#print_status(\"Session received, sending push notification\")\n\t\t\t\tsendslack(\"#{@user_name} You did it! New session... Source: #{$source}; Session: #{session.sid}; Platform: #{session.platform}; Type: #{session.type}\", \"http://emojipedia-us.s3.amazonaws.com/cache/a3/d8... | [
"0.6722215",
"0.6695168",
"0.6541949",
"0.65035385",
"0.64767283",
"0.64095366",
"0.63560057",
"0.6324238",
"0.6240115",
"0.62150484",
"0.6198093",
"0.60837865",
"0.6069323",
"0.60089225",
"0.5998683",
"0.59757054",
"0.59157467",
"0.5907715",
"0.58991617",
"0.58593994",
"0.58... | 0.82167363 | 0 |
will be used to get details for a given user | def get_by_id
# the user_id param comes from our route
user = User.find(params[:user_id])
if user
render json: user, status: :ok
else
render json: { errors: 'User not found' }, status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def info\n\t@user = User.find(params[:id])\n end",
"def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.con... | [
"0.78125465",
"0.7412827",
"0.7400798",
"0.736983",
"0.7358849",
"0.7343312",
"0.7341921",
"0.7337703",
"0.73229516",
"0.7197429",
"0.71945626",
"0.7188985",
"0.71778816",
"0.7172722",
"0.71392316",
"0.7116914",
"0.7108701",
"0.70865405",
"0.7072937",
"0.70690995",
"0.7054552... | 0.0 | -1 |
will be used to update a users information, such as name, email or password | def update_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_info(db_connection, full_name, email)\n sql = <<~SQL\n UPDATE users\n SET name = $1,\n email = $2\n WHERE id = $3;\n SQL\n db_connection.exec_params(sql, [ full_name, email, id ])\n @name = full_name\n @email = email\n end",
"def update\n\t\tuser = User.f... | [
"0.766992",
"0.74737656",
"0.7468624",
"0.74527276",
"0.7418589",
"0.74174887",
"0.7410627",
"0.73926365",
"0.73383224",
"0.73190135",
"0.7308702",
"0.7308354",
"0.7300933",
"0.72742635",
"0.72645223",
"0.726265",
"0.7246092",
"0.72154164",
"0.7213965",
"0.7193463",
"0.718594... | 0.80277675 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.