query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Waits for pipe to become writeable.
def wait_writable(timeout = nil) if timeout move_on_after(timeout) do Polyphony.backend_wait_io(self, true) self end else Polyphony.backend_wait_io(self, true) self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_writable(io)\n wait io do |monitor|\n monitor.wait_writable\n end\n end", "def wait_writeable(io)\n wait_for_io io, @writers\n end", "def wait_writable\n if evented?\n Celluloid.current_actor.wait_writable(self.to_io)\n else\n Ker...
[ "0.752676", "0.7222756", "0.7048527", "0.6824121", "0.6221485", "0.61434484", "0.6111581", "0.6069954", "0.6008336", "0.5992989", "0.59528625", "0.5941441", "0.59293884", "0.5896221", "0.5891101", "0.5853165", "0.58259463", "0.58246434", "0.5815048", "0.5813057", "0.5782563",...
0.6977084
4
Splices to the pipe from the given source. If maxlen is negative, splices repeatedly using absolute value of maxlen until EOF is encountered.
def splice_from(src, maxlen) Polyphony.backend_splice(src, self, maxlen) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splice(src, dest, maxlen)\n Polyphony.backend_splice(src, dest, maxlen)\n end", "def readpartial(maxlen=99, buf=\"buffer\") end", "def readpartial(maxlen, buf=nil)\n if maxlen == 0\n if buf\n buf.clear\n return buf\n else\n return \"\"\n ...
[ "0.6756934", "0.5335579", "0.52518076", "0.5160258", "0.5158399", "0.5146615", "0.51364076", "0.5130741", "0.5129564", "0.5129564", "0.5127515", "0.51227415", "0.50734925", "0.50629175", "0.50275797", "0.50035566", "0.50035566", "0.4989617", "0.49786207", "0.48795536", "0.486...
0.723598
1
def is_authenticated? return !!session[:id] end
def current_user if session[:user_id] return User.find(session[:id]) else return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_authenticated?\n !session[:user_id].nil?\n end", "def authenticated?\n !!session[:user]\n end", "def is_authenticated?\n end", "def user_is_authenticated\r\n !!current_user\r\n end", "def is_logged_in?\n session[:authenticated]\n end", "def authenticated?\n true\n ...
[ "0.9185622", "0.9024745", "0.9001974", "0.8870406", "0.8849725", "0.8720222", "0.8651552", "0.8632624", "0.86095524", "0.86059284", "0.86059284", "0.8564435", "0.8564435", "0.85563725", "0.8552506", "0.8545005", "0.85416365", "0.8529629", "0.8529629", "0.8529629", "0.85133296...
0.0
-1
8. Perfect numbers between 1 to 100
def sample for num in 1..100 sum = 0 for j in 1..num-1 if( num % j == 0 ) sum = sum + j end end if( sum == num ) puts "perfect number : #{num}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_six\n (1.upto(100).reduce(:+)) ** 2 - (1.upto(100).map { |n| n ** 2 }).reduce { |sum, n| sum + n }\n end", "def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_u...
[ "0.7088248", "0.7083985", "0.70444626", "0.6881134", "0.68630105", "0.68528044", "0.6840165", "0.6784488", "0.6782659", "0.67424595", "0.66867125", "0.66520375", "0.66219944", "0.6586693", "0.6554745", "0.6532103", "0.6527514", "0.6527514", "0.6517824", "0.65173745", "0.65070...
0.7134008
0
State transition tables end reduce 0 omitted
def _reduce_1(val, _values, result) result = Root.new(val[1], val[2]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions; end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n...
[ "0.64042956", "0.6064393", "0.60386634", "0.6007729", "0.5946686", "0.59351325", "0.59351325", "0.5909589", "0.58873314", "0.58676314", "0.58676314", "0.57807076", "0.5779571", "0.5710219", "0.56961817", "0.5655912", "0.55736065", "0.55026084", "0.54936284", "0.5481873", "0.5...
0.0
-1
reduce 18 omitted reduce 19 omitted reduce 20 omitted
def _reduce_21(val, _values, result) result = H1.new(val[1]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_18(val, _values, result); end", "def _reduce_18(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_17(val, _values, result); end", "def _reduce_218(va...
[ "0.6839518", "0.6839518", "0.6826711", "0.67160404", "0.6680724", "0.667495", "0.666061", "0.6659988", "0.6659988", "0.6630516", "0.6606065", "0.65911376", "0.6588511", "0.6584769", "0.6584306", "0.6584306", "0.65842474", "0.6573848", "0.6572972", "0.656832", "0.6566702", "...
0.0
-1
Public: Initialize a CSS generation / distribution. name A String name that will be used to name a font and stylesheet file. file A String name that will be used to link to the font files. has A zero or more Symbol font types that a stylesheet will use. Valid symbols are: :eot, :svg, :woff, :ttf. Returns the String CSS stylesheet code.
def initialize(name, file, *has) [name, file, has] @has = has @name = name @filename = File.basename(file, '.*') # :nocov: @url = (self.class.relative_from.nil? ? (self.class.link_to ? (self.class.link_to + '/' + File.basename(file)) : file) : (self.class.link_to ? (self.class.link_to + '/' + File.basename(file)) : file)).to_s[/.*(?=\..+$)/] # :nocov: make_css end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css(file)\n\t\t\t\"<link rel='stylesheet' type='text/css' href='#{file}'>\"\n\t\tend", "def initialize(name,stylesheet)\n @name = name\n @stylesheet = stylesheet\n end", "def initialize(name,stylesheet)\n @name = name\n @stylesheet = stylesheet\n end", "def compile(n...
[ "0.6177854", "0.5792176", "0.5792176", "0.575686", "0.57238257", "0.56745803", "0.56512165", "0.56038404", "0.5405856", "0.53903514", "0.53752583", "0.5373458", "0.5315361", "0.52358884", "0.5209652", "0.52000433", "0.5186539", "0.51644284", "0.5153708", "0.5152381", "0.51429...
0.6157282
1
Internal: (Re)Create a CSS file and write code there. dir The String directory path to write CSS file to. Returns the css file just written.
def write(dir) @dir = FileUtils.mkdir_p dir @css_file = File.join(@dir, @filename + '.css') File.delete(@css_file) if File.exist?(@css_file) @output = File.open(@css_file, 'w') { |file| file.write(@result) } @css_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(dir)\r\n\tsavedir = Dir.pwd\r\n\tDir.chdir(dir)\r\n\r\n\t# 中間ファイル削除\r\n\tclean\r\n\r\n\t# 個別ファイルコンパイル\r\n\tDir::glob(\"*.pdf\").each do |file|\r\n\t\tnext if \"nzmath_doc\" == file[0...-4]\r\n\t\ttex_compile(file[0...-4])\r\n\tend\r\n\r\n\theader_footer = [\"header_overview.tex\", \"header_basic_util.t...
[ "0.5898902", "0.57185215", "0.567795", "0.5611694", "0.5572777", "0.5522076", "0.5483323", "0.5462372", "0.5448493", "0.53976876", "0.53748834", "0.52758175", "0.5220733", "0.5174061", "0.517192", "0.5120866", "0.5098613", "0.5077205", "0.5077205", "0.5076975", "0.50692004", ...
0.8405349
0
Public: Use template to fill placeholders with relevant values. Returns the String containing a CSS stylesheet code.
def make_css template = ERB.new TEMPLATE result = template.result binding (0..3).each { result.gsub!(/\n;\n/m, ";\n") } @result = result.gsub /^$\n/, '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assemble_css\n renderer = Liquid::Template.parse(@stylesheet.data)\n renderer.render(global_template_data, :filters => liquid_filters)\n end", "def css(*args); end", "def css(*args); end", "def css(*args); end", "def css(*args); end", "def to_css\n css = '('\n css << resolved_name\n ...
[ "0.63095415", "0.5806732", "0.5806732", "0.5806732", "0.5806732", "0.578862", "0.5722213", "0.56791705", "0.5675144", "0.56462574", "0.56446165", "0.5600719", "0.55762386", "0.55540633", "0.5548197", "0.5528408", "0.5481213", "0.5472172", "0.5458201", "0.5441029", "0.5410685"...
0.72517484
0
creates read and write methods
def initialize @portfolio = {} @name = "phil" @password = 1234 @gender = Stockman.gender end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\nend", "def read\n end", "def read\n end", "def read\n end", "def read\n end", "def read\n \n end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read\n raise NotImplementedError\n e...
[ "0.67666686", "0.6656167", "0.6656167", "0.6656167", "0.6656167", "0.6645576", "0.6579548", "0.6579548", "0.6579548", "0.6579548", "0.6579548", "0.6579548", "0.6579548", "0.653357", "0.6494755", "0.64168704", "0.63869023", "0.6365604", "0.6307512", "0.6293687", "0.6246891", ...
0.0
-1
GET /opinion_reports GET /opinion_reports.json
def index @opinion_reports = OpinionReport.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end", "def index\n @reports = Report.all\n\n respond_...
[ "0.676599", "0.6744532", "0.67176515", "0.6636575", "0.66225827", "0.659227", "0.65313697", "0.6501744", "0.64977497", "0.6422435", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", "0.6414742", ...
0.7774515
0
GET /opinion_reports/1 GET /opinion_reports/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @opinion_reports = OpinionReport.all\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to d...
[ "0.75124884", "0.6787663", "0.6599458", "0.65561825", "0.65473145", "0.6508159", "0.6506484", "0.6497241", "0.64782566", "0.6473375", "0.6473323", "0.6398738", "0.6387489", "0.63841593", "0.6356869", "0.6356869", "0.6356869", "0.6356869", "0.6356869", "0.6356869", "0.6356869"...
0.0
-1
POST /opinion_reports POST /opinion_reports.json
def create if OpinionReport.where(opinion_report_params).count > 0 render json: { status: "Error", message: "Ya se ha enviado un reporte sobre esta opinión" }.to_json else @opinion_report = OpinionReport.new(opinion_report_params) if @opinion_report.save render json: { status: "Exito", message: "Se ha enviado la denuncia satisfactoriamente" }.to_json else format.json { render json: @opinion_report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @opinion_reports = OpinionReport.all\n end", "def opinion_report_params\n params.require(:opinion_report).permit(:opinion_id, :reason, :user_id)\n end", "def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params...
[ "0.6828106", "0.63153374", "0.6295352", "0.612353", "0.6093642", "0.60286754", "0.59918565", "0.599123", "0.5990987", "0.59480035", "0.5918481", "0.5915681", "0.59105617", "0.5905141", "0.5903417", "0.58701444", "0.5860024", "0.58498853", "0.58251554", "0.5784668", "0.5775127...
0.7281066
0
PATCH/PUT /opinion_reports/1 PATCH/PUT /opinion_reports/1.json
def update respond_to do |format| if @opinion_report.update(opinion_report_params) format.html { redirect_to @opinion_report, notice: 'Opinion report was successfully updated.' } format.json { render :show, status: :ok, location: @opinion_report } else format.html { render :edit } format.json { render json: @opinion_report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n...
[ "0.6662384", "0.6468669", "0.6466897", "0.62971467", "0.62910783", "0.62250257", "0.62184453", "0.61896753", "0.61696917", "0.61493486", "0.6149035", "0.6149035", "0.6134327", "0.6105999", "0.61057854", "0.6097116", "0.60599715", "0.60589784", "0.60562", "0.6043677", "0.60436...
0.7180212
0
DELETE /opinion_reports/1 DELETE /opinion_reports/1.json
def destroy @opinion_report.destroy respond_to do |format| format.html { redirect_to opinion_reports_url, notice: 'Opinion report was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|...
[ "0.7349504", "0.7219695", "0.72195554", "0.721269", "0.71301913", "0.71294814", "0.71294814", "0.71294814", "0.7114345", "0.71045244", "0.7088226", "0.7034202", "0.70226806", "0.7017514", "0.7002945", "0.69912595", "0.69706774", "0.6966951", "0.69663113", "0.69604194", "0.694...
0.7651813
0
Use callbacks to share common setup or constraints between actions.
def set_opinion_report @opinion_report = OpinionReport.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def opinion_report_params params.require(:opinion_report).permit(:opinion_id, :reason, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /vlan_details/1 GET /vlan_details/1.xml
def show @vlan_detail = VlanDetail.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @vlan_detail } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @vlan }\n end\n end", "def show\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml ...
[ "0.8188131", "0.812569", "0.71993154", "0.7125191", "0.7082284", "0.6987521", "0.67301327", "0.6497025", "0.6448811", "0.6446775", "0.6425056", "0.6403707", "0.63576996", "0.63509965", "0.6331887", "0.632852", "0.63061804", "0.6302211", "0.62804914", "0.6268851", "0.62382466"...
0.82618773
0
GET /vlan_details/new GET /vlan_details/new.xml
def new @vlan_detail = VlanDetail.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @vlan_detail } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @vlan }\n end\n end", "def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vlan }\n end\n end", "...
[ "0.84023374", "0.83642495", "0.7765211", "0.7657264", "0.761953", "0.7365833", "0.7212881", "0.7149883", "0.7146596", "0.6963858", "0.6804152", "0.67895174", "0.6749218", "0.6649486", "0.6633858", "0.66127497", "0.6602427", "0.6585634", "0.65559876", "0.65298617", "0.65255934...
0.83645254
1
POST /vlan_details POST /vlan_details.xml
def create @vlan_detail = VlanDetail.new(params[:vlan_detail]) respond_to do |format| if @vlan_detail.save flash[:notice] = 'VlanDetail was successfully created.' format.html { redirect_to(@vlan_detail) } format.xml { render :xml => @vlan_detail, :status => :created, :location => @vlan_detail } else format.html { render :action => "new" } format.xml { render :xml => @vlan_detail.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vlan = Vlan.new(vlan_params)\n\n respond_to do |format|\n if @vlan.save\n flash[:notice] = 'VLAN was successfully created.'\n format.html { redirect_to(admin_vlans_path) }\n format.xml { render xml: @vlan, status: :created, location: @vlan }\n else\n forma...
[ "0.73366696", "0.7254835", "0.7098234", "0.69306386", "0.68697053", "0.6854008", "0.6651302", "0.65985614", "0.65504575", "0.64670604", "0.64436704", "0.6296945", "0.6204243", "0.60897243", "0.5982654", "0.59227705", "0.5909971", "0.5901296", "0.58853257", "0.5863771", "0.586...
0.7650778
0
PUT /vlan_details/1 PUT /vlan_details/1.xml
def update @vlan_detail = VlanDetail.find(params[:id]) respond_to do |format| if @vlan_detail.update_attributes(params[:vlan_detail]) flash[:notice] = 'VlanDetail was successfully updated.' format.html { redirect_to(@vlan_detail) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @vlan_detail.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n if @vlan.update_attributes(params[:vlan])\n flash[:notice] = 'Vlan was successfully updated.'\n format.html { redirect_to(@vlan) }\n format.xml { head :ok }\n else\n format.html { render :action =>...
[ "0.7309595", "0.72106314", "0.68898517", "0.67382944", "0.67142093", "0.6565873", "0.64978397", "0.64828444", "0.64793855", "0.64776397", "0.64325446", "0.6369396", "0.6363444", "0.6289484", "0.6250942", "0.62075704", "0.6194882", "0.6158836", "0.61440533", "0.5988808", "0.59...
0.74717534
0
DELETE /vlan_details/1 DELETE /vlan_details/1.xml
def destroy @vlan_detail = VlanDetail.find(params[:id]) @vlan_detail.destroy respond_to do |format| format.html { redirect_to(vlan_details_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vlan = Vlan.find(params[:id])\n @vlan.destroy\n\n respond_to do |format|\n format.html { redirect_to(vlans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hq_vlan = HqVlan.find(params[:id])\n @hq_vlan.destroy\n \n respond_to do |format|\n for...
[ "0.78283495", "0.74942267", "0.7375414", "0.70161873", "0.6958906", "0.68342835", "0.6643369", "0.65767473", "0.6422847", "0.6399574", "0.6328427", "0.63230187", "0.63037944", "0.62984455", "0.62906283", "0.6274453", "0.62638825", "0.62597704", "0.6246578", "0.62443775", "0.6...
0.7998813
0
Show asset with IP under that vlan
def vlan_hosts @vlan_detail = VlanDetail.find(params[:id]) @assets = @vlan_detail.assets.sort{|a,b| a.name <=> b.name} @assets = @assets.uniq{|x| x.name} respond_to do |format| format.html # index.html.erb format.xml { render :xml => @assets } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_pvn_vlan_details\n loop do\n answer = ask(\n \"Please enter the IP range you'd like to set up your private virtual network in CIDR \"\\\n \"notation:\"){ |q| q.default = '10.10.10.0/24'}\n begin\n ip = IPAddress.parse(answer)\n if ip.p...
[ "0.64726985", "0.63905203", "0.6372198", "0.63629836", "0.63629836", "0.63629836", "0.62417275", "0.6134599", "0.61209077", "0.61193043", "0.6110542", "0.6110542", "0.610411", "0.60921353", "0.6074775", "0.6029216", "0.60039264", "0.5967925", "0.5965804", "0.5963838", "0.5878...
0.63793737
2
(Try not to use this too much.)
def is_pdc? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def anchored; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def stderrs; end", "def terpene; end", "def offences_by; end", "def berlioz; end", "def identify; end", "def formation; end", "de...
[ "0.7280746", "0.6570851", "0.61225265", "0.604402", "0.6021085", "0.6021085", "0.6021085", "0.6021085", "0.5814513", "0.578158", "0.5745551", "0.5685709", "0.5682792", "0.5654548", "0.5630037", "0.5630037", "0.56007916", "0.5599029", "0.5599029", "0.55878735", "0.5585986", ...
0.0
-1
For want of a better name use the term "release_variant" to mean either a variant or a pdc_variant.
def release_variants variants end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variant; end", "def variant; end", "def variant=(variant); end", "def to_release\n user.releases.find_or_initialize_by(discogs_release_id: discogs_release_id).tap do |release|\n release.catalog_number = catalog_number\n release.label = label\n release.artist = artist\n release.name...
[ "0.62560093", "0.62560093", "0.6147223", "0.5904362", "0.58950055", "0.5765194", "0.57468003", "0.5736408", "0.5736194", "0.56948906", "0.5687286", "0.5641507", "0.5638455", "0.5636061", "0.5588106", "0.55563176", "0.55250937", "0.55091655", "0.55016565", "0.5457319", "0.5408...
0.62003255
2
Source: rubydoc, stackoverflow, Jennings
def combine_anagrams(words) output_array = Array.new(0) #create a new output array words.each do |firstword| temp_array = [] #create a temp array words.each do |nextword| if (nextword.downcase.split(//).sort == firstword.downcase.split(//).sort) #compare if two words are anagrams temp_array.push(nextword) #if so, push nextword to array end end output_array.push(temp_array) #push word to output array, then move up end return output_array.uniq #output array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def doc=(_arg0); end", "def doc=(_arg0); end", "def doc=(_arg0); end", "def base_docstring; end", "def docstring; end", "def docstring; end", "def docstring_range; end", "def docstring_hash_flag; end", "def docs=(_arg0); end", ...
[ "0.7473142", "0.7473142", "0.7473142", "0.7473142", "0.7396741", "0.7396741", "0.7396741", "0.7236714", "0.71883595", "0.71883595", "0.69842213", "0.69779134", "0.69470936", "0.68108773", "0.6748856", "0.6733831", "0.6709633", "0.6628891", "0.6587282", "0.64742947", "0.640486...
0.0
-1
Define Methods This will populate the Array based upon user input
def populateArray(arraySize) # Create Array, with a default of zero of all entries arrNumbers = Array.new(arraySize, 0); # Populate the Array i = 0; while (i < arraySize) do print("Enter in datum #{i+1} of #{arraySize}: "); arrNumbers[i] = gets().to_i(); i += 1; end # return array return arrNumbers; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_method(input)\n\treturn \"thanks for the sweet array!\"\nend", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each {|ele| add ele}\n\n # Fill in the rest of the initialize method here.\n \n # What should you do with each element of the incoming array?\n end", "def initi...
[ "0.6158802", "0.6011778", "0.5972734", "0.590999", "0.58833575", "0.5827265", "0.5807898", "0.5788143", "0.57762545", "0.57756007", "0.5759401", "0.5757754", "0.5739212", "0.5738943", "0.570728", "0.56961054", "0.5683885", "0.56786454", "0.5597912", "0.5580346", "0.55797136",...
0.5902523
4
This will sum all the values within the array
def calcTotal(numArray) sum = 0; numArray.each do |value| sum += value; end return sum; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend", "def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend", "def sum_values(arr)\n arr.inject(:+)\n end", "def total(my_array)\n my_array.sum\n end", "def sum(arra...
[ "0.81941444", "0.8176185", "0.816547", "0.8158442", "0.81029665", "0.80878973", "0.80816144", "0.80786914", "0.80780184", "0.8076158", "0.80725104", "0.8020704", "0.8007403", "0.8004146", "0.7998185", "0.7994439", "0.79925174", "0.7991933", "0.79912317", "0.7981484", "0.79782...
0.0
-1
This will calculate the average of the values within the array
def calcAvg(numArray) result = 0; # Check to see if our array is empty if (numArray.length() > 0) result = calcTotal(numArray) / numArray.length().to_f(); end return result; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_average \n result = array.sum(0.0)/array.size\n return result\n end", "def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end", "def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend", ...
[ "0.85694593", "0.85103923", "0.8463897", "0.8280219", "0.82648045", "0.8221508", "0.8202691", "0.81879187", "0.81335825", "0.8125586", "0.8117355", "0.8116428", "0.8112011", "0.8105962", "0.808068", "0.808068", "0.80782515", "0.8065224", "0.80585694", "0.8049483", "0.80419815...
0.73828256
96
This will calculate the Standard Deviation
def calcStandardDeviation(numArray) result = 0 if (numArray.length() == 1) result = numArray[0]; else avg = calcAvg(numArray); sum = 0 numArray.each do |x| sum = sum + ((x - avg)**2); end result = Math.sqrt(sum.to_f() / (numArray.length() - 1)); end return result; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def std_dev\n count = self.size\n mean = self.avg\n return Math.sqrt( self.inject(0) { |sum, e| sum + (e - mean) ** 2 } / count.to_f )\n end", "def std_dev\n Math.sqrt((@sum2.to_f - ((@sum.to_f * @sum.to_f)/@count.to_f)) / (@count.to_f - 1))\n end", "def stddev()\n if mean == -1\n mean()\...
[ "0.8471054", "0.8469435", "0.8418784", "0.840061", "0.83323073", "0.8323696", "0.8296676", "0.824962", "0.824962", "0.8241091", "0.82336736", "0.822686", "0.82179517", "0.820527", "0.8200095", "0.8200095", "0.8185351", "0.81818026", "0.8177606", "0.8168597", "0.8165046", "0...
0.74715793
80
This will display the results
def displayResults(numArray, total, avg, standardDev) # Header Row puts(); puts("Line #\tValue"); puts("------\t-----"); # Data Row sum = 0; line = 0; numArray.each do |x| sum = sum + x; line = line + 1; puts("#{line}\t#{x}"); end; # Grand Total puts(); puts("Total Number of Items: #{numArray.length()}"); puts("Grand Total: #{total}"); # Average puts(); puts("Average: " + format("%0.2f" % [avg])); # Standard Deviation puts(); puts("Standard Deviation: " + format("%0.4f" % [standardDev])); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end", "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end", "def display_results\r\n raise \"Not implemented\"\r\n end", "def showResults() \n\n end", "de...
[ "0.8100514", "0.79049927", "0.78712714", "0.7840865", "0.7810524", "0.77397305", "0.7708712", "0.7703749", "0.7439642", "0.7396527", "0.73570037", "0.73570037", "0.734946", "0.7326059", "0.7300185", "0.7284944", "0.7249997", "0.72385985", "0.72385985", "0.72385985", "0.720480...
0.676629
39
GET /enqueues GET /enqueues.json
def index @enqueues = Enqueue.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @enqueue = Enqueue.new(enqueue_params)\n\n respond_to do |format|\n if @enqueue.save\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }\n format.json { render :show, status: :created, location: @enqueue }\n else\n format.html { rend...
[ "0.6399622", "0.636724", "0.6155865", "0.60852784", "0.6017635", "0.5988283", "0.59550303", "0.59520835", "0.5918499", "0.5909206", "0.58986527", "0.589833", "0.5821724", "0.5819036", "0.58142185", "0.5810027", "0.5805604", "0.57812464", "0.57745177", "0.57744515", "0.5727791...
0.739622
0
GET /enqueues/1 GET /enqueues/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @enqueues = Enqueue.all\n end", "def create\n @enqueue = Enqueue.new(enqueue_params)\n\n respond_to do |format|\n if @enqueue.save\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }\n format.json { render :show, status: :created, location:...
[ "0.7186419", "0.6791196", "0.65474105", "0.6210437", "0.6209032", "0.61592543", "0.61441255", "0.6109664", "0.61055595", "0.60138386", "0.6007274", "0.5952444", "0.58751607", "0.58730114", "0.5847846", "0.58131194", "0.5780955", "0.5780667", "0.57710433", "0.5763677", "0.5684...
0.0
-1
POST /enqueues POST /enqueues.json
def create @enqueue = Enqueue.new(enqueue_params) respond_to do |format| if @enqueue.save format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' } format.json { render :show, status: :created, location: @enqueue } else format.html { render :new } format.json { render json: @enqueue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enqueue_params\n params.require(:enqueue).permit(:title, :text, :type, :category, :user_id)\n end", "def index\n @enqueues = Enqueue.all\n end", "def enqueue(item)\n end", "def enqueue( * )\n\t\t# No-op\n\tend", "def enqueue(*args); end", "def create\n arg = params[:email]\n counte...
[ "0.6499383", "0.64600056", "0.6225681", "0.6139643", "0.61385083", "0.61261934", "0.6082269", "0.60621554", "0.6009469", "0.6001736", "0.5975336", "0.5963701", "0.5955417", "0.59343475", "0.58794236", "0.58474815", "0.582951", "0.57697004", "0.5758289", "0.57346964", "0.56814...
0.7116463
0
PATCH/PUT /enqueues/1 PATCH/PUT /enqueues/1.json
def update respond_to do |format| if @enqueue.update(enqueue_params) format.html { redirect_to @enqueue, notice: 'Enqueue was successfully updated.' } format.json { render :show, status: :ok, location: @enqueue } else format.html { render :edit } format.json { render json: @enqueue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\...
[ "0.6018225", "0.59883356", "0.59556013", "0.595523", "0.5952416", "0.5952416", "0.5952416", "0.58493733", "0.5830232", "0.58256", "0.5823589", "0.58192915", "0.57849896", "0.5715887", "0.5679859", "0.5672567", "0.5659781", "0.5650481", "0.56400955", "0.56372046", "0.5631617",...
0.72399914
0
DELETE /enqueues/1 DELETE /enqueues/1.json
def destroy @enqueue.destroy respond_to do |format| format.html { redirect_to enqueues_url, notice: 'Enqueue was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteQueue( queue_id)\n params = Hash.new\n params['queue_id'] = queue_id\n return doCurl(\"delete\",\"/queue\",params)\n end", "def destroy\n @wait_queue.destroy\n respond_to do |format|\n format.html { redirect_to wait_queues_url, notice: \"Wait queue was successfully destroyed.\" }\n...
[ "0.68569595", "0.68183833", "0.67979604", "0.6727158", "0.6689218", "0.66470677", "0.6625463", "0.65813184", "0.65781456", "0.6554075", "0.6530053", "0.65290856", "0.64452493", "0.64413023", "0.643709", "0.64357966", "0.6433246", "0.6397519", "0.63841176", "0.6346085", "0.634...
0.76331973
0
Use callbacks to share common setup or constraints between actions.
def set_enqueue @enqueue = Enqueue.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def enqueue_params params.require(:enqueue).permit(:title, :text, :type, :category, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Paypal sends the user back here
def index redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paypal_return\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n #render :text => params \r\n if Purchase.exists?(params[:id])\r\n redirect_to(:action=>'order_confirm...
[ "0.7710904", "0.71439636", "0.70864105", "0.7085826", "0.70301765", "0.7011088", "0.6892122", "0.68912435", "0.68068475", "0.6762341", "0.66120726", "0.65329695", "0.6528623", "0.65161496", "0.649762", "0.6401485", "0.6383207", "0.63582027", "0.6317984", "0.6276889", "0.62677...
0.0
-1
the itinerary edit page is THE MAIN INTERFACE for attendee registration so... this page has mission creeped and is a bit messy it functions like a 'new' page for line_items and transactions NOTE: the itinerary isn't responsible for creating, updating, or destroying either of those resources though it also acts like an 'index' page for proposals
def edit @itinerary = Itinerary.find(params[:id]) authorize! :update, @itinerary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\titinerary = Itinerary.find(params[:id])\n\tend", "def index\n redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface\n end", "def edit\n \n end", ...
[ "0.72200865", "0.6515793", "0.6459003", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", "0.6328116", ...
0.66953987
1
FORCE to implement content_for in controller
def view_context super.tap do |view| (@_content_for || {}).each do |name,content| view.content_for name, content end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n ...
[ "0.75203246", "0.7484351", "0.73812956", "0.73812956", "0.73812956", "0.72570103", "0.7173389", "0.7173389", "0.7173389", "0.7066237", "0.690314", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0....
0.75152975
1
authlogic users authlogic venues
def current_venue_session return @current_venue_session if defined?(@current_venue_session) @current_venue_session = VenueSession.find end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #create venues trought users controller\n end", "def load_venues\r\n @venues = Venue.find(:all, \r\n :conditions => [ \"user_id = ?\", session[:user_id]])\r\n end", "def index\n @venues = current_user.venues\n end", "def index\n @venues = current_user.venue...
[ "0.61246413", "0.6084446", "0.60620785", "0.6054703", "0.60198665", "0.59942746", "0.5849713", "0.5831833", "0.5690142", "0.5634541", "0.5632786", "0.5593922", "0.5566959", "0.55195624", "0.55056864", "0.55016524", "0.54474163", "0.54315186", "0.5420919", "0.54177076", "0.541...
0.0
-1
The tuition calculated indicator is always S09 and TCALC
def tuition_calculated? type_code == '+S09' && reason_code == 'TCALC' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tupe\n if @tupe_flag == 'Y'\n @tupe =\n if @supplier_name\n @subtotal3 * @rate_card.data['Variances'][@supplier_name]['TUPE Risk Premium (DA %)'].to_f\n else\n @subtotal3 * @framework_rates['M148']\n end\n else\n 0\n end\n end", ...
[ "0.65868026", "0.60269016", "0.5877031", "0.5797632", "0.57933867", "0.56945443", "0.56872433", "0.5684176", "0.5627982", "0.55986583", "0.5549551", "0.5544073", "0.5522585", "0.5487636", "0.5468708", "0.54627633", "0.54601943", "0.5440606", "0.542751", "0.54165375", "0.53750...
0.64559186
1
GET /admin/weeks GET /admin/weeks.json
def index @admin_weeks = Week.order(:id).page params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weeks_on_list\n @data['weeks_on_list']\n end", "def index\n @weeks = Week.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weeks }\n end\n end", "def index\n if params[:league_id]\n league = League.find(params[:league_id])\n ...
[ "0.7343009", "0.72935605", "0.6904275", "0.6790616", "0.6764334", "0.6755687", "0.66631615", "0.6601792", "0.6567554", "0.65478504", "0.6516748", "0.6482828", "0.646859", "0.645838", "0.6404669", "0.632616", "0.6291614", "0.62767905", "0.6261471", "0.6260482", "0.6255865", ...
0.7260698
2
GET /admin/weeks/1 GET /admin/weeks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @weeks = Week.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weeks }\n end\n end", "def index\n @admin_weeks = Week.order(:id).page params[:page]\n end", "def weeks_on_list\n @data['weeks_on_list']\n end", "def index\n ...
[ "0.73214847", "0.7245699", "0.6842896", "0.6827583", "0.6804079", "0.66798055", "0.6663232", "0.6602102", "0.65749794", "0.655973", "0.65188986", "0.6494443", "0.64863485", "0.6474114", "0.6425487", "0.6312316", "0.6293122", "0.6281919", "0.6263649", "0.62034446", "0.6175162"...
0.0
-1
POST /admin/weeks POST /admin/weeks.json
def create @admin_week = Week.new(admin_week_params) respond_to do |format| if @admin_week.save format.html { redirect_to @admin_week, success: 'Week was successfully created.' } format.json { render :show, status: :created, location: @admin_week } else format.html { render :new } format.json { render json: @admin_week.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weeks_on_list\n @data['weeks_on_list']\n end", "def index\n @weeks = Week.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weeks }\n end\n end", "def schedule_params\n params.require(:schedule).permit(:weeks)\n end", "def crea...
[ "0.68010515", "0.6665091", "0.65331364", "0.65225804", "0.6455217", "0.6430298", "0.64089113", "0.63609725", "0.63458586", "0.62928516", "0.6292469", "0.6240901", "0.623347", "0.6197346", "0.61898685", "0.6173062", "0.61687183", "0.6128474", "0.61132616", "0.6083751", "0.6026...
0.6646312
2
PATCH/PUT /admin/weeks/1 PATCH/PUT /admin/weeks/1.json
def update respond_to do |format| if @admin_week.update(admin_week_params) format.html { redirect_to @admin_week, success: 'Week was successfully updated.' } format.json { render :show, status: :ok, location: @admin_week } else format.html { render :edit } format.json { render json: @admin_week.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @week = Week.find(params[:id])\n\n respond_to do |format|\n if @week.update_attributes(params[:week])\n format.html { redirect_to @week, :notice => 'Week was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit...
[ "0.65777916", "0.65333056", "0.63889223", "0.62320113", "0.6217546", "0.6187142", "0.6168561", "0.6111102", "0.61026907", "0.6030845", "0.6017585", "0.601497", "0.6009933", "0.59970903", "0.5955447", "0.59453326", "0.59129137", "0.59023345", "0.58936507", "0.58565253", "0.583...
0.6930342
0
DELETE /admin/weeks/1 DELETE /admin/weeks/1.json
def destroy @admin_week.destroy respond_to do |format| format.html { redirect_to admin_weeks_url, success: 'Week was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @day_week.destroy\n respond_to do |format|\n format.html { redirect_to day_weeks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @week = Week.find(params[:id])\n # @week.destroy\n\n respond_to do |format|\n format.html { redirect_to weeks_ur...
[ "0.7387031", "0.7379276", "0.7358234", "0.7358234", "0.7345342", "0.7119358", "0.7119252", "0.70316577", "0.69931716", "0.6991566", "0.6968955", "0.6897956", "0.6897389", "0.6879026", "0.6860818", "0.68506145", "0.676406", "0.67487353", "0.67425764", "0.6689473", "0.66772103"...
0.762575
0
Use callbacks to share common setup or constraints between actions.
def set_admin_week @admin_week = Week.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def admin_week_params params.fetch(:admin_week, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Checks message data consistency with the class default matcher.
def valid? self.class.matcher.match? data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_single_data(data:, message:)\n crit_msg(message) if data\n end", "def attribute_to_check_message_against; end", "def verify_messages_received\n # TODO: this doesn't provide good enough error messages to fix the error.\n # Error msg should tell exactly what went wrong. (AH).\n ...
[ "0.6006811", "0.5555014", "0.54604983", "0.5257278", "0.52236307", "0.5194804", "0.5182676", "0.51464856", "0.512828", "0.51156604", "0.5110231", "0.5095562", "0.50317943", "0.4999051", "0.49977425", "0.4992108", "0.49818772", "0.4981355", "0.4980109", "0.4974698", "0.4951657...
0.5420229
3
Creates a new factory with all the subclasses of base added to it as matchers.
def factory raise RuntimeError unless defined? @subclasses MessageFactory.new @subclasses.map(&:matcher) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extended(base)\n base.matchers.concat(matchers)\n end", "def child_factories; end", "def instantiate_subclasses(klass); end", "def inherited(base)\n base.send :create_dynamic_classes\n super\n end", "def inherited(base)\n klasses << base\n end", "def new(*a, &b)\n ...
[ "0.5896407", "0.58151835", "0.55468345", "0.5459844", "0.54579604", "0.5338063", "0.52701664", "0.52432096", "0.5086458", "0.5024644", "0.49408376", "0.49070334", "0.4905335", "0.48628333", "0.485909", "0.4857042", "0.4857042", "0.48550758", "0.48424715", "0.48307174", "0.482...
0.6463484
0
Alias to `matcher` that swaps named arguments for positional ones.
def [](channel, number = nil) matcher channel: channel, number: number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matcher=(_arg0); end", "def matcher_name=(_arg0); end", "def transformed_argname=(_); end", "def prepend_optionals(*names)\n current_optionals = @matcher_optionals.dup\n @matcher_optionals = []\n optional(*names)\n @matcher_optionals += current_optionals\n ...
[ "0.5834738", "0.5769382", "0.56646407", "0.5316694", "0.53091764", "0.5198111", "0.5165979", "0.5068673", "0.5065523", "0.5060004", "0.5028954", "0.49367964", "0.49305272", "0.48982874", "0.48201734", "0.4743559", "0.47388372", "0.4726314", "0.47141913", "0.46769413", "0.4661...
0.0
-1
Build a new instance of `Message::Base`, or a subclass, using more intuitive arguments. Subclasses of Base can utilize the same functionality by simply redefining `DATA_LENGTH` to correspond to their message length. Note that status and channel are masked using the default masks, and not the constants that may have been defined by a subclass.
def create(*bytes, status: self::STATUS, channel: 0, timestamp: Time.now.to_f) raise ArgumentError if bytes.length >= self::DATA_LENGTH validate_status status validate_channel channel data = Array.new self::DATA_LENGTH, 0 # Note: this line line must reference # STATUS_MASK and not self::STATUS_MASK data[0] = (status & STATUS_MASK) + (channel & CHANNEL_MASK) # Copy the bytes bytes.each_with_index { |value, index| data[index + 1] = value } new data, timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(args={})\n klass = FRAME_TYPE_MAP[args[:type].to_i]\n if(klass == FrameType::Response)\n klass.new(:response => args[:data])\n elsif(klass == FrameType::Error)\n klass.new(:error => args[:data])\n elsif(klass == FrameType::Message)\n unpacked = args[...
[ "0.61125255", "0.5855573", "0.56630296", "0.5547056", "0.5547056", "0.5439408", "0.5436918", "0.5436586", "0.54194045", "0.53850937", "0.5374965", "0.5345116", "0.5298132", "0.5298132", "0.52920866", "0.5253265", "0.52319163", "0.5226704", "0.52238154", "0.521879", "0.5210989...
0.5348212
11
Called automatically by inheriting classes.
def inherited(subclass) (@subclasses ||= []) << subclass nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def special\n override\n end", "def super_method; end", "def inherited(base); end", "def superclass() end", "def private; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize()\n super\n ...
[ "0.75753474", "0.7125592", "0.7042103", "0.7013877", "0.6982973", "0.6956117", "0.6953019", "0.6953019", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", "0.6878188", ...
0.0
-1
Creates a value and mask that can be used to match the first byte of a message. == Usage The following example illustrates how the value and mask are intended to be used. value, mask = status_value_and_mask 0x42 & mask == value => true if STATUS == 0x40 value, mask = status_value_and_mask 3 0x42 & mask == value => false since channel is 2
def status_value_and_mask(channel = nil) if channel validate_channel channel [(self::STATUS & self::STATUS_MASK) + (channel & CHANNEL_MASK), self::STATUS_MASK + CHANNEL_MASK] else [self::STATUS, self::STATUS_MASK] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_value_v1(value)\n # Int masks for one and zero chars\n ones_mask = @mask.chars.map { |c| c == \"1\" ? \"1\" : \"0\" }.join.to_i(2)\n zeros_mask = @mask.chars.map { |c| c == \"0\" ? \"1\" : \"0\" }.join.to_i(2)\n\n result = (ones_mask | value) & ~zeros_mask\n\n if DEBUG\n puts \" ...
[ "0.6243042", "0.5804736", "0.57224923", "0.5657368", "0.55966294", "0.5487266", "0.53218156", "0.5168772", "0.5157935", "0.5147742", "0.51307285", "0.50201744", "0.4992241", "0.4992241", "0.49884808", "0.49825266", "0.49813023", "0.494457", "0.494457", "0.49407294", "0.487402...
0.6877293
0
The klass matcher is the most generic `Matcher` for the message class and is cached to avoid duplication. By default the default `Matcher` uses the value and mask returned by `status_value_and_mask` to match messages. Subclasses that need different behaviour can pass a block to be forwarded directly to the matcher (see Matcher.new).
def klass_matcher(&block) return @klass_matcher if defined?(@klass_matcher) unless block_given? val, mask = status_value_and_mask block = proc { |d| (d[0] & mask) == val } end @klass_matcher = Matcher.new(self, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] >= 120\n end\n end", "def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] < 120\n end\n end", "def matcher(key, value)\n i...
[ "0.7424613", "0.73864794", "0.54925275", "0.5213161", "0.50020134", "0.49349326", "0.48404106", "0.48026842", "0.47157714", "0.46928883", "0.4668136", "0.45988646", "0.45614588", "0.45614588", "0.45548847", "0.4536644", "0.45190725", "0.45190725", "0.45090806", "0.44982448", ...
0.81724775
0
Constructs a Valkyrie::Persistence::CustomQueryContainer using this query service
def custom_queries @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_query\n DataServicesApi::QueryGenerator.new\n end", "def initialize\n super(\"query\")\n end", "def initialize(query={})\n @query = query\n end", "def initialize(query)\n @query = query \n end", "def initialize(query)\n @query = query\n end", "def build(attrs = {}...
[ "0.62247634", "0.6179609", "0.61784935", "0.6026644", "0.6021266", "0.5903643", "0.5809702", "0.5671776", "0.5641182", "0.56119287", "0.56032777", "0.55961984", "0.55961984", "0.5592445", "0.5534292", "0.55183417", "0.55100566", "0.55097336", "0.55021995", "0.5476193", "0.544...
0.8073523
0
GET /arms/new GET /arms/new.xml
def new @arm = Arm.new respond_to do |format| format.js{ render :update do |page| page.replace_html 'new_arm_entry', :partial => 'arms/form' end } format.html # new.html.erb format.xml { render :xml => @arm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml ...
[ "0.71332526", "0.71097887", "0.70058054", "0.6852666", "0.6852666", "0.6810658", "0.6755575", "0.6736488", "0.66951144", "0.6692428", "0.66834736", "0.6666734", "0.66659576", "0.6646728", "0.66333824", "0.663128", "0.66260797", "0.66217303", "0.6615985", "0.659831", "0.659831...
0.0
-1
POST /arms POST /arms.xml
def create @arm = Arm.new(params[:arm]) @arm.study_id = session[:study_id] display_num = @arm.get_display_number(session[:study_id]) @arm.display_number = display_num @arm.save respond_to do |format| if @arm.save @arms = Arm.find(:all, :conditions => {:study_id => session[:study_id]}) format.js { render :update do |page| page.replace_html 'arms_table', :partial => 'arms/table' page['new_arm_form'].reset new_row_name = "arm_row_" + @arm.id.to_s page[new_row_name].visual_effect(:highlight, {:startcolor => "#00ee00",:endcolor => "#ffffff", :restorecolor=>"#ffffff", :duration=>2}) page.replace_html 'arm_validation_message', "" end } format.html {} else problem_html = "<div class='error_message'>The following errors prevented the form from being submitted:<br/><ul>" for i in @arm.errors problem_html += "<li>" + i.to_s + " " + @arm.errors[i][0] + "</li>" end problem_html += "</ul>Please correct the form and press 'Save' again.</div><br/>" format.html { render :update do |page| page.replace_html 'arm_validation_message', problem_html end } #format.html { render :action => "new" } format.xml { render :xml => @arm.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @alarm = Alarm.new(alarm_params)\n if @alarm.save\n respond_with(@alarm, location: alarms_path, notice: 'Alarm was successfully created.')\n else\n respond_with(@alarm)\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \...
[ "0.56429434", "0.5638255", "0.543302", "0.5354322", "0.5276143", "0.5173262", "0.51551795", "0.5124128", "0.5121136", "0.5086284", "0.5073102", "0.50603676", "0.5057525", "0.5045305", "0.50423133", "0.5036492", "0.5034763", "0.5031704", "0.5029331", "0.50285894", "0.50278085"...
0.0
-1
PUT /arms/1 PUT /arms/1.xml
def update @arm = Arm.find(params[:id]) respond_to do |format| if @arm.update_attributes(params[:arm]) @arms = Arm.find(:all, :conditions => {:study_id => session[:study_id]}) format.js{ render :update do |page| page.replace_html 'arms_table', :partial => 'arms/table' new_row_name = "arm_row_" + @arm.id.to_s page[new_row_name].visual_effect(:highlight, {:startcolor => "#00ee00",:endcolor => "#ffffff", :restorecolor=>"#ffffff", :duration=>2}) page.replace_html 'arm_validation_message', "" @arm = Arm.new page.replace_html 'new_arm_entry', :partial=>'arms/form' end } format.html { redirect_to(@arm, :notice => 'Arm was successfully updated.') } format.xml { head :ok } else problem_html = "<div class='error_message'>The following errors prevented the form from being submitted:<br/><ul>" for i in @arm.errors problem_html += "<li>" + i.to_s + " " + @arm.errors[i][0] + "</li>" end problem_html += "</ul>Please correct the form and press 'Save' again.</div><br/>" format.html { render :update do |page| page.replace_html 'arm_validation_message', problem_html end } format.html { render :action => "edit" } format.xml { render :xml => @arm.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def res...
[ "0.63883674", "0.6087065", "0.58621955", "0.58292544", "0.57869846", "0.5779627", "0.57340634", "0.5724597", "0.56096363", "0.5599702", "0.55876523", "0.55573046", "0.555155", "0.55429554", "0.55099297", "0.55057615", "0.54895246", "0.54607856", "0.54521513", "0.54515433", "0...
0.0
-1
DELETE /arms/1 DELETE /arms/1.xml
def destroy @arm = Arm.find(params[:id]) @arm.shift_display_numbers(session[:study_id]) @arm.destroy respond_to do |format| format.js { @arms = Arm.find(:all, :conditions => {:study_id => session[:study_id]}) render :update do |page| page.replace_html 'arms_table', :partial => 'arms/table' @arm = Arm.new page.replace_html 'new_arm_entry', :partial => 'arms/form' end } format.html { redirect_to( study_arms_path(session[:study_id]) ) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def...
[ "0.6951352", "0.6557154", "0.64893574", "0.64581186", "0.6408342", "0.63115066", "0.6255977", "0.621644", "0.6202164", "0.619314", "0.61921644", "0.61444104", "0.6093234", "0.60785097", "0.6047445", "0.6029912", "0.60271865", "0.6015448", "0.60049736", "0.59871846", "0.598342...
0.0
-1
Return an error message if the name is invalid. Return nil if name is valid.
def error_for_list_name(name) if !(1..100).cover? name.size "List name must be between 1 and 100 characters." elsif session[:lists].any? {|list| list[:name] == name} "List name must be unique." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_invalid\n errors.add(:name, :unknown)\n end", "def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end", "def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end", "def name...
[ "0.79094726", "0.7621115", "0.74599296", "0.7410516", "0.72915965", "0.72062385", "0.7199446", "0.7144117", "0.70809036", "0.70197594", "0.70103854", "0.69986826", "0.6928774", "0.688518", "0.6864018", "0.6820561", "0.67747974", "0.669889", "0.669889", "0.6663252", "0.6654922...
0.0
-1
Return an error message if the name is invalid. Return nil if name is valid.
def error_for_todo(name) if !(1..100).cover? name.size "Todo name must be between 1 and 100 characters." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_invalid\n errors.add(:name, :unknown)\n end", "def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end", "def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end", "def name...
[ "0.790899", "0.76194715", "0.74582595", "0.74096197", "0.7290398", "0.7203984", "0.71964496", "0.7144012", "0.7082206", "0.70175177", "0.70105004", "0.7001168", "0.6926408", "0.68835825", "0.68639684", "0.6818678", "0.6775574", "0.6696702", "0.6696702", "0.66612494", "0.66528...
0.0
-1
Ensure that a redirect occurs with list param ids that are greater than our list of
def load_list(index) list = session[:lists][index] if index && session[:lists][index] return list if list session[:error] = "The specified list was not found." redirect "/lists" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_redirects(times)\n @redirects = times\n end", "def redirection_limit=(limit); end", "def max_redirects; end", "def check_arguments_count(input_params)\n return if input_params.count >= declared_params.count\n raise ArgumentError, \"#{declared_params.count} parameters expected.\"\n end", ...
[ "0.55826527", "0.54775935", "0.54543185", "0.53857285", "0.53801537", "0.53442305", "0.53442305", "0.5195298", "0.5128976", "0.5080549", "0.5060624", "0.5060624", "0.5060624", "0.50409603", "0.5018822", "0.50082535", "0.49981856", "0.49970093", "0.49823242", "0.4965238", "0.4...
0.0
-1
TODO: this API is clearly designed to do these in bulk.
def update_value # I don't know why it isn't working with HTTPI # Putting these exact fields into HTTPI fails and this works correctly so... url = "#{@credential.sentinelone_url}#{ANALYST_VERDICT_URL}#{@action}" uri = URI.parse(url) request = Net::HTTP::Post.new(uri) request.content_type = "application/json" request["Authorization"] = "ApiToken #{@credential.access_token}" body = { "filter" => { "ids" => [@app_result.details.id] } } request.body = JSON.dump(body) req_options = { use_ssl: uri.scheme == "https" } resp = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(request) end resp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_bulk; end", "def bulk_generate\n\n end", "def private; end", "def _all; end", "def all; end", "def multi; end", "def take_all; end", "def setup\n db = CouchRest.database!(\"http://127.0.0.1:5984/couchdb_test\")\n\n (1..@num_packs).each do |num_pack|\n elems = []\n (1..@num_i...
[ "0.61134833", "0.5678864", "0.5629328", "0.5611747", "0.5453252", "0.5398245", "0.5308655", "0.52821344", "0.5226588", "0.52147853", "0.5187893", "0.51822853", "0.51451665", "0.51413167", "0.5138092", "0.5138092", "0.50997496", "0.5096641", "0.50840074", "0.50831145", "0.5083...
0.0
-1
GET /languages GET /languages.json
def index session[:search_params] = params[:language] ? params[:language] : nil session[:set_pager_number] = params[:set_pager_number] if params[:set_pager_number] if session[:set_pager_number].nil? session[:set_pager_number] = PER_PAGE end @o_all = Language. search(session[:search_params]). order(sort_column + " " + sort_direction). paginate(:per_page => session[:set_pager_number], :page => params[:page]) @params_arr = { :name => { "type" => 'text' }, :code => { "type" => 'text' } } @o_single = controller_name.classify.constantize.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_languages\n\t\trender json: Language.all.to_json\n\tend", "def get_languages(options = {})\n object_from_response(GogoKit::PagedResource,\n GogoKit::LanguagesRepresenter,\n :get,\n get_root.links['viagogo:language...
[ "0.8043601", "0.79068565", "0.7800961", "0.7726499", "0.7668648", "0.75873524", "0.75537485", "0.7421925", "0.73789513", "0.73606074", "0.69749457", "0.6959757", "0.6931539", "0.688288", "0.6844224", "0.6821272", "0.68115413", "0.67462003", "0.6729769", "0.6704751", "0.669561...
0.0
-1
GET /languages/1 GET /languages/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language\n\t\trender json: Language.find(params[:language_id]).to_json\n\tend", "def language(id, params = {})\n get \"languages/#{id}\", {query: params}\n end", "def index\n @languages = Language.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { ...
[ "0.77902293", "0.75988847", "0.7462973", "0.7395749", "0.73584473", "0.7303465", "0.7251116", "0.7036625", "0.6951743", "0.69434446", "0.69339126", "0.68410814", "0.68176085", "0.67245847", "0.67245847", "0.67245847", "0.67245847", "0.67245847", "0.67245847", "0.67245847", "0...
0.0
-1
POST /languages POST /language_sessions POST /language_sessions.xml
def create @o_single = Language.new(language_params) respond_to do |format| if @o_single.save create_locale_file format.html { redirect_to admin_languages_url, notice: t("general.successfully_created") } format.json { head :no_content } else format.html { render action: 'new' } format.json { render json: @o_single.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_language\r\n session[:language] = 'english'\r\n end", "def create\n @language = Language.new(params[:language])\n\n respond_to do |format|\n if @language.save\n flash[:notice] = t('languages.new.success')\n format.html { redirect_to(@language) }\n format.xml { render ...
[ "0.5995371", "0.58339775", "0.56832933", "0.5622439", "0.5512452", "0.55096626", "0.5506894", "0.54907614", "0.54731333", "0.5454668", "0.54532593", "0.5420893", "0.53982013", "0.53594387", "0.53372854", "0.5327262", "0.5313852", "0.53044885", "0.5297232", "0.52467215", "0.52...
0.5105694
39
PATCH/PUT /languages/1 PATCH/PUT /languages/1.json
def update respond_to do |format| if @o_single.update(language_params) update_locale_file format.html { redirect_to admin_languages_url, notice: t("general.successfully_updated") } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @o_single.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @language = Language.find(params[:id])\n\n respond_to do |format|\n if @language.update_attributes(params[:language])\n format.html { redirect_to :back, notice: t(:modification_registered) }\n format.json { head :no_content }\n else\n format.html { redirect_to :bac...
[ "0.682517", "0.67773896", "0.6769086", "0.66506225", "0.6632527", "0.6628076", "0.6606491", "0.6563891", "0.64977205", "0.6491283", "0.6491283", "0.6423149", "0.63759977", "0.63357884", "0.6321463", "0.6294658", "0.62798506", "0.6264165", "0.62338704", "0.6210363", "0.6175708...
0.65807873
7
DELETE /languages/1 DELETE /languages/1.json
def destroy delete_locale_file @o_single.destroy respond_to do |format| format.html { redirect_to admin_languages_url, notice: t("general.successfully_destroyed") } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @language = Language.find(params[:id])\n @language.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: t(:language_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @language.destroy\r\n respond_to do |format|\r\n ...
[ "0.79292005", "0.7776024", "0.7758681", "0.76657397", "0.7512597", "0.75000715", "0.74715155", "0.74715155", "0.74615216", "0.7442635", "0.7354793", "0.73471606", "0.73123074", "0.73119617", "0.7291266", "0.7253621", "0.71434", "0.7126188", "0.7112562", "0.7074144", "0.701668...
0.7145588
16
Use callbacks to share common setup or constraints between actions.
def set_language @o_single = Language.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def language_params params.require(:language).permit! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Code to parse files from HPO database. METHODS
def load_hpo_file(file) storage = [] id = nil name = nil alt_id = [] syn = [] is_a = [] File.open(file).each do |line| line.chomp! tag, info = line.split(': ') if tag == 'id' || tag == 'name' || tag == 'is_a' || tag == 'synonym' || tag == 'alt_id' if tag == 'id' storage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a) if !name.nil? #if !temp[1].include?("obsolete") id = info name = nil alt_id = [] syn = [] is_a = [] end if tag == 'alt_id' alt_id << info elsif tag == 'is_a' is_a.concat(info.split(' ! ')) elsif tag == 'synonym' syn << info.split('"')[1] else name = info end end end storage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a) return storage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_htfiles (htfiles)\n delete_sql = %w[\n DELETE FROM holdings_memberitem\n WHERE member_id = ?\n AND item_type = ?\n ].join(' ');\n load_sql = %w[\n LOAD DATA LOCAL INFILE ?\n INTO TABLE holdings_memberitem IGNORE 1 LINES\n (oclc, local_id, member_id, status, item_condition,\n ...
[ "0.65713745", "0.64572173", "0.6448469", "0.643459", "0.61574376", "0.61238927", "0.6083209", "0.6037458", "0.60342926", "0.60342926", "0.6033292", "0.6006531", "0.6002041", "0.59454334", "0.59444183", "0.59358245", "0.5930228", "0.59284675", "0.5882903", "0.585733", "0.58191...
0.5832411
20
Drop a call to this into a Selenium test block to work with the browser interactively. Useful during test development!
def debug_repl $stderr.puts("Debug REPL active. Type :eof to abort") while true line = $stdin.readline break if line.strip == ":eof" begin puts eval(line).inspect rescue puts $! end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n @browser = Selenium::WebDriver.for :firefox\n @wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n @browser.get 'http://demo.redmine.org'\n end", "def setup\n @verification_errors = []\n if $selenium\n @selenium = $selenium\n else\n @selenium = Selenium::Client::Driver...
[ "0.6788726", "0.6610423", "0.65883774", "0.6508289", "0.6468248", "0.64287615", "0.63877237", "0.63798743", "0.6340892", "0.63196725", "0.6294175", "0.62805855", "0.6274071", "0.6203242", "0.6202054", "0.6188363", "0.61646086", "0.6150776", "0.61407244", "0.61325157", "0.6111...
0.0
-1
A few globals here to allow things to be reused between nested suites.
def login_as_archivist( create_new = false ) if !$test_repo ($test_repo, $test_repo_uri) = create_test_repo("repo_#{SecureRandom.hex}", "description") end if !$archivist_user or create_new ($archivist_user, $archivist_pass) = create_user add_user_to_archivists($archivist_user, $test_repo_uri) end login($archivist_user, $archivist_pass) select_repo($test_repo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n\n # Save the Global variable's original settings so that they can be changed in this\n # test without affecting other test, so long as they are restored by teardown\n @@VERBOSE_ORIG = $VERBOSE\n @@DEBUG_ORIG = $DEBUG\n @@FAST_SPEED_ORIG = $FAST_SPEED\n @@HIDE_IE_ORIG = $HIDE_IE\n\n ...
[ "0.6394448", "0.63356215", "0.63158065", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", "0.6280009", ...
0.0
-1
Parse out _str_ and return two Time objects. It will return nil if one of the times are corrupt (like 13th month) or missing. It will also look at context if no end time is given so: 2008 becomes 20080101 00:00:00 20081231 23:59:59 200801 becomes 20080101 00:00:00 20080131 23:59:59 20080101 becomes 20080101 00:00:00 20080101 23:59:59 and so forth...
def parse(str) match_data = str.match(DATE_REGEXP) # Oh my god, I hate this shit. Basically it prepares dates for # Time.parse consuming because it's so stupid and ignorant it wants # to make me puke :( from = extract_time_string_from_match_data(match_data) to = extract_time_string_from_match_data(match_data, 12) begin from = Time.parse(from) unless from.nil? rescue ArgumentError from = nil end begin if to.nil? and not from.nil? case extract_context_from_match_data(match_data) when :year to = from.end_of_year when :month to = from.end_of_month when :day to = from.end_of_day when :hour to = from + (59 - from.min).minutes + (59 - from.sec) when :minute to = from + (59 - from.sec) end else to = Time.parse(to) end rescue ArgumentError to = nil end [from, to] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_parsing str\n Time.parse(str) if str && str != \"<null>\"\n end", "def parse_times(str)\n \tstr.delete(' ')\n \ttimes = []\n \tsuccess = true\n \tstr.split(',').each do |t|\n \t pt = parse_time(t)\n \t if pt\n \t \ttimes << pt\n \t else\n \t \traise \"unable to parse time #{t}\"\n ...
[ "0.7274767", "0.65754855", "0.6502847", "0.64645815", "0.62937933", "0.62896746", "0.62896746", "0.62896746", "0.6259417", "0.62309694", "0.6205177", "0.61774254", "0.61242664", "0.61092573", "0.61092573", "0.61092573", "0.61092573", "0.61092573", "0.61092573", "0.61092573", ...
0.6699145
1
Check if _str_ is a date range. Date range format is ([] indicating optional parts): yyyy[MM[dd[ hh[:mm[:ss]]]]][ ][yyyy[MM[dd[ hh[:mm[:ss]]]]]]
def match?(str) str.match(DATE_REGEXP).nil? ? false : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_range(start_str, end_str)\n Date.parse(start_str)..Date.parse(end_str)\n rescue ArgumentError => e\n halt 400, { err: 'Invalid date(s)', msg: e.message }.to_json\n end", "def date_range_from_string(date_str)\n if date_str == nil || date_str.length < 4\n return n...
[ "0.68228227", "0.6567573", "0.6441602", "0.6428828", "0.63096774", "0.60704446", "0.6065182", "0.6044244", "0.6002385", "0.5956918", "0.5888476", "0.5879502", "0.586088", "0.58533126", "0.58169025", "0.5793735", "0.57808495", "0.5765102", "0.5752561", "0.57491064", "0.5727268...
0.6201954
5
Extract context from match data. For example if user enters just 2008 it will return :year. Return value meanings: :year: end range should be years end :month: end range should be months end :nothing: nothing should be done with end range
def extract_context_from_match_data(m, offset=0) year, month, day, hour, minute, second = \ extract_pieces_from_match_data(m, offset) if year and month and day and hour and minute and second :nothing elsif year and month and day and hour and minute :minute elsif year and month and day and hour :hour elsif year and month and day :day elsif year and month :month elsif year :year end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def term\n return nil unless start_time\n case start_time.mon\n when 1..3 # Lent term\n return month_range( start_time.year, 1, 3 )\n when 4..6 # Easter term\n return month_range( start_time.year, 4, 6 )\n when 7..9 # Long vac.\n return month_range( start_time.year, 7, 9 )\n ...
[ "0.5681878", "0.55291873", "0.54597914", "0.53294075", "0.53150725", "0.5312115", "0.5310349", "0.52532923", "0.52528447", "0.51866615", "0.51760566", "0.51282996", "0.508316", "0.50603604", "0.5035899", "0.5003991", "0.49374774", "0.49357435", "0.49126983", "0.49019644", "0....
0.6747188
0
== Instance Methods =====================================================
def initialize(contents = nil) case (contents) when ReDNS::Buffer # Ensure that this String subclass is handled using the default # method, not intercepted and treated as an actual String super(contents) when String super(name: contents) unless (ReDNS::Support.is_ip?(name) or self.name.match(/\.\z/)) self.name += '.' end else super(contents) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def initialize\n\t\t\n\tend", "def initialize\n \n end", "def initialize\n\n end", "def initialize\n\n end", "def initialize\r\n\r\n end", "def implementation; end", "def implementation; end", "def initialize\n end", "def initialize\n end", "def initialize\n ...
[ "0.84480613", "0.7321441", "0.7319484", "0.72957546", "0.72957546", "0.72925824", "0.72724235", "0.72724235", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7218338", "0.7160271", "0.7142233", "0.7142233...
0.0
-1
'data' is an Array[], where "String" is a series of characters representing a navigational command. The set represents navigation instructions.
def initialize data self.data = data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands(list)\n @commands = list.chars\n end", "def sets\n end", "def commands\n\t\t{\n\t\t\t\"db_search\"\t\t=> \"[type] [ WHERE [sub_type] CONTAINS [column]=[value] [OR ...] ] - Find database items\",\n\t\t\t\"db_set_list\" \t\t=> \"List all sets\",\n\t\t\t\"db_set_show\" \t\t=> \"[id] - Show the s...
[ "0.5114515", "0.5091169", "0.4955518", "0.4945068", "0.49416777", "0.4782376", "0.47750086", "0.47256494", "0.47173098", "0.469622", "0.4689566", "0.4667086", "0.46628743", "0.46481758", "0.46300706", "0.46212015", "0.46198785", "0.46120158", "0.4604427", "0.4598303", "0.4596...
0.0
-1
NOTE: Nasty Hack because of AoC.
def navigation_command? command %w[ForwardMovement LeftRotation RightRotation].include? command.class.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def schubert; end", "def berlioz; end", "def terpene; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def rassoc(p0) end", "def stderrs; end", "def ibu; end", "def offences_by; end", "def jac...
[ "0.657317", "0.6186789", "0.60336727", "0.58899677", "0.58614945", "0.57952255", "0.5787666", "0.5787666", "0.5787666", "0.5787666", "0.5741018", "0.5684409", "0.5630495", "0.5601069", "0.55492055", "0.5534674", "0.55075324", "0.55075324", "0.55075324", "0.54808927", "0.54546...
0.0
-1
east > north > west > south > east
def turn_left steps value = key - steps value = (4 + value).abs if value.negative? self.key = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def west \n \"west\" \n end", "def east\n @east ||= west + SIZE\n end", "def north\n @north ||= south + SIZE\n end", "def east\n @state.east(self)\n end", "def north_east\n @north_east ||= Point.new(north, east)\n end", "def right position\n # if currently facing north\n if posi...
[ "0.68237054", "0.6635362", "0.6564657", "0.64404446", "0.6348607", "0.632243", "0.6308366", "0.6250974", "0.61506534", "0.6147591", "0.6135115", "0.610147", "0.6099016", "0.60726935", "0.6071848", "0.60624385", "0.5986376", "0.5978177", "0.5929971", "0.58676904", "0.5855585",...
0.0
-1
east > south > west > north > east
def turn_right steps value = key + steps value = (4 - value).abs if value >= 4 self.key = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def west \n \"west\" \n end", "def east\n @east ||= west + SIZE\n end", "def north\n @north ||= south + SIZE\n end", "def east\n @state.east(self)\n end", "def right_directions\n {\n ToyEnums::NORTH => ToyEnums::EAST,\n ToyEnums::EAST => ToyEnums::SOUTH,\n ToyEnu...
[ "0.68481547", "0.6597534", "0.64988935", "0.6396449", "0.6358969", "0.63421166", "0.6280905", "0.62783176", "0.61774725", "0.6140672", "0.6124099", "0.6099264", "0.60932964", "0.6057946", "0.60570866", "0.60261315", "0.600066", "0.5966181", "0.5903809", "0.5890851", "0.588834...
0.0
-1
Derive from this waypoint's location, its opposite location and its left & right locations. These will be determined to make 'rotation' easier. Example: For a location east 10, north 1 oppositie location is: west 10, south 1 right location is: east 1, south 10 left location is: west 1, north 10.
def location_changed! east = location.east_units west = location.west_units north = location.north_units south = location.south_units # NOTE: expectation is 1 of the paired directions will be zero. calculate_location_opposite east: east, west: west, north: north, south: south calculate_location_right east: east, west: west, north: north, south: south calculate_location_left end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_location_right east:, west:, north:, south:\n self.location_right = {}\n if east.zero? && north.zero?\n location_right[:west] = south\n location_right[:north] = west\n elsif east.zero? && south.zero?\n location_right[:east] = north\n location_right[:north] = west\n els...
[ "0.70908403", "0.6990884", "0.66217375", "0.6384931", "0.6233099", "0.617369", "0.6073762", "0.59224135", "0.5917899", "0.5903764", "0.58580405", "0.57399726", "0.5735009", "0.5721882", "0.5700005", "0.56951934", "0.5689652", "0.56895316", "0.5688678", "0.5688303", "0.5660922...
0.7117434
0
Example: For a location east 10, north 1 oppositie location is: west 10, south 1
def calculate_location_opposite east:, west:, north:, south: self.location_opposite = {} if east.zero? location_opposite[:east] = west else location_opposite[:west] = east end if north.zero? location_opposite[:north] = south else location_opposite[:south] = north end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n ...
[ "0.6988844", "0.67001283", "0.6687246", "0.66694206", "0.65815085", "0.6473859", "0.63812053", "0.63083404", "0.63045985", "0.6291671", "0.6269261", "0.6262504", "0.6179521", "0.61734277", "0.61674803", "0.61533666", "0.6059062", "0.6059062", "0.6059062", "0.6036644", "0.6027...
0.69202095
1
Example: For a location east 10, north 1 right location is: east 1, south 10
def calculate_location_right east:, west:, north:, south: self.location_right = {} if east.zero? && north.zero? location_right[:west] = south location_right[:north] = west elsif east.zero? && south.zero? location_right[:east] = north location_right[:north] = west elsif west.zero? && north.zero? location_right[:west] = south location_right[:south] = east else location_right[:east] = north location_right[:south] = east end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_location_left\n self.location_left = {}\n if location_right.key? :east\n location_left[:west] = location_right[:east]\n else\n location_left[:east] = location_right[:west]\n end\n\n if location_right.key? :north\n location_left[:south] = location_right[:north]\n else\...
[ "0.6966873", "0.68311363", "0.6594091", "0.6567964", "0.64203787", "0.6311611", "0.6224666", "0.61903715", "0.61848915", "0.61588734", "0.6136917", "0.60667384", "0.60667384", "0.60667384", "0.6020196", "0.59962046", "0.59773296", "0.5973496", "0.59495157", "0.59431916", "0.5...
0.7431923
0
Example: For a location east 10, north 1 left location is: west 1, north 10. NOTE: location left is opposite from location right
def calculate_location_left self.location_left = {} if location_right.key? :east location_left[:west] = location_right[:east] else location_left[:east] = location_right[:west] end if location_right.key? :north location_left[:south] = location_right[:north] else location_left[:north] = location_right[:south] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n ...
[ "0.7180343", "0.69969976", "0.67336714", "0.6691611", "0.66659105", "0.6658387", "0.6472062", "0.6142473", "0.614056", "0.6109168", "0.6064806", "0.6058206", "0.6030131", "0.60280156", "0.601265", "0.59770083", "0.59219563", "0.5883541", "0.5868157", "0.58477896", "0.5840435"...
0.74215484
0
NOTE: Nasty Hack because of AoC.
def navigation_command? command %w[ForwardMovement].include? command.class.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def schubert; end", "def berlioz; end", "def terpene; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def rassoc(p0) end", "def stderrs; end", "def ibu; end", "def offences_by; end", "def jac...
[ "0.657317", "0.6186789", "0.60336727", "0.58899677", "0.58614945", "0.57952255", "0.5787666", "0.5787666", "0.5787666", "0.5787666", "0.5741018", "0.5684409", "0.5630495", "0.5601069", "0.55492055", "0.5534674", "0.55075324", "0.55075324", "0.55075324", "0.54808927", "0.54546...
0.0
-1
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) min_value=-1 cheapest=nil name_hash.collect do |thing, value| if min_value==-1 min_value=value cheapest=thing elsif min_value>value min_value=value cheapest=thing end end cheapest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n...
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585...
0.0
-1
GET /bankets GET /bankets.json
def index @bankets = Banket.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format...
[ "0.76801455", "0.7476931", "0.7080124", "0.7064575", "0.7016689", "0.696387", "0.6960119", "0.6893481", "0.6892587", "0.6801927", "0.6785925", "0.6777888", "0.67705154", "0.6756606", "0.6750544", "0.6740486", "0.66743165", "0.6597684", "0.65846604", "0.6584592", "0.6575276", ...
0.7417427
2
GET /bankets/1 GET /bankets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def show\n render json: @bank\n end", "def index\n @bankets = Banket.all\n end", "def show\n @bank = ...
[ "0.74209857", "0.7413908", "0.7079778", "0.7064105", "0.701003", "0.69089586", "0.6884841", "0.6879096", "0.6802867", "0.6735408", "0.67252326", "0.672463", "0.67204434", "0.6717139", "0.66331", "0.6571266", "0.6552814", "0.6551983", "0.6505937", "0.6490335", "0.64858145", ...
0.0
-1
POST /bankets POST /bankets.json
def create @banket = Banket.new(banket_params) respond_to do |format| if @banket.save format.html { redirect_to @banket, notice: 'Banket was successfully created.' } format.json { render :show, status: :created, location: @banket } else format.html { render :new } format.json { render json: @banket.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.succe...
[ "0.6535218", "0.6401779", "0.62633854", "0.62352747", "0.6176619", "0.6160421", "0.6114946", "0.6091957", "0.6049036", "0.6025356", "0.5973933", "0.59646356", "0.5947393", "0.5908161", "0.5889099", "0.58485776", "0.58447814", "0.58068705", "0.57958186", "0.57835853", "0.57462...
0.6947752
0
PATCH/PUT /bankets/1 PATCH/PUT /bankets/1.json
def update respond_to do |format| if @banket.update(banket_params) format.html { redirect_to @banket, notice: 'Banket was successfully updated.' } format.json { render :show, status: :ok, location: @banket } else format.html { render :edit } format.json { render json: @banket.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n format.html { redirect_to @bank, notice: 'Bank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6450134", "0.6434901", "0.6401177", "0.631454", "0.63131493", "0.62878984", "0.6270798", "0.62674767", "0.62448066", "0.624004", "0.62303656", "0.62303656", "0.6225549", "0.6207581", "0.62047094", "0.618524", "0.6171994", "0.6157234", "0.614989", "0.6133582", "0.61241424",...
0.6604139
0
DELETE /bankets/1 DELETE /bankets/1.json
def destroy @banket.destroy respond_to do |format| format.html { redirect_to bankets_url, notice: 'Banket was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank.destroy\n respond_to do |format|\n format.html { redirect_to banks_url, notice: '...
[ "0.724147", "0.72099483", "0.7140855", "0.7108241", "0.702999", "0.6937988", "0.6930966", "0.6911572", "0.6898664", "0.68749624", "0.6872276", "0.68690807", "0.6868805", "0.6855764", "0.6849086", "0.68477905", "0.68477905", "0.6846234", "0.68058443", "0.67974794", "0.67872834...
0.7363097
0
Use callbacks to share common setup or constraints between actions.
def set_banket @banket = Banket.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def banket_params params.require(:banket).permit(:arrival, :departure, :places, :price, :post_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Replace domain & protocol template with user defined activities.
def patch_adapter(adapter, domain:, protocol:) Class.new(adapter) do step Subprocess( protocol, patch: -> { step Subprocess( domain ), inherit: true, id: :domain, replace: :domain } ), inherit: true, id: :protocol, replace: :protocol end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace\n @replace ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id, obj|\n do_request('replace', entit...
[ "0.5868886", "0.5549187", "0.53772295", "0.52340865", "0.52268976", "0.5213297", "0.50119746", "0.49273515", "0.49273515", "0.49273515", "0.49156165", "0.49041256", "0.48373938", "0.48254117", "0.47959986", "0.47952235", "0.47949415", "0.47312906", "0.47244957", "0.4722459", ...
0.4576149
28
Find a way to accumulate the :worldwide_grosses and return that Integer using director_data as input
def gross_for_director(director_data) movie_count = 0 total_gross = 0 while movie_count < director_data[:movies].length do total_gross += director_data[:movies][movie_count][:worldwide_gross] movie_count += 1 end total_gross end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gross_for_director(director_data)\n movie_index = 0\n worldwide_grosses = 0\n while movie_index < director_data[:movies].length\n worldwide_grosses += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\nworldwide_grosses\nend", "def gross_for_director(director_data)\n s...
[ "0.8031094", "0.79803103", "0.7979809", "0.7938483", "0.7927118", "0.7893617", "0.78402203", "0.77561146", "0.77524376", "0.7717609", "0.76706547", "0.7670455", "0.7654349", "0.76027364", "0.7602346", "0.7588497", "0.7581547", "0.75780565", "0.7557646", "0.75266427", "0.75179...
0.7608682
13
COUNTER TO IGNORE THE 'puts stringsHash[:band_name]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER
def getEventName() counter = 0 event_name_check = "" event_name = "" @eventName = "" while event_name_check != 'y' || event_name_check != "exit" if counter == 0 puts @@stringsHash[:band_name] end counter += 1 event_name = gets.strip if event_name == 'exit' return end puts "\n" puts "Is '#{event_name}' the correct event name?\nPress 'y' for 'Yes' or 'n' for 'No' and press 'Enter'." event_name_check = gets.strip if event_name_check == "exit" return end if event_name_check == 'y' @eventName = event_name break end if event_name_check == 'n' puts "\n" puts "-------------------------------------------------------" puts "Re-Enter the Event Name and press 'Enter':" redo end if event_name_check != 'y' || event_name_check != 'n' puts "Please press 'y' for 'Yes' or 'n' for 'No' and hit the 'Enter' Key." puts "If you'd like to exit the program, type 'exit' and hit the 'Enter' Key." puts "\n" puts "**** Now Re-Enter the event name and hit 'Enter'. ****" redo end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBandNum(eventName)\n counter = 0\n band_num_check = \"\"\n @bandNum = \"\"\n while band_num_check != 'y' || band_num_check != \"exit\"\n if counter == 0\n puts @@stringsHash[:band_num]\n end\n counter += 1\n band_num = ge...
[ "0.55946434", "0.5024111", "0.49813637", "0.49517635", "0.49489236", "0.49099362", "0.48969808", "0.48689592", "0.48548916", "0.48229215", "0.4800722", "0.47863787", "0.4772988", "0.47551736", "0.47546607", "0.4711669", "0.4702972", "0.469361", "0.46930218", "0.46920958", "0....
0.47581697
13