query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
PATCH/PUT /online_judges/1 PATCH/PUT /online_judges/1.json | def update
respond_to do |format|
if @online_judge.update(online_judge_params)
format.html { redirect_to current_user, notice: 'Online judge was successfully updated.' }
format.json { render :show, status: :ok, location: @online_judge }
else
format.html { render :edit }
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.5928994",
"0.59072495",
"0.5810702",
"0.58060664",
"0.580363",
"0.5769774",
"0.57471496",
"0.5739974",
"0.5702337",
"0.56777084",
"0.56761044",
"0.5673122",
"0.5670219",
"0.5668757",
"0.566013",
"0.5654656",
"0.56453514",
"0.56266946",
"0.5622915",
"0.5618859",
"0.5608668"... | 0.6276049 | 0 |
This method is used to return portable data, which describes some attribute of an Invoice == Outputs Returns a hash value with all concrete_charges | def portable_format
# an invoice basic information
invoice_hash = {}
invoice_hash[:id] = self.id
invoice_hash[:start_date] = self.start_date
invoice_hash[:end_date] = self.end_date
invoice_hash[:issue_date] = self.issue_date
invoice_hash[:total_charges] = self.total
invoice_hash[:distributio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [unit_of_measure, pricing_component_type, charge_type, period_start, period_end, created, changed_by, updated, id, invoice_id, unit_of_measure_id, subscription_id, product_rate_plan_id, public_product_rate_plan_name, product_rate_plan_name, product_id, public_product_name, product_name, organizatio... | [
"0.64053595",
"0.6355245",
"0.6251433",
"0.6180573",
"0.61086524",
"0.60006726",
"0.59608144",
"0.5927735",
"0.5782559",
"0.5766123",
"0.5764404",
"0.5759244",
"0.57399523",
"0.5724937",
"0.57041246",
"0.5682993",
"0.56768644",
"0.5669663",
"0.56549877",
"0.5641062",
"0.56340... | 0.71880966 | 0 |
GET /firms/new GET /firms/new.json | def new
@title = t('view.firms.new_title')
@firm = Firm.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @firm }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def create\n @title = t('view.firms.new_title')\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.htm... | [
"0.7751174",
"0.73691654",
"0.72218347",
"0.70463496",
"0.70351094",
"0.7019751",
"0.6977956",
"0.6952969",
"0.6941487",
"0.693557",
"0.69337404",
"0.69330966",
"0.69117504",
"0.68867517",
"0.68782175",
"0.6877839",
"0.6862913",
"0.6859532",
"0.68418276",
"0.6840955",
"0.6815... | 0.7993061 | 0 |
POST /firms POST /firms.json | def create
@title = t('view.firms.new_title')
@firm = Firm.new(params[:firm])
respond_to do |format|
if @firm.save
format.html { redirect_to @firm, notice: t('view.firms.correctly_created') }
format.json { render json: @firm, status: :created, location: @firm }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @firm = Firm.new(firm_params)\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Firm was successfully created.' }\n format.json { render :show, status: :created, location: @firm }\n else\n format.html { render :new }\n fo... | [
"0.62247837",
"0.6170513",
"0.6169376",
"0.5966475",
"0.57999766",
"0.5772246",
"0.57486314",
"0.5708599",
"0.5675701",
"0.5633",
"0.5628051",
"0.5567741",
"0.5546342",
"0.5545006",
"0.5536649",
"0.5527791",
"0.5500777",
"0.5473998",
"0.5466345",
"0.5433702",
"0.5415413",
"... | 0.65028435 | 0 |
DELETE /firms/1 DELETE /firms/1.json | def destroy
@firm = Firm.find(params[:id])
@firm.destroy
respond_to do |format|
format.html { redirect_to firms_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def delete\n ren... | [
"0.6951848",
"0.68777543",
"0.68197554",
"0.68169296",
"0.68006384",
"0.68006384",
"0.67076325",
"0.6698469",
"0.6665981",
"0.6618573",
"0.6585148",
"0.64497644",
"0.64468896",
"0.6389992",
"0.6383792",
"0.6374941",
"0.6362597",
"0.6361317",
"0.6357924",
"0.635509",
"0.635073... | 0.69620305 | 0 |
Sample names Get sample names containing a substring | def get_sample_names(substring)
inputs = Dir.glob("inputs/#{$jobid}/*.txt")
inputs = inputs.select {|x| x.include? substring}
inputs = inputs.map{|x| File.basename(x).sub(".txt", "")}
return inputs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? subs... | [
"0.7544055",
"0.7544055",
"0.7544055",
"0.7544055",
"0.7541987",
"0.7073276",
"0.6378959",
"0.6314352",
"0.6258772",
"0.6256963",
"0.6181172",
"0.6140425",
"0.60791445",
"0.6078461",
"0.6075472",
"0.60706043",
"0.6051366",
"0.58784837",
"0.5877926",
"0.5872074",
"0.58698726",... | 0.76673555 | 0 |
Recipes for adding stat. error shapes. Makes a new file task: input_file_stat_errors.root => input_file.root | def add_fake_errors(input_file, channel, prefix)
output_file = "#{File.dirname(input_file)}/#{channel}_shapes_#{prefix}_statshapes.root"
output_sys_list = output_file.sub('.root', ".txt")
file output_file => [input_file] do |t|
sh "add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_fake_errors(input_file, prefix)\n output_file = input_file.sub('.root', '_statshapes.root')\n output_sys_list = input_file.sub('.root', '_statshapes.txt')\n file output_file => [input_file] do |t|\n sh \"add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$p... | [
"0.713875",
"0.5739326",
"0.56185156",
"0.53063333",
"0.52506006",
"0.5243376",
"0.5230361",
"0.5130129",
"0.51293904",
"0.51293904",
"0.51293904",
"0.5126742",
"0.50969017",
"0.5093162",
"0.50008947",
"0.49912214",
"0.49550954",
"0.49535787",
"0.49491897",
"0.49491897",
"0.4... | 0.69926775 | 1 |
GET /user_groups/new GET /user_groups/new.json | def new
@user_group = UserGroup.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respon... | [
"0.8310889",
"0.81497216",
"0.8142499",
"0.7712325",
"0.77065724",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7655521",
"0.7640157",
"0.7623279",
"0.7622778",
"0.7622778",
"0.75998354",
"0.7594935",
"0.758957",
... | 0.8208239 | 1 |
PUT /user_groups/1 PUT /user_groups/1.json | def update
@user_group = UserGroup.find(params[:id])
respond_to do |format|
if @user_group.update_attributes(params[:user_group])
format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }
format.json { head :ok }
else
format.html { render action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.72298145",
"0.71930164",
"0.702065",
"0.7013743",
"0.70038235",
"0.6998484",
"0.69377214",
"0.6921055",
"0.69135416",
"0.6888388",
"0.6864287",
"0.6783159",
"0.6760395",
"0.67462766",
"0.67376494",
"0.6737197",
"0.6737197",
"0.6723572",
"0.6694551",
"0.6662927",
"0.6653735... | 0.7262623 | 0 |
DELETE /user_groups/1 DELETE /user_groups/1.json | def destroy
@user_group = UserGroup.find(params[:id])
@user_group.destroy
respond_to do |format|
format.html { redirect_to user_groups_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_gro... | [
"0.7891348",
"0.78831",
"0.7809744",
"0.75663036",
"0.75447077",
"0.7542565",
"0.75411755",
"0.75356305",
"0.75271446",
"0.752069",
"0.75115293",
"0.75049376",
"0.7468739",
"0.74383307",
"0.73791003",
"0.7348354",
"0.7343422",
"0.73423296",
"0.7331332",
"0.7329655",
"0.732965... | 0.7893964 | 0 |
GET /machine_total_owners/1 GET /machine_total_owners/1.xml | def show
@machine_total_owner = MachineTotalOwner.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @machine_total_owner }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end",
"def new\n @machine_total_owner = MachineTotalOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_total_owner }\n end\n end",
"def show\n ... | [
"0.6501926",
"0.6119094",
"0.58848095",
"0.5762673",
"0.5761391",
"0.56927025",
"0.5616077",
"0.5608162",
"0.5492607",
"0.5419119",
"0.54171705",
"0.5388998",
"0.5379635",
"0.5369289",
"0.5368704",
"0.5356861",
"0.53260547",
"0.5322657",
"0.53082913",
"0.53082913",
"0.5271537... | 0.6894594 | 0 |
GET /machine_total_owners/new GET /machine_total_owners/new.xml | def new
@machine_total_owner = MachineTotalOwner.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @machine_total_owner }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @machine_total_owner = MachineTotalOwner.new(params[:machine_total_owner])\n\n respond_to do |format|\n if @machine_total_owner.save\n format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully created.') }\n format.xml { render :xml => @... | [
"0.7032036",
"0.70277107",
"0.64169455",
"0.6097371",
"0.59877056",
"0.59637964",
"0.595459",
"0.59182155",
"0.58719677",
"0.58628976",
"0.58223635",
"0.5802269",
"0.57879484",
"0.57713646",
"0.5730904",
"0.56772995",
"0.56370085",
"0.56234986",
"0.5544524",
"0.5536235",
"0.5... | 0.7657783 | 0 |
POST /machine_total_owners POST /machine_total_owners.xml | def create
@machine_total_owner = MachineTotalOwner.new(params[:machine_total_owner])
respond_to do |format|
if @machine_total_owner.save
format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully created.') }
format.xml { render :xml => @machine_tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owners_count=(value)\n @owners_count = value\n end",
"def new\n @machine_total_owner = MachineTotalOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_total_owner }\n end\n end",
"def number_of_owners\n ... | [
"0.58404577",
"0.57672024",
"0.57359636",
"0.5613227",
"0.55302656",
"0.5528535",
"0.5463702",
"0.53708345",
"0.53279436",
"0.52992266",
"0.5217112",
"0.50919485",
"0.5016713",
"0.49437276",
"0.48925456",
"0.48865107",
"0.48865107",
"0.48479763",
"0.4842613",
"0.48223314",
"0... | 0.6370827 | 0 |
PUT /machine_total_owners/1 PUT /machine_total_owners/1.xml | def update
@machine_total_owner = MachineTotalOwner.find(params[:id])
respond_to do |format|
if @machine_total_owner.update_attributes(params[:machine_total_owner])
format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully updated.') }
format.xml { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @total_owner = TotalOwner.find(params[:id])\n\n respond_to do |format|\n if @total_owner.update_attributes(params[:total_owner])\n format.html { redirect_to(@total_owner, :notice => 'Total owner was successfully updated.') }\n format.xml { head :ok }\n else\n form... | [
"0.6142214",
"0.594405",
"0.5930078",
"0.56690264",
"0.56145513",
"0.5570665",
"0.5465965",
"0.54319435",
"0.5270826",
"0.5230895",
"0.5198499",
"0.51862276",
"0.51713955",
"0.5166644",
"0.51434886",
"0.51312166",
"0.5110083",
"0.5091017",
"0.5089099",
"0.50720835",
"0.506486... | 0.6865128 | 0 |
DELETE /machine_total_owners/1 DELETE /machine_total_owners/1.xml | def destroy
@machine_total_owner = MachineTotalOwner.find(params[:id])
@machine_total_owner.destroy
respond_to do |format|
format.html { redirect_to(machine_total_owners_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @total_owner = TotalOwner.find(params[:id])\n @total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n ... | [
"0.6662746",
"0.64222366",
"0.6332752",
"0.62428766",
"0.62211853",
"0.6213186",
"0.6189766",
"0.61796147",
"0.60052264",
"0.60047626",
"0.59796864",
"0.5976597",
"0.59500057",
"0.5926452",
"0.5912931",
"0.59092957",
"0.58768314",
"0.584046",
"0.5832535",
"0.5830624",
"0.5825... | 0.75512 | 0 |
Perform GET request, parsing response as JSON. Autofollows redirects until redirect_limit reached. Raises Net::HTTPExceptions if response code not 2xx. | def get(path, redirect_limit=5)
parse_json do |parser|
@http_client.get(path, redirect_limit) {|chunk| parser << chunk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response(uri, limit = 10)\n response = Net::HTTP.get_response(uri)\n case response\n when Net::HTTPRedirection\n if limit == 0\n response\n else\n get_response(URI.parse(response['location']), limit - 1)\n end\n else\n response\n end\nend",
"def get_response(uri, limit = 5)\n ... | [
"0.6904074",
"0.67233187",
"0.6695907",
"0.6672841",
"0.6555054",
"0.6532709",
"0.6504292",
"0.6504292",
"0.64515924",
"0.64484215",
"0.64484215",
"0.6427041",
"0.6425898",
"0.6394115",
"0.63861275",
"0.6373827",
"0.63396436",
"0.63111144",
"0.63100004",
"0.6286418",
"0.62758... | 0.743483 | 0 |
Perform POST request, parsing response as JSON. Optionally takes a form_data hash. Raises Net::HTTPExceptions if response code not 2xx. | def post(path, form_data=nil)
parse_json do |parser|
@http_client.post(path, form_data) {|chunk| parser << chunk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end",
"def do_post_request(data)\n\t\tresponse = Net::HTTP.post_form(URI(@url),data)\n if response.message == \"OK\"\n\t\t\tresult = {}\n\t\t\tresponse.body.s... | [
"0.6595641",
"0.6484076",
"0.63408405",
"0.6275608",
"0.6064396",
"0.5957534",
"0.5905347",
"0.5902154",
"0.5882809",
"0.5875129",
"0.5858936",
"0.58544815",
"0.57964206",
"0.5749961",
"0.57483023",
"0.5742018",
"0.5725345",
"0.5707047",
"0.57012063",
"0.5695377",
"0.5672729"... | 0.72276425 | 0 |
fibo_rec does the same as the fibo function, but recursively | def fibo_rec(n)
return n <= 1 ? n : fibo(n - 1) + fibo(n - 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fiboRec(no)\n if no == 0\n return [0]\n elsif no == 1\n return fiboRec(0).push(1)\n else\n arr = fiboRec(no-1)\n return arr.push(arr[no-1] + arr[no-2])\n end\nend",
"def fib_rec(n)\n return 0 if n == 1\n return 1 if n == 2\n fib_rec(n - 1) + fib_rec(n - 2)\nend",
"def fibs_rec(n)\n n ==... | [
"0.7589294",
"0.75471646",
"0.75246876",
"0.74658644",
"0.74612075",
"0.7417537",
"0.7409339",
"0.7407692",
"0.73908246",
"0.73687744",
"0.73672754",
"0.73587453",
"0.7357443",
"0.7333702",
"0.7329575",
"0.73270816",
"0.73226243",
"0.7304224",
"0.7301747",
"0.7299018",
"0.728... | 0.8003041 | 0 |
Endpoint to save event updates | def save
event = params
# This assumes that all keys exists. Yay no error handling...
toSave = Event.new(update_type: event[:event],
start_time: event[:payload][:event][:start_time_pretty],
end_time: event[:payload][:event][:end_time_pretty],
location: event[:payload][:event][:location],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def save_event(event)\n method = event.new_even... | [
"0.7199514",
"0.6966364",
"0.6937411",
"0.6875301",
"0.68403476",
"0.68078023",
"0.6786235",
"0.6781844",
"0.6756455",
"0.6698402",
"0.6654565",
"0.6646607",
"0.6617489",
"0.6617489",
"0.6599386",
"0.65940815",
"0.65940815",
"0.6581809",
"0.65687793",
"0.6525739",
"0.6516756"... | 0.75483465 | 0 |
Writer method. We want to take this value, baby_name, and write into this variable, my_name. This method allows me to give a baby a name. | def name=(the_baby_name)
@my_name = the_baby_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_the_boat(name)\n @name = name\n puts @name\n end",
"def update_boat_name=(name)\n @name = name\n puts @name\n end",
"def name=(value)\n if @playing_girl\n @name_girl = value\n else\n @name_boy = value\n end\n $game_actors[1].name = value\n end",
"def ... | [
"0.7281455",
"0.6788559",
"0.63908225",
"0.62913525",
"0.61911356",
"0.6176719",
"0.61533916",
"0.6133584",
"0.61308324",
"0.61068934",
"0.60610515",
"0.60561764",
"0.6042773",
"0.6016939",
"0.59930706",
"0.59871316",
"0.59842134",
"0.59803796",
"0.59663296",
"0.596017",
"0.5... | 0.77098846 | 0 |
Flood paths are connections from one mapping to another along which the given flooder is activated. These paths are built for all flooders on startup, as they only need to be built once and should provide a performance increase in the queries. The flood paths are stored in a graph for the flooder the graph uri is build... | def build_flood_paths (flooder)
flooderURI = flooder[:flooder]
floodFrom = flooder[:floodFrom] || flooder[:path] || "<http://www.w3.org/2004/02/skos/core#broader>/^<http://www.w3.org/2004/02/skos/core#broader>"
floodTo = flooder[:floodTo] || flooder[:path] || "<http://www.w3.org/2004/02/skos/core#broader>/^... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_paths_for_clearings\n CLEARING_ADJACENCY_LINKS.each do |clearing, adjacents|\n adjacents.each do |adj|\n clearings[clearing].add_path(clearings[adj])\n end\n end\n end",
"def fill_path_weights\r\n\r\n #for each vertex, each level, find the shortest pa... | [
"0.5261304",
"0.50428826",
"0.48480588",
"0.48448434",
"0.48013595",
"0.47480488",
"0.47362193",
"0.47235966",
"0.470354",
"0.46921924",
"0.46890816",
"0.46758726",
"0.46088687",
"0.4580606",
"0.45711395",
"0.45514587",
"0.4542081",
"0.45235693",
"0.45183894",
"0.4504197",
"0... | 0.792001 | 0 |
The root scope of the client locale, found on the locale file. | def locale_scope
I18n::Scope.new(locale_translations)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def get_language_root\n self_and_ancestors.find_by(language_root: true)\n end",
"def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : ... | [
"0.63497055",
"0.6079783",
"0.5964192",
"0.58889776",
"0.582838",
"0.57870376",
"0.5731655",
"0.57221025",
"0.57221025",
"0.56979865",
"0.5687736",
"0.56795007",
"0.5667674",
"0.5646845",
"0.5631991",
"0.55988264",
"0.5596214",
"0.5578557",
"0.5552365",
"0.55408305",
"0.55261... | 0.67087805 | 0 |
GET /hr/config/discipline_types GET /hr/config/discipline_types.json | def index
@hr_config_discipline_types = Hr::Config::DisciplineType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def types\n configuration[:types]\n end",
"d... | [
"0.7222895",
"0.68726057",
"0.66277295",
"0.655945",
"0.6552935",
"0.6526827",
"0.6487009",
"0.63101894",
"0.6307604",
"0.626727",
"0.62545425",
"0.6218064",
"0.6177747",
"0.6176772",
"0.6016547",
"0.59945905",
"0.5944777",
"0.59345037",
"0.58687425",
"0.5845839",
"0.5815358"... | 0.7852595 | 0 |
POST /hr/config/discipline_types POST /hr/config/discipline_types.json | def create
@hr_config_discipline_type = Hr::Config::DisciplineType.new(hr_config_discipline_type_params)
respond_to do |format|
if @hr_config_discipline_type.save
format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully created.' }
format.json { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hr_config_discipline_types = Hr::Config::DisciplineType.all\n end",
"def create\n @discipline_type = DisciplineType.new(params[:discipline_type])\n\n respond_to do |format|\n if @discipline_type.save\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina c... | [
"0.6702746",
"0.6538874",
"0.6354929",
"0.62524533",
"0.6246494",
"0.6245315",
"0.6233283",
"0.61518484",
"0.61518484",
"0.6116841",
"0.6116841",
"0.58884126",
"0.58710396",
"0.58417284",
"0.5782723",
"0.5777549",
"0.57768357",
"0.5718048",
"0.56962794",
"0.56754047",
"0.5650... | 0.7097678 | 0 |
PATCH/PUT /hr/config/discipline_types/1 PATCH/PUT /hr/config/discipline_types/1.json | def update
respond_to do |format|
if @hr_config_discipline_type.update(hr_config_discipline_type_params)
format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully updated.' }
format.json { render :show, status: :ok, location: @hr_config_discipline_type }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n if @discipline_type.update_attributes(params[:discipline_type])\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina atualizado com sucesso.' }\n format.json { head :no_con... | [
"0.67636883",
"0.6253525",
"0.6180455",
"0.6162052",
"0.6154335",
"0.61219496",
"0.60997987",
"0.6075615",
"0.6068102",
"0.6062248",
"0.60564446",
"0.60506326",
"0.6037525",
"0.6026557",
"0.6013677",
"0.6010247",
"0.59855956",
"0.5978234",
"0.5969341",
"0.5952249",
"0.5928074... | 0.72596556 | 0 |
DELETE /hr/config/discipline_types/1 DELETE /hr/config/discipline_types/1.json | def destroy
@hr_config_discipline_type.destroy
respond_to do |format|
format.html { redirect_to hr_config_discipline_types_url, notice: 'Discipline type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @discipline_type = DisciplineType.find(params[:id])\n @discipline_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_types_url, :notice => 'Tipo de disciplina excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.7193676",
"0.6853794",
"0.67405784",
"0.6647212",
"0.66164833",
"0.6584385",
"0.6583263",
"0.6567717",
"0.6566776",
"0.6556137",
"0.65439403",
"0.65271336",
"0.6507875",
"0.6499804",
"0.6497381",
"0.64961725",
"0.6489565",
"0.64695174",
"0.6450735",
"0.6425926",
"0.6409018... | 0.7698277 | 0 |
There is a queue for the selfcheckout tills at the supermarket. Your task is write a function to calculate the total time required for all the customers to check out! input customers: an array of positive integers representing the queue. Each integer represents a customer, and its value is the amount of time they requi... | def queue_time(customers, n)
if n >= customers.length && !customers.empty?
customers.max
elsif customers.empty?
0
else
time_steps = []
current_queue = customers[0..(n - 1)]
addition_to_queue = []
until current_queue.empty?
customers.shift(n)
time_steps << current_queue.min
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_time(customers, n)\n return customers.inject(0, &:+) if n == 1\n time = 0\n cust_num = customers.size\n tills = Array.new(n > cust_num ? cust_num : n) \n tills = tills.map do |till|\n customers.shift\n end\n until tills.all?(&:zero?) && customers.empty?\n tills.map! do |till|... | [
"0.827027",
"0.77864546",
"0.7744593",
"0.75245076",
"0.75228417",
"0.7441975",
"0.6134081",
"0.56285244",
"0.5606069",
"0.5585157",
"0.5559285",
"0.5374144",
"0.52781135",
"0.5277836",
"0.52715844",
"0.52609646",
"0.52283406",
"0.5209606",
"0.51888263",
"0.5176638",
"0.51747... | 0.824925 | 1 |
Returns true if the current users is a moderator of a specified board | def current_user_is_moderator?(board)
signed_in? && current_user.moderating?(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moderating?(board)\n\t\tself.moderating.include?(board)\n\tend",
"def owned_by? a_user\n a_user == program.moderator\n end",
"def moderator_of?(forum)\n moderatorships.where('forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)).count == 1\n end",
"def is_user_moderator?(user)\n if user\n ... | [
"0.7777761",
"0.7400253",
"0.7263338",
"0.72233444",
"0.7170496",
"0.6991256",
"0.69674605",
"0.69509107",
"0.6934332",
"0.68868303",
"0.68797916",
"0.6825884",
"0.680896",
"0.676173",
"0.6757196",
"0.6753906",
"0.66891474",
"0.6629169",
"0.66011095",
"0.65999126",
"0.658668"... | 0.84541 | 0 |
scope/association that is used to test eligibility TODO: use vendors association to get eligible items | def eligible_items
@eligible_items ||= ::InventoryItem.where(vendor: promotion.vendors)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_buy_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n item.activate\n\n assert(user.can_buy?(item))\n\n user.work_on_behalf_of(org)\n assert(!user.on_behalf_of.can_buy?(item))\n end",
"def po... | [
"0.5961624",
"0.58224463",
"0.58197266",
"0.5757219",
"0.5690592",
"0.5623458",
"0.55992377",
"0.55767703",
"0.5550145",
"0.55453277",
"0.5529154",
"0.551477",
"0.54550755",
"0.540709",
"0.540709",
"0.5405668",
"0.53671426",
"0.535982",
"0.53323686",
"0.53229696",
"0.53009075... | 0.61457 | 0 |
Adds the static forwarding entries for this VLANs. | def add_static_forwarding(opts)
opts = check_params(opts,[:forwarding_entries])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_static_forwarding(opts)\n opts = check_params(opts,[:forwarding_entries])\n super(opts)\n end",
"def static_forwarding\n super\n end",
"def remove_all_static_forwardings\n super\n end",
"def add_tunnel(tunnel)\n @tunnels << tunnel\n end",
"def forward(payload... | [
"0.54614234",
"0.5177727",
"0.4971853",
"0.47495744",
"0.47224817",
"0.4719782",
"0.47196257",
"0.47119203",
"0.46118152",
"0.46044904",
"0.45643958",
"0.45531666",
"0.45353636",
"0.44721627",
"0.4454668",
"0.44535086",
"0.44512296",
"0.44436446",
"0.44371474",
"0.4425158",
"... | 0.6714846 | 0 |
Gets the source checking states for this VLANs. If enabled and auto lasthop is disabled, check that the source of the first packet of a connection is correct (correct VLAN, router, node). This is equivalent to BSD's net.inet.sourcecheck sysctl variable. | def source_check_state
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sources(server)\n return 'Not owned by DLSS' if netdb_but_not_dlss?(server)\n return 'Only in NetDB' if only_netdb?(server)\n return 'Only in VMware' if only_vmware?(server)\n return 'Old configurations need cleaning' if only_configs?(server)\n\n ''\n end",
"def source_dest_check\n ... | [
"0.5644886",
"0.5552355",
"0.53372747",
"0.5220253",
"0.5174169",
"0.5144973",
"0.49879262",
"0.49019197",
"0.48894802",
"0.48599455",
"0.4844443",
"0.483568",
"0.48065585",
"0.4784018",
"0.47373685",
"0.47110423",
"0.46811065",
"0.4673714",
"0.46680132",
"0.46335825",
"0.461... | 0.55632234 | 1 |
Removes all dynamic forwarding entries from this VLANs. | def remove_all_dynamic_forwardings
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end",
"def remove_static_forwarding(opts)\n opts = chec... | [
"0.61871845",
"0.5740274",
"0.56061757",
"0.5411529",
"0.5411525",
"0.53052205",
"0.52229315",
"0.51910275",
"0.51542443",
"0.50242585",
"0.5024105",
"0.49246648",
"0.4903879",
"0.48783788",
"0.48524007",
"0.4846858",
"0.47903228",
"0.47868112",
"0.47828767",
"0.47702166",
"0... | 0.6753043 | 0 |
Removes all static forwarding entries from this VLANs. | def remove_all_static_forwardings
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_static_forwarding(opts)\n opts = check_params(opts,[:forwarding_entries])\n super(opts)\n end",
"def remove_all_dynamic_forwardings\n super\n end",
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat... | [
"0.63283604",
"0.586739",
"0.5837022",
"0.56149393",
"0.55367655",
"0.550825",
"0.539627",
"0.5254293",
"0.52215713",
"0.520375",
"0.5171784",
"0.51704776",
"0.51696515",
"0.5036314",
"0.5024911",
"0.5024911",
"0.5008007",
"0.49891686",
"0.4982834",
"0.48948872",
"0.48947042"... | 0.6730628 | 0 |
Removes the static forwarding entries from this VLANs. | def remove_static_forwarding(opts)
opts = check_params(opts,[:forwarding_entries])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_static_forwardings\n super\n end",
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n e... | [
"0.66223276",
"0.5779972",
"0.5777585",
"0.53033954",
"0.5266683",
"0.5204652",
"0.51946",
"0.5132867",
"0.5113216",
"0.51128066",
"0.5107174",
"0.51066464",
"0.509349",
"0.5050976",
"0.50097835",
"0.49552625",
"0.4953449",
"0.49200773",
"0.4915842",
"0.48526126",
"0.4849997"... | 0.6349129 | 1 |
Sets the failsafe actions for this VLANs. | def set_failsafe_action(opts)
opts = check_params(opts,[:actions])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_resource_actions=(value)\n @allowed_resource_actions = value\n end",
"def set_actions\n @actions = []\n end",
"def actions=(value)\n @actions = value\n end",
"def resource_actions=(value)\n @resource_actions = value\n ... | [
"0.5557978",
"0.5451567",
"0.54025733",
"0.5333571",
"0.5333571",
"0.52568656",
"0.49465573",
"0.49401897",
"0.49308124",
"0.49308124",
"0.4928236",
"0.48394543",
"0.47806686",
"0.4701454",
"0.46878085",
"0.4674948",
"0.46516898",
"0.46014345",
"0.4588947",
"0.45678788",
"0.4... | 0.6087308 | 0 |
Sets the failsafe states for this VLANs. | def set_failsafe_state(opts)
opts = check_params(opts,[:states])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlan_names])\n super(opts)\n end",
"def set_across_virtual_state... | [
"0.5510336",
"0.5510336",
"0.5462976",
"0.5246599",
"0.51180726",
"0.5000983",
"0.49131224",
"0.48837385",
"0.47754562",
"0.47754562",
"0.4770132",
"0.47505707",
"0.47334623",
"0.473322",
"0.473322",
"0.47237733",
"0.4680484",
"0.46504948",
"0.4648394",
"0.4648394",
"0.464839... | 0.6018011 | 0 |
Sets the failsafe timeouts for this VLANs. | def set_failsafe_timeout(opts)
opts = check_params(opts,[:timeouts])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeouts_set=(_arg0); end",
"def timeout=(value)\n @timeout = value\n end",
"def ... | [
"0.6181343",
"0.6181343",
"0.6133695",
"0.612566",
"0.6039777",
"0.60108817",
"0.5971421",
"0.5963526",
"0.5929368",
"0.58751124",
"0.583962",
"0.5818067",
"0.5811619",
"0.5790336",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57650316",
"0.5765031... | 0.64635533 | 0 |
Sets the learning modes for this VLANs. | def set_learning_mode(opts)
opts = check_params(opts,[:modes])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_mode\n super\n end",
"def learning_mode\n super\n end",
"def set_mode(new)\n @mode = new\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\... | [
"0.56995386",
"0.56995386",
"0.51865405",
"0.49555126",
"0.49555126",
"0.49260685",
"0.4862684",
"0.48415494",
"0.47989288",
"0.47979152",
"0.47953194",
"0.47600383",
"0.4744386",
"0.4741109",
"0.468539",
"0.4679454",
"0.46697485",
"0.46660614",
"0.46657026",
"0.4658308",
"0.... | 0.67180735 | 1 |
Sets the MAC masquerade addresses for this VLANs. | def set_mac_masquerade_address(opts)
opts = check_params(opts,[:mac_masquerade_addresses])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_set_mac(mac_addr)\n execute(:set_network_mac, VmId: vm_id, Mac: mac_addr)\n end",
"def set_mac_address(mac)\n end",
"def set_mac_address(mac)\n execute(\"modifyvm\", @uuid, \"--macaddress1\", mac)\n end",
"def mac_masquerade_address\n super\n end",
"def mac_ma... | [
"0.6430824",
"0.63315135",
"0.6178039",
"0.5857728",
"0.5857728",
"0.5600889",
"0.5470703",
"0.54511577",
"0.5391618",
"0.53053737",
"0.5263485",
"0.5130334",
"0.5068038",
"0.50635636",
"0.50322783",
"0.49475056",
"0.494549",
"0.49177012",
"0.49131742",
"0.48951057",
"0.48512... | 0.672542 | 1 |
Sets the the source checking states for this VLANs. If enabled and auto lasthop is disabled, check that the source of the first packet of a connection is correct (correct VLAN, router, node). This is equivalent to BSD's net.inet.sourcecheck sysctl variable. | def set_source_check_state(opts)
opts = check_params(opts,[:states])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_check_source_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def source_check_state\n super\n end",
"def check_source_state\n super\n end",
"def set_source_interface(name = 'Vxlan1', opts = {})\n commands = command_builder('vxlan source-int... | [
"0.6762547",
"0.60307753",
"0.5692701",
"0.56040984",
"0.54006916",
"0.53888077",
"0.5177032",
"0.512024",
"0.5015896",
"0.4943069",
"0.49320355",
"0.49155912",
"0.49133372",
"0.49016485",
"0.4837418",
"0.48176342",
"0.48176342",
"0.47626108",
"0.4740771",
"0.4729829",
"0.471... | 0.6682239 | 1 |
GET /fingers/1 GET /fingers/1.xml | def show
@finger = Finger.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @finger }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n ... | [
"0.6058822",
"0.57901186",
"0.5787219",
"0.5698869",
"0.5647543",
"0.56392294",
"0.5624455",
"0.5605942",
"0.5587766",
"0.5496254",
"0.54085344",
"0.53884786",
"0.53834164",
"0.5379891",
"0.53256345",
"0.5324248",
"0.5319311",
"0.53118926",
"0.530363",
"0.5297249",
"0.5291596... | 0.70847297 | 0 |
GET /fingers/new GET /fingers/new.xml | def new
@finger = Finger.new
@finger.user = current_user
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @finger }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n format.html { redirect_to(fingers_path) }\n format.xml { render :xml => @finger, :status => :... | [
"0.68037736",
"0.6724813",
"0.6646627",
"0.6530833",
"0.64731985",
"0.64006215",
"0.6397397",
"0.63782346",
"0.6364024",
"0.6330678",
"0.63297874",
"0.6315338",
"0.62802935",
"0.6279807",
"0.6256123",
"0.62546724",
"0.6254477",
"0.62474364",
"0.6228865",
"0.6226489",
"0.61872... | 0.72824943 | 0 |
POST /fingers POST /fingers.xml | def create
@finger = Finger.new(params[:finger])
@finger.user = current_user
respond_to do |format|
if @finger.save
flash[:notice] = 'Finger was successfully created.'
format.html { redirect_to(fingers_path) }
format.xml { render :xml => @finger, :status => :created, :loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @finger = Finger.find(params[:id])\n @finger.user = current_user\n respond_to do |format|\n if @finger.update_attributes(params[:finger])\n flash[:notice] = 'Finger was successfully updated.'\n format.html { redirect_to(fingers_path) }\n format.xml { head :ok }\n ... | [
"0.55039704",
"0.54251176",
"0.5343005",
"0.53175426",
"0.5239797",
"0.5229069",
"0.52240103",
"0.51637775",
"0.51343894",
"0.5091505",
"0.5073883",
"0.5017746",
"0.49986044",
"0.4991063",
"0.49683544",
"0.49375308",
"0.4926145",
"0.48768073",
"0.4848334",
"0.4847382",
"0.484... | 0.68211067 | 0 |
PUT /fingers/1 PUT /fingers/1.xml | def update
@finger = Finger.find(params[:id])
@finger.user = current_user
respond_to do |format|
if @finger.update_attributes(params[:finger])
flash[:notice] = 'Finger was successfully updated.'
format.html { redirect_to(fingers_path) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n format.html { redirect_to(fingers_path) }\n format.xml { render :xml => @finger, :status => :... | [
"0.59614885",
"0.58890104",
"0.58790255",
"0.56750077",
"0.5599315",
"0.55899286",
"0.55658597",
"0.5400704",
"0.5395109",
"0.5373981",
"0.5366468",
"0.52468497",
"0.5245675",
"0.5244778",
"0.52437353",
"0.5215326",
"0.51994777",
"0.51800364",
"0.51800364",
"0.51800364",
"0.5... | 0.68502283 | 0 |
DELETE /fingers/1 DELETE /fingers/1.xml | def destroy
@finger = Finger.find(params[:id])
@finger.destroy
respond_to do |format|
format.html { redirect_to(fingers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
... | [
"0.642467",
"0.64239526",
"0.6389003",
"0.63723946",
"0.63683456",
"0.6359452",
"0.6331855",
"0.625638",
"0.6209855",
"0.61830294",
"0.6177054",
"0.61646986",
"0.6144835",
"0.6133123",
"0.6133123",
"0.6133123",
"0.6133123",
"0.6133123",
"0.6133123",
"0.6133123",
"0.60908574",... | 0.7430854 | 0 |
Main entry point Requires a Time object and a parameter Hash, currently :format Returns an array of sound files with the requested output Example: sound_files_for_time(Time.now, format: "dMYaHm" format: h: 12h hour H: 24h hour m: minutes s: seconds d: day in number w: weekday name M: month name Y: year as "twenty twelv... | def sounds_for_time(time, args={})
format = args.delete(:format) || 'dMYaHm'
result = []
format.each_char do |c|
result += send("parse_#{FORMAT_TABLE[c]}".to_sym, time)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n file = \"english.srt\"\n times = parse_times file\n build_ffmpeg times, file\nend",
"def file_for_day(day)\n sound_path(\"day-#{day}.ul\")\n end",
"def collectFileInformation(tracks, flavor, startTimes, real_start_time)\n startTimes.each do |file|\n pathToFile = File.join(file[\"... | [
"0.61816245",
"0.5397976",
"0.538732",
"0.52377385",
"0.5225956",
"0.51569784",
"0.512419",
"0.509282",
"0.50804037",
"0.5053026",
"0.5043899",
"0.5036145",
"0.49884212",
"0.4984467",
"0.49619898",
"0.4961411",
"0.49398535",
"0.49191245",
"0.49179387",
"0.49104792",
"0.488077... | 0.7513356 | 0 |
Returns the sounds for the single digits composing a number | def sounds_for_digits(num)
result = []
num.to_s.each_char do |c|
result << sound_path("#{c}.ul")
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sounds_for_number(number)\n number = number.to_i\n result = []\n thousands = (number / 1000).floor\n if thousands > 0\n result << \"#{thousands}.ul\" << \"thousand.ul\"\n end\n rest = number % 1000\n hundreds = (rest / 100).floor\n if hundreds > 0\n result ... | [
"0.78654265",
"0.5743771",
"0.5627809",
"0.562216",
"0.56200093",
"0.5618234",
"0.5611642",
"0.559557",
"0.5577491",
"0.5554955",
"0.5546062",
"0.55415964",
"0.55395436",
"0.5508156",
"0.55058163",
"0.5505423",
"0.5496334",
"0.5474896",
"0.5428884",
"0.542052",
"0.54169273",
... | 0.8130094 | 0 |
Parses an "h" character from the main methods Returns the time in AM time. | def parse_hour_12h(time)
sounds_for_number(time.strftime("%l"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def H; cat @time.strftime('%H') end",
"def parse_hour_24h(time)\n sounds_for_number(time.strftime(\"%k\"))\n end",
"def hour() time[0] end",
"def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index... | [
"0.7094211",
"0.7090618",
"0.6903488",
"0.668905",
"0.657391",
"0.6550515",
"0.64884627",
"0.64142066",
"0.6390568",
"0.6379535",
"0.6333664",
"0.6332102",
"0.63174045",
"0.6297677",
"0.627675",
"0.62738585",
"0.6267137",
"0.625339",
"0.62307733",
"0.6205075",
"0.61759114",
... | 0.7338429 | 0 |
Parses an "H" character from the main methods Returns the time in 24 time. | def parse_hour_24h(time)
sounds_for_number(time.strftime("%k"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_hour_12h(time)\n sounds_for_number(time.strftime(\"%l\"))\n end",
"def H; cat @time.strftime('%H') end",
"def hour() time[0] end",
"def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index... | [
"0.752976",
"0.7320571",
"0.68377846",
"0.6787406",
"0.6606236",
"0.6604363",
"0.65456736",
"0.65254277",
"0.64779127",
"0.64444906",
"0.63874817",
"0.6375319",
"0.6333604",
"0.6297861",
"0.62934923",
"0.6269661",
"0.62559444",
"0.62559444",
"0.6208015",
"0.6201986",
"0.61660... | 0.7876351 | 0 |
Parses an "M" character from the main methods Returns the month in an array. | def parse_month(time)
[file_for_month(time.strftime("%-m"))]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roman_month(date)\n date[1]\n end",
"def months_as_array\n (1..12).map {|m| [Date::MONTHNAMES[m]]}\n end",
"def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[1])\n end",
"def month_array\r\n\t\t[[\"January\", \"1\"],[\"February\", \"2\"], \r\n\t\t[\"March\", \"3\"],[\"April\"... | [
"0.7245807",
"0.712635",
"0.70139784",
"0.70082116",
"0.6973466",
"0.6808378",
"0.67515224",
"0.6545827",
"0.65232563",
"0.64642924",
"0.64642924",
"0.64196014",
"0.6395765",
"0.6393626",
"0.6390436",
"0.63685083",
"0.63532376",
"0.6275884",
"0.6272925",
"0.6265755",
"0.62456... | 0.773772 | 0 |
Parses a "d" character from the main methods Returns the numbers for the day. | def parse_day(time)
sounds_for_number(time.strftime("%-d"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_day(day)\n '%.2d' % day.to_i\n end",
"def handle_dn\n @wday = Date::DAYS[@tokens[@index].get_tag(DayName).type]\n @index += 1\n @precision = :day\n end",
"def parse_dob(dob)\n LineParser.dob(dob.split('/').map(&:to_i))\n end",
"def ord(day)\n\nend",
"def parse_dob(do... | [
"0.65706754",
"0.64472526",
"0.59283096",
"0.59272754",
"0.5918117",
"0.5857765",
"0.5746278",
"0.572903",
"0.56919897",
"0.56760955",
"0.5639098",
"0.5585565",
"0.55712116",
"0.5556135",
"0.55493206",
"0.5548936",
"0.5515986",
"0.5499876",
"0.54895705",
"0.54888123",
"0.5487... | 0.70314485 | 0 |
Parses a "w" character from the main methods Returns the weekday sound. | def parse_weekday(time)
[file_for_day(time.strftime("%w"))]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t... | [
"0.5982429",
"0.59736145",
"0.5855363",
"0.5843768",
"0.5716571",
"0.5656632",
"0.5634727",
"0.56127197",
"0.5593326",
"0.55864394",
"0.5586208",
"0.55794543",
"0.5547098",
"0.55291426",
"0.5528946",
"0.5461002",
"0.5454875",
"0.54478186",
"0.5430737",
"0.5403627",
"0.5400925... | 0.63193196 | 0 |
Parses a "m" character from the main methods Returns the numbers for the minutes | def parse_minutes(time)
minutes = time.strftime("%M").to_i
minutes == 0 ? [sound_path("oclock.ul")] : sounds_for_number(minutes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes\n _nudge[1]\n end",
"def parse_ms(with_hour: false)\n s0 = @scanner.pos\n s1 = match_digits!\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n elsif match_str(':') != :failed\n s3 = match_digits!\n if s3 == :failed\n ... | [
"0.691876",
"0.6805741",
"0.6769295",
"0.6769295",
"0.6556016",
"0.6504679",
"0.64736044",
"0.6459606",
"0.64034283",
"0.6396048",
"0.63351774",
"0.62757033",
"0.62239575",
"0.6200673",
"0.6146094",
"0.61390084",
"0.60862774",
"0.6086245",
"0.604878",
"0.60487",
"0.60487",
... | 0.69660586 | 0 |
Parses a "s" character from the main methods Returns the numbers for the seconds | def parse_seconds(time)
sounds_for_number(time.strftime("%S"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReturnSeconds(value)\n result = value.split(/m|s/)\n result = result[0].to_i*60 + result[1].to_i\n return result\nend",
"def parse_time(str)\n seconds = 0\n str.scan(/\\d+ *[Dd]/).each { |m| seconds += (m.to_i * 24 * 60 * 60) }\n str.scan(/\\d+ *[Hh]/).each { |m| seconds += (m.to_i * 60 * 60) ... | [
"0.67289317",
"0.6694145",
"0.65751565",
"0.6459403",
"0.6431439",
"0.6426587",
"0.64001393",
"0.6386974",
"0.63670474",
"0.6365357",
"0.63624674",
"0.6318847",
"0.6223675",
"0.6223675",
"0.6223207",
"0.621081",
"0.620728",
"0.62024933",
"0.6200599",
"0.6153995",
"0.6150515",... | 0.7095934 | 0 |
Parses a "p" character Returns AM or PM sound files | def parse_am_pm(time)
time.strftime("%P") == "am" ? [sound_path("a-m.ul")] : [sound_path("p-m.ul")]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbResolveAudioFile(str,volume=nil,pitch=nil)\n if str.is_a?(String)\n str=pbStringToAudioFile(str)\n str.volume=100\n str.volume=volume if volume\n str.pitch=100\n str.pitch=pitch if pitch\n end\n if str.is_a?(RPG::AudioFile)\n if volume || pitch\n return RPG::AudioFile.new(str.name,\... | [
"0.545785",
"0.5429428",
"0.5306381",
"0.51962537",
"0.5174581",
"0.5147074",
"0.5139501",
"0.5045755",
"0.5045755",
"0.5045755",
"0.5045554",
"0.49954948",
"0.49948603",
"0.49886262",
"0.49773237",
"0.4969655",
"0.49572945",
"0.49486795",
"0.49465916",
"0.49029744",
"0.49014... | 0.69330776 | 0 |
Gets the path for a sound file based on configuration and platform | def sound_path(name)
multi_path(File.join(Adhearsion.config.ahnsay.sounds_dir, name))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sound_source(type)\r\n sound = nil\r\n case type\r\n when :play_fitbell\r\n sound = File.join(get_resource_path, \"sound/fitebell.wav\")\r\n when :play_ba\r\n sound = File.join(get_resource_path, \"sound/ba.wav\")\r\n when :play_click4\r\n sound = File.join(get_res... | [
"0.7387547",
"0.7022132",
"0.6817764",
"0.6745143",
"0.6715965",
"0.66164345",
"0.6444321",
"0.64136654",
"0.64128417",
"0.63787866",
"0.63623923",
"0.63603956",
"0.63603956",
"0.63603956",
"0.6144198",
"0.6126113",
"0.6100045",
"0.6086465",
"0.6079731",
"0.6026207",
"0.60101... | 0.7876083 | 0 |
will always be a positive integer and return its additive persistence which is the number of times you must add the digits in num until you reach a single digit. For example: if num is 2718 then your program should return 2 because 2 + 7 + 1 + 8 = 18 and 1 + 8 = 9 and you stop at 9. | def AdditivePersistence(num)
# code goes here
sum = 0
count = 0
until num < 10
num1 = num.to_s
sum = 0
for i in 0..num1.length-1
sum += num1[i].to_i
end
num = sum
count += 1
end
return count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AdditivePersistence(num)\n addv_pers = 0\n until num < 10\n num = num.digits.sum\n addv_pers += 1\n end\n addv_pers\nend",
"def AdditivePersistence(num)\n count = 0\n\n while num > 9\n num = num.to_s.split(\"\").map{|i| i.to_i}.inject(:+)\n count += 1\n end\n\n count\nend",
"def additiv... | [
"0.84167403",
"0.80365",
"0.77320504",
"0.7713103",
"0.7605349",
"0.74756783",
"0.7138025",
"0.7126007",
"0.70803404",
"0.7049356",
"0.70313007",
"0.7028427",
"0.7020832",
"0.69682056",
"0.69554216",
"0.69242376",
"0.6908651",
"0.69063514",
"0.6901997",
"0.6889966",
"0.685747... | 0.8045087 | 1 |
filter the counts based on the user id set produces a new array of just the matched items if the user id filter is nil we match all the form of the input data is expected to be: [[user_id, cohort], ...] we sum up the count of matching user_ids into their cohort bucket | def sum_cohorts(users)
sums = []
# initialize the expected number of cohorts
(1..current_cohort).each do |cohort|
sums[cohort] = 0
end
users.each do |user|
user_id = user[0]
cohort = user[1]
sums[cohort] = 0 if sums[cohort].nil?
if match_user_id?(user_id)
sums[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cohorts_query_in(db, proc)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n if !@user_ids.nil?\n # build our user ids\n total_ids = @user_ids.length\n count = 0\n stmt = \"\"\n @user_ids.ea... | [
"0.6179814",
"0.5751907",
"0.55744034",
"0.5488608",
"0.5350726",
"0.5249186",
"0.52092034",
"0.52043134",
"0.5147224",
"0.5118692",
"0.51013154",
"0.5058948",
"0.50578564",
"0.50486875",
"0.5045273",
"0.5021556",
"0.5004701",
"0.49844268",
"0.4980961",
"0.49513242",
"0.49374... | 0.7025142 | 0 |
This form of query expects you to provide summarized results When we run the query we expect to get back results of: [[cohort, count], ...] we then record the sums in the rollup result table | def cohorts_query(db, proc)
sums = []
# initialize the expected number of cohorts
(1..current_cohort).each do |cohort|
sums[cohort] = 0
end
sql = proc.call(date_first, date_last)
results = db.execute(sql)
results.each do |r|
cohort = r[0]
sum = r[1]
sums[cohort] = 0 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_cohorts(users)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n users.each do |user|\n user_id = user[0]\n cohort = user[1]\n sums[cohort] = 0 if sums[cohort].nil?\n if match_user_id?(user_i... | [
"0.6110699",
"0.60947895",
"0.5991278",
"0.5985832",
"0.5840837",
"0.57941365",
"0.57623947",
"0.5734036",
"0.56640846",
"0.55760056",
"0.55481046",
"0.55356014",
"0.5510348",
"0.5414227",
"0.5407771",
"0.540386",
"0.5400838",
"0.5367653",
"0.5350469",
"0.5318325",
"0.5241472... | 0.70358753 | 0 |
Run a cohorts_query derived from the current user_ids that have been added formed into a set that can be used in an IN clause. We actually break the set up into multiple parts in case we have a very large number of ids. We then sum the cohorts from the multiple calls, and report them the query must return results as [[... | def cohorts_query_in(db, proc)
sums = []
# initialize the expected number of cohorts
(1..current_cohort).each do |cohort|
sums[cohort] = 0
end
if !@user_ids.nil?
# build our user ids
total_ids = @user_ids.length
count = 0
stmt = ""
@user_ids.each do |user_id|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_cohorts(users)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n users.each do |user|\n user_id = user[0]\n cohort = user[1]\n sums[cohort] = 0 if sums[cohort].nil?\n if match_user_id?(user_i... | [
"0.6177951",
"0.6114492",
"0.52603155",
"0.5226534",
"0.5221034",
"0.5028796",
"0.50081253",
"0.49946836",
"0.4981251",
"0.49521142",
"0.49093488",
"0.48550412",
"0.48397872",
"0.48375145",
"0.48262027",
"0.48130345",
"0.47871277",
"0.47742367",
"0.47499028",
"0.4749216",
"0.... | 0.7764512 | 0 |
GET /black_fridays GET /black_fridays.json | def index
@black_fridays = BlackFriday.paginate(:page => params[:page], :per_page => 10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @fridays = Friday.all\n end",
"def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closing_day }\n end\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n ... | [
"0.63019675",
"0.57668734",
"0.57145727",
"0.57114524",
"0.5696606",
"0.5683033",
"0.56441444",
"0.564085",
"0.5618594",
"0.56143415",
"0.5519595",
"0.550131",
"0.54865074",
"0.54823333",
"0.54411155",
"0.5439421",
"0.54295236",
"0.5393427",
"0.5368539",
"0.53629714",
"0.5327... | 0.64573187 | 0 |
POST /black_fridays POST /black_fridays.json | def create
@black_friday = BlackFriday.new(black_friday_params)
respond_to do |format|
if @black_friday.save
format.html { redirect_to @black_friday, notice: 'Black friday was successfully created.' }
format.json { render :show, status: :created, location: @black_friday }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @friday = Friday.new(friday_params)\n\n respond_to do |format|\n if @friday.save\n format.html { redirect_to @friday, notice: \"Friday was successfully created.\" }\n format.json { render :show, status: :created, location: @friday }\n else\n format.html { render :n... | [
"0.64180404",
"0.586408",
"0.5675287",
"0.566221",
"0.5656307",
"0.5606775",
"0.5582695",
"0.5578594",
"0.5558162",
"0.5536122",
"0.55284905",
"0.5519413",
"0.54999155",
"0.548241",
"0.54597807",
"0.5457774",
"0.5438455",
"0.54267293",
"0.5408235",
"0.54040164",
"0.53981847",... | 0.6805994 | 0 |
PATCH/PUT /black_fridays/1 PATCH/PUT /black_fridays/1.json | def update
respond_to do |format|
if @black_friday.update(black_friday_params)
format.html { redirect_to @black_friday, notice: 'Black friday was successfully updated.' }
format.json { render :show, status: :ok, location: @black_friday }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @friday.update(friday_params)\n format.html { redirect_to @friday, notice: \"Friday was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friday }\n else\n format.html { render :edit, status: :unprocessable_ent... | [
"0.6534209",
"0.6212672",
"0.6169254",
"0.61150664",
"0.6111235",
"0.61073947",
"0.60652864",
"0.60615295",
"0.6045077",
"0.60324526",
"0.6021983",
"0.6021285",
"0.6003562",
"0.59936595",
"0.59888697",
"0.592375",
"0.5914209",
"0.59090865",
"0.5907867",
"0.5885865",
"0.588226... | 0.6813972 | 0 |
DELETE /black_fridays/1 DELETE /black_fridays/1.json | def destroy
@black_friday.destroy
respond_to do |format|
format.html { redirect_to black_fridays_url, notice: 'Black friday was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @friday.destroy\n respond_to do |format|\n format.html { redirect_to fridays_url, notice: \"Friday was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |... | [
"0.67711014",
"0.6717281",
"0.6709792",
"0.66702175",
"0.66188335",
"0.66172785",
"0.66040945",
"0.66011256",
"0.65438354",
"0.6541761",
"0.65403503",
"0.65228885",
"0.6511923",
"0.6509053",
"0.6505492",
"0.64925",
"0.6491775",
"0.64911705",
"0.6463169",
"0.6442766",
"0.64415... | 0.69452596 | 0 |
METHOD: update remaining guess count INPUT: N/A OUTPUT: integer of remaining guesses | def update_guess_count
@guess_count > 0 ? @guess_count -= 1 : @guess_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_count\n\t\t @number_of_guesses -= 1\n\tend",
"def increment_guess_count(current_guess_count)\n\tcurrent_guess_count += 1\nend",
"def total_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend",
"def increment_guess_count(guesses_made)\n guesses_made = guesses_made + 1\nend",
... | [
"0.7759731",
"0.73455924",
"0.7324958",
"0.73007137",
"0.7288633",
"0.7288633",
"0.7223735",
"0.7216042",
"0.7200896",
"0.71794975",
"0.69632095",
"0.6962135",
"0.6941786",
"0.6849557",
"0.6814378",
"0.66789806",
"0.6602662",
"0.65936023",
"0.65774333",
"0.6550532",
"0.651826... | 0.79700905 | 0 |
METHOD: display word state INPUT: N/A OUTPUT: word state as string | def display_word_state
@word_state.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_state_of_word()\r\n\r\n wordString = \"\"\r\n\r\n for i in 0..@secretWordLength-1 do\r\n\r\n key = @secretWord[i]\r\n\r\n if @lettersGuessed[key] == true \r\n wordString += key\r\n elsif @lettersGuessed[key] == false\r\n wordString += \"_ \" ... | [
"0.662951",
"0.6614449",
"0.65313107",
"0.6524054",
"0.6500809",
"0.6387393",
"0.6297495",
"0.62627405",
"0.62448466",
"0.6211618",
"0.61427057",
"0.6130881",
"0.6130296",
"0.61248255",
"0.6119928",
"0.61089206",
"0.61068046",
"0.61050934",
"0.6091142",
"0.6081492",
"0.607822... | 0.79703206 | 0 |
GET /corps GET /corps.json | def index
@corps = Corp.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @corges = Corge.all\n end",
"def index\n @copons = Copon.all\n end",
"def index\n @popcorns = Popcorn.all\n end",
"def index\n @corridas = Corrida.all\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def index\n @cps = Cp.all\... | [
"0.6263931",
"0.5835342",
"0.58079046",
"0.5802921",
"0.57680696",
"0.5691794",
"0.56731963",
"0.56525725",
"0.55293006",
"0.55221397",
"0.5511802",
"0.5472816",
"0.54695475",
"0.5452315",
"0.54469156",
"0.54377645",
"0.5437015",
"0.54313797",
"0.5425353",
"0.54224765",
"0.54... | 0.6692728 | 0 |
The message version is the 1B encoding of the `VERSION` above. It is encoded using Arraypack 'C' (8bit unsigned integer). The max value it can encode is 255 (`(2 8) 1`). | def msg_version; @msg_version ||= PackedHeader.new(1, 'C').encode(VERSION); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_version\n msg['_version']\n end",
"def message_version\r\n\t\t\tCURRENT_VERSION\r\n\t\tend",
"def version\na = unpack\nv = (a[2] & 0xF000).to_s(16)[0].chr.to_i\nreturn v if (1..5).include? v\nreturn nil\nend",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end"... | [
"0.68111587",
"0.66897714",
"0.6539145",
"0.6185384",
"0.6054243",
"0.5982473",
"0.5863531",
"0.58546376",
"0.585361",
"0.585361",
"0.585361",
"0.585361",
"0.585361",
"0.57980716",
"0.5789196",
"0.5775429",
"0.57546926",
"0.5741168",
"0.5719009",
"0.5622509",
"0.56210524",
... | 0.7580419 | 0 |
The message size is encoded using Arraypack 'N'. This encoding represents a 32bit (4 byte) unsigned integer. The max value that can be encoded in 4 bytes is 4,294,967,295 (`(2 32) 1`) or a size of ~4GB. | def msg_size; @msg_size ||= PackedHeader.new(4, 'N'); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n to_payload.bytesize\n end",
"def total_payload_size\n length + 16 * character_count\n end",
"def size\r\n @pack.size\r\n end",
"def length\n pack.length\n end",
"def size\n (@bit_length*@length*@count)/8.0\n end",
"def byte_size(); @data.byte_size + 4; end",... | [
"0.66808796",
"0.6674084",
"0.6663601",
"0.65916175",
"0.63128614",
"0.6294512",
"0.62791353",
"0.62791353",
"0.6266398",
"0.6248313",
"0.6179435",
"0.6147006",
"0.6145162",
"0.61416656",
"0.61341494",
"0.6125885",
"0.6041502",
"0.6033389",
"0.60078526",
"0.60053056",
"0.5999... | 0.72234046 | 0 |
THe message body is encoded using BSON. | def msg_body; @msg_body ||= BsonBody.new; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(data); ::BSON.serialize(data).to_s; end",
"def to_bson\n [ self ].pack(bson_pack_directive)\n end",
"def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end",
"def to_bson(buffer = ByteBuffer.new)\n position = buffer.length\n buffer.put_int32(0)\n buf... | [
"0.6660244",
"0.65159535",
"0.6455533",
"0.64504915",
"0.6373777",
"0.6351061",
"0.6295756",
"0.628682",
"0.6257544",
"0.6227274",
"0.62202144",
"0.61677545",
"0.61517864",
"0.6133742",
"0.61247176",
"0.60864556",
"0.6074265",
"0.6021508",
"0.59797966",
"0.59219116",
"0.58857... | 0.7670512 | 0 |
=begin isaacs = TomcatUtility::TomcatDeploymentsCache.instance.get_isaac_deployments isaacs.first.tomcat.name isaacs.first.get_db_uuid isaacs.first.get_name isaacs.first.komets.first.get_name isaacs.first.komets.first.get_isaac_db_uuid will match with isaacs.first.get_db_uuid include TomcatUtility TomcatDeploymentsCach... | def get_indifferent_cached_deployments
HashWithIndifferentAccess.new get_cached_deployments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deployment_hash\n deployment = deployments\n if deployment.size == 1\n deployment[0]\n elsif deployment.size > 1\n next_deployment_after_measured\n else\n {}\n end\n end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def deployed_at() ; info_time... | [
"0.64817715",
"0.5889312",
"0.5889312",
"0.5880407",
"0.5748293",
"0.5628184",
"0.5487089",
"0.5376809",
"0.5224653",
"0.52022636",
"0.51979077",
"0.51937354",
"0.51916146",
"0.5180423",
"0.517036",
"0.5150626",
"0.5133205",
"0.5132308",
"0.5040332",
"0.50386935",
"0.5038627"... | 0.59113157 | 1 |
No edit , update or destroy on invite GET /invites/1/edit | def edit
@invite = Invite.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n \t@user = User.find_by_invite_token!(params[:id])\n end",
"def edit\n @invite_user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n @role = @invite_user.roles.first\n @inviter = User.where(:id => @role.invite_user_id).first\n @course = @role.cour... | [
"0.739073",
"0.73263067",
"0.6957787",
"0.69538087",
"0.6876259",
"0.6871937",
"0.6871937",
"0.6871937",
"0.68659145",
"0.68556875",
"0.68451524",
"0.67601275",
"0.67601275",
"0.6760038",
"0.66684943",
"0.6647012",
"0.6647012",
"0.6647012",
"0.6647012",
"0.66464335",
"0.66464... | 0.8278068 | 0 |
PUT /invites/1 PUT /invites/1.json | def update
@invite = Invite.find(params[:id])
respond_to do |format|
if @invite.update_attributes(params[:invite])
format.html { redirect_to @invite, notice: (t 'invite.update') }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user... | [
"0.67971027",
"0.65787655",
"0.65787655",
"0.65787655",
"0.6515703",
"0.6389459",
"0.6334293",
"0.6333119",
"0.63229674",
"0.6315305",
"0.6275967",
"0.6265954",
"0.6194329",
"0.6194329",
"0.6194329",
"0.6194329",
"0.61791176",
"0.6152989",
"0.6152989",
"0.611643",
"0.6109015"... | 0.6617818 | 1 |
Given a card, insert it on the bottom your deck | def add_card(card)
@deck.add(card, :back)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bottom (card)\n @cards.unshift(card);\n end",
"def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card... | [
"0.826293",
"0.8149494",
"0.78617173",
"0.75007695",
"0.7479656",
"0.7441609",
"0.74125063",
"0.7366898",
"0.73449177",
"0.7342745",
"0.7334327",
"0.7331764",
"0.72779423",
"0.72772646",
"0.7261177",
"0.7246629",
"0.7169112",
"0.71673834",
"0.71518415",
"0.7144674",
"0.713853... | 0.81820077 | 1 |
You will need to play the entire game in this method using the WarAPI | def play_game
# WarAPI.play_turn()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n #calls to all the methods that produce game!\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def play\n\t\tgame_loop\n\tend",
"def play\n \n end",
"def play\n end",
"def play\n greeting\n get_tiles\n move_sequence\n end",
"def play\n\t\t@current_tu... | [
"0.78186065",
"0.724834",
"0.7237337",
"0.71275693",
"0.7107241",
"0.7082583",
"0.7052699",
"0.702659",
"0.70212364",
"0.70166296",
"0.70166296",
"0.70166296",
"0.70166296",
"0.70144576",
"0.69931406",
"0.6984065",
"0.69730777",
"0.69730777",
"0.6957336",
"0.69454926",
"0.692... | 0.8411591 | 0 |
bomb in the 2D gridlike field in front of you. Write a function mineLocation/MineLocation that accepts a 2D array, and returns the location of the mine. The mine is represented as the integer 1 in the 2D array. Areas in the 2D array that are not the mine will be represented as 0s. The location returned should be an arr... | def mineLocation field
coords = []
field.each_index do | i |
field[i].each_index do | j |
if field[i][j] == 1
coords << i
coords << j
end
end
end
coords
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end",
"def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end",
"def mine_locations\n mine_array = []\n until mine_array.length == 9\n row = (0..9).to_a.sampl... | [
"0.68042094",
"0.67441136",
"0.6648272",
"0.6566782",
"0.6532259",
"0.65184504",
"0.63955855",
"0.6298916",
"0.6191949",
"0.608033",
"0.6029884",
"0.6006745",
"0.598417",
"0.5980205",
"0.5951131",
"0.58934844",
"0.58675253",
"0.5850481",
"0.5830921",
"0.5801239",
"0.5793308",... | 0.6766224 | 1 |
Get PgVersion that is released at the given date. Return nil if not have. | def get_released_version(date)
@minor_versions.each do |pv|
if pv.release_date == date then
return pv
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_date\n release_dates.first[:date] rescue nil\n end",
"def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end",
"def release_date\n document[\"release\"][\"releaseDate\"] rescue nil\n end",
"def prerelea... | [
"0.69371414",
"0.679275",
"0.63974357",
"0.5946498",
"0.59137017",
"0.5878385",
"0.579597",
"0.5723556",
"0.57207483",
"0.57120687",
"0.5627439",
"0.5588903",
"0.55780953",
"0.55757266",
"0.5521762",
"0.5470397",
"0.5386423",
"0.53670657",
"0.5330954",
"0.53030103",
"0.530259... | 0.85417295 | 0 |
Already release note file exists? | def exist?()
return File.exist?(@r_note_filepath)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkReleaseNotes(iReleaseDir, iReleaseInfo)\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.html\"))\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.txt\"))\n end",
"def is_new?\n !File.exists? @filename\n end",
"def file_exists\n end",
"def ... | [
"0.65962934",
"0.64236635",
"0.6143156",
"0.6142977",
"0.60162115",
"0.5997049",
"0.5989373",
"0.5959471",
"0.5959471",
"0.5952987",
"0.59493744",
"0.59235567",
"0.59226215",
"0.58932346",
"0.585563",
"0.5837311",
"0.5826832",
"0.58176714",
"0.58006704",
"0.5791112",
"0.57897... | 0.7161358 | 0 |
Save release note html file into ReleaseNoteDir | def save_release_note()
puts "Saving the release note of " + @version + " ..."
r_note = Nokogiri::HTML(open(@release_note_url))
File.open(@r_note_filepath, "w") do |f|
f.puts(r_note)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateReleaseNote_HTML\r\n rSuccess = true\r\n\r\n logOp('Generating release note in HTML format') do\r\n lLastChangesLines = []\r\n getLastChangeLog.each do |iLine|\r\n lLastChangesLines << iLine.\r\n gsub(/\\n/,\"<br/>\\n\").\r\n gsub(/^=== (.*)$/, '<h... | [
"0.6573925",
"0.61920804",
"0.61546034",
"0.60735035",
"0.6034229",
"0.6020748",
"0.60170573",
"0.5995989",
"0.59736466",
"0.59657705",
"0.5914977",
"0.58825105",
"0.588186",
"0.58807033",
"0.5863057",
"0.58536613",
"0.5851847",
"0.58517694",
"0.58483016",
"0.5839252",
"0.583... | 0.82210606 | 0 |
=============================================================================== Helper and utility functions for managing quests =============================================================================== Helper function for activating quests | def activateQuest(quest,color=colorQuest(nil),story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.activateQuest(quest,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quest; end",
"def activateQuest(quest,color,story)\n if !quest.is_a?(Symbol)\n raise _INTL(\"The 'quest' argument should be a symbol, e.g. ':Quest1'.\")\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id == quest\n pbMessage(\"You have already started this quest.\"... | [
"0.72086614",
"0.7181531",
"0.7138753",
"0.7120502",
"0.7077674",
"0.7058291",
"0.6826155",
"0.6770229",
"0.65837616",
"0.65448",
"0.6452135",
"0.6424945",
"0.6424945",
"0.6424945",
"0.6424945",
"0.642236",
"0.6414558",
"0.6372918",
"0.62991464",
"0.6292872",
"0.6277443",
"... | 0.73231465 | 0 |
Helper function for marking quests as failed | def failQuest(quest,color=nil,story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.failQuest(quest,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed?; state == 'failed'; end",
"def failed?; state == 'failed'; end",
"def mark_failure\n self.failure_occurred = true\n end",
"def mark_failure\n self.failure_occurred = true\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def failed!\n @success = false\n... | [
"0.64380085",
"0.64380085",
"0.63974255",
"0.63974255",
"0.6386845",
"0.6324332",
"0.62693053",
"0.625873",
"0.625873",
"0.625873",
"0.6201395",
"0.619108",
"0.61764365",
"0.61525196",
"0.6132045",
"0.6125698",
"0.6119402",
"0.61165553",
"0.6100646",
"0.6072988",
"0.6069385",... | 0.68772 | 0 |
Helper function for advancing quests to given stage | def advanceQuestToStage(quest,stageNum,color=nil,story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.advanceQuestToStage(quest,stageNum,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activateQuest(quest,color=colorQuest(nil),story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.activateQuest(quest,color,story)\nend",
"def quest; end",
"def calculate_stage(game, stage)\n game.cycle = self\n game.result.each { |result| stage[result - 1] += 1 }\n stages << stage\n e... | [
"0.57296294",
"0.57182324",
"0.571017",
"0.56700176",
"0.5653914",
"0.56302047",
"0.5585278",
"0.5565238",
"0.5515287",
"0.55095565",
"0.54952955",
"0.53983873",
"0.53963214",
"0.53963214",
"0.53699756",
"0.5367081",
"0.53667486",
"0.5360327",
"0.5336824",
"0.53367835",
"0.53... | 0.71767396 | 0 |
Get symbolic names of failed quests Unused | def getFailedQuests
failed = []
$PokemonGlobal.quests.failed_quests.each do |s|
failed.push(s.id)
end
return failed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failing_modules\n modules.reject {|m| %w(passed softfailed running none).include? m['result']}.map {|m| m['name'] }\n end",
"def verify_unused(names,flags,switches,context) # :nodoc:\n names.each do |name|\n verify_unused_in_option(name,flags,\"flag\",context)\n verify_unused_in_option(n... | [
"0.61377",
"0.55914456",
"0.55671275",
"0.5499207",
"0.54338914",
"0.5429478",
"0.54044485",
"0.53673255",
"0.5342061",
"0.5331159",
"0.53132546",
"0.5295025",
"0.5266962",
"0.525107",
"0.5232682",
"0.5230677",
"0.5217739",
"0.52134484",
"0.52079004",
"0.51857936",
"0.5170335... | 0.62398887 | 0 |
Get name of quest giver | def getQuestGiver(quest)
return "#{QuestModule.const_get(quest)[:QuestGiver]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @gapi ? @gapi[\"name\"] : @name\n end",
"def name\n @gapi[\"name\"]\n end",
"def name\n @gapi[\"name\"]\n end",
"def name\n @game_info['name']\n end",
"def name\n @gapi.name\n end",
"def name\n @gapi.name\n end",
... | [
"0.6607635",
"0.6561576",
"0.6561576",
"0.6528959",
"0.65129274",
"0.6440821",
"0.64353913",
"0.6405718",
"0.6319761",
"0.6312193",
"0.63046086",
"0.6271073",
"0.6251253",
"0.62409055",
"0.62362516",
"0.6233459",
"0.6233459",
"0.62158597",
"0.6206141",
"0.61976737",
"0.618479... | 0.78256774 | 0 |
Get array of quest stages | def getQuestStages(quest)
arr = []
for key in QuestModule.const_get(quest).keys
arr.push(key) if key.to_s.include?("Stage")
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stages\n return @stages\n end",
"def stages\n return @stages\n end",
"def stage_names\n @stages.keys\n end",
"def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\ne... | [
"0.6830067",
"0.6830067",
"0.61889935",
"0.59292173",
"0.59120125",
"0.5834044",
"0.57828534",
"0.5767325",
"0.57462835",
"0.5743583",
"0.5738883",
"0.5694336",
"0.56836957",
"0.5673413",
"0.56726485",
"0.5645226",
"0.5608514",
"0.55898213",
"0.5585968",
"0.55788153",
"0.5576... | 0.80295444 | 0 |
Get overall quest description | def getQuestDescription(quest)
return "#{QuestModule.const_get(quest)[:QuestDescription]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descr\n return text_get(2, id)\n end",
"def description\n text_get(7, @id)\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n p... | [
"0.7065177",
"0.70596975",
"0.6922498",
"0.69074833",
"0.68928367",
"0.6856413",
"0.6760685",
"0.6734638",
"0.67250705",
"0.66907924",
"0.66221803",
"0.6583001",
"0.6558498",
"0.65495914",
"0.65452635",
"0.65243983",
"0.6521471",
"0.6512449",
"0.6503124",
"0.64869064",
"0.647... | 0.8123579 | 0 |
Get maximum number of tasks for quest | def getMaxStagesForQuest(quest)
quests = getQuestStages(quest)
return quests.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_count\n variables.has_key?(:task_count) ? variables[:task_count] : 14\n end",
"def tasks_total_count\n tasks.length\n end",
"def total_tasks\n tasks.count\n end",
"def task_count()\n @tasks.size\n end",
"def max_queue_count()\n @max_queue_count\n end... | [
"0.70064133",
"0.6908555",
"0.675357",
"0.6669237",
"0.66600496",
"0.6603714",
"0.6390325",
"0.6351163",
"0.6274227",
"0.62049484",
"0.6155755",
"0.6142336",
"0.6129812",
"0.6095859",
"0.6093563",
"0.6093563",
"0.60773253",
"0.6073894",
"0.6063058",
"0.60590833",
"0.60535693"... | 0.6930273 | 1 |
=============================================================================== Class that contains utility methods to return quest properties =============================================================================== Utility function to check whether the player current has any quests | def hasAnyQuests?
if $PokemonGlobal.quests.active_quests.length >0 ||
$PokemonGlobal.quests.completed_quests.length >0 ||
$PokemonGlobal.quests.failed_quests.length >0
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".... | [
"0.6926412",
"0.68074673",
"0.6314898",
"0.6099784",
"0.6074462",
"0.59012276",
"0.57835287",
"0.5622351",
"0.55206466",
"0.5518889",
"0.5451204",
"0.5374794",
"0.5361204",
"0.53589755",
"0.53361446",
"0.5306457",
"0.5283109",
"0.52714807",
"0.5264498",
"0.5262639",
"0.524865... | 0.6944552 | 0 |
Visits a static page | def visit_static_page
visiting = STATIC_LOCATIONS[Kernel.rand(STATIC_LOCATIONS.size)]
puts "Competitor #{@id} is visiting #{visiting}"
@browser.location = @base_url + visiting
raise "Visiting #{visiting} led to an error" unless @browser.is200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_mandate\n # renders static page\n end",
"def accessibility_statement\n # renders static page\n end",
"def load_page\n page.visit('')\n end",
"def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end",
"def visit_page \n visi... | [
"0.7374358",
"0.7279139",
"0.69864595",
"0.686534",
"0.6844059",
"0.6788788",
"0.67241484",
"0.6723106",
"0.66264635",
"0.6612763",
"0.6612763",
"0.6612763",
"0.6482587",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
... | 0.7803893 | 0 |
takes current_page and maximum to produce pagination array | def getPaginationArray(current_page, maximum, window = WINDOW, minimum = 1)
return((minimum+window<current_page ? minimum.upto(window).collect : minimum.upto(current_page+window).collect) + (current_page-window > minimum+window ? [".."] : []) + (current_page>minimum+window ? (current_page-window > minimum+window ? ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginated_pages(current_page, total_pages) # rubocop:disable Metrics/MethodLength\n paginated_pages = []\n pages = prepare_pages(current_page, total_pages)\n pages.each_with_index do |page, index|\n if (pages.size == index + 1) || (pages[index + 1] - page == 1)\n paginated_pages << page\n ... | [
"0.7356153",
"0.727306",
"0.7216143",
"0.7207415",
"0.7133741",
"0.6868365",
"0.6846854",
"0.6814351",
"0.6745161",
"0.6718364",
"0.6591143",
"0.65344787",
"0.6528539",
"0.64752436",
"0.6467507",
"0.64656174",
"0.6465026",
"0.64492476",
"0.6447451",
"0.6426955",
"0.6425104",
... | 0.7689271 | 0 |
Includes a partial. The path is relative to the Selenium tests root. The starting _ and the file extension don't have to be specified. include test/selenium/_partial. include_partial 'partial' include test/selenium/suite/_partial. include_partial 'suite/partial' include test/selenium/suite/_partial. and provide local a... | def include_partial path, local_assigns = {}
partial = @view.render :partial => path, :locals => local_assigns
@output << partial
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_partial(relative_path)\n return if @partial_templates.key?(relative_path)\n\n @partial_templates[relative_path] = nil\n render(Pathname.new(\"#{@script_path}/#{relative_path}\"))\n end",
"def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invoke... | [
"0.68579316",
"0.6286506",
"0.61970615",
"0.61375266",
"0.61279833",
"0.60859585",
"0.58853424",
"0.5802644",
"0.5724634",
"0.57098573",
"0.5702608",
"0.56954813",
"0.5687252",
"0.5617213",
"0.5612826",
"0.5583607",
"0.5576045",
"0.55722475",
"0.5568694",
"0.55496705",
"0.545... | 0.7437805 | 1 |
Add a selection to the set of selected options in a multiselect element using an option locator. See the select command for more information about option locators. | def add_selection locator, option_locator
command 'addSelection', locator, option_locator
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_selected_option(option)\n if new_record?\n self.selected_options = build_selected_options\n else\n update_column(:selected_options, build_selected_options(vote_proposal_options + [option]))\n end\n end",
"def store_select_options locator, variable_name\r\n command 'storeSelectOptio... | [
"0.66450036",
"0.63963354",
"0.63625973",
"0.60460186",
"0.6039635",
"0.6022019",
"0.6022019",
"0.59825194",
"0.59673065",
"0.5697151",
"0.55566144",
"0.555519",
"0.55261797",
"0.5519465",
"0.5498487",
"0.54579663",
"0.5404081",
"0.5355633",
"0.53060555",
"0.52610403",
"0.525... | 0.669435 | 1 |
Waits for a popup window to appear and load up. The +timeout+ is specified in milliseconds. | def wait_for_popup window_id, timeout
command 'waitForPopUp', window_id||'null', timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end",
"def wait_for_element(element, timeout)\n element.when_present timeout\n element.when_visible timeout\n sleep Utils.click_wait\n end",
"def load_window(waittime, window)\n begin\n Timeout::timeout(waittime) do\n ... | [
"0.67727995",
"0.65322536",
"0.618935",
"0.61204183",
"0.59789014",
"0.5959777",
"0.5941881",
"0.5924773",
"0.5924773",
"0.5867076",
"0.5864496",
"0.5825298",
"0.5792088",
"0.5713232",
"0.5685096",
"0.5676842",
"0.56285006",
"0.5603574",
"0.55893207",
"0.5570003",
"0.5546727"... | 0.79213357 | 1 |
Simulates the user pressing the alt key and hold it down until do_alt_up() is called or a new page is loaded. | def alt_key_down
command 'altKeyDown'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alt_key_up\r\n command 'altKeyUp'\r\n end",
"def enter_alt(alt)\n raise NotImplementedError\n end",
"def load_page_with_key_press(key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_loaded(\"\")\n end",
"def load_page_with_key_press(k... | [
"0.72400016",
"0.6134243",
"0.5773372",
"0.5773372",
"0.5691471",
"0.56769526",
"0.5587448",
"0.5564512",
"0.551409",
"0.5501384",
"0.5487634",
"0.5484888",
"0.5472499",
"0.54629797",
"0.5428086",
"0.54059994",
"0.5395215",
"0.5380009",
"0.5354265",
"0.5317013",
"0.53093505",... | 0.7090653 | 1 |
Simulates the user releasing the alt key. | def alt_key_up
command 'altKeyUp'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alt_key_down\r\n command 'altKeyDown'\r\n end",
"def key_released( event )\n @keys -= [event.key]\n end",
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def key_release *args\n\t\t\tevent(:key_release, *args)\n\t\tend",
"def releaseKey(key)\n\t\t@keysPressed.delete(k... | [
"0.71781206",
"0.64977336",
"0.61834204",
"0.61346126",
"0.6099386",
"0.60806715",
"0.5796961",
"0.5782629",
"0.57585025",
"0.57407683",
"0.57407683",
"0.5729792",
"0.5626446",
"0.5597214",
"0.55585194",
"0.5549129",
"0.55478543",
"0.5514924",
"0.5493437",
"0.5482966",
"0.547... | 0.73549134 | 0 |
Simulates the user releasing the control key. | def control_key_up
command 'controlKeyUp'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def key_released( event )\n @keys -= [event.key]\n end",
"def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend",
"def button_down(id)\r\n case id\r\n when... | [
"0.71004444",
"0.7075031",
"0.6776605",
"0.64335394",
"0.6366527",
"0.6346033",
"0.631607",
"0.62931114",
"0.6287399",
"0.6281883",
"0.6230533",
"0.6169614",
"0.61186373",
"0.6095681",
"0.6080647",
"0.6079532",
"0.6070555",
"0.60401744",
"0.6029993",
"0.59985405",
"0.5992777"... | 0.7302922 | 0 |
Delete a named cookie with specified path. | def delete_cookie name, path
command 'deleteCookie', name, path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cookie(name); end",
"def delete(name)\n @control.delete_cookie(name)\n end",
"def delete_cookie name\n @response.delete_cookie name\n end",
"def delete_cookie(name)\n browser.delete_cookie(name)\n end",
"def delete(name)\n set_cookie(\"name\" => name.to_s, \"value\" => \"\")... | [
"0.80507576",
"0.79902595",
"0.78462714",
"0.78460497",
"0.7762308",
"0.7753331",
"0.7736792",
"0.7722644",
"0.76973075",
"0.766335",
"0.7624122",
"0.7584712",
"0.7552487",
"0.74235904",
"0.7396429",
"0.71628356",
"0.69966125",
"0.69966125",
"0.6991922",
"0.69721454",
"0.6944... | 0.8839943 | 0 |
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded. | def meta_key_down
command 'metaKeyDown'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_key_up\r\n command 'metaKeyUp'\r\n end",
"def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end",
"def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end",
"def load_page_with_key_press(key, *modifiers)\n wait... | [
"0.73959273",
"0.5958385",
"0.5958385",
"0.57138026",
"0.57138026",
"0.5493059",
"0.54181105",
"0.5400129",
"0.53765786",
"0.53765786",
"0.5357723",
"0.5101127",
"0.50555325",
"0.50555325",
"0.5010577",
"0.5010577",
"0.4997196",
"0.4990738",
"0.4990738",
"0.4976433",
"0.49741... | 0.6653389 | 1 |
Opens a popup window (if a window with that ID isn't already open). After opening the window, you'll need to select it using the select_window command. This command can also be a useful workaround for bug SEL339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or bef... | def open_window url, window_id
command 'openWindow', url, window_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_to_window(id)\n driver.switch_to.window(id)\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def ensure_open_window\n ... | [
"0.69990504",
"0.6681354",
"0.6681354",
"0.66316944",
"0.65099555",
"0.6451773",
"0.6411729",
"0.6411729",
"0.6404836",
"0.62769806",
"0.62484086",
"0.6238764",
"0.621939",
"0.6118268",
"0.6080029",
"0.6063865",
"0.60496545",
"0.6017028",
"0.60162187",
"0.59910357",
"0.596673... | 0.81492454 | 0 |
Selects a frame within the current window. (You may invoke this command multiple times to select nested frames.) To select the parent frame, use "relative=parent" as a locator; to select the top frame, use "relative=top". You may also use a DOM expression to identify the frame you want directly, like this: dom=frames["... | def select_frame locator
command 'selectFrame', locator
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame(selector, argument)\n case selector\n when :name\n driver.switch_to.frame(argument)\n when :index\n driver.switch_to.frame(argument.to_i - 1) # index starts from 1 in Watir\n else\n raise OperaWatir::Exceptions::NotImplementedException,\n ... | [
"0.67133945",
"0.6637828",
"0.6467598",
"0.6302869",
"0.62870646",
"0.6228209",
"0.6050934",
"0.60387737",
"0.59692645",
"0.5949901",
"0.58981776",
"0.58876044",
"0.5780057",
"0.57478094",
"0.5740962",
"0.5740382",
"0.5737422",
"0.572849",
"0.57204854",
"0.5668381",
"0.561242... | 0.7479179 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.