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
following strings. If it does exist, print out the word.
def has_lab(string) if string =~ /lab/ puts string else puts "no 'lab' found in string" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(word)\n find_word(word) { |found, current| return found && current.is_word }\n end", "def include?(word)\n if !@head.nil?\n each do |data|\n if data.to_s.downcase == word.downcase\n return true\n end\n end\n end\n false\n end", "def found_match(str)\n...
[ "0.63553876", "0.6251725", "0.61440945", "0.60920185", "0.6084716", "0.60819334", "0.60801256", "0.6064847", "0.60500085", "0.6049788", "0.6017794", "0.60097104", "0.60076594", "0.5996279", "0.5958649", "0.5956455", "0.5954554", "0.5950496", "0.5943277", "0.58911127", "0.5864...
0.5504235
71
should open a new view.
def version(sender) v = ::Vdoc2Org::VERSION puts "version: #{v}" v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_view\n unless ( name = path_matcher.controller_name )\n return\n end\n # figure out what the name of def we are in is\n action = find_function_under_cursor\n view = File.join(project_root, \"/app/views/#{name}/#{action}\")\n\n # open the according ...
[ "0.6736078", "0.64449644", "0.6432651", "0.6392508", "0.6372416", "0.63341206", "0.6326482", "0.6326482", "0.6244204", "0.6244204", "0.62320447", "0.62049025", "0.61833066", "0.6171576", "0.6170324", "0.6150592", "0.6135813", "0.6130711", "0.61286825", "0.612682", "0.612682",...
0.0
-1
Parses the argument array _args_, according to the pattern _s_, to retrieve the single character command line options from it. If _s_ is 'xy:' an option 'x' without an option argument is searched, and an option 'y foo' with an option argument ('foo'). An option hash is returned with all found options set to true or the found option argument.
def go(s, args = ARGV) b, v = s.scan(/(.)(:?)/).inject([{},{}]) { |t,(o,a)| t[a.empty? ? 0 : 1][o] = a.empty? ? false : nil t } while a = args.shift a !~ /\A-(.+)/ and args.unshift a and break p = $1 until p == '' o = p.slice!(0, 1) if v.key?(o) v[o] = if p == '' then args.shift or break 1 else p end break elsif b.key?(o) b[o] = true else args.unshift a break 1 end end and break end b.merge(v) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go(s, args = ARGV)\n b,v = s.scan(/(.)(:?)/).inject([{},{}]) { |t,(o,a)|\n a = a == ':'\n t[a ? 1 : 0][o] = a ? nil : false\n t\n }\n while a = args.shift\n a !~ /\\A-(.+)/ and args.unshift a and break\n p = $1\n until p == ''\n o = p.slice!(0, ...
[ "0.6415081", "0.63070804", "0.61446255", "0.6038307", "0.59607023", "0.595367", "0.5904518", "0.5880006", "0.5851824", "0.5832778", "0.58127904", "0.5808244", "0.5802768", "0.579153", "0.5789424", "0.5763535", "0.5751916", "0.5747422", "0.57225615", "0.5712255", "0.568699", ...
0.6243141
2
display the previous extraction forms that information can be borrowed from
def import_from_previous_forms @extraction_form = ExtractionForm.find(params[:extraction_form_id]) # NEED ONLY TO LIST FORMS THAT I ARE NOT ALREADY BORROWING FROM THE CURRENT?? @previous_extraction_forms = ExtractionForm.find(:all,:conditions=>["project_id = ? AND id <> ?",params[:project_id], params[:extraction_form_id]]) @assigned_questions_hash, @included_sections_hash,@checked_boxes = [Hash.new,Hash.new,Hash.new] # for each of the previously existing forms @previous_extraction_forms.each do |ef| # get the key questions assigned @assigned_questions_hash[ef.id] = ExtractionForm.get_assigned_question_numbers(ef.id) # get the sections included @included_sections_hash[ef.id] = ExtractionFormSection.get_included_sections_by_extraction_form_id(ef.id) @borrowers = ExtractionFormSectionCopy.get_borrowers(params[:extraction_form_id]) # determine which boxes should already be checked already_entered = ExtractionFormSectionCopy.get_previous_data(params[:extraction_form_id], ef.id) already_entered = already_entered.collect{|x| x.section_name} @checked_boxes[ef.id] = already_entered # get rid of key questions and publications @included_sections_hash[ef.id].delete_at(0);@included_sections_hash[ef.id].delete_at(0); end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_history\n\t\t@generations.each_with_index do | gen, n |\n\t\t\tmod_print = @modifications[n].to_s\n\t\t\tputs \"gen: \" + n.to_s + \" - \" + gen.word.to_s + \" | mod: \" + mod_print\n\t\tend\n\tend", "def previous_autolist; end", "def prev_line; end", "def print_previous_lines(file, line, output)\n...
[ "0.6188614", "0.5512384", "0.54955465", "0.5444025", "0.54127556", "0.5347082", "0.5341701", "0.5308936", "0.53028536", "0.5296642", "0.52605534", "0.5211679", "0.52111423", "0.51869005", "0.5182116", "0.51765656", "0.51762694", "0.5174502", "0.51426315", "0.5122699", "0.5120...
0.51039976
22
save any import requests made by the user
def save_import_request # set up for arms page: @extraction_form = ExtractionForm.find(params[:extraction_form_id]) @project = Project.find(params[:project_id]) @donors = ExtractionFormSectionCopy.get_donor_forms(@extraction_form.id,"arms") @donor_info = ExtractionFormSectionCopy.get_donor_info(@donors,"ExtractionFormArm") @arms = ExtractionFormArm.where(:extraction_form_id => @extraction_form.id) @extraction_form_arm = ExtractionFormArm.new @extraction_form_section = ExtractionFormSection.where(:extraction_form_id => @extraction_form.id, :section_name => "arms").first @extraction_form_section = ExtractionFormSection.new # collect the params and add the requests to a junction table unless params[:import_section].nil? input = params[:import_section] ExtractionFormSectionCopy.setup_import(@extraction_form.id,input) end unless params[:import_section].nil? flash[:success] = "Import settings were successfully updated." else flash[:notice] = "No previous information was imported for this form." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_import\n end", "def save_import\n if platinum_user_and_above?\n uid = current_user.id\n existing_domains = Domain.pluck(:name)\n data_dir = Rails.root.join('shared', 'data')\n # save import to cache file\n file = data_dir.join('domains')\n f = File.ope...
[ "0.65545255", "0.65448654", "0.64288855", "0.6326033", "0.6077401", "0.57662445", "0.5729643", "0.5699146", "0.5698472", "0.5693524", "0.5611267", "0.55770767", "0.5536636", "0.5534235", "0.55309117", "0.55278295", "0.55110073", "0.5507622", "0.5486413", "0.54754287", "0.5439...
0.6215836
4
TODO: probably not scalable & should spin off a job, so perhaps best driven externally, out of here completely
def attach_audio_file(path) AttachAudioService.call(self, path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executor; end", "def executor; end", "def executor; end", "def run() end", "def reserve_and_run_one_job; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def in_parallel?; end", "...
[ "0.6825842", "0.6825842", "0.6825842", "0.6406863", "0.63516945", "0.633992", "0.633992", "0.633992", "0.633992", "0.633992", "0.633992", "0.633992", "0.633992", "0.633992", "0.6232038", "0.62294865", "0.62294865", "0.61159366", "0.6026119", "0.6026119", "0.6026119", "0.602...
0.0
-1
GET /student_group_settings/1 GET /student_group_settings/1.xml
def show @student_group_setting = StudentGroupSetting.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @student_group_setting } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t@student_group_setting = StudentGroupSetting.new\n\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @student_group_setting }\n\tend\n end", "def update\n\t@student_group_setting = StudentGroupSetting.find(params[:id])\n\n\trespond_to do |format|\n\t if @stud...
[ "0.66699636", "0.64127916", "0.6153987", "0.6153987", "0.6140746", "0.61047035", "0.6030074", "0.6027121", "0.6017721", "0.5984269", "0.5905496", "0.5904335", "0.58661646", "0.58225626", "0.58225626", "0.58039457", "0.5803377", "0.57951975", "0.5768663", "0.5768663", "0.57103...
0.7693304
0
GET /student_group_settings/new GET /student_group_settings/new.xml
def new @student_group_setting = StudentGroupSetting.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @student_group_setting } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t@student_group_setting = StudentGroupSetting.new(params[:student_group_setting])\n\n\trespond_to do |format|\n\t if @student_group_setting.save\n\t\t#format.html { redirect_to(@student_group_setting, :notice => 'Student group setting was successfully created.') }\n\t\tformat.html { redirect_to(:cont...
[ "0.72151625", "0.686929", "0.686929", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.68372303", "0.6833291", "0.68186045", "0.67943406", "0.6794101", "0.6794101", "0.6737582", "0.66878164", "0.66615963", "0.6...
0.7811148
0
POST /student_group_settings POST /student_group_settings.xml
def create @student_group_setting = StudentGroupSetting.new(params[:student_group_setting]) respond_to do |format| if @student_group_setting.save #format.html { redirect_to(@student_group_setting, :notice => 'Student group setting was successfully created.') } format.html { redirect_to(:controller=>:student_groups, :action=>'show', :id=>@student_group_setting.student_group_id, :notice => 'Student group setting was successfully created.') } format.xml { render :xml => @student_group_setting, :status => :created, :location => @student_group_setting } else format.html { render :action => "new" } format.xml { render :xml => @student_group_setting.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t@student_group_setting = StudentGroupSetting.find(params[:id])\n\n\trespond_to do |format|\n\t if @student_group_setting.update_attributes(params[:student_group_setting])\n\t\tformat.html { redirect_to(@student_group_setting, :notice => 'Student group setting was successfully updated.') }\n\t\tforma...
[ "0.6191522", "0.60126925", "0.58383286", "0.58301616", "0.5739342", "0.57289755", "0.5716083", "0.56946003", "0.56678134", "0.5601746", "0.5588146", "0.5586154", "0.5568524", "0.5568286", "0.5527127", "0.5508174", "0.5490639", "0.547487", "0.5450705", "0.5434497", "0.54197055...
0.70773095
0
PUT /student_group_settings/1 PUT /student_group_settings/1.xml
def update @student_group_setting = StudentGroupSetting.find(params[:id]) respond_to do |format| if @student_group_setting.update_attributes(params[:student_group_setting]) format.html { redirect_to(@student_group_setting, :notice => 'Student group setting was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @student_group_setting.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @student_group_association.update(student_group_association_params)\n format.html { redirect_to @student_group_association, notice: 'Student group association was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_gr...
[ "0.6018553", "0.5923228", "0.59119713", "0.59029746", "0.5900254", "0.58929706", "0.5879618", "0.58644897", "0.5845104", "0.58341527", "0.5811968", "0.57838553", "0.57675207", "0.5748059", "0.57362264", "0.57346135", "0.57346135", "0.5723251", "0.57226676", "0.5722504", "0.57...
0.73425263
0
DELETE /student_group_settings/1 DELETE /student_group_settings/1.xml
def destroy @student_group_setting = StudentGroupSetting.find(params[:id]) @student_group_setting.destroy respond_to do |format| format.html { redirect_to(student_group_settings_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\...
[ "0.6467817", "0.6359584", "0.6347827", "0.6332794", "0.6328565", "0.630839", "0.6207837", "0.6174829", "0.6142908", "0.60434234", "0.59900534", "0.5985311", "0.59505534", "0.594999", "0.5941351", "0.5941351", "0.5924405", "0.5922107", "0.59136695", "0.5910537", "0.5896884", ...
0.7393474
0
Sets stylesheets... Can pass in multiple paths for css files.
def add_style_sheets(*sheets) for sheet in sheets do @style_sheets << " -s #{sheet} " end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stylesheets(*args)\n\t\t@stylesheets ||= []\n\t\targs.each do |stylesheet|\n\t\t\tunless @stylesheets.include?(stylesheet.to_s)\n\t\t\t\t@stylesheets.push(stylesheet.to_s)\n\t\t\t\tcontent_for(:head,stylesheet_link_tag(stylesheet.to_s))\n\t\t\tend\n\t\tend\n\tend", "def stylesheets(*args)\n\t\t@stylesheets |...
[ "0.7097912", "0.7097912", "0.6915847", "0.6801117", "0.65325564", "0.65212584", "0.64755595", "0.6452501", "0.642611", "0.63568366", "0.63074183", "0.63074183", "0.63060784", "0.63060784", "0.6304188", "0.62971437", "0.6291915", "0.62882733", "0.62756085", "0.6157588", "0.614...
0.5832258
38
Sets arbitrary command line arguments
def add_cmd_args(str) @cmd_args << " #{str} " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_arguments (args)\n end", "def argv=(args)\n puts \"setting argv to #{args.inspect}\"\n eval \"opal.runtime.cs(opal.runtime.Object, 'ARGV', #{args.inspect});\"\n end", "def set(*args)\n run \"set #{OptArg.parse(*args)}\"\n nil\n end", "def set_arguments(*args)\n @argu...
[ "0.75514394", "0.74664444", "0.7347841", "0.7033323", "0.7001379", "0.6948462", "0.6611544", "0.6548069", "0.6478863", "0.6445091", "0.637463", "0.637463", "0.62688684", "0.62292325", "0.6220767", "0.614551", "0.614067", "0.60950977", "0.6055364", "0.6027271", "0.6013237", ...
0.0
-1
Returns fully formed executable path with any command line switches we've set based on our variables.
def exe_path # Add any standard cmd line arguments we need to pass @exe_path << " --input=html --server --log=#{log_file} " @exe_path << @cmd_args @exe_path << @style_sheets return @exe_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exe_path\n # Add any standard cmd line arguments we need to pass\n @exe_path << \" --input=html --server --log='#{log_file}' \"\n @exe_path << @cmd_args\n @exe_path << @style_sheets\n return @exe_path\n end", "def executable_path=(_arg0); end", "def build_command_line(name, *args)\n ex...
[ "0.6912297", "0.6552656", "0.6512571", "0.6376599", "0.6348454", "0.6348454", "0.6348454", "0.6059444", "0.6059209", "0.6053944", "0.60079527", "0.60047174", "0.59679765", "0.5951879", "0.5898595", "0.5877016", "0.5815611", "0.5815611", "0.58031374", "0.5765709", "0.57606673"...
0.7015767
0
Makes a pdf from a passed in string. Returns PDF as a stream, so we can use send_data to shoot it down the pipe using Rails.
def pdf_from_string(string, output_file = '-') path = self.exe_path() # Don't spew errors to the standard out...and set up to take IO # as input and output path << ' --silent - -o -' # Show the command used... logger.info "\n\nPRINCE XML PDF COMMAND" logger.info path logger.info '' # Actually call the prince command, and pass the entire data stream back. pdf = IO.popen(path, "w+") pdf.puts(string) pdf.close_write result = pdf.gets(nil) pdf.close_read result.force_encoding('BINARY') if RUBY_VERSION >= "1.9" return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf_from_string(string, options={})\n # -q for no errors on stdout\n command_for_stdin_stdout = \"#{@exe_path} #{parse_pdf_options(options)} -q - - \" \n p \"*\"*15 + command_for_stdin_stdout + \"*\"*15 unless defined?(Rails) and Rails.env != 'development'\n pdf, err = begin\n Open3....
[ "0.789861", "0.7276215", "0.67349184", "0.66998744", "0.66768295", "0.6507746", "0.6468734", "0.64140075", "0.63956857", "0.63753706", "0.6337676", "0.6335708", "0.63353586", "0.6316676", "0.62908345", "0.62866354", "0.62833625", "0.62825274", "0.6275268", "0.62678564", "0.62...
0.7317066
1
GET /items GET /items.json
def index respond_to do |format| format.html format.json { render :json => Item.all} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def index\n @items =...
[ "0.79562956", "0.7546286", "0.74375594", "0.7434485", "0.73975587", "0.7358414", "0.7358414", "0.7358414", "0.7358414", "0.7357372", "0.7313286", "0.73129123", "0.7311041", "0.7306297", "0.7281173", "0.7273615", "0.72629416", "0.72484964", "0.72301924", "0.71767205", "0.71181...
0.67557514
57
GET /items/1 GET /items/1.json
def show respond_to do |format| format.html format.json { render :json => Item.joins(:tag).where('tag_id = ?', params[:tag])} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def show\n item = I...
[ "0.7736526", "0.7547988", "0.74948645", "0.73696035", "0.7328169", "0.7293223", "0.7287578", "0.71326286", "0.71247333", "0.71196556", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "...
0.0
-1
POST /items POST /items.json params: file, username, tag_name, alternative_name, description
def create upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attach...
[ "0.67809063", "0.65340525", "0.6451269", "0.64463097", "0.63846177", "0.6358222", "0.63508165", "0.6335555", "0.6293642", "0.6290403", "0.6283694", "0.62766033", "0.6261161", "0.6250009", "0.6243519", "0.62391305", "0.6228304", "0.6227382", "0.62034994", "0.61987644", "0.6175...
0.7526805
0
PATCH/PUT /items/1 PATCH/PUT /items/1.json
def update item = Item.find(params[:item_id]) item.name = params[:name] item.details = params[:details] item.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n\n #update the item of request_item\n if (par...
[ "0.7441283", "0.7143631", "0.7138621", "0.70232904", "0.7001103", "0.69939095", "0.6979452", "0.69359636", "0.6920768", "0.6870842", "0.68318534", "0.6816314", "0.6805184", "0.6805184", "0.67938346", "0.6787414", "0.6787414", "0.6787414", "0.6787414", "0.6787414", "0.6787414"...
0.0
-1
DELETE /items/1 DELETE /items/1.json
def destroy item = Item.find(params[:item_id]) user = User.find(item[:user_id]) if(user && user[:username] == session['username']) if (item.item_type == 'file') FileUploader.delete_file item.path end Item.delete(params[:item_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n @item = Item.find(params[:id...
[ "0.7906849", "0.76885504", "0.7604411", "0.7585917", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.7547388", "0.7539847", "0.7528851", ...
0.0
-1
Return a modulo function
def modulo(other) Modulo.new(self, other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modulo(p0) end", "def modulo(arg0)\n end", "def modulo(arg0)\n end", "def my_modulo(dividend, divisor)\r\n # your code goes here\r\n # use of modulo operator\r\n\r\n dividend % divisor\r\nend", "def mod(first_number, second_number)\n first_number % second_number\nend", "def remainder(val); end"...
[ "0.8614408", "0.8378381", "0.8378381", "0.8089884", "0.7910156", "0.78237987", "0.77189964", "0.7706136", "0.7682447", "0.7646019", "0.7646019", "0.7623794", "0.7603585", "0.75402606", "0.7528216", "0.75103134", "0.7406739", "0.7397801", "0.73092854", "0.7268315", "0.7217502"...
0.6674571
35
print the return methods
def cube(num) return num * num * num #this is an official return statement # after return, it will break and jump out from the method # nothing after it wiil be executed 8 puts "print this line" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_method(*) end", "def print\n end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def print\n\n end", "def print\n end", "def print\n end", "def print\n end", "def display_me...
[ "0.73974884", "0.68374604", "0.68219334", "0.67976624", "0.6795732", "0.6773215", "0.6773215", "0.6773215", "0.6735352", "0.66891795", "0.6616667", "0.65359986", "0.6514174", "0.65069675", "0.65053415", "0.6505131", "0.6470113", "0.6440673", "0.6419659", "0.6419659", "0.64196...
0.0
-1
Payment gateway this account accepts payments through.
def payment_gateway(**options) return if payment_gateway_type.blank? PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_activate?\n self.authorize_payment\n end", "def provider_payment_gateway\n provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?)\n end", "def gateway\n ActiveMerchant::Billing::Base.mode = :test\n\n @gateway ||= \n ActiveMerchant::Billing::PaypalRecurringGatew...
[ "0.6853565", "0.6428193", "0.63494873", "0.6320662", "0.6298716", "0.6283909", "0.6262367", "0.6262367", "0.6164472", "0.6155474", "0.6125761", "0.6118897", "0.6078844", "0.6073745", "0.60575163", "0.60520357", "0.60486794", "0.60229534", "0.6010164", "0.5978152", "0.59581035...
0.62118894
8
MIGRATION use separate table over columns in same table Accessors for backward compatibility There is an issue, build_association will automatically save the association on parent save So invoking this method and saving Account instance will create a row in PaymentGatewaySetting table But this is OK as we invoke Accountsave AND Accountpayment_gateway_options at the same time in only one place: app/controllers/admin/account/payment_gateways_controller.rb via change_payment_gateway! Solution: The fix is to use nested attributes.
def find_or_build_gateway_setting (payment_gateway_setting || build_payment_gateway_setting) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_association(obj, type)\n @logger.info(\"Creating association for #{type} #{obj.name}\")\n case type\n when \"agent\"\n iso = find_sugarcrm_object('iso', 'sf_id', obj.sf_iso)\n obj.associate! iso if iso\n when \"merchant\"\n \n payment_method_id = find_paym...
[ "0.56819475", "0.55512416", "0.5510548", "0.54000443", "0.5351391", "0.53464437", "0.5275663", "0.5219873", "0.5216755", "0.5205658", "0.5205035", "0.518835", "0.5182834", "0.51320386", "0.5122864", "0.5073533", "0.503367", "0.50225013", "0.50126785", "0.4997075", "0.49950206...
0.49486792
22
MIGRATION use separate table over columns in same table Accessors for backward compatibility
def payment_gateway_type gateway_setting.gateway_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate\n raise NotImplementedError\n end", "def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end", "def migrate\n...
[ "0.65882033", "0.6573994", "0.654096", "0.6381884", "0.6279847", "0.6212607", "0.6081981", "0.60590905", "0.6054544", "0.59881574", "0.5984498", "0.5936947", "0.5904286", "0.59028167", "0.588025", "0.581781", "0.58148825", "0.5789818", "0.5754122", "0.5752626", "0.57406616", ...
0.0
-1
MIGRATION use separate table over columns in same table Accessors for backward compatibility
def payment_gateway_type=(type) gateway_setting.gateway_type = type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate\n raise NotImplementedError\n end", "def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end", "def migrate\n...
[ "0.65882033", "0.6573994", "0.654096", "0.6381884", "0.6279847", "0.6212607", "0.6081981", "0.60590905", "0.6054544", "0.59881574", "0.5984498", "0.5936947", "0.5904286", "0.59028167", "0.588025", "0.581781", "0.58148825", "0.5789818", "0.5754122", "0.5752626", "0.57406616", ...
0.0
-1
MIGRATION use separate table over columns in same table Accessors for backward compatibility
def payment_gateway_options gateway_setting.symbolized_settings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate\n raise NotImplementedError\n end", "def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end", "def migrate\n...
[ "0.6582506", "0.65718144", "0.653978", "0.6377208", "0.6278301", "0.62083524", "0.60775244", "0.6057428", "0.6054347", "0.5986368", "0.59836257", "0.59364605", "0.5905627", "0.5899781", "0.5884367", "0.5815972", "0.581597", "0.57909745", "0.5752801", "0.57502824", "0.5742289"...
0.0
-1
MIGRATION use separate table over columns in same table Accessors for backward compatibility
def payment_gateway_options=(hash) gateway_setting.gateway_settings = hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate\n raise NotImplementedError\n end", "def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end", "def migrate\n...
[ "0.65882033", "0.6573994", "0.654096", "0.6381884", "0.6279847", "0.6212607", "0.6081981", "0.60590905", "0.6054544", "0.59881574", "0.5984498", "0.5936947", "0.5904286", "0.59028167", "0.588025", "0.581781", "0.58148825", "0.5789818", "0.5754122", "0.5752626", "0.57406616", ...
0.0
-1
Payment gateway this account sends payments through.
def provider_payment_gateway provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_gateway(**options)\n return if payment_gateway_type.blank?\n\n PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {})\n end", "def adyen_payment\n load_object\n opts = all_opts(@order,params[:payment_method_id], 'payment')\n opts.merge!(address...
[ "0.7096746", "0.6903911", "0.68763196", "0.6834233", "0.67943394", "0.670413", "0.6697754", "0.6635563", "0.66245604", "0.6622841", "0.6622841", "0.6607381", "0.65889794", "0.6459253", "0.6447559", "0.64430594", "0.640652", "0.640061", "0.63818187", "0.6370275", "0.63486934",...
0.6255797
23
Initializes the base object through which you access the Yelp API. Obtain API access here: +consumer_key+ OAuth2 Consumer Key +consumer_secret+ OAuth2 Consumer Secret +token+ OAuth2 Access Token +token_secret+ OAuth2 Access Secret
def initialize(consumer_key, consumer_secret, token, token_secret) @consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {:site => API_HOST}) @access_token = OAuth::AccessToken.new(@consumer, token, token_secret) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection...
[ "0.73469484", "0.7093125", "0.7018009", "0.69608104", "0.6924701", "0.6921171", "0.68708616", "0.6853224", "0.68379825", "0.6800059", "0.67958343", "0.6791814", "0.6791814", "0.6783221", "0.6728319", "0.6712689", "0.6705261", "0.66949236", "0.66852754", "0.66642934", "0.66642...
0.73715365
0
Search for businesses near a given location +term+ The search term +location+ The location to search search_by_location("dinner", "san+francisco") Returns an array of Yelp::Business objects
def search_with_location(term, location, options={}) search_businesses(term, options.merge(:location => location)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(term, location)\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n limit: SEARCH_LIMIT\n }\n#this takes info from params hash\n response = HTTP.auth(bearer_token).get(url, params: params)\n response.parse[\"businesses\"]\nend", "def search_with_coord...
[ "0.6712948", "0.67085296", "0.6187356", "0.61460954", "0.60580707", "0.5926747", "0.5923601", "0.5886422", "0.5826447", "0.5801907", "0.5741751", "0.5644916", "0.5632834", "0.56057465", "0.55919534", "0.55636185", "0.55577576", "0.55445105", "0.5492434", "0.54901284", "0.5481...
0.7724632
0
Search for businesses near the given coordinates +term+ The search term +latitute+ The latitude in decimal degrees +longitude+ The longitude in decimal degrees
def search_with_coordinates(term, latitude, longitude, options={}) search_businesses(term, options.merge(:ll=>"#{latitude},#{longitude}")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_with_location(term, location, options={})\n search_businesses(term, options.merge(:location => location))\n end", "def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, lim...
[ "0.7731121", "0.7265968", "0.70547837", "0.6939724", "0.6821083", "0.68054426", "0.6784429", "0.67666364", "0.67080265", "0.6671413", "0.6649131", "0.66234326", "0.6619261", "0.65164155", "0.6490457", "0.64894193", "0.64796555", "0.64481276", "0.6427437", "0.64252883", "0.637...
0.88026094
0
Helper method to generate planets
def gen_planet(class_map) class_map["colour"] = PLANET_COLOURS[class_map["type"].downcase] text = "//#{class_map["package"]} class: #{class_map["name"]} #{class_map["indexed_name"]}.setValues({ name: \"#{class_map["indexed_name"]}\", geometry: new THREE.SphereGeometry(#{class_map["radius"]+0.01}, 10, 10), material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: #{class_map["colour"]}, map: planet_texture}), origin: #{class_map["package"]}, orbitradx: #{(Random.rand(2) == 0)? "" : "-"}#{class_map["orbit"]}, orbitrady: #{(Random.rand(2) == 0)? "" : "-"}#{class_map["orbit"]}, #{(Random.rand(2) == 0)? "ysin: false" : "xsin:false"}, rotx: 0.01, roty: 0.01, rotz: 0.01, tfactor: #{1 + Random.rand}}); celestials[celestials.length] = #{class_map["indexed_name"]};\n\n" return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def planets()\n pseed = @seed.clone\n Enumerator.new do |yielder|\n loop do\n name, new_seed = planet_name(pseed)\n yielder.yield name\n break if new_seed==@seed\n pseed = new_seed\n end\n end\n end", "def planets; end", "def create_planet(nam...
[ "0.74253964", "0.73798615", "0.71712947", "0.6786745", "0.67080873", "0.6688951", "0.6594317", "0.64599925", "0.64593905", "0.6450168", "0.6444184", "0.6383001", "0.6367218", "0.63648707", "0.6335565", "0.6326127", "0.6303987", "0.62890697", "0.628875", "0.62790906", "0.62597...
0.6725293
4
Helper method to generate moons
def gen_moon(method_map) text = "//#{method_map["class"]} function: #{method_map["name"]} var #{method_map["indexed_name"]} = new Celestial({ name: \"#{method_map["indexed_name"]}\", geometry: new THREE.SphereGeometry(#{method_map["radius"]+0.01}, 8, 8), material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: 0xbb8800, map: planet_texture}), origin: #{method_map["class"]}, orbitradx: #{(Random.rand(2) == 0)? "" : "-"}#{method_map["orbit"]}, orbitrady: #{(Random.rand(2) == 0)? "" : "-"}#{method_map["orbit"]}, #{(Random.rand(2) == 0)? "ysin: false" : "xsin:false"}, rotx: 0.01, roty: 0.01, rotz: 0.01, tfactor: #{2 + Random.rand * 2}}); celestials[celestials.length] = #{method_map["indexed_name"]};\n\n" return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moon; end", "def generate\n end", "def generate; end", "def generate; end", "def create_movements\n @run500m = Movement.create(name: \"500m run\")\n @run1000m = Movement.create(name: \"1000m run\")\n @run5000m = Movement.create(name: \"5000m run\")\n\n @row500m = Movement.create(name...
[ "0.6523202", "0.58156735", "0.5745642", "0.5745642", "0.5713735", "0.5697822", "0.5696794", "0.56255156", "0.56021345", "0.5511387", "0.55059963", "0.5415515", "0.54002786", "0.53849214", "0.53741956", "0.5370293", "0.53599346", "0.5359152", "0.53463626", "0.5345293", "0.5282...
0.6889886
0
Helper method to generate stars
def gen_star(package_map) text = "//#{package_map["name"]} var #{package_map["indexed_name"]} = new Celestial({ name: \"#{package_map["indexed_name"]}\", geometry: new THREE.SphereGeometry(#{package_map["radius"]+0.01}, 12, 12), material: new THREE.MeshBasicMaterial({color: 0xffdd22, map: star_texture}), light: new THREE.PointLight( 0xffddbb, 1, 0 ), rotx: 0.01, roty: 0.01, rotz: 0.01}); celestials[celestials.length] = #{package_map["indexed_name"]};\n\n" return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_stars(stars)\n i = 0\n j = 0\n star_line = ''\n open_star = 5 - stars\n while i < stars\n star_line += '<img src=\"app/assets/images/star-full.png\">'\n i+=1\n end\n while j < open_star\n star_line += '<img src=\"app/assets/images/star-gray.png\">...
[ "0.80316055", "0.7824943", "0.7594706", "0.7432636", "0.73946357", "0.7387228", "0.7307596", "0.71014863", "0.70582634", "0.7028462", "0.7024535", "0.6983929", "0.6947171", "0.68606913", "0.68508214", "0.67546475", "0.6678335", "0.65851605", "0.656783", "0.6563828", "0.655369...
0.58701074
66
Helper method to generate routes
def gen_route(dep_map) text = "// Dependency Route: #{dep_map["class_indexed_name"]} -> #{dep_map["dclass_indexed_name"]}\n" temp = 0 eta = 100 if(dep_map["strength"].nil?) dep_map["strength"] = DEFAULT_SHIPS end while(temp < dep_map["strength"]) text += "var #{dep_map["indexed_name"]}_#{temp} = new Ship({ name: \"#{dep_map["indexed_name"]}_#{temp}\", material: new THREE.SpriteMaterial({map: trade_texture, color: 0xffffff, fog: true}), origin: #{dep_map["class_indexed_name"]}.mesh, target: #{dep_map["dclass_indexed_name"]}, offset: #{eta*temp/dep_map["strength"]}, eta: #{eta}, loop: true}); #{dep_map["class_indexed_name"]}.trade[#{dep_map["class_indexed_name"]}.trade.length] = #{dep_map["indexed_name"]}_#{temp}; #{dep_map["indexed_name"]}_#{temp}.spr.scale.set(2,2,1);\n\n" temp += 1 end return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def _routes; end", "def routes(context={})\n \n routes = [ ...
[ "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.7874971", "0.759426", "0.75574017", "0.75574017", "0.7539704", "0.74770176", "0.7463737", "0.7453789", "0.72882944", "0.71956944", "0.7190781",...
0.0
-1
Helper method to generate star positions
def gen_star_positions(packages, max_dist_map) size = Math.sqrt(packages.length).ceil cols = Array.new(size, 0) rows = Array.new(size, 0) for i in 0..(size-1) for j in 0..(size-1) temp_package = packages.values[size*i+j] unless(temp_package.nil?) cols[j] = (cols[j] < temp_package["orbit_radius"] * 2) ? temp_package["orbit_radius"] * 2 : cols[j] rows[i] = (rows[i] < temp_package["orbit_radius"] * 2) ? temp_package["orbit_radius"] * 2 : rows[i] end end end text = "" for i in 0..(size-1) for j in 0..(size-1) temp_package = packages.values[size*i+j] unless(temp_package.nil?) sum_x = (j > 0)? cols[0..(j-1)].inject{|sum, x| sum + x} : 0 sum_y = (i > 0)? rows[0..(i-1)].inject{|sum, y| sum + y} : 0 text += "#{temp_package["indexed_name"]}.mesh.position.x = #{sum_x + (cols[j]/2.0)}\n" text += "#{temp_package["indexed_name"]}.mesh.position.y = #{sum_y + (rows[i]/2.0)}\n" end end end max_dist_map[:x] = cols.inject{|sum, x| sum + x} max_dist_map[:y] = rows.inject{|sum, y| sum + y} return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def star(num)\n stars = ['*','*','*']\n center = (num / 2) - 1\n lines = []\n\n # create array with mirrored lines using unshift and push\n 0.upto(center) do |i|\n spaces = ' ' * i\n offset = ' ' * (center - i)\n lines.unshift(offset + stars.join(spaces))\n lines.push(offset + stars.join(spaces))\...
[ "0.69012856", "0.6889118", "0.6823611", "0.67636883", "0.65913445", "0.6532417", "0.64998204", "0.6467288", "0.6417213", "0.639329", "0.6385404", "0.6368003", "0.6348545", "0.62200433", "0.6206389", "0.61892885", "0.6136747", "0.61285394", "0.61281395", "0.61092156", "0.60667...
0.6402401
9
Reads and gathers all used citations of the current document and puts them into a new +BibTeX::Bibliography+ of the +Jekyll::Document+. Citations, which originates in the JLESC BibTeX file (i.e. +jlesc.bib+) are tagged with the keyword _own_ to denote publications created within JLESC. Returns nothing.
def read_used_citations puts ' reading used citations' @citations = gather_citations @bibfiles = get_bibfiles if @citations.length < 1 puts "WARNING: no citations for project #{document.data['slug']}" else @citations.each do |cite| unless @bibfiles[cite[:bibfile]] raise StandardError.new "Bibliography not included: #{cite[:bibfile]}" end bib_entry = @bibfiles[cite[:bibfile]][cite[:bibtex_id]] unless bib_entry puts "WARNING: BibTeX key '#{cite[:bibtex_id]}' not found in #{cite[:bibfile]}.bib." end cite[:bibtex] = create_clean_bibtex_entry(bib_entry, document, cite[:bibfile] =~ /jlesc/) end num_ref_jlesc = @citations.find_all {|e| e[:bibfile] =~ /jlesc/}.length num_ref_external = @citations.find_all {|e| e[:bibfile] !~ /jlesc/}.length puts " Found #{num_ref_jlesc} JLESC citations" puts " Found #{num_ref_external} external citations" end num_ref_jlesc ||= 0 num_ref_external ||= 0 if num_ref_jlesc == 0 document.content.gsub! BIBLIOGRAPHY_MATCHER_JLESC, "\nNo publication yet." end if num_ref_external == 0 document.content.gsub! BIBLIOGRAPHY_MATCHER_EXTERNAL, "\nNo external references." end document.bibtex = BibTeX::Bibliography.new @citations.each do |cite| document.bibtex << cite[:bibtex] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def citations\n CounterCitation.citations(stash_identifier: self)\n end", "def citations\n CounterCitation.citations(stash_identifier: self)\n end", "def generate_citations(document)\n if document.has? 'bibtex_t'\n begin\n if document['bibtex_t'].is_a?(Array)\n ...
[ "0.6160191", "0.6160191", "0.6107367", "0.5561566", "0.55076927", "0.54916376", "0.5177646", "0.51099396", "0.51024383", "0.5063145", "0.5035759", "0.501378", "0.5001188", "0.49975997", "0.49517098", "0.49434167", "0.49055648", "0.49049374", "0.48279276", "0.48108697", "0.480...
0.75086415
0
Cleans up the Markdown of the current document.
def md_cleanup puts ' cleaning up obsolete stuff in Markdown' # generation/output of the bibliography (note: the LaTeX package _biblatex_ is used) # a) the JLESC publications document.content.gsub! BIBLIOGRAPHY_MATCHER_JLESC, '\printbibliography[heading=none,keyword=own]' # b) external references document.content.gsub! BIBLIOGRAPHY_MATCHER_EXTERNAL, '\printbibliography[heading=none,notkeyword=own]' # the _jekyll-scholar_ +cite+ Liquid tag needs to be replace as it generates HTML code document.content.gsub! CITATION_MATCHER, "\\cite{\\k<bibtex_id>-#{document.data['slug'].gsub(/_/, '-')}}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_markdown\n self.explanation_html = Kramdown::Document.new(explanation_md || '').to_html.gsub(/[\\r\\n]+/, '')\n end", "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "def cleanup\n jekyll('clean')\nend", "def clear_remarks\n rema...
[ "0.6703306", "0.6218638", "0.6206999", "0.6031708", "0.5999982", "0.59772974", "0.58999544", "0.5897953", "0.58803666", "0.5870876", "0.58475864", "0.5813414", "0.5804969", "0.5798814", "0.5763279", "0.57520694", "0.5748225", "0.5706594", "0.5672022", "0.5648431", "0.56480813...
0.720911
0
Cleans up the LaTeX as generated by _kramdown_
def tex_cleanup puts ' cleanup obsolete stuff in LaTeX' document.content.gsub! /\\textbackslash\{}printbibliography/, '\printbibliography' document.content.gsub! /\\textbackslash\{}cite\\\{(.*?)\\}/, '\cite{\1}' puts ' increase heading levels' # for the annual report the level of headings of the project reports need to be increased # a) headings within a project need to be named paragraphs document.content.gsub! /\\subsection{(.*)}\\label/, '\subsubsection{\1}~\\\label' # b) project titles need to be two levels down document.content.gsub! /\\section{(.*)}\\label/, '\subsection{\1}\label' # TODO: do we need that here? # to fix multiple occurrences of labels in the aggregated report, we prepend each label with # the project's slug document.content.gsub! /\\label{([\w-]*)}/, "\\label{#{document.data['slug']}-\\1}" # wrap the project's report in it's own _biblatex_ reference section document.content.prepend("\\begin{refsection}[projects/#{document.data['slug']}]\n\n") document.content += "\n\\end{refsection}\n" # add the project's title document.content.prepend("\\subsection{#{document.data['title']}}\\label{#{document.data['title'].downcase.gsub(/\s/, '-')}}\n\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_latex_document\n cache_literal(@polytex, :latex).tap do |doc|\n expand_input!(doc,\n Proc.new { |source| cache_literal(source, :latex) },\n 'tex')\n end\n end", "def md_cleanup\n puts ' cleaning up obsolete stuff in Markd...
[ "0.7061352", "0.64970577", "0.62933946", "0.6166561", "0.6128475", "0.6119458", "0.60915244", "0.5948202", "0.59250087", "0.5918017", "0.5907144", "0.5882884", "0.5877016", "0.5864089", "0.58575803", "0.5840911", "0.583019", "0.57547385", "0.5723922", "0.5705098", "0.564627",...
0.67643803
1
Returns true if the given token matches the digest
def authenticated?(token) hex_encrypt(token) == remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n ...
[ "0.7857136", "0.75394505", "0.743387", "0.7321885", "0.714117", "0.714117", "0.71279824", "0.7091808", "0.705077", "0.6928193", "0.6892255", "0.6887895", "0.6860336", "0.6815546", "0.6793302", "0.678842", "0.67861015", "0.678452", "0.67813665", "0.67691225", "0.6757527", "0...
0.0
-1
Converts email to all lowercase.
def downcase_email email.downcase! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downcase_email\n\t email.downcase!\n\t end", "def downcase_email\n email.downcase!\n end", "def lowercase_email\n email.downcase! if email.present?\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def do...
[ "0.8380517", "0.8339932", "0.8242504", "0.82153374", "0.82153374", "0.82153374", "0.82153374", "0.8192566", "0.8161937", "0.8131639", "0.8121609", "0.8112856", "0.80987734", "0.80987734", "0.80987734", "0.80724174", "0.7995695", "0.79493546", "0.79492545", "0.7946815", "0.794...
0.80567265
19
GET /seeds or /seeds.json
def index @seeds = Seed.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:search].present?\n @seeds = Seed.order(:catalog_number).basic_search(params[:search]).page(params[:page])\n else\n @seeds = Seed.order(:catalog_number).page params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.6781099", "0.6659429", "0.6658523", "0.6532974", "0.6425021", "0.63198483", "0.6214195", "0.6133152", "0.593313", "0.58999354", "0.58610153", "0.5849568", "0.5771707", "0.571877", "0.56403613", "0.56240684", "0.5618786", "0.5613614", "0.5612905", "0.5612876", "0.5569012", ...
0.70877475
0
GET /seeds/1 or /seeds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @seeds = Seed.all\n end", "def show\n @seed = Seed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seed }\n end\n end", "def generate_seed(objectType, id)\n return @client.raw(\"get\", \"/helpers/seeds/#{objectT...
[ "0.66954064", "0.65464205", "0.65351665", "0.6390035", "0.6312762", "0.6297268", "0.62802094", "0.61740345", "0.61054075", "0.6058452", "0.59903646", "0.5814091", "0.57290643", "0.55555195", "0.5509752", "0.5461352", "0.5428073", "0.54011756", "0.5346484", "0.5337769", "0.533...
0.0
-1
POST /seeds or /seeds.json
def create @seed = Seed.new(seed_params) respond_to do |format| if @seed.save format.html { redirect_to @seed, notice: "Seed was successfully created." } format.json { render :show, status: :created, location: @seed } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @seed.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @seed = Seed.new(params[:seed])\n\n respond_to do |format|\n if @seed.save\n format.html { redirect_to @seed, notice: 'Seed was successfully created.' }\n format.json { render json: @seed, status: :created, location: @seed }\n else\n format.html { render action: \"...
[ "0.67253774", "0.5933517", "0.592391", "0.5874196", "0.5856683", "0.58493274", "0.5819119", "0.5773671", "0.57360435", "0.56752366", "0.5611356", "0.5610581", "0.5600671", "0.55956", "0.5564088", "0.5538085", "0.5526484", "0.5521559", "0.5494464", "0.5492317", "0.5479191", ...
0.66592985
1
PATCH/PUT /seeds/1 or /seeds/1.json
def update respond_to do |format| if @seed.update(seed_params) format.html { redirect_to @seed, notice: "Seed was successfully updated." } format.json { render :show, status: :ok, location: @seed } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @seed.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_seed\n @seed = Seed.find(params[:id])\n end", "def update\n @seed = Seed.find(params[:id])\n\n respond_to do |format|\n if @seed.update_attributes(params[:seed])\n format.html { redirect_to edit_seed_path, notice: 'Seed was successfully updated.' }\n format.json { head :n...
[ "0.64316005", "0.6321124", "0.62413096", "0.5762909", "0.57008153", "0.56560385", "0.55970204", "0.55103415", "0.5499739", "0.5432306", "0.5431133", "0.5412604", "0.5394588", "0.5392577", "0.5392577", "0.5359598", "0.53384984", "0.53223413", "0.53110576", "0.5299005", "0.5281...
0.62292117
3
DELETE /seeds/1 or /seeds/1.json
def destroy @seed.destroy respond_to do |format| format.html { redirect_to seeds_url, notice: "Seed was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @seed = Seed.find(params[:id])\n @seed.destroy\n\n respond_to do |format|\n format.html { redirect_to seeds_url }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete\n client.delete(\"/#{id}\")\...
[ "0.73364943", "0.6635959", "0.657147", "0.64572483", "0.6225351", "0.6098829", "0.6079236", "0.60780436", "0.6004456", "0.59864926", "0.59812266", "0.59800464", "0.5977004", "0.59515065", "0.593163", "0.592465", "0.5906064", "0.58930016", "0.5887137", "0.58725965", "0.5863422...
0.71224236
1
Use callbacks to share common setup or constraints between actions.
def set_seed @seed = Seed.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def seed_params params.require(:seed).permit(:seedId, :name, :state, :growth, :drought, :soil, :salt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Returns true if this ProductTests most recent TestExecution is passing
def execution_state return :pending if self.test_executions.empty? self.test_executions.ordered_by_date.first.state end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end", "def passing?\n return true if self.product_tests.empty?\n\n passing = self.product_tests.include...
[ "0.83545655", "0.7890957", "0.7351292", "0.7189185", "0.7155273", "0.69287205", "0.68352056", "0.67664975", "0.6498606", "0.6492435", "0.6492435", "0.64514446", "0.64229506", "0.6317564", "0.63038856", "0.6299814", "0.6299045", "0.62847626", "0.626609", "0.626478", "0.6248979...
0.0
-1
Return all measures that are selected for this particular ProductTest
def measures return [] if !measure_ids self.bundle.measures.in(:hqmf_id => measure_ids).order_by([[:hqmf_id, :asc],[:sub_id, :asc]]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select *selection\n @measures.merge! paramerize(selection, VALID_MEASURES, 'Invalid measurement selection')\n self\n end", "def list_measures\n exec_req_and_parse_response \"/measure/list\"\n end", "def useful_measures_by_measure_type(validation_id)\n validation = Validation.find(va...
[ "0.65423244", "0.6247492", "0.60081273", "0.5871274", "0.5762266", "0.5746221", "0.573849", "0.573849", "0.570224", "0.56737393", "0.5627861", "0.56234825", "0.56169295", "0.5616168", "0.55758935", "0.5440485", "0.5371396", "0.5350419", "0.53377765", "0.5325561", "0.5308375",...
0.6758097
0
Get the expected result for a particular measure
def expected_result(measure) (expected_results || {})[measure.key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expected_result(measure)\n (expected_results || product_test.expected_results || {})[measure.key] || {}\n end", "def find_value_for_one_measure(total_measures, total_credits)\n total_credits.to_f / @measure.roman_to_digital(total_measures)\n end", "def reported_result(measure)\n (reported_result...
[ "0.8053689", "0.6587213", "0.6266076", "0.604876", "0.59887546", "0.5826578", "0.5826375", "0.582432", "0.5774515", "0.5762455", "0.5758994", "0.5736607", "0.5729348", "0.56966245", "0.56681216", "0.5648361", "0.5593564", "0.5580932", "0.55764294", "0.556654", "0.55625063", ...
0.81875676
0
Used for downloading and emailing the records associated with this test. Returns a file that represents the test's patients given the requested format.
def generate_records_file(format) file = Tempfile.new("patients-#{Time.now.to_i}") patients = Record.where("test_id" => self.id) Cypress::PatientZipper.zip(file, patients, format.to_sym) file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_records_file(format)\n file = Tempfile.new(\"patients-#{Time.now.to_i}\")\n patients = Record.where(\"test_id\" => self.id)\n \n if format == 'csv'\n Cypress::PatientZipper.flat_file(file, patients)\n else\n Cypress::PatientZipper.zip(file, patients, format.to_sym)\n end\n ...
[ "0.70940155", "0.6474332", "0.6262047", "0.5541518", "0.55240214", "0.5516998", "0.54519105", "0.5437547", "0.5414184", "0.53596485", "0.52981913", "0.52898586", "0.52839094", "0.5240179", "0.5234723", "0.5233444", "0.5215507", "0.51583743", "0.51027083", "0.50766706", "0.507...
0.6690141
1
todo. these should show how aligned the user is with the group. and calculate the general interst and then compare it to you. if there is a strong corolation, there is a stronger interest.
def interest_in_article(article) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_common_interests(interests, current_user)\n total_interests_in_common = 0\n interests.each do |interest|\n if current_user.user_interests.any?(interest)\n total_interests_in_common += 1\n end\n end\n # return total interest count\n total_interests_in_common\n end", ...
[ "0.5962046", "0.56952775", "0.5633984", "0.56206363", "0.56119096", "0.5584705", "0.5573017", "0.55435", "0.5539846", "0.5472207", "0.5461548", "0.5433094", "0.5403409", "0.5373409", "0.53219026", "0.53104526", "0.5304151", "0.5299186", "0.5296356", "0.5294833", "0.52849585",...
0.0
-1
Encrypts the password with the user salt
def encrypt(password) self.class.encrypt(password, salt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n ...
[ "0.8456656", "0.83809954", "0.837295", "0.83666867", "0.8361271", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83539045", "0.8353123", "0.83147633", "0.8314556", "0.83011955", "0.82853645", "0.8279242", "0.8253498", "0.82321554", "0.8...
0.0
-1
These create and unset the fields required for remembering users between browser closes
def remember_me remember_me_for 2.weeks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forgets\n update_attribute(:remember_digest, nil)\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:...
[ "0.655833", "0.64576274", "0.6433039", "0.6433039", "0.63186485", "0.6318346", "0.62982345", "0.62982345", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", ...
0.0
-1
There are a total of 20 vulnerable areas. These areas are located in cells,psap,numbering,smpp fields. One request for each of these fields has been used for exploitation. These are listed below. /[CLS_ID]/[CLS_NODE_TYPE]/numbering/plmns/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1 /[CLS_ID]/[CLS_NODE_TYPE]/smpp/export?file_name=/export/home/mpcadmin/[FILENAME]&host=[HOSTNAME] HTTP/1.1 /[CLS_ID]/[CLS_NODE_TYPE]/cells/gsm/cgi_cells/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1 /[CLS_ID]/[CLS_NODE_TYPE]/psap/wireless/specific_routings/export?file_name=/export/home/mpcadmin/[FILENAME] HTTP/1.1 for Origin and Referer headers
def peer "#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n#http://libserver3.yale.edu:3000/auth?oid=10590515&type=jpg150&ip=130.132.80.210\n#http://lbdev.library.yale.edu/xml_accesscondition.aspx?a=s_lib_ladybird&b=E8F3FF02-A65A-4A20-B7B1-A9E35969A0B7&c=10590515'\n oid = params[:oid] || \"\"\n\ttype = params[:type] || \"\"\n\tip = params[:ip] || \"\"\n\tne...
[ "0.532571", "0.5169407", "0.50479865", "0.492319", "0.49083412", "0.48427543", "0.48385376", "0.4819718", "0.48158404", "0.48098293", "0.4809543", "0.48016503", "0.4788314", "0.47648573", "0.475823", "0.47450566", "0.47020563", "0.4698825", "0.46755555", "0.46534356", "0.4649...
0.0
-1
split strings to salt
def split(data, string_to_split) word = data.scan(/"#{string_to_split}":"([\S\s]*?)"/) string = word.split('"]').join('').split('["').join('') return string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def salt_password( password )\n case placement.to_sym\n when :end\n password.to_s + string\n when :beginning\n string + password.to_s\n when :split\n string[0...(string.length/2).floor] + password.to_s + string[(string.length/2).floor......
[ "0.70908123", "0.6879588", "0.6723357", "0.6566835", "0.6509686", "0.63802135", "0.63612014", "0.6315344", "0.62775445", "0.624284", "0.6232458", "0.622548", "0.61577934", "0.61577934", "0.614679", "0.61445266", "0.61425406", "0.6126635", "0.6067919", "0.60339844", "0.6033119...
0.0
-1
Log metadata about this ruleset to the currently running deployment
def notify sg_data = MU.structToHash( MU::Cloud::Google::FirewallRule.find(cloud_id: @cloud_id, region: @config['region']) ) sg_data ||= {} sg_data["group_id"] = @cloud_id sg_data["project_id"] = @project_id sg_data["cloud_id"] = @cloud_id return sg_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_debug 'In #run'\n audit self.class.payloads, self.class.options\n end", "def record_to_statsd\n # Only record production deployments in production graphite\n if self.environment == \"production\"\n key = \"deploys.#{self.application.shortname}\"\n STATSD.i...
[ "0.54701173", "0.53571355", "0.5327553", "0.51641273", "0.5160555", "0.51460004", "0.5136015", "0.5108246", "0.5040128", "0.503627", "0.5028032", "0.50229406", "0.49987307", "0.49891275", "0.49806234", "0.49666506", "0.49508625", "0.4948504", "0.49334854", "0.49189657", "0.49...
0.0
-1
Insert a rule into an existing security group.
def addRule(hosts, proto: "tcp", port: nil, egress: false, port_range: "0-65535") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_group(group, rule)\n return false unless rule.is_a?(Rule)\n @groups ||= {}\n (@groups[group] ||= []) << rule\n end", "def add_rule(key, rule = nil, &block)\n key = key.to_sym\n if rules[key].nil?\n rule ||= Rule.new(key, &block)\n rules[key] = rule\n else\n ...
[ "0.6768331", "0.66592056", "0.6553603", "0.64926904", "0.6476545", "0.64582264", "0.6352097", "0.6234922", "0.6197109", "0.61785495", "0.6114273", "0.6113903", "0.59489554", "0.59410363", "0.59260315", "0.5871608", "0.58088213", "0.5715657", "0.56822675", "0.5647617", "0.5634...
0.0
-1
GET /bookmarks GET /bookmarks.json
def index @bookmarks = Bookmark.user_bookmarks(current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookmarks = Bookmark.all\n render json: { bookmarks: @bookmarks }, status: :ok\n end", "def bookmarks\n\t\toptions = { list: true }\n\t\tresponse = self.server.run_with_json_template( :bookmarks, **options )\n\t\treturn response.map {|bk| Hglib::Repo::Bookmark.new(self, **bk) }\n\tend", "de...
[ "0.79481", "0.78161955", "0.77625155", "0.76365644", "0.7631135", "0.74768716", "0.74189895", "0.735247", "0.7311321", "0.71859217", "0.7151939", "0.714009", "0.7111507", "0.710681", "0.7087552", "0.7087552", "0.701677", "0.7002643", "0.6980754", "0.68785614", "0.68566144", ...
0.70959634
14
POST /bookmarks POST /bookmarks.json
def create @bookmark = Bookmark.new(bookmark_params) @bookmark.user_id = current_user.id respond_to do |format| if @bookmark.save format.html { redirect_to @redirect, notice: 'Bookmark was successfully created.' } format.json { render :show, status: :created, location: bookmarks_path } else format.html { redirect_to @redirect, alert: "Bookmark could not be saved" } format.json { render json: @bookmark.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bookmark = Bookmark.new(params[:bookmark])\n# req = ActiveSupport::JSON.decode(request.body)\n# @bookmark = Bookmark.new(req)\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.js...
[ "0.7601388", "0.7501046", "0.7428683", "0.73990256", "0.7320891", "0.7053024", "0.7021579", "0.68947303", "0.6827968", "0.6793302", "0.67932713", "0.6715096", "0.6694452", "0.66603863", "0.6629462", "0.6622624", "0.66059315", "0.66040224", "0.6578182", "0.6558899", "0.6548775...
0.67191845
11
DELETE /bookmarks/1 DELETE /bookmarks/1.json
def destroy @bookmark.destroy respond_to do |format| format.html { redirect_to @redirect, notice: 'Bookmark was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmarks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |for...
[ "0.7707112", "0.7665514", "0.7464211", "0.74564487", "0.74493945", "0.74256516", "0.74138814", "0.74115217", "0.7408013", "0.7408013", "0.738349", "0.7374239", "0.7362362", "0.7344076", "0.7270821", "0.7231424", "0.7228766", "0.72132033", "0.71970284", "0.71391743", "0.710091...
0.72599775
15
Check if the current user is the owner of the bookmark and also set the bookmark
def set_bookmark_check_owner @bookmark = Bookmark.find(params[:id]) if @bookmark.user != current_user respond_to do |format| format.html { redirect_to root_url, alert: "You dont have permissions for this action"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bookmark\n @bookmark = current_user.bookmarks.find(params[:id])\n end", "def set_authorized_bookmark\n @bookmark = Bookmark.find(params[:id])\n redirect_to bookmarks_path, notice: \"Not authorized to operate on this bookmark\" unless current_user == @bookmark.user\n end", "def book...
[ "0.735294", "0.7100118", "0.7058876", "0.6839759", "0.6639056", "0.65991956", "0.65714544", "0.65084046", "0.64786434", "0.6468364", "0.6415549", "0.6383909", "0.63401884", "0.6327939", "0.63261044", "0.63102424", "0.63102424", "0.63102424", "0.63102424", "0.63102424", "0.631...
0.7654808
0
Custom redirect for create and destroy methodss
def set_redirect @redirect = params[:origin_url] == nil ? bookmarks_path : params[:origin_url] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_after_create\n resources_url {}\n end", "def redirect_after_destroy\n url = caller_url\n if url\n redirect_to url\n else\n redirect_to url_for([model_name.pluralize])\n end\n end", "def create_redirect_action\n if params[:redirect_fro...
[ "0.7546049", "0.7231048", "0.6943585", "0.68767154", "0.68010205", "0.67701423", "0.6737539", "0.6730852", "0.6704272", "0.6660237", "0.6649508", "0.65838856", "0.65654594", "0.6530129", "0.6530129", "0.6481723", "0.64756805", "0.6455428", "0.6451169", "0.6440487", "0.6436338...
0.0
-1
Only allow a list of trusted parameters through.
def bookmark_params params.permit(:bookmark, :post_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Constructs a new TimeOrDateTime. timeOrDateTime can be a Time, DateTime or Integer. If using a Time or DateTime, any time zone information is ignored. Integer timestamps must be within the range supported by Time on the platform being used.
def initialize(timeOrDateTime) @time = nil @datetime = nil @timestamp = nil if timeOrDateTime.is_a?(Time) @time = timeOrDateTime # Avoid using the slower Rational class unless necessary. nsec = RubyCoreSupport.time_nsec(@time) usec = nsec % 1000 == 0 ? nsec / 1000 : Rational(nsec, 1000) @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec, usec) unless @time.utc? @orig = @time elsif timeOrDateTime.is_a?(DateTime) @datetime = timeOrDateTime @datetime = @datetime.new_offset(0) unless @datetime.offset == 0 @orig = @datetime else @timestamp = timeOrDateTime.to_i if !RubyCoreSupport.time_supports_64bit && (@timestamp > 2147483647 || @timestamp < -2147483648 || (@timestamp < 0 && !RubyCoreSupport.time_supports_negative)) raise RangeError, 'Timestamp is outside the supported range of Time on this platform' end @orig = @timestamp end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <=>(timeOrDateTime)\n return nil unless timeOrDateTime.is_a?(TimeOrDateTime) ||\n timeOrDateTime.is_a?(Time) ||\n timeOrDateTime.is_a?(DateTime) ||\n timeOrDateTime.is_a?(TimestampWithOffset) ||\n timeOrDateTime.re...
[ "0.7050232", "0.69038963", "0.684509", "0.6769529", "0.6700714", "0.59060115", "0.564362", "0.5490283", "0.5484259", "0.5472272", "0.5449295", "0.539685", "0.5388648", "0.5370767", "0.5310206", "0.53053874", "0.5214997", "0.5154613", "0.5130931", "0.5126723", "0.508977", "0...
0.7441325
0
Returns the time as a Time. When converting from a DateTime, the result is truncated to microsecond precision.
def to_time # Thread-safety: It is possible that the value of @time may be # calculated multiple times in concurrently executing threads. It is not # worth the overhead of locking to ensure that @time is only # calculated once. unless @time result = if @timestamp Time.at(@timestamp).utc else Time.utc(year, mon, mday, hour, min, sec, usec) end return result if frozen? @time = result end @time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_time\n # Thread-safety: It is possible that the value of @time may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @time is only\n # calculated once.\n\n unless @time\n if @timestamp\n @ti...
[ "0.74301505", "0.73713", "0.7048538", "0.7003883", "0.6817992", "0.6806805", "0.6634038", "0.6603997", "0.6596779", "0.65903884", "0.65893507", "0.65476406", "0.6543548", "0.6515027", "0.65133315", "0.64883703", "0.6445421", "0.6435426", "0.6404207", "0.6372866", "0.6356819",...
0.7272988
2
Returns the time as a DateTime. When converting from a Time, the result is truncated to microsecond precision.
def to_datetime # Thread-safety: It is possible that the value of @datetime may be # calculated multiple times in concurrently executing threads. It is not # worth the overhead of locking to ensure that @datetime is only # calculated once. unless @datetime # Avoid using Rational unless necessary. u = usec s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000) result = RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s) return result if frozen? @datetime = result end @datetime end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_time\n # Thread-safety: It is possible that the value of @time may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @time is only\n # calculated once.\n\n unless @time\n if @timestamp\n @ti...
[ "0.7100872", "0.694876", "0.693944", "0.68311775", "0.6732338", "0.6732338", "0.6604466", "0.6453278", "0.64389724", "0.6327229", "0.62855023", "0.6214323", "0.61961997", "0.6181711", "0.61689866", "0.607637", "0.6073339", "0.6054788", "0.6011455", "0.59961665", "0.59528244",...
0.65644306
7
Returns the time as an integer timestamp.
def to_i # Thread-safety: It is possible that the value of @timestamp may be # calculated multiple times in concurrently executing threads. It is not # worth the overhead of locking to ensure that @timestamp is only # calculated once. unless @timestamp result = to_time.to_i return result if frozen? @timestamp = result end @timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_timestamp(time = '00:00')\n DateTime.parse([self, time].join(' ')).to_time.to_i\n end", "def to_i\n return self.time.to_i\n end", "def to_i\n # Thread-safety: It is possible that the value of @timestamp may be\n # calculated multiple times in concurrently executing threads. It is not\n...
[ "0.7813479", "0.7789028", "0.75574607", "0.74244523", "0.74239284", "0.739586", "0.7341508", "0.73102707", "0.72724456", "0.72641015", "0.72141457", "0.7181819", "0.71782017", "0.71780354", "0.7154653", "0.71403086", "0.7126736", "0.71080506", "0.71015435", "0.7087582", "0.70...
0.75329554
3
Returns the time as the original time passed to new.
def to_orig @orig end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_time()\n #This is a stub, used for indexing\n end", "def to_time\n self\n end", "def time\n return Time.new(@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec)\n end", "def get_time\n Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def time=(new_time)\n @time...
[ "0.6697649", "0.6696673", "0.6617309", "0.64406425", "0.64332604", "0.639077", "0.6378485", "0.6371405", "0.6355255", "0.6350876", "0.63389826", "0.63339496", "0.63285154", "0.632278", "0.6257533", "0.620928", "0.6202607", "0.61927027", "0.6191294", "0.6137722", "0.61349446",...
0.0
-1
Returns a string representation of the TimeOrDateTime.
def to_s if @orig.is_a?(Time) "Time: #{@orig.to_s}" elsif @orig.is_a?(DateTime) "DateTime: #{@orig.to_s}" else "Timestamp: #{@orig.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_s\n time_to_s(time)\n end", "def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n elsif @orig.is_a?(TimestampWithOffset)\n \"TimestampWithOffset: #{@orig.to_s}\"\n else\n \"Timestam...
[ "0.7358139", "0.7323617", "0.70119977", "0.6801877", "0.6744071", "0.66936815", "0.6673014", "0.6617359", "0.6612761", "0.66068757", "0.6576527", "0.65509456", "0.65307695", "0.65233666", "0.64921236", "0.6470404", "0.64526165", "0.64479065", "0.64398044", "0.643596", "0.6429...
0.74946856
1
Returns internal object state as a programmerreadable string.
def inspect "#<#{self.class}: #{@orig.inspect}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"#{name}#{state}\"\n end", "def to_pretty_s\n \"#{type}:#{name} is #{state}\"\n end", "def to_s\n \"state: #{@state}, line: #{@line_counter}, file: #{@file_name}\"\n end", "def inspect\n \"#{name}=#{state.inspect} #{location}\"\n end", "def inspect; to_s; end...
[ "0.72272044", "0.7102299", "0.6986669", "0.69722795", "0.69205236", "0.69205236", "0.69205236", "0.69205236", "0.69205236", "0.6782744", "0.6781884", "0.6717852", "0.6717852", "0.6693693", "0.6672083", "0.66672283", "0.66560626", "0.66560626", "0.66560626", "0.66560626", "0.6...
0.0
-1
Returns the month of the year (1..12).
def mon if @time @time.mon elsif @datetime @datetime.mon else to_time.mon end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def months_in_year\n 12\nend", "def month() end", "def month\n return @month\n end", "def month\n months = %w{January February March April May June July August September October November December}\n months[Time.now.month - 1]\n ...
[ "0.76854324", "0.76336354", "0.7609652", "0.7564997", "0.75300974", "0.7509046", "0.7501045", "0.74948704", "0.7477927", "0.74683136", "0.7397781", "0.7397781", "0.7395114", "0.7387072", "0.72975653", "0.7282819", "0.7264514", "0.7239525", "0.7203249", "0.71281606", "0.712441...
0.0
-1
Returns the day of the month (1..n).
def mday if @time @time.mday elsif @datetime @datetime.mday else to_time.mday end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nwday_of_month(n)\n self + (nwday_day(n) - day).days\n end", "def day_of_month\n return self.day_of_year if self.month == 1\n ((self.day_of_year - 1) - DAYS_IN_MONTH.slice(0, (month - 1)).inject(:+)) + 1\n end", "def day_in_month(year, month, day)\n return Date.new(year, month, da...
[ "0.8041053", "0.72893023", "0.7188594", "0.7185649", "0.70354587", "0.70218563", "0.7014999", "0.7014999", "0.6969219", "0.68883187", "0.6885691", "0.684601", "0.6815636", "0.6781904", "0.6757036", "0.6728899", "0.6720594", "0.670162", "0.6700879", "0.66969824", "0.6686073", ...
0.0
-1
Returns the day of the week (0..6 for Sunday to Saturday).
def wday if @time @time.wday elsif @datetime @datetime.wday else to_time.wday end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_of_week\n # Date.wday returns 0-6 for Sunday,...Saturday\n return @day.wday\n end", "def day_of_week\n # Zellers: 0 = Saturday, 1 = Sunday, 2 = Monday, ..., 6 = Friday\n # day_of_week: 1 = Sunday, 7 = Saturday\n (zellers_congruence + 6) % 7\n end", "def day_of_week\n to_time.wday\...
[ "0.8535862", "0.8336422", "0.817168", "0.81282455", "0.7893926", "0.78752214", "0.78063154", "0.770183", "0.7455943", "0.7417571", "0.73899007", "0.7385858", "0.7376861", "0.73515034", "0.73412615", "0.7322764", "0.731034", "0.7115404", "0.7095304", "0.70863754", "0.70853925"...
0.6321603
98
Returns the hour of the day (0..23).
def hour if @time @time.hour elsif @datetime @datetime.hour else to_time.hour end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hour\n # seconds_since_start_of_day / H_SECS\n (seconds_since_start_of_day / H_SECS).to_i\n end", "def hour\n return @t_hour\n end", "def hour_thc\n hour = @t_hour\n hour -= 12 if hour > 12\n return hour\n end", "def hour() time[0] end", "def hour\n @hour\n end"...
[ "0.78771704", "0.7580654", "0.7578141", "0.75737643", "0.75075936", "0.74544644", "0.73538166", "0.7281383", "0.727703", "0.72657603", "0.7263349", "0.72387385", "0.72044784", "0.71898854", "0.716567", "0.7090867", "0.69819283", "0.6862825", "0.6826901", "0.6824362", "0.68136...
0.7097673
17
Returns the minute of the hour (0..59).
def min if @time @time.min elsif @datetime @datetime.min else to_time.min end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minute\n @minute\n end", "def getminute()\n\t\treturn @min\n\tend", "def to_i\n hour * 60 + minute\n end", "def minute\n set_function_and_argument(:minute, nil)\n end", "def minute\n self.to_duration.to_units(:hour, :minute, :second).fetch(:minute)\n end", "def...
[ "0.76168805", "0.75115323", "0.7400418", "0.7291517", "0.7264071", "0.71790254", "0.6984181", "0.69761115", "0.6890814", "0.68628556", "0.6859385", "0.67962086", "0.6721731", "0.6721731", "0.6627458", "0.65930545", "0.6557322", "0.6549359", "0.65378225", "0.6484371", "0.64843...
0.5739169
81
Returns the second of the minute (0..60). (60 for a leap second).
def sec if @time @time.sec elsif @datetime @datetime.sec else to_time.sec end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sec\n @sec ||= time_parts[2]\n end", "def minutes() 60 * seconds end", "def second\n self.to_duration.to_units(:hour, :minute, :second).fetch(:second)\n end", "def seconds_in_minutes(num_min)\n\tnum_min * 60\nend", "def sec() time[2] end", "def minutes\n (seconds % 3600) / 60\n ...
[ "0.72489357", "0.71643585", "0.7002234", "0.69992113", "0.6882843", "0.68802774", "0.6866271", "0.68414056", "0.6763384", "0.6715851", "0.67100227", "0.66187584", "0.65915644", "0.64990944", "0.64990944", "0.64827764", "0.64093566", "0.6354304", "0.6336383", "0.62963885", "0....
0.62487185
23
Returns the number of microseconds for the time.
def usec if @time @time.usec elsif @datetime # Ruby 1.8 has sec_fraction (of which the documentation says # 'I do NOT recommend you to use this method'). sec_fraction no longer # exists in Ruby 1.9. # Calculate the sec_fraction from the day_fraction. ((@datetime.day_fraction - OffsetRationals.rational_for_offset(@datetime.hour * 3600 + @datetime.min * 60 + @datetime.sec)) * 86400000000).to_i else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def microseconds(time)\n ((time[:sec_fraction].to_f % 1) * 1_000_000).to_i\n end", "def microseconds() Float(self * (10 ** -6)) end", "def microseconds(time)\n time[:sec_fraction] ? (time[:sec_fraction] * 1_000_000).to_i : 0\n end", "def usec\n return @t_usec\n end", "def toMil...
[ "0.806098", "0.7726769", "0.7701477", "0.75633913", "0.74346584", "0.73760957", "0.73507106", "0.73321253", "0.73321253", "0.7023275", "0.6997538", "0.6992963", "0.69644463", "0.6959251", "0.6857265", "0.684026", "0.68213004", "0.6815042", "0.67913824", "0.6758588", "0.668460...
0.732815
9
Compares this TimeOrDateTime with another Time, DateTime, timestamp (Integer) or TimeOrDateTime. Returns 1, 0 or +1 depending whether the receiver is less than, equal to, or greater than timeOrDateTime. Returns nil if the passed in timeOrDateTime is not comparable with TimeOrDateTime instances. Comparisons involving a DateTime will be performed using DateTime. Comparisons that don't involve a DateTime, but include a Time will be performed with Time. Otherwise comparisons will be performed with Integer.
def <=>(timeOrDateTime) return nil unless timeOrDateTime.is_a?(TimeOrDateTime) || timeOrDateTime.is_a?(Time) || timeOrDateTime.is_a?(DateTime) || timeOrDateTime.respond_to?(:to_i) unless timeOrDateTime.is_a?(TimeOrDateTime) timeOrDateTime = TimeOrDateTime.wrap(timeOrDateTime) end orig = timeOrDateTime.to_orig if @orig.is_a?(DateTime) || orig.is_a?(DateTime) # If either is a DateTime, assume it is there for a reason # (i.e. for its larger range of acceptable values on 32-bit systems). to_datetime <=> timeOrDateTime.to_datetime elsif @orig.is_a?(Time) || orig.is_a?(Time) to_time <=> timeOrDateTime.to_time else to_i <=> timeOrDateTime.to_i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <=>(timeOrDateTime)\n return nil unless timeOrDateTime.is_a?(TimeOrDateTime) ||\n timeOrDateTime.is_a?(Time) ||\n timeOrDateTime.is_a?(DateTime) ||\n timeOrDateTime.is_a?(TimestampWithOffset) ||\n timeOrDateTime.re...
[ "0.7772341", "0.7647143", "0.6072132", "0.57692647", "0.5685252", "0.56831145", "0.55960715", "0.5519526", "0.53915846", "0.52137005", "0.5139923", "0.5077324", "0.5059307", "0.5044536", "0.50103", "0.49811935", "0.48791724", "0.48791724", "0.48429343", "0.48200956", "0.47263...
0.7586256
2
Adds a number of seconds to the TimeOrDateTime. Returns a new TimeOrDateTime, preserving what the original constructed type was. If the original type is a Time and the resulting calculation goes out of range for Times, then an exception will be raised by the Time class.
def +(seconds) if seconds == 0 self else if @orig.is_a?(DateTime) TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) else # + defined for Time and Integer TimeOrDateTime.new(@orig + seconds) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def +(seconds)\n if seconds == 0\n self\n else\n if @orig.is_a?(DateTime)\n TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds))\n else\n # + is defined for Time, TimestampWithOffset and Integer.\n TimeOrDateTime.new(@orig + seconds)\n ...
[ "0.7666559", "0.71088904", "0.6741678", "0.6595366", "0.6344636", "0.6186966", "0.6068617", "0.6062155", "0.6021938", "0.59858453", "0.5903138", "0.5889501", "0.5841004", "0.5743455", "0.5622994", "0.56135064", "0.5591005", "0.5488915", "0.5485516", "0.5482653", "0.5451686", ...
0.77803224
1
Subtracts a number of seconds from the TimeOrDateTime. Returns a new TimeOrDateTime, preserving what the original constructed type was. If the original type is a Time and the resulting calculation goes out of range for Times, then an exception will be raised by the Time class.
def -(seconds) self + (-seconds) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def -(seconds)\n TzTime.new(time - seconds, @zone)\n end", "def -(other)\n if other.acts_like?(:time)\n to_time - other.to_time\n elsif duration_of_variable_length?(other)\n method_missing(:-, other)\n else\n result = utc.acts_like?(:date) ? utc.ago(other) : utc - other re...
[ "0.6613704", "0.6204663", "0.58813256", "0.57706845", "0.5631291", "0.56091505", "0.5584698", "0.55248153", "0.5501946", "0.5479136", "0.5456052", "0.5433738", "0.54307073", "0.54290414", "0.54186505", "0.5398979", "0.5392649", "0.5360987", "0.5360987", "0.5333456", "0.533271...
0.53566754
21
Similar to the + operator, but converts to a DateTime based TimeOrDateTime where the Time or Integer timestamp to go out of the allowed range for a Time, converts to a DateTime based TimeOrDateTime. Note that the range of Time varies based on the platform.
def add_with_convert(seconds) if seconds == 0 self else if @orig.is_a?(DateTime) TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) else # A Time or timestamp. result = to_i + seconds if ((result > 2147483647 || result < -2147483648) && !RubyCoreSupport.time_supports_64bit) || (result < 0 && !RubyCoreSupport.time_supports_negative) result = TimeOrDateTime.new(to_datetime + OffsetRationals.rational_for_offset(seconds)) else result = TimeOrDateTime.new(@orig + seconds) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <=>(timeOrDateTime)\n return nil unless timeOrDateTime.is_a?(TimeOrDateTime) ||\n timeOrDateTime.is_a?(Time) ||\n timeOrDateTime.is_a?(DateTime) ||\n timeOrDateTime.is_a?(TimestampWithOffset) ||\n timeOrDateTime.re...
[ "0.69330156", "0.6875831", "0.6834405", "0.6063978", "0.580282", "0.580282", "0.5762877", "0.5727283", "0.57195586", "0.56744367", "0.5672837", "0.56247836", "0.5622446", "0.5610763", "0.55622", "0.5555238", "0.5413637", "0.54022485", "0.5381119", "0.53592527", "0.5356421", ...
0.5394861
18
Returns true if todt represents the same time and was originally constructed with the same type (DateTime, Time or timestamp) as this TimeOrDateTime.
def eql?(todt) todt.kind_of?(TimeOrDateTime) && to_orig.eql?(todt.to_orig) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eql?(todt)\n todt.kind_of?(TimeOrDateTime) && to_orig.eql?(todt.to_orig)\n end", "def eql?(todt)\n todt.kind_of?(TimeOrDateTime) && to_orig.eql?(todt.to_orig)\n end", "def ==(other)\n self.same_time?(other)\n end", "def same?(other)\n other.hour == @hour and other.minute ...
[ "0.8377924", "0.8377924", "0.73043144", "0.68743277", "0.6862144", "0.6688016", "0.6604063", "0.6364341", "0.62827164", "0.62707275", "0.6227917", "0.61325485", "0.61109716", "0.60979223", "0.6039192", "0.60388637", "0.6021706", "0.6012536", "0.5997193", "0.5977696", "0.59741...
0.8340534
2
Returns a hash of this TimeOrDateTime.
def hash @orig.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [from, timezone, to].hash\n end", "def hash\n @offset.hash ^ @previous_offset.hash ^ @timestamp.hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n utc_offset.hash ^ std_offset.hash ^ abbreviation.hash\n end", "def hash ...
[ "0.6590694", "0.6563607", "0.6512761", "0.64564234", "0.63568693", "0.63340944", "0.6326574", "0.6311776", "0.6277731", "0.6223044", "0.6218659", "0.61133474", "0.6111339", "0.60458195", "0.6023672", "0.6015677", "0.6015677", "0.6015677", "0.6003562", "0.6003562", "0.59888023...
0.0
-1
GET /material_types GET /material_types.json
def index @material_types = MaterialType.all render json: @material_types end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_material_types\n METADATA_RELATIONS_CONFIG['material_types']\n end", "def index\n @material_types = MaterialType.all\n end", "def show\n render json: @material_type\n end", "def material_type\n attributes['material_type']\n end", "def material_type\n attributes['material_type']\n...
[ "0.7732913", "0.77025366", "0.7340212", "0.690191", "0.690191", "0.67517513", "0.66524297", "0.6605872", "0.6575561", "0.65139145", "0.65139145", "0.64771396", "0.6476055", "0.64550173", "0.64060456", "0.6405289", "0.63991386", "0.63899934", "0.63739705", "0.6340566", "0.6335...
0.8057425
0
GET /material_types/1 GET /material_types/1.json
def show render json: @material_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @material_types = MaterialType.all\n\n render json: @material_types\n end", "def index\n @material_types = MaterialType.all\n end", "def get_material_types\n METADATA_RELATIONS_CONFIG['material_types']\n end", "def material_type\n attributes['material_type']\n end", "def mate...
[ "0.7967804", "0.7653231", "0.72486734", "0.7037358", "0.7037358", "0.6945488", "0.69371194", "0.69371194", "0.68666506", "0.68612194", "0.68612194", "0.6757629", "0.6694482", "0.6648928", "0.662511", "0.659436", "0.65927845", "0.65748084", "0.6547958", "0.6547958", "0.6547958...
0.76032364
2
POST /material_types POST /material_types.json
def create @material_type = MaterialType.new(material_type_params) if @material_type.save render json: @material_type, status: :created, location: @material_type else render json: @material_type.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @material_type = MaterialType.new(material_type_params)\n\n respond_to do |format|\n if @material_type.save\n format.html { redirect_to @material_type, notice: 'Material type was successfully created.' }\n format.json { render :show, status: :created, location: @material_type ...
[ "0.749657", "0.73558706", "0.72912514", "0.6700096", "0.6583948", "0.6583948", "0.6571985", "0.6534968", "0.65178293", "0.6503478", "0.64999026", "0.6482453", "0.6408931", "0.63930815", "0.6345891", "0.63125694", "0.63080525", "0.62988484", "0.6275991", "0.6275991", "0.618235...
0.78080374
0
PATCH/PUT /material_types/1 PATCH/PUT /material_types/1.json
def update @material_type = MaterialType.find(params[:id]) if @material_type.update(material_type_params) head :no_content else render json: @material_type.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @material_type.update(material_type_params)\n format.html { redirect_to @material_type, notice: 'Material type was successfully updated.' }\n format.json { render :show, status: :ok, location: @material_type }\n else\n format.html { render ...
[ "0.75079256", "0.6829885", "0.6728052", "0.6617153", "0.6617153", "0.6598197", "0.65930283", "0.6530585", "0.6440991", "0.64317113", "0.6427574", "0.6427574", "0.6424332", "0.64199704", "0.64175487", "0.6376824", "0.63682044", "0.63454646", "0.6342051", "0.63186955", "0.62951...
0.7799207
0
DELETE /material_types/1 DELETE /material_types/1.json
def destroy @material_type.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @material_type.destroy\n respond_to do |format|\n format.html { redirect_to material_types_url, notice: 'Material type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mtype = Mtype.find(params[:id])\n @mtype.destroy\n\n re...
[ "0.7911478", "0.76007897", "0.7300382", "0.72970563", "0.72928643", "0.7210436", "0.7207729", "0.71706384", "0.71278006", "0.70975083", "0.70901054", "0.7068017", "0.706414", "0.70464385", "0.7038735", "0.7038735", "0.7022333", "0.7022333", "0.70094395", "0.7003541", "0.69981...
0.7974557
0
Created by: Satish Zol Created on: 04/03/2012 Purpose: ++ This method is used to find all discussions of that group
def all_group_discussions(page) per_page = 20 off = (page-1)*per_page Discussion.find_by_sql(["Select d.* from (discussion_group_discussions dgd LEFT JOIN discussions d ON d.id=dgd.discussion_id) Where (dgd.discussion_group_id=? and d.share_type=?) ORDER BY dgd.created_at DESC LIMIT ? OFFSET ?", self.id, "groups", per_page, off]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end", "def list\n @list ||= begin\n drequest = {\n where: {owner_id: owner.id},\n colonnes: []\n }\n dbtable_frigo_discussions.select(drequest).collect do...
[ "0.7102656", "0.6927338", "0.6857437", "0.67227334", "0.67005783", "0.6605562", "0.653508", "0.6488578", "0.6470569", "0.64188945", "0.638123", "0.6293409", "0.62651056", "0.615577", "0.60814506", "0.60814506", "0.60246414", "0.60214883", "0.60193706", "0.5980517", "0.5925608...
0.747567
0
Created by: Satish Zol Created on: 06/03/2012 Purpose: ++ This method is used to find all group users
def group_users DiscussionGroupUser.where("discussion_group_id=? AND is_member=?", self.id, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << gr...
[ "0.78314066", "0.7585664", "0.73860115", "0.7291694", "0.72674584", "0.71922326", "0.7169876", "0.7158042", "0.712217", "0.70689505", "0.70674247", "0.70466727", "0.7025594", "0.70176053", "0.6983516", "0.69832444", "0.69269663", "0.69039005", "0.6802331", "0.6790027", "0.678...
0.69696784
16
CODE FOR TESTING: (DO NOT EDIT)
def assert_equal(expected, actual) unless expected == actual abort "Expected #{expected} to match #{actual} on line #{caller.first.split(":")[1]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def terpene; end", "def stderrs; end", "def berlioz; end", "def trd; end", "def identify; end", "def refutal()\n end", "def suivre; end", "def webe...
[ "0.72852707", "0.67617494", "0.65363306", "0.65212655", "0.65212655", "0.65212655", "0.65212655", "0.6256818", "0.6235653", "0.60989827", "0.6080679", "0.6069831", "0.6019674", "0.60139185", "0.60110736", "0.60059977", "0.5989666", "0.5989666", "0.59895986", "0.59231824", "0....
0.0
-1
Ajax helper to refresh current index page once the user selects an option.
def redraw_mails(option, value, mailing) if value.is_a?(Array) param, value = value.first, value.last end remote_function( :url => send("redraw_mails_#{controller.controller_name}_path"), :with => "{ #{option}: '#{param || value}', 'related': #{mailing} }", :condition => "$('#{option}').innerHTML != '#{value}'", :loading => "$('#{option}').update('#{value}'); $('loading').show()", :complete => "$('loading').hide()" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_page_on_index(page)\n if params[:search]\n target = page.toolbox.last.find(\"div.search_results.#{model_name.pluralize}\")\n if collection.empty?\n target.html(\"No #{resource_name.pluralize.humanize} found.\")\n else\n target.html(page.context.list_of(collect...
[ "0.62332255", "0.5943109", "0.57441485", "0.5687729", "0.56416684", "0.5639901", "0.5608083", "0.5608083", "0.55849785", "0.54865503", "0.54723203", "0.54713804", "0.54614276", "0.54573566", "0.5441742", "0.54364616", "0.5431022", "0.5420763", "0.54205465", "0.5396552", "0.53...
0.0
-1
DFID research outputs are always bulk published, because our 'publication' is just a proxy for a research output PDF. Its date is not important to a user. Setting this +true+ means that specialistfrontend will never render the publishingapi +published+ date.
def bulk_published true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_publish_date\n if publisher_tools_config.always_private?\n word_document.private = true\n import_data[:always_private] = true\n return true\n end\n end", "def publish?\n false\n end", "def published?; end", "def published?; end", "def publish!\n self.published ...
[ "0.68596506", "0.68094766", "0.6733525", "0.6733525", "0.6671773", "0.66354734", "0.6617149", "0.66013736", "0.65788126", "0.65739876", "0.6530847", "0.64812475", "0.6473078", "0.6459099", "0.6426865", "0.64261234", "0.6425049", "0.64116395", "0.639594", "0.63853014", "0.6384...
0.6910211
0
This helper instruction consolidates our earlier instructions so it is easier to reuse. Note that there are no parameters to this instruction so we can omit the parenthesis after the instruction name
def get_price_of_bitcoin data = get_data_from_website(BLOCKCHAIN_WEBSITE) price = get_price_in_usd(data) # This converts the string to a floating point number # Another conversion instruction is to_i (integer) price.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instruction name, instruction\n end", "def processing_instruction!(name, attributes = nil)\n unless attributes\n self << \"<?#{name} ?>\"\n else\n self << \"<?#{name} \"\n attributes.each do |a, v|\n self << %[#{a}=\"#{v}\" ]\n end\n self << \"?>\"\n end\n end", ...
[ "0.5923408", "0.5700833", "0.55495423", "0.55493367", "0.5395798", "0.53617376", "0.53601396", "0.5257595", "0.5234774", "0.52072805", "0.5191078", "0.5188091", "0.51352406", "0.5122758", "0.50951225", "0.50951225", "0.5069032", "0.50599796", "0.503055", "0.50115645", "0.5011...
0.0
-1
Add the following code to the User model for getting and setting the list of roles a user belongs to. This will perform the necessary bitwise operations to translate an array of roles into the integer field.
def roles=(roles) self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.inject(0, :+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_roles=(value)\n roles[:user_roles]=value\n end", "def roles\n roles_from_users\n end", "def roles\r\n @roles ||= user_roles.map(&:name)\r\n end", "def role_ids=(id_list)\n\t\tlogger.info(\"[ROLE IDS] #{id_list}\")\n\t\tself.roles.clear\n\t\tfor id in id_list\n\t\t\tnext if id.empty?\n\t\...
[ "0.725351", "0.71046555", "0.7009423", "0.69842714", "0.6955666", "0.6955666", "0.6948951", "0.6948951", "0.69187886", "0.69012904", "0.6877795", "0.68561786", "0.6838907", "0.68385816", "0.68118846", "0.67823803", "0.6714408", "0.6687999", "0.66874033", "0.668562", "0.666711...
0.6938213
9
This method checks the user's role
def is?(role) roles.include?(role.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_role\n if current_user && current_user.has_role?(:admin)\n return\n else\n flash[:notice]= \"You are not authorised to access the page you sought.\"\n redirect_to root_path\n end\n end", "def check_for_role\n\t\tself.role = ROLES[:user] if !self.role.present?\n\te...
[ "0.80921245", "0.8031052", "0.8006534", "0.7939082", "0.78985494", "0.78190213", "0.78132", "0.7776644", "0.77359605", "0.76866376", "0.76814485", "0.767367", "0.767367", "0.7633259", "0.76125455", "0.76118284", "0.7610091", "0.7592979", "0.7592248", "0.756529", "0.75374603",...
0.0
-1
show message after installation.
def caveats <<~EOS # rnssh need AWS access key for working. # Please set key/secret to AWS credentials (~/.aws/credentials) [default] aws_access_key_id=your_key_id aws_secret_access_key=your_secret # or environment variable for AWS connection. # (~/.bashrc, ~/.zshrc or other.) export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY # set default aws region. # until v0.3.9 rnssh --init # after v0.4.0 rnssh -init EOS end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_message; end", "def complete\n unless options[:quiet]\n puts \"*\" * 75\n puts \" \"\n puts \">> Questionnaire has been installed successfully.\"\n puts \">> You're all ready to go!\"\n puts \" \"\n puts \">> Enjoy!\"\n end\n end", "def show_he...
[ "0.71326125", "0.68129116", "0.6790476", "0.6533042", "0.63751304", "0.625986", "0.6225275", "0.60790914", "0.60396254", "0.60225433", "0.5906464", "0.5897832", "0.5886468", "0.5884546", "0.5868468", "0.5832907", "0.5774519", "0.5763071", "0.57353044", "0.5729349", "0.5716004...
0.0
-1