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
== Metodo suma Dispersa
def +(other) #if ((other.class.to_s == "Dispersa") && (other.fil == @fil) && (other.col == @col)) matrizSuma = Array.new(@fil) {Array.new(@col) {0}} 0.upto(@numElementos - 1) do |i| matrizSuma[@filM[i]][@colM[i]] = @eleM[i] end 0.upto(other.numElementos - 1) do |i| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n ...
[ "0.6191417", "0.6145878", "0.61335695", "0.61130834", "0.610881", "0.59997654", "0.5980322", "0.59518814", "0.5925779", "0.5893532", "0.5893091", "0.5877957", "0.58752376", "0.5770682", "0.5745549", "0.5689198", "0.5688272", "0.56882524", "0.5685207", "0.56724936", "0.5669644...
0.0
-1
== Metodo resta Dispersa
def -(other) #if ((other.class.to_s == "Dispersa") && (other.fil == @fil) && (other.col == @col)) matrizResta = Array.new(@fil) {Array.new(@col) {0}} i = 0 (other.numElementos - 1).times { matrizResta[other.filM[i]][other.colM[i]] = 0 - other.eleM[i] i += 1 } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def mi_carrera\n\n\tend", "def show\n add_breadcrumb \"Detalles\", @reqcargos\n end", "def zuruecksetzen()\n end", "def sigla; @nome; end", "def show\n #calculo de presupuesto\n \n end", "def unsichtbar_machen()\n end", "def display_details()\n puts \"Numele pe...
[ "0.6417766", "0.6188226", "0.60239285", "0.6008295", "0.6005342", "0.5946158", "0.5909313", "0.58419067", "0.58419067", "0.5831526", "0.58143795", "0.5789364", "0.57860494", "0.5778818", "0.5727165", "0.57262605", "0.57159233", "0.5681059", "0.56730354", "0.5669841", "0.56689...
0.0
-1
== Metodo producto Dispersa
def *(other) #if ((other.class.to_s == "Dispersa") && (other.fil == @fil) && (other.col == @col)) matrizProd = Array.new(@fil) {Array.new(@col) {0}} 0.upto(other.numElementos - 1) do |i| if (other.filM[i] = @colM[i]) matrizProd[@filM[i]][@colM[i]] += @eleM[i] * other.eleM[i] end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products\n end", "def show\r\n @productos = Producto.where(\"producto_padre_id = ?\",@producto_padre.id);\r\n end", "def product\n nic_view.product\n end", "def retorna_nome_produto\n titulo_produto.greenify\n titulo_produto.text\n end", "def show\n combo_...
[ "0.6475011", "0.639226", "0.63387185", "0.6226604", "0.61944246", "0.6190762", "0.6188815", "0.61596507", "0.6116307", "0.6112368", "0.6110953", "0.6102688", "0.60977286", "0.6095239", "0.6083448", "0.60633254", "0.60617805", "0.6054588", "0.6054588", "0.60425776", "0.6029050...
0.0
-1
GET /field_definitions GET /field_definitions.json
def index if params[:step_definition_id] step_definition = StepDefinition.find(params[:step_definition_id]) if step_definition != nil @field_definitions = step_definition.field_definitions else @field_definitions = [] end else @field_definitions = FieldDefinition....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definitions(key, field=nil)\n begin\n defs = self.definition_schema[key]\n if field.present?\n defs[field]\n else\n defs\n end\n rescue NoMethodError => e\n field_key = field.present? ? \"#{key}/#{field}\" : key\n ErrorTracker.report_exception(e, self.study.use...
[ "0.70758086", "0.6337163", "0.6179126", "0.61459696", "0.6027708", "0.5972366", "0.59629065", "0.5953797", "0.59530354", "0.5900668", "0.5883962", "0.5828771", "0.57892615", "0.5778741", "0.5736973", "0.5733617", "0.5733617", "0.5733617", "0.5733617", "0.5733617", "0.572039",...
0.6603736
1
GET /field_definitions/1 GET /field_definitions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definitions(key, field=nil)\n begin\n defs = self.definition_schema[key]\n if field.present?\n defs[field]\n else\n defs\n end\n rescue NoMethodError => e\n field_key = field.present? ? \"#{key}/#{field}\" : key\n ErrorTracker.report_exception(e, self.study.use...
[ "0.6568905", "0.6402544", "0.6175839", "0.6164917", "0.61279273", "0.59294397", "0.5729203", "0.56470335", "0.5594209", "0.5581703", "0.5569659", "0.5538788", "0.5516743", "0.54836804", "0.54660326", "0.545755", "0.5430624", "0.5420847", "0.5420162", "0.541188", "0.54072845",...
0.0
-1
POST /field_definitions POST /field_definitions.json
def create @field_definition = FieldDefinition.new(field_definition_params) respond_to do |format| if @field_definition.save format.html { redirect_to @field_definition, notice: 'Field definition was successfully created.' } format.json { render :show, status: :created, location: @field_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n @step_definition = StepDefinition.new(step_definition_attributes)\n @step_definition.field_definitions = FieldDefinition.createFieldDefinition...
[ "0.6650409", "0.6428674", "0.63167727", "0.5891492", "0.5798324", "0.57660174", "0.5747204", "0.5697241", "0.5676426", "0.56692153", "0.56343377", "0.56055397", "0.55115455", "0.5498918", "0.544877", "0.5438454", "0.5410673", "0.5372006", "0.53685665", "0.5311249", "0.5295316...
0.6931197
0
PATCH/PUT /field_definitions/1 PATCH/PUT /field_definitions/1.json
def update respond_to do |format| if @field_definition.update(field_definition_params) format.html { redirect_to @field_definition, notice: 'Field definition was successfully updated.' } format.json { render :show, status: :ok, location: @field_definition } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n step_definition_attributes = step_definition_params\n field_definitions_attributes = step_definition_attributes.delete(\"field_definitions\")\n\n FieldDefinition.updateFieldDefinitions(field_definitions_attributes)\n\n respond_to do |format|\n if @step_definition.update(step_definit...
[ "0.6562135", "0.6268004", "0.6123477", "0.6123477", "0.60710317", "0.59882385", "0.597456", "0.5937513", "0.5937513", "0.5863146", "0.5801755", "0.57935566", "0.57839036", "0.57632226", "0.5755195", "0.57141423", "0.5708985", "0.5672161", "0.5616817", "0.5612955", "0.55771303...
0.65656084
0
DELETE /field_definitions/1 DELETE /field_definitions/1.json
def destroy @field_definition.destroy respond_to do |format| format.html { redirect_to field_definitions_url, notice: 'Field definition was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_field!(field_name); end", "def DeleteField id\n \n APICall(path: \"ticket_fields/#{id}.json\",method: 'DELETE')\n \n end", "def delete_field(id)\n delete(\"fields/#{id}\")\n end", "def test_delete_field\n local_file_name = 'GetField.docx'\n remote_fi...
[ "0.6994925", "0.67600447", "0.6716103", "0.6662268", "0.66504896", "0.6497389", "0.6497389", "0.6495189", "0.6476443", "0.6375809", "0.63211066", "0.63173664", "0.63096696", "0.63096696", "0.6283502", "0.6262463", "0.6253855", "0.62296414", "0.62217116", "0.62123173", "0.6203...
0.74825364
0
Use callbacks to share common setup or constraints between actions.
def set_field_definition @field_definition = FieldDefinition.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def field_definition_params params.permit(:field_definition,:name, :field_type, :validationRegex, :required, :step_definition_id, :errorMessage, :order) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
2Given an array, find the int that appears an odd number of times. There will always be only one integer that appears an odd number of times.
def find_it(seq) uniqueInts=seq.uniq uniqueInts.each do |value| k=0 seq.each do |mainSeq| k+=1 if mainSeq==value end return value if k%2==1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odd_occurances_in_array(a)\n res = 0\n a.each { |el| res ^= el }\n res\nend", "def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend", "def find_odd(arr)\n arr.find { |i| arr.count(i).odd? }\nend", "def o...
[ "0.78197885", "0.7638051", "0.7525708", "0.74908644", "0.7486596", "0.7483844", "0.74471146", "0.737544", "0.7351387", "0.73412836", "0.73292327", "0.72991675", "0.7288738", "0.72786164", "0.72373706", "0.7227842", "0.7197603", "0.7197414", "0.7189893", "0.7150033", "0.713118...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_purchase @purchase = Purchase.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def purchase_param params.require(:purchase).permit(:item_id, :quantity, :date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /organizations GET /organizations.json
def index @organizations = Organization.order_by_most_recent @json = gmap4rails_with_popup_partial(@organizations,'popup') @category_options = Category.html_drop_down_options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or...
[ "0.80765116", "0.80071", "0.78597564", "0.78338337", "0.78312206", "0.7745588", "0.7691283", "0.7672265", "0.76290935", "0.7590858", "0.7536119", "0.7533662", "0.7521284", "0.75053763", "0.75053763", "0.75053763", "0.75053763", "0.75053763", "0.75053763", "0.75053763", "0.750...
0.0
-1
GET /organizations/1 GET /organizations/1.json
def show @organization = Organization.find(params[:id]) @editable = current_user.can_edit?(@organization) if current_user @grabbable = current_user ? current_user.can_request_org_admin?(@organization) : true # @next_path = current_user ? organization_user_path(@organization.id, current_user.id) : new_use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end", "def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end", "def index\n ...
[ "0.7965355", "0.7789723", "0.7624976", "0.76014984", "0.75791377", "0.75791377", "0.75518954", "0.7519814", "0.74602246", "0.74229765", "0.7412952", "0.7383728", "0.7383559", "0.7383559", "0.7383559", "0.7383559", "0.7383559", "0.7383559", "0.7383559", "0.7383559", "0.7383559...
0.0
-1
GET /organizations/new GET /organizations/new.json
def new @organization = Organization.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end", "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ren...
[ "0.80002916", "0.80002916", "0.79110706", "0.7769764", "0.74969125", "0.74499846", "0.7448206", "0.7431489", "0.7401061", "0.7384301", "0.73354286", "0.73137957", "0.7312422", "0.7312422", "0.7299635", "0.7295927", "0.72741574", "0.7259706", "0.7255205", "0.7255205", "0.72195...
0.7459801
9
POST /organizations POST /organizations.json
def create # model filters for logged in users, but we check here if that user is an admin # TODO refactor that to model responsibility? unless current_user.try(:admin?) flash[:notice] = PERMISSION_DENIED redirect_to organizations_path and return false end @organization = Organizatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redire...
[ "0.7546241", "0.71868527", "0.703545", "0.70268863", "0.7016771", "0.6988308", "0.6930564", "0.69226116", "0.69226116", "0.69226116", "0.69226116", "0.6916983", "0.6892586", "0.68546283", "0.685141", "0.67094165", "0.670208", "0.6676121", "0.6673902", "0.6667356", "0.661678",...
0.0
-1
PUT /organizations/1 PUT /organizations/1.json
def update @organization = Organization.find(params[:id]) params[:organization][:admin_email_to_add] = params[:organization_admin_email_to_add] if params[:organization] return false unless user_can_edit? @organization if @organization.update_attributes_with_admin(params[:organization]) redirect_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :...
[ "0.78295016", "0.7434708", "0.7253623", "0.7247928", "0.7240768", "0.7187564", "0.7173343", "0.71293944", "0.71054447", "0.70963454", "0.70263505", "0.6951313", "0.6945305", "0.6945305", "0.6945305", "0.6945305", "0.6945305", "0.6945305", "0.6945305", "0.69379544", "0.6911741...
0.0
-1
DELETE /organizations/1 DELETE /organizations/1.json
def destroy unless current_user.try(:admin?) flash[:notice] = PERMISSION_DENIED redirect_to organization_path(params[:id]) and return false end @organization = Organization.find(params[:id]) @organization.destroy redirect_to organizations_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to organizations_url }\n fo...
[ "0.7767288", "0.75106853", "0.75106853", "0.7457346", "0.7439525", "0.7439525", "0.7439525", "0.7331174", "0.73253006", "0.73227197", "0.7295465", "0.7285924", "0.7278945", "0.7270234", "0.726735", "0.72643864", "0.72632885", "0.723405", "0.7200872", "0.7193817", "0.71657467"...
0.0
-1
=begin Make a API call to convert file/url/hash based on parameters and return xml response.
def convert(target_type_method, source_type, source, source_name=nil, source_options=nil, notification_url=nil) if !@@_target_type_options.has_key?(target_type_method) raise "Invalid Target Type." end @@_target_type =@@_target_type_options[target_type_method] if !@@_source_type_opt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(params = {:format => :xml, :action => :query})#TODO put these in so that they're default and not lost when we pass stuff in...\n url = _form_url(params)\n \n #TODO wonder if I should make a generic library for external url requests, to standardize the header/etc?\n #requests without user-agents are...
[ "0.62352574", "0.5829825", "0.5788444", "0.5745369", "0.57185555", "0.56870383", "0.5615419", "0.55938756", "0.55938756", "0.55931884", "0.55706173", "0.5545379", "0.5537766", "0.55376756", "0.5528486", "0.55256814", "0.55100614", "0.54819185", "0.5456925", "0.54431677", "0.5...
0.0
-1
=begin Make an API call to server based on action and parameters.
def api_call(action, xml_data) require 'net/http' require 'uri' current_url = URL; if action != 'get-queue' get_server(@@_target_type_options[@@_target_type]); end uri = URI.parse(current_url+"/"+action) http = Net::HTTP.new(uri.host,uri.port) request=Net::HTTP::Post.new(uri.reques...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\t#check response\n\t\tresponse_body = JSON.parse(response.body)\n\tend", "def request(action, params = {})\n # Merge the default params wi...
[ "0.77791095", "0.7266592", "0.705587", "0.6855841", "0.6766559", "0.67496413", "0.67155707", "0.66886926", "0.6679214", "0.6666716", "0.6639777", "0.66321707", "0.66321707", "0.6547145", "0.65405256", "0.6539476", "0.6513818", "0.65135354", "0.6489488", "0.6482179", "0.647019...
0.663921
11
=begin getProgress Provide process status for created instance or you can manually check status for specific hash.
def get_progress(hash=nil) if @@hash.length < 1 and hash == nil raise "Get Progress: Hash not found." end return api_call('queue-status',{"apiKey"=>@@_api_key,"hash"=>(hash!=nil)?hash:@@hash }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_status\n response = @api.get(@cloud.url(:status, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @progress = response['ProgressPercents'].to_i\n @progress\n end", "def check_progress\n self.increment_count\n begin\n self.send(\"check_progress_#{self.t...
[ "0.7091271", "0.67764544", "0.6535717", "0.64436024", "0.64172184", "0.63970846", "0.63940275", "0.6329501", "0.6329501", "0.6329501", "0.6329501", "0.6329501", "0.6308591", "0.62772566", "0.6162767", "0.611275", "0.6062739", "0.60513943", "0.60277295", "0.60080534", "0.60037...
0.64988923
3
=begin deleteFile Delete file from server after process or you can manually delete for specific hash.
def delete_file(hash=nil) if @@hash.length < 1 && hash === nil raise "Delete File: Hash not found." end return api_call('queue-manager',{"apiKey"=>@@_api_key,"hash"=>(hash!=nil)?hash:@@hash, "method"=>"deleteFile" }); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(filename); end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", ...
[ "0.73422194", "0.7309502", "0.7309502", "0.7259103", "0.71199125", "0.7115461", "0.70857453", "0.7083061", "0.7082959", "0.7033079", "0.7033079", "0.6990905", "0.6967677", "0.6964429", "0.6955098", "0.6925234", "0.690997", "0.6902744", "0.6896549", "0.68585706", "0.68562996",...
0.71981096
4
=begin Get free api server information.
def get_server(target_type) return api_call('get-queue',{'apiKey' => @@_api_key,'targetType' => target_type}); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_info\n return @server_info if @server_info.present?\n response = request :get, SERVER_INFO_PATH\n @server_info = response.error? ? nil :\n response.result.with_indifferent_access\n end", "def server_info()\n #This is a stub, used for indexing\n end"...
[ "0.71093667", "0.7016905", "0.6907714", "0.6830765", "0.67768633", "0.67594224", "0.67090803", "0.6695377", "0.66152024", "0.6554503", "0.6554107", "0.6536369", "0.65354407", "0.6467605", "0.64468616", "0.64468616", "0.6440169", "0.6367192", "0.6367192", "0.62701386", "0.6244...
0.5579157
86
=begin Create one time token to use API.
def create_token return api_call('request-token',{"apiKey"=> @@_api_key }); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_one_time_token\n @one_time_token =\n JSON::JWT.new(iss: 'try-it-juku-test',\n exp: 5.minutes.since,\n nbf: Time.current,\n sub: { shin_cd: @current_chief.shin_cd })\n .sign(ACCESS_TOKEN_SIGNATURE, :HS2...
[ "0.8003303", "0.7740658", "0.73060983", "0.7283917", "0.72717005", "0.7226481", "0.72062707", "0.71999466", "0.71927714", "0.7190985", "0.719002", "0.7186691", "0.7161049", "0.714691", "0.71447974", "0.7141118", "0.7110375", "0.7105321", "0.70993626", "0.7097249", "0.7093375"...
0.8550086
0
=begin Convert an array to xml string.
def array_to_xml(hash, xml) require "active_support/core_ext" return hash.to_xml(:root => 'queue') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(a)\n r = \"\"\n if ishash(@a[a])\n r = self.hash_to_xml(a,@a[a])\n elsif isarray(@a[a])\n r = self.array_to_xml(a,@a[a])\n else\n r = \"<#{a}>#{@a[a]}</#{a}>\"\n end\n r \n end", "def to_xml\n @node.flatten.map(&:t...
[ "0.6696121", "0.669173", "0.65800935", "0.65800935", "0.64539003", "0.64539003", "0.64367825", "0.64367825", "0.64367825", "0.64367825", "0.64367825", "0.64367825", "0.643426", "0.639226", "0.6366356", "0.6366356", "0.63052046", "0.62652904", "0.62152576", "0.619897", "0.6195...
0.6912599
0
=begin Convert an xml string to array.
def xml_to_array(xml_string) return Hash.from_xml(xml_string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_from_xml(xml, opts=OPTS)\n node = Nokogiri::XML(xml).children.first\n unless node \n raise Error, \"Malformed XML used\"\n end\n node.children.reject{|c| c.is_a?(Nokogiri::XML::Text)}.map{|c| from_xml_node(c, opts)}\n end", "def parse_to_array(line_...
[ "0.76040816", "0.666295", "0.65903074", "0.63825923", "0.6306955", "0.61723995", "0.61355793", "0.6132945", "0.61137897", "0.61028665", "0.5969989", "0.5931572", "0.5931572", "0.5922456", "0.59220636", "0.59026235", "0.58812326", "0.5865497", "0.5809855", "0.5809386", "0.5790...
0.8026987
0
=begin To get hash value of job
def get_hash() return @@hash; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def job_key\n Digest::MD5.hexdigest(path)\n end", "def expected_digest\n hash = {\n 'class' => 'CourseDataUpdateWorker',\n 'queue' => queue_for(@course),\n 'unique_args' => [@course_i...
[ "0.7202386", "0.7202386", "0.71622455", "0.6925619", "0.6860948", "0.6721181", "0.66859925", "0.66045046", "0.66045046", "0.66045046", "0.65331626", "0.65301454", "0.6493129", "0.6493129", "0.6493129", "0.6493129", "0.6493129", "0.6493129", "0.6493129", "0.6459377", "0.638108...
0.57810384
98
=begin To get download url of inserted job
def get_download_url() return @@download_url; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n \"#{ProcessingJob.endpoint}/#{cloud_crowd_id}\"\n end", "def url\n \"#{File.join(job.url, number.to_s)}/\"\n end", "def build_jobs_url\n \"http://#{host_name}:#{port}/jobs\"\n end", "def track_download\n connection.get(links.download_location)[\"url\"]\n end", "def get...
[ "0.651653", "0.64707714", "0.63897383", "0.6312987", "0.62368554", "0.61887854", "0.6162872", "0.6162872", "0.6159142", "0.61589646", "0.6135914", "0.61326665", "0.6115116", "0.61142886", "0.61062783", "0.60814697", "0.6069027", "0.6066687", "0.60637474", "0.60447466", "0.604...
0.64159566
2
Serializes the object, POSTs it to +url+ with +format+, deserializes the returned document and updates properties accordingly.
def post(options={}, &block) response = http.post_uri(options.merge(:body => serialize), &block) handle_response(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post url, object = nil\n request url, HTTP::Post, object\n end", "def save document\n ensure_connection!\n resp = connection.create_doc index_id, document.to_hash\n if resp.success?\n raw = document.instance_variable_get \"@raw\"\n raw.merge! JSON.parse(resp.bod...
[ "0.5841951", "0.5771368", "0.5770921", "0.5748789", "0.56112456", "0.5555683", "0.5555321", "0.5524757", "0.54836804", "0.54252154", "0.54065543", "0.5390666", "0.5313991", "0.53101856", "0.52858627", "0.5282111", "0.5273313", "0.5271023", "0.52601826", "0.52429634", "0.52162...
0.5166971
24
GETs +url+ with +format+, deserializes the returned document and updates properties accordingly.
def get(options={}, &block) response = http.get_uri(options, &block) handle_response(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(url, query = {})\n query[:format] ||= @format\n OEmbed::Response.create_for(raw(url, query), self, url, query[:format].to_s)\n end", "def get(url, options={})\n resp = RestClient.get url, rest_client_options(options)\n Representation.new self, MultiJson.load(resp)\n end", "def call\...
[ "0.63117754", "0.621188", "0.60270643", "0.5922283", "0.5872436", "0.5795031", "0.57926154", "0.57490164", "0.57336766", "0.5714641", "0.57051593", "0.570485", "0.56958234", "0.56830424", "0.5682117", "0.5676084", "0.5672516", "0.5664012", "0.56617785", "0.56219715", "0.56212...
0.0
-1
Serializes the object, PUTs it to +url+ with +format+, deserializes the returned document and updates properties accordingly.
def put(options={}, &block) response = http.put_uri(options.merge(:body => serialize), &block) handle_response(response) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n s...
[ "0.66783696", "0.6592143", "0.611606", "0.6053623", "0.60305244", "0.5755128", "0.5714296", "0.57021576", "0.5689208", "0.56457937", "0.5645185", "0.5637551", "0.56319565", "0.5626417", "0.5618084", "0.5589152", "0.55726236", "0.5570112", "0.5565754", "0.5526729", "0.55235016...
0.6161295
2
This smells of :reek:FeatureEnvy (refers to 'faraday' more than self)
def connection @connection ||= Faraday.new(Features::SegmentDeletionConfig.config.uri) do |faraday| faraday.use ResponseMiddleware faraday.use Faraday::Adapter::NetHttp end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faraday_builder(builder)\n end", "def faraday_connection(url=nil)\n url ||= self.root\n key = \"faraday_connection_#{url}\"\n return Thread.current[key] if Thread.current[key]\n\n fc = Faraday.new(:url => url)\n fc.headers.merge!('User-Agent' => \"HyperResource #{HyperResource::VERSION}\")\n ...
[ "0.6038544", "0.5699972", "0.55331606", "0.5529503", "0.53634346", "0.53439194", "0.5320443", "0.5310597", "0.53085977", "0.53005457", "0.5298104", "0.5298104", "0.5298104", "0.52591604", "0.5186078", "0.5181141", "0.5181141", "0.5125692", "0.5125199", "0.5110972", "0.5107333...
0.0
-1
If options[:previous] is true, returns the code for the immediately previous subqing (multilevel only).
def odk_code(options = {}) CodeMapper.instance.code_for_item(object, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev\n prev? ? @current - 1 : nil\n end", "def previous\n end", "def previous\n end", "def previous\n before.ascending.last\n end", "def previous(options = {})\n pages = self_and_siblings.where(\"lft < ?\", lft)\n select_page(pages, options.merge(order: :desc))\n end", "def...
[ "0.63352436", "0.6200611", "0.6200611", "0.6152846", "0.6146951", "0.6125282", "0.61186343", "0.6050739", "0.60451937", "0.5940888", "0.5930395", "0.5918392", "0.59064096", "0.5832325", "0.5829831", "0.5829831", "0.58231807", "0.58141625", "0.5795504", "0.57760155", "0.572684...
0.0
-1
Yields a block where inside the block you have a different breadcrumb than outside.
def with_breadcrumb(key, *args, &block) original_renderer = @_gretel_renderer @_gretel_renderer = Gretel::Renderer.new(self, key, *args) yield @_gretel_renderer = original_renderer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadcrumb(&block)\n config.breadcrumb = block\n end", "def parent_breadcrumb(options = {}, &block)\n if block_given?\n gretel_renderer.yield_parent_breadcrumb(options, &block)\n else\n gretel_renderer.parent_breadcrumb(options)\n end\n end", "def r_breadcrumbs(&bloc...
[ "0.68129647", "0.67216146", "0.6717222", "0.6500311", "0.6433048", "0.6320943", "0.6131868", "0.6078897", "0.6028785", "0.59340864", "0.59029555", "0.58716357", "0.58684564", "0.5856284", "0.5838531", "0.58041793", "0.5773873", "0.57517636", "0.57260644", "0.57254916", "0.572...
0.6009178
9
Renders the breadcrumbs HTML, for example in your layout. See the readme for default options. If you supply a block, it will yield an array with the breadcrumb links so you can build the breadcrumbs HTML manually: You are here: ()
def breadcrumbs(options = {}) gretel_renderer.render(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_breadcrumbs(&block)\n content_tag(\"div\", &block)\n end", "def breadcrumb(&block)\n config.breadcrumb = block\n end", "def block_view(context, block_name)\n \n app = context[:app]\n \n result = case block_name\n \n when 'site_breadcrumb_public'\n\n pre...
[ "0.78619164", "0.7748351", "0.75749576", "0.744244", "0.7280234", "0.70840126", "0.7059596", "0.70563114", "0.69747335", "0.692678", "0.68995434", "0.68396497", "0.68174696", "0.68052185", "0.6779306", "0.67790353", "0.6575714", "0.6551005", "0.65180796", "0.6514634", "0.6490...
0.73083365
4
Returns or yields parent breadcrumb (secondtolast in the trail) if it is present. ()
def parent_breadcrumb(options = {}, &block) if block_given? gretel_renderer.yield_parent_breadcrumb(options, &block) else gretel_renderer.parent_breadcrumb(options) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_breadcrumb(options = {})\n render(options)[-2]\n end", "def yield_parent_breadcrumb(options = {})\n if parent = parent_breadcrumb(options)\n yield parent\n end\n end", "def breadcrumb current\n return [] if current.nil?\n result = Array.new\n result << current\n ...
[ "0.71094614", "0.7056014", "0.6413934", "0.63741654", "0.63702136", "0.6329462", "0.6316898", "0.6302244", "0.6295133", "0.6194351", "0.61781543", "0.6129419", "0.6129419", "0.59964657", "0.5981051", "0.59602785", "0.5919928", "0.5919928", "0.5898388", "0.5876841", "0.5874468...
0.73721915
0
Reference to the Gretel breadcrumbs renderer.
def gretel_renderer @_gretel_renderer ||= Gretel::Renderer.new(self, nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadcrumbs(options = {})\n gretel_renderer.render(options)\n end", "def with_breadcrumb(key, *args, &block)\n original_renderer = @_gretel_renderer\n @_gretel_renderer = Gretel::Renderer.new(self, key, *args)\n yield\n @_gretel_renderer = original_renderer\n end", "def goldb...
[ "0.8187783", "0.75630695", "0.7382717", "0.6954178", "0.6743278", "0.6724286", "0.67181635", "0.6576366", "0.6514266", "0.6514109", "0.6514109", "0.6496024", "0.6482023", "0.6463976", "0.64127415", "0.6392123", "0.6386978", "0.63468766", "0.6320909", "0.61905783", "0.61519027...
0.63012195
19
helper method for delete:
def maximum(tree_node = @root) while tree_node.right tree_node = tree_node.right end return tree_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n \n end", "def delete\n end", "def delete\n\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n\n\tend", "def delete\n ...
[ "0.8373501", "0.80260485", "0.8013269", "0.80042505", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.79107374", "0.7799738", "0.77781236", "0.7493549", "0.7422571", "0.74152577", "0.7396308", "0.73679674", "0.7326224", "0.7326224...
0.0
-1
optional helper methods go here:
def find_parent(value, tree_node = @root) return nil if @root.value == value # puts "tree_node.value", tree_node.value # puts "tree_node.left.value", tree_node.left.value # puts "tree_node.right.value", tree_node.right.value return tree_node if tree_node.left.value == value || tree_node.right.value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optional; end", "def private; end", "def maybe; end", "def extra; end", "def missing?; end", "def optional_positionals; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def required_defaults; end", "def missing; end", "def fallbacks=(_arg0); end", "de...
[ "0.69176954", "0.63765454", "0.63068986", "0.6306494", "0.6274195", "0.6185965", "0.61177635", "0.61177635", "0.61177635", "0.61177635", "0.6087291", "0.6078838", "0.6068349", "0.59986085", "0.59986085", "0.5961325", "0.5961325", "0.5928666", "0.5928561", "0.59222955", "0.590...
0.0
-1
Given a string of words, you need to find the highest scoring word Each letter of a word scores points according to its position in the alphabet: a = 1, b = 2, c = 3 etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original string. A...
def high(x) x = ('abcdefghijklmnopqrstuvwxyz') letterScore = { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def high(string)\n letter_scores = ('a'..'z').to_a\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores.index(char}\n score \n end\n words[word_scores.index(word_scores.max)]\nend", "def high(string)\n letter_scores = ('a'..'z...
[ "0.82453847", "0.8169409", "0.8084587", "0.80545866", "0.8015876", "0.790732", "0.7879747", "0.7776403", "0.77014893", "0.76093554", "0.7572922", "0.7511308", "0.74876714", "0.74689996", "0.74571675", "0.745092", "0.74367625", "0.74190664", "0.7389264", "0.73663265", "0.73248...
0.0
-1
A palindrome is a word or sequence of words that reads the same backwards as forwards. Write a method that returns the length of the longest palindrome in a given string. If there is no palindrome longer than two letters, return false.
def longest_palindrome(string) longest_palindrome = false i = 0 while i < string.length - 1 j = i + 1 while j < string.length curr_string = string[i..j] len = curr_string.length if is_palindrome?(curr_string) longest_palindrome = len if !longest_palindrome || len > longest_pal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_palindrome(string)\n string.length.downto(3) do |length|\n string.chars.each_cons(length) do |substr_arr|\n return substr_arr.length if palindrome?(substr_arr.join)\n end\n end\n false\nend", "def longest_palindrome(string)\n\tcurrent_longest = \"\"\n\tif string.length < 3\n\t\treturn f...
[ "0.87534237", "0.8531388", "0.8502772", "0.8411477", "0.83973724", "0.83963454", "0.83865374", "0.8368124", "0.8297867", "0.8293101", "0.82867646", "0.82867646", "0.82867646", "0.82502496", "0.823413", "0.82338357", "0.8229775", "0.8208013", "0.81769633", "0.8171867", "0.8168...
0.8370956
8
Write a function `anagrams(str1, str2)` that takes in two words and returns a boolean indicating whether or not the words are anagrams. Anagrams are words that contain the same characters but not necessarily in the same order. Solve this without using `Arraysort` or `Arraysort_by`.
def anagrams(str1, str2) letters = Hash.new(0) str1.split('').each do |char| letters[char] += 1 end str2.split('').each do |char| letters[char] -= 1 end letters.all? { |_, v| v.zero? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anagrams?(str1, str2)\n return false unless str1.length == str2.length\n\n str1.each_char do |chr|\n return false unless str2.count(chr) == str1.count(chr)\n end\n\n true\nend", "def are_anagrams?(str1, str2)\n # if different length, then can't possibly match\n return false if str1.length != str2.le...
[ "0.9069233", "0.9025581", "0.90137744", "0.89904934", "0.8972882", "0.8948267", "0.89023894", "0.8873611", "0.88331133", "0.8813541", "0.8813156", "0.88123095", "0.8796728", "0.8793009", "0.8793009", "0.8792254", "0.87823725", "0.8780502", "0.8780502", "0.8780502", "0.8767096...
0.8828899
9
Define a recursive method `permutations(array)` that returns all of the permutations of an array example => permutations([1,2,3]) should return => [ [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1] ] You CANNOT use call Ruby's builtin `Arraypermutation` method.
def permutations(array) return [array] if array.length <= 1 # Similar to the subsets problem, we observe that to get the permutations of # [1, 2, 3] we can look at the permutations of [1, 2] which are [1, 2] and # [2, 1] and add the last element to every possible index getting [3, 1, 2], # [1, 3, 2], [1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(array)\n\treturn array.permutation\nend", "def permutations(array)\n return [array] if array.length == 1\n\n perms = []\n array.each do |el|\n dupped = array.dup\n dupped.delete(el)\n permutations(dupped).each { |perm| perms << [el] + perm }\n end\n\n perms\nend", "def permutatio...
[ "0.8647357", "0.85897994", "0.84596074", "0.8430699", "0.8413507", "0.84101796", "0.84101796", "0.84101796", "0.84101796", "0.8404899", "0.8383136", "0.83517617", "0.83476245", "0.8343056", "0.8307858", "0.83060837", "0.8285539", "0.81761634", "0.8172498", "0.81558454", "0.81...
0.8478517
2
Back in the good old days, you used to be able to write a darn near uncrackable code by simply taking each letter of a message and incrementing it by a fixed number, so "abc" by 2 would look like "cde", wrapping around back to "a" when you pass "z". Write a function, `caesar_cipher(str, shift)` which will take a messag...
def caesar_cipher(str, shift) letters = ("a".."z").to_a encoded_str = "" str.split('').each do |char| if char == " " encoded_str << " " next end old_idx = letters.find_index(char) new_idx = (old_idx + shift) % letters.count encoded_str << letters[new_idx] end encoded_str en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caesar_cipher(string, shift_factor)\n\n\n upc_alphabet_arr = ('A'..'Z').to_a\n downc_alphabet_arr = ('a'..'z').to_a\n\n\n string_chars_arr = string.chars\n\n new_chars_arr = []\n\n string_chars_arr.each do |char|\n if upc_alphabet_arr.include?(char)\n new_index = (upc_alphabet_arr.index(char) + sh...
[ "0.8599134", "0.8594511", "0.85886806", "0.856101", "0.8551369", "0.85338473", "0.85260546", "0.85254586", "0.85237694", "0.85232854", "0.85210884", "0.8505192", "0.8492382", "0.8481106", "0.8459711", "0.84583384", "0.8453188", "0.84526193", "0.84524393", "0.84277356", "0.842...
0.8567948
3
Write a recursive method that takes in a base 10 number n and converts it to a base b number. Return the new number as a string E.g. base_converter(5, 2) == "101" base_converter(31, 16) == "1f"
def base_converter(num, b) return num.to_s if [0,1].include?(num) digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) base_converter(num/b, b) + digits[num % b] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_converter(num, b)\n\n return num.to_s if [0, 1].include?(num)\n\n digits = %w(0123456789abcdef)\n base_converter(num/b, b) + digits[num % b]\n\nend", "def base_converter(num, b)\n return \"\" if num == 0\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n\n base_converter(num/b, b) + digits[num...
[ "0.835826", "0.8239488", "0.79268646", "0.75288016", "0.7468854", "0.74058414", "0.7319654", "0.72496575", "0.7096845", "0.70771414", "0.700969", "0.700969", "0.6985824", "0.697721", "0.6976664", "0.6951264", "0.69168115", "0.67891693", "0.66726947", "0.66271615", "0.66150093...
0.8167173
2
Write a recursive method `subsets(array)` that returns all of the subsets of an array example => subsets([1,2,3]) should return => [ [], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3] ]
def subsets(array) return [[]] if array.empty? subs = subsets(array[0..-2]) subs.concat(subs.map{|el| el += [array.last]}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsets(array)\n if array.length <= 1\n return array\n end\n subset_array = []\n (0..array.length - 1).each do |i|\n subset_array << subsets(array[0...i]) << subsets(array[0...i]).concat([array[-1]])\n end\n return subset_array\nend", "def subsets(arr)\n return [arr] if arr.em...
[ "0.87270164", "0.8645382", "0.8640923", "0.8629626", "0.85947233", "0.85543853", "0.84376246", "0.8425681", "0.8392608", "0.83855593", "0.83690864", "0.8278923", "0.82593596", "0.8256711", "0.82462156", "0.8226202", "0.82134324", "0.820435", "0.82006145", "0.8193629", "0.8193...
0.8103324
22
See question here: Write a recursive method to solve `make_better_change`. HINT: To make_better_change, we only take one coin at a time and never rule out denominations that we've already used. This allows each coin to be available each time we get a new remainder. By iterating over the denominations and continuing to ...
def make_better_change(value, coins) return nil if coins.empty? return [] if value == 0 change = [] coins = coins.sort.reverse.select{|coin| coin <= value} coins.each do |coin| remainder = value - coin if remainder > 0 best_remainder = make_better_change(remainder, coins) change << [coin]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_better_change(amount, coin_denoms)\n return [amount] if coin_denoms.include?(amount)\n return [] if amount <= 0\n\n coin_denoms.sort.reverse!\n all_possible_arr = []\n\n coin_denoms.each do |value|\n change_arr = []\n change_arr << value\n change_arr.concat(make_better_change(amount - value,...
[ "0.8316686", "0.83139235", "0.82586664", "0.82519823", "0.8250704", "0.82127", "0.8174465", "0.80130213", "0.79879445", "0.79535246", "0.79313856", "0.79106355", "0.78628373", "0.7860745", "0.78558904", "0.78454685", "0.78333384", "0.7801111", "0.7747187", "0.7690399", "0.767...
0.7930268
12
THIS PROBLEM WILL NOT SHOW UP ON A REAL ASSESSMENT If you are a nonnative English speaker and find it difficult to understand this problem, do not spend too much time on it. Focus on other problems instead. Define a method `pig_latinify(sentence)` that translates a sentence into pig latin. You may want a helper method....
def pig_latinify(sentence) translated_words = sentence.split(" ").map do |word| translate_word(word) end translated_words.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pig_latin_sentence(sentence)\n y = sentence\n x = sentence.split\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n t = \"t\"\n h = \"h\"\n qu = \"qu\"\n\n x.map do |word|\n first_letter = word[0]\n if vowels.include?(first_letter)\n word << \"way\"\n elsif word.include?(t && h)\n word ...
[ "0.8841267", "0.87730575", "0.867668", "0.8656043", "0.8618591", "0.8613246", "0.8606145", "0.85803676", "0.85799867", "0.8579038", "0.85786974", "0.856355", "0.8539216", "0.8521281", "0.84993243", "0.84793234", "0.84407496", "0.8440136", "0.8426666", "0.8412286", "0.8398716"...
0.8566909
11
It is sometimes necessary to be able to break down a number into its prime factors. The process is called prime factorization. We can use a factor tree to determine the prime factorization of a number: 12 / \ / \ 4 3 / \ 2 2 Define a method `prime_factorization(n)` that breaks a number down into it's prime factors. exa...
def prime_factorization(num) # Base case - 1 is not a prime so we return an empty array here return [] if num == 1 # initialize i to 2, since it is the first prime # i = 2 # increment i until we find a prime factor i += 1 until is_prime?(i) && num % i == 0 # Add i to prime factors and make recur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factorization(num)\n if is_prime?(num)\n return [num]\n end\n factors = []\n (2..num).each do |factor|\n if num % factor == 0\n factors << factor\n factors << prime_factorization(num/factor)\n \n break\n end\n end\n factor...
[ "0.84289056", "0.8248386", "0.82452244", "0.81594414", "0.8114608", "0.8114608", "0.81008667", "0.80888236", "0.803569", "0.8034098", "0.80324554", "0.80171794", "0.7986873", "0.7978031", "0.79566336", "0.79540265", "0.7942906", "0.79321647", "0.79179937", "0.7909866", "0.788...
0.8201956
3
Write a method that takes a string and an alphabet. It returns a copy of the string with the letters reordered according to their positions in the alphabet. If no alphabet is passed in, it defaults to normal alphabetical order (az). Do NOT use `Arraysort` or `Arraysort_by`. Example: `jumble_sort("hello")` => "ehllo" `j...
def jumble_sort(str, alphabet = nil) alphabet ||= ('a'..'z').to_a sorted = false until sorted sorted = true (0...str.length - 1).to_a.each do |i| if alphabet.index(str[i]) > alphabet.index(str[i + 1]) str[i], str[i + 1] = str[i + 1], str[i] sorted = false end end end s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jumble_sort(str, alphabet = nil)\n alphabet ||= (\"a\"..\"z\").to_a\n\n new_string = str.split(\"\").sort do |letter_a, letter_b|\n alphabet.find_index(letter_a) <=> alphabet.find_index(letter_b)\n end\n new_string.join\nend", "def jumble_sort(str, alphabet = nil)\n\nend", "def jumble_sort(str, alph...
[ "0.82597476", "0.82006204", "0.82006204", "0.82006204", "0.81293917", "0.79909444", "0.798923", "0.78909403", "0.78866094", "0.7872284", "0.7859529", "0.7758186", "0.7693955", "0.7579312", "0.757669", "0.7435558", "0.7020224", "0.69431144", "0.68666995", "0.68644327", "0.6863...
0.782901
11
Define a method `rec_sum(nums)` that returns the sum of all elements in an array recursively
def rec_sum(nums) return 0 if nums.empty? nums[0] + rec_sum(nums.drop(1)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rec_sum(nums)\n\nend", "def rec_sum(nums)\n\nend", "def sum(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend", "def sum_rec(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend", "def sum_rec(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums.drop(1))\n...
[ "0.8344894", "0.8344894", "0.83379805", "0.8250366", "0.8015812", "0.791744", "0.79006046", "0.78274053", "0.7825242", "0.7817675", "0.7757072", "0.7699849", "0.76764464", "0.7612195", "0.75971943", "0.75934255", "0.75595033", "0.75439817", "0.7517138", "0.7516624", "0.750718...
0.7893728
7
Write a method that returns b^n recursively. Your solution should accept negative values for n.
def exponent(b, n) return 1 if n == 0 if n > 0 b * exponent(b, n - 1) else 1.0/b * exponent(b, n + 1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exponentiation(b, n)\n return 1 if n == 0\n\n return exponentiation(b, n - 1) * b\nend", "def exponent(b, n)\n return 1 if n == 0\n\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend", "def power(b, n)\n\n\t# b^n.to_i\n\n\tb ** n\n\nend", "def my_pow(x, n)\...
[ "0.7867685", "0.7708262", "0.76860213", "0.7595162", "0.75813276", "0.7523488", "0.75191253", "0.7430109", "0.7412472", "0.73890454", "0.73381114", "0.73173046", "0.73164076", "0.73164076", "0.73164076", "0.7310674", "0.7285143", "0.72811705", "0.7151168", "0.7126279", "0.712...
0.7718268
2
Write a recursive method that returns the sum of the first n even numbers recursively. Assume n > 0.
def first_even_numbers_sum(n) return 2 if n == 1 2 * n + first_even_numbers_sum(n-1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_even_numbers_sum(n)\n return 2 if n == 1\n 2 * n + first_even_numbers_sum(n-1)\n end", "def first_even_numbers_sum(n)\n\nend", "def first_even_numbers_sum(n)\n\nend", "def recursion(n)\n if n % 2 ==0\n n\n else\n recursion(n + 1)\nend\nend", "def even_num_rec(n)\n n = (0...n).to_a...
[ "0.88773525", "0.8361318", "0.8361318", "0.7575595", "0.7511886", "0.7442943", "0.7334038", "0.73173136", "0.7249176", "0.72258985", "0.72222763", "0.72195196", "0.71986216", "0.7167344", "0.71563643", "0.71517795", "0.71517795", "0.71517795", "0.71517795", "0.7151437", "0.71...
0.88209176
1
Write a recursive method `string_include_key?(string, key)` that takes in a string to search and a key string. Return true if the string contains all of the characters in the key in the same order that they appear in the key. example_1: string_include_key?("cadbpc", "abc") => true example_2: string_include_key("cba", "...
def string_include_key?(string, key) return true if key.length == 0 next_key_char = key.chars.first key_index = string.index(next_key_char) return false if key_index.nil? string_include_key?(string[key_index+1..-1], key[1..-1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_include_key?(string, key)\n return true if key == \"\"\n string.each_char.with_index do |char, idx|\n if char == key[0]\n return string_include_key(string[(idx + 1)..-1], key[1..-1])\n end\n end\n\n false\nend", "def string_include_key?(string, key)\n return true ...
[ "0.89874685", "0.8913823", "0.8888482", "0.87212694", "0.85243636", "0.82422984", "0.82422984", "0.82422984", "0.66606194", "0.66560686", "0.63048655", "0.62778956", "0.6241291", "0.6210503", "0.6195383", "0.61917645", "0.61839944", "0.61603725", "0.61597145", "0.6120425", "0...
0.87752384
3
Write a recursive method that returns the first "num" factorial numbers in ascending order. Note that the 1st factorial number is 0!, which equals 1. The 2nd factorial is 1!, the 3rd factorial is 2!, etc.
def factorials_rec(num) return [1] if num == 1 facs = factorials_rec(num - 1) facs << facs.last * (num - 1) facs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_factorial(num)\n if num < 2\n return 1\n else\n return num * first_factorial(num - 1)\n end\nend", "def FirstFactorial(num)\n if num > 1\n return num*(FirstFactorial(num-1)) \n end\n return num \nend", "def factorialrecursion num\n\tif num < 0\n\t\tnil\n\tend\n\t\n\tif nu...
[ "0.8557698", "0.8358884", "0.8140083", "0.810765", "0.80212927", "0.7778724", "0.7766124", "0.7759598", "0.775164", "0.7727939", "0.7718227", "0.77165973", "0.77111447", "0.77050495", "0.770471", "0.7693072", "0.76910025", "0.76594365", "0.76479346", "0.76479346", "0.76479346...
0.7458574
37
Write a method that finds the sum of the first n fibonacci numbers recursively. Assume n > 0.
def fibs_sum(n) return 0 if n == 0 return 1 if n == 1 fibs_sum(n-1) + fibs_sum(n-2) + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibs_sum(n - 1) + fibs_sum(n - 2) + 1\nend", "def fibs_sum(n)\n return 1 if n == 1 || n == 2\n sum = 0\n sum += (fibs_sum(n - 1) + fibs_sum(n - 2))\n \n \nend", "def fib_sum(n)\n return n if ( 0..1 ).include? n\n ( fib_sum( n - 1 ) + fi...
[ "0.8981103", "0.87479585", "0.87065566", "0.86833096", "0.86395675", "0.8585491", "0.8540424", "0.85397935", "0.85042083", "0.8501192", "0.8486396", "0.8470936", "0.84407544", "0.84372413", "0.8435925", "0.8426029", "0.8420815", "0.84188473", "0.8410866", "0.84104073", "0.840...
0.897471
4
Using recursion and the `is_a?` method, write an `Arraydeep_dup` method that will perform a "deep" duplication of the interior arrays.
def deep_dup(arr) arr.map{ |el| el.is_a?(Array) ? deep_dup(el) : el } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_dup(arr)\n\nend", "def deep_dup(arr)\n\nend", "def deep_dup(arr)\n\nend", "def recursive_deep_dup(arr)\n # # does arr contain anymore arrays?\n # if !(arr.is_a? Array)\n # arr\n # else\n # arr[recursive_deep_dup(arr)].dup\n # arr_copy = arr.dup\n arr_copy = []\n arr.each do |sub|\n if...
[ "0.85042363", "0.85042363", "0.85042363", "0.84489757", "0.82127714", "0.8200443", "0.8174736", "0.814522", "0.80592114", "0.80548733", "0.80500925", "0.8030352", "0.8012406", "0.79844856", "0.7955026", "0.79337823", "0.792694", "0.7918144", "0.79002017", "0.78950816", "0.788...
0.79173654
19
Write a method, `digital_root(num)`. It should Sum the digits of a positive integer. If it is greater than 9 (i.e. more than one digit), sum the digits of the resulting number. Keep repeating until there is only one digit in the result, called the "digital root". Do NOT use the built in `Integerto_s` or `Integerdigits`...
def digital_root(num) while num >= 10 num = digital_root_step(num) end num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digital_root(num)\n digits = []\n until num == 0\n digits << num % 10\n num /= 10\n end\n sum = digits.reduce(0, :+)\n sum < 10 ? sum : digital_root(sum)\nend", "def digital_root(num)\n while num >= 10\n num = digit_sum(digits(num))\n end\n num\nend", "def digital_root(num)\n return num...
[ "0.85688275", "0.85077804", "0.83943987", "0.833194", "0.828805", "0.826393", "0.8259746", "0.82578325", "0.81562227", "0.8050004", "0.7998421", "0.7972975", "0.79618883", "0.79329646", "0.79190266", "0.79143006", "0.788124", "0.77757186", "0.77722305", "0.7758617", "0.774776...
0.78652364
19
Write a method that doubles each element in an array. Assume all elements of the array are integers.
def doubler(array) array.map { |num| num * 2 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_doubles(arr)\n arr.map {|a|a*2}\n\nend", "def calculate_doubles!(array)\n\t\n\tarray.map! { |num| num * 2}\nend", "def calculate_doubles(arr)\n doubled_array = []\n arr.each {|int| doubled_array.push(int * 2)}\n doubled_array\nend", "def calculate_doubles!(arr)\n arr.map! {|int| int * 2}\n...
[ "0.78323674", "0.7791123", "0.77871126", "0.7782026", "0.7671097", "0.7597189", "0.75927764", "0.7561571", "0.7515987", "0.747603", "0.73090553", "0.7289148", "0.7277876", "0.7251727", "0.7218472", "0.7213917", "0.7183743", "0.71794516", "0.71755594", "0.7169577", "0.7160739"...
0.6613417
49
Define a method `primes(num)` that returns an array of the first "num" primes. You may wish to use an `is_prime?` helper method.
def is_prime?(num) return false if num < 2 (2...num).none? { |factor| num % factor == 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(num)\n\twhole_array = (2..num).to_a\n\tprime_array = [whole_array.shift]\n\n\tuntil whole_array == []\n\t\twhole_array.delete_if { |x| x % prime_array.last == 0 }\n\t\tprime_array << whole_array.shift\n\tend\n\tprime_array\nend", "def get_primes num\n primes = []\n for i in 0 ... num do\n ...
[ "0.7643744", "0.7534903", "0.7441485", "0.7402979", "0.7356517", "0.73547095", "0.7348984", "0.73454016", "0.73451585", "0.7342191", "0.72874844", "0.72853553", "0.7260889", "0.7200118", "0.71627927", "0.7137368", "0.70895994", "0.70784783", "0.70361525", "0.70328224", "0.700...
0.0
-1
Write a method that returns the factors of a number in ascending order.
def factors(num) return nil if num <= 0 return [1] if num == 0 (1..num).select { |i| (num % i) == 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factors(num)\n\t((1..num).select {|n| num % n == 0 } ).sort\nend", "def factors(num)\n factors = []\n for factor in 1..num\n factors << factor if num % factor == 0\n end\n factors.sort\nend", "def factors(num)\n\nend", "def factors(num)\n\nend", "def factors(num)\n\nend", "def factors(num)\n ...
[ "0.8575256", "0.8532261", "0.84801", "0.84801", "0.84801", "0.8478011", "0.8477378", "0.83777696", "0.83758056", "0.83459604", "0.8343072", "0.83401227", "0.83394605", "0.8335541", "0.8334777", "0.83283925", "0.831717", "0.8308934", "0.8308751", "0.8306715", "0.8306715", "0...
0.8082092
90
Write an `Arraymy_controlled_flatten(n)` method that only flattens n levels of an array. For example, if you have an array with 3 levels of nested arrays, and run `arr.my_flatten(1)`, you should return an array with 1 level of nested arrays flattened. Example: `[1,[2,3], [4,[5]]].my_controlled_flatten(1)` => [1,2,3,4,[...
def my_controlled_flatten(level = nil) flattened = [] self.each do |ele| if ele.is_a?(Array) && level != 0 flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1)) else flattened << ele end end flattened end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_controlled_flatten(n)\n flattened = []\n self.my_each do |el|\n if n > 0 && el.is_a?(Array)\n flattened += el.my_controlled_flatten(n - 1)\n else\n flattened << el\n end\n end\n flattened\n end", "def my_controlled_flatten(n)\n flattened = []\n\n self.each d...
[ "0.8792398", "0.87656134", "0.8753098", "0.86528426", "0.8628412", "0.8628412", "0.8622892", "0.8345546", "0.8345546", "0.79406697", "0.7091221", "0.6984455", "0.6984455", "0.69825655", "0.6965448", "0.6965448", "0.6965448", "0.6965448", "0.6965448", "0.6965448", "0.6949501",...
0.78683156
10
GET /abooks GET /abooks.json
def index @abooks = Abook.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @books = Book.get_avaible_books\n end", "def index\n @books = Book.all\n render json: @books\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\n...
[ "0.6982796", "0.6957329", "0.6949324", "0.68977684", "0.6820236", "0.6779995", "0.6751502", "0.67465687", "0.6721131", "0.66992205", "0.6696414", "0.66711694", "0.6655469", "0.6625742", "0.6621738", "0.6601952", "0.6601003", "0.65989757", "0.65951073", "0.658131", "0.6559724"...
0.7113232
0
GET /abooks/1 GET /abooks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n ...
[ "0.6811565", "0.6724151", "0.6673446", "0.6654508", "0.6644538", "0.65525883", "0.65376234", "0.6533649", "0.65321964", "0.6521902", "0.6511819", "0.6509823", "0.65060794", "0.64998686", "0.64294577", "0.64133376", "0.6406616", "0.6406616", "0.63970315", "0.63885933", "0.6384...
0.0
-1
POST /abooks POST /abooks.json
def create @abook = Abook.new(abook_params) respond_to do |format| if @abook.save format.html { redirect_to @abook, notice: 'Abook was successfully created.' } format.json { render :show, status: :created, location: @abook } else format.html { render :new } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def create\n @book = Book.new(book_params)\n\n if @book.s...
[ "0.6125391", "0.6040874", "0.6029674", "0.58725584", "0.58690166", "0.5814412", "0.5790517", "0.5739043", "0.57092375", "0.5704596", "0.57025206", "0.56746817", "0.56602204", "0.56549394", "0.56280553", "0.56187016", "0.5566896", "0.5566896", "0.5566896", "0.5566896", "0.5566...
0.6885678
0
PATCH/PUT /abooks/1 PATCH/PUT /abooks/1.json
def update respond_to do |format| if @abook.update(abook_params) format.html { redirect_to @abook, notice: 'Abook was successfully updated.' } format.json { render :show, status: :ok, location: @abook } else format.html { render :edit } format.json { render json: @abook.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @obj...
[ "0.63389295", "0.62552476", "0.62552476", "0.6253487", "0.6253081", "0.6228533", "0.62126774", "0.6208144", "0.6187638", "0.6162022", "0.61475354", "0.61317796", "0.60827076", "0.6082219", "0.60683763", "0.6060259", "0.6018262", "0.601791", "0.6011754", "0.5998342", "0.599834...
0.65643257
0
DELETE /abooks/1 DELETE /abooks/1.json
def destroy @abook.destroy respond_to do |format| format.html { redirect_to abooks_url, notice: 'Abook was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def de...
[ "0.702121", "0.6976222", "0.6811468", "0.67723113", "0.676742", "0.6674516", "0.6669128", "0.66688925", "0.6666575", "0.6654977", "0.66456056", "0.6628885", "0.66274464", "0.6623885", "0.66220206", "0.661985", "0.66136426", "0.6591164", "0.65891767", "0.65891767", "0.65891767...
0.70690453
0
Use callbacks to share common setup or constraints between actions.
def set_abook @abook = Abook.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def abook_params params.require(:abook).permit(:title, :description, :sdescription, :image, :previewo, :previewt, :previewth, :price, :offerprice, :coupon, :author, :publication, :saving, :off) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
new is initialized with an argument of a title pushes new instances into a class variable
def initialize(title) @title=title @@all << self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(name)\n @name = name\n @@all << self #pushes every instance into the @@all array\nend", "def initialize(name) #initial with name\n @name = name # set name instance varibale to the passing name\n @@all << self # keep track of all instances by putting each instance into the class variable ...
[ "0.72222126", "0.7077006", "0.7055978", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6976549", "0.6931541", "0.6927776", "0.68961716", "0.6885669", "0.6885669", "0.6885669", "0.6885669", "0.6885669", "0.6832213", ...
0.66767985
26
author_name knows the name of its author returns nil if the post does not have an author
def author_name if self.author self.author.name else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author_name\n self.author ? self.author.name : nil\n end", "def author_name\n self.posts.first.author_name\n end", "def author_name\n self.author ? self.author.name : nil \n end", "def author_name\n self.author.name if author \n end", "def author_name\n author.full_name if autho...
[ "0.8126534", "0.8126239", "0.8073739", "0.8004891", "0.7914814", "0.7884917", "0.7585794", "0.74104595", "0.73815733", "0.7375413", "0.73479724", "0.73479724", "0.7320386", "0.7221285", "0.7148087", "0.7141909", "0.71012664", "0.70949674", "0.70919853", "0.708323", "0.7044326...
0.81866527
0
Reverse Geocoding Reverse geocoding is the process of converting a coordinate or location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or area subdivisions such as a neighborhood, county, state, or country.
def reverse(lat, lon, format, normalizecity, opts = {}) data, _status_code, _headers = reverse_with_http_info(lat, lon, format, normalizecity, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_geocode\n do_lookup(true) do |o,rs|\n if r = rs.first\n unless r.address.nil?\n o.__send__ \"#{self.class.geocoder_options[:fetched_address]}=\", r.address\n end\n r.address\n end\n end\n end", "def reverse_geocode\n result = Geokit:...
[ "0.7566016", "0.7546457", "0.72926354", "0.7209077", "0.6912252", "0.68828386", "0.6858201", "0.68352926", "0.6642573", "0.66420996", "0.65697587", "0.6517245", "0.6277231", "0.6028675", "0.59304166", "0.58426845", "0.5736893", "0.57335377", "0.5711746", "0.5682751", "0.56782...
0.67838985
9
Reverse Geocoding Reverse geocoding is the process of converting a coordinate or location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or area subdivisions such as a neighborhood, county, state, or country.
def reverse_with_http_info(lat, lon, format, normalizecity, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReverseApi.reverse ...' end # verify the required parameter 'lat' is set if @api_client.config.client_side_validation && lat.nil? f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_geocode\n do_lookup(true) do |o,rs|\n if r = rs.first\n unless r.address.nil?\n o.__send__ \"#{self.class.geocoder_options[:fetched_address]}=\", r.address\n end\n r.address\n end\n end\n end", "def reverse_geocode\n result = Geokit:...
[ "0.7564929", "0.7546099", "0.7291449", "0.72085553", "0.6912238", "0.6884488", "0.6855514", "0.6835236", "0.678736", "0.678736", "0.66437846", "0.66417956", "0.65688074", "0.65170014", "0.6274152", "0.60239655", "0.5925795", "0.58385664", "0.5733644", "0.5732255", "0.57130766...
0.5641033
24
GET /requests/devolutions/products/details/1 GET /requests/devolutions/products/details/1.json
def show @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.find(params[:id]) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n json_response(@api_v1_product)\n end", "def show\n @requests_transferences_products_detail = Requests::Transferences::Products::Detail.find(params[:id])\n respond_to do |format|\n format.html\n end\n end", "def show\n @product = Product.find(params[:id])\n json_respo...
[ "0.7218091", "0.7158551", "0.70554394", "0.6978709", "0.6977609", "0.69348764", "0.6933271", "0.6928328", "0.6925765", "0.69160664", "0.6910675", "0.6902752", "0.68951666", "0.6875545", "0.6854568", "0.68179977", "0.6794714", "0.67926866", "0.6785334", "0.6773074", "0.6760922...
0.7594424
0
GET /requests/devolutions/products/details/new GET /requests/devolutions/products/details/new.json
def new @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.new respond_to do |format| end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @product = Product.new\n\n render json: @product\n end", "def new\n get_product\n @product_detail = @product.details.new\n end", "def new\n @product = ProductProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n ...
[ "0.7427585", "0.73749167", "0.7350126", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.730964", "0.7...
0.7500732
0
POST /requests/devolutions/products/details POST /requests/devolutions/products/details.json
def create @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.new(params[:requests_devolutions_products_detail]) @requests_devolutions_products_detail.requests_devolutions_product = Requests::Devolutions::Product.find(params["header_id"]) @requests_devolutions_products_details =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.new\n respond_to do |format|\n end\n end", "def create\n get_product\n @product_detail = @product.details.create(params[:product_detail])\n end", "def create\n\n product_details = params.permit(:title,...
[ "0.71484536", "0.69727653", "0.6856084", "0.6842989", "0.6611098", "0.65442276", "0.6543582", "0.6534524", "0.6507852", "0.65026474", "0.65018326", "0.64723074", "0.64519846", "0.64393574", "0.6437788", "0.6427423", "0.63870835", "0.63652235", "0.63645047", "0.6362649", "0.63...
0.68423057
4
PUT /requests/devolutions/products/details/1 PUT /requests/devolutions/products/details/1.json
def update @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.find(params[:id]) @requests_devolutions_product = @requests_devolutions_products_detail.requests_devolutions_product; @requests_devolutions_products_details = @requests_devolutions_product.details.paginate(:page => pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "def update_products_details; end", "def update\n begin\n @api_v1_product.update!(api_v1_product_params)...
[ "0.72421026", "0.7078214", "0.69090635", "0.686018", "0.678667", "0.67352563", "0.66542846", "0.6654134", "0.6609205", "0.6443004", "0.6409627", "0.63984656", "0.63694954", "0.63638735", "0.6353361", "0.6352648", "0.6351733", "0.63419265", "0.63127553", "0.6309887", "0.629496...
0.6348054
17
return word with guesses filled in
def current_word #for each char in the word, either fill it in if its guessed or replace with '_' my_word = "" word.each_char do |c| if guesses.include? c my_word << c else my_word << "_" end end my_word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guessed_word()\r\n\t\tresult = ''\r\n\r\n\t\t# TODO: fill in method body\r\n\t\t\r\n\t\treturn result\r\n\tend", "def word_with_guesses\n word_to_display = ''\n self.word.chars do |letter|\n # if we find letter in the word to be in guessed letters\n # replace it with the actual letter\n ...
[ "0.8030174", "0.80026644", "0.788203", "0.7563455", "0.7493515", "0.7299315", "0.7279139", "0.7190165", "0.7189548", "0.7189548", "0.7189548", "0.7189548", "0.7153519", "0.7141275", "0.71179014", "0.71179014", "0.70854473", "0.7074733", "0.70745134", "0.70645607", "0.7062662"...
0.77189225
3
Check whether the maze has been solved
def target_reached? @current_value == @target_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert...
[ "0.7384006", "0.72615165", "0.72250617", "0.7160867", "0.695254", "0.6948034", "0.6912617", "0.6813264", "0.6771722", "0.67707443", "0.67015135", "0.6670485", "0.6668237", "0.66547185", "0.66277486", "0.6622541", "0.66212934", "0.66190505", "0.6603029", "0.6593161", "0.657934...
0.0
-1
Generate the next round of paths
def next_paths Operations.list.map do |operation| new_value = Operations.send(operation, @current_value) operation_history = @operation_history + [operation] Path.new(new_value, @target_value, operation_history: operation_history) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths(n)\n return nCr(2*(n-1),n)\nend", "def path(k)\n x = k\n y = 1 - k\n path = []\n direction = 1\n (k*8).times do |i|\n path.push(x.to_s + ';' + y.to_s)\n if direction == 1\n y += 1\n direction = 2 if y == k\n elsif direction == 2\n x -= 1\n direction = 3 if x * (-1) ...
[ "0.6833168", "0.65635276", "0.6379017", "0.63330495", "0.63083893", "0.62988335", "0.6287713", "0.6273768", "0.6251025", "0.61220175", "0.61073124", "0.61034083", "0.60669386", "0.60412073", "0.59958404", "0.5950208", "0.5924406", "0.58955294", "0.58699673", "0.5850981", "0.5...
0.71066934
0
GET /student_categories GET /student_categories.json
def index # @student_categories = StudentCategory.all respond_to do |format| format.html # index.html.erb format.json { render json: @student_categories } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n # @student_category = StudentCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_category }\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'cate...
[ "0.6934892", "0.6927601", "0.6902103", "0.674329", "0.66500926", "0.64506054", "0.64237016", "0.6378067", "0.63600516", "0.6348026", "0.63244313", "0.63234967", "0.63000333", "0.6292553", "0.62393785", "0.6192926", "0.6173628", "0.61670274", "0.615083", "0.6150037", "0.615003...
0.77031684
0
GET /student_categories/1 GET /student_categories/1.json
def show # @student_category = StudentCategory.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @student_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # @student_categories = StudentCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_categories }\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories',...
[ "0.7759597", "0.6814022", "0.6791496", "0.66728014", "0.66453403", "0.66340023", "0.6506893", "0.6480909", "0.64319426", "0.6423036", "0.6359196", "0.6353617", "0.6347104", "0.6327567", "0.6326933", "0.6326933", "0.63242084", "0.6309942", "0.6287733", "0.6257623", "0.6236738"...
0.73360837
1
GET /student_categories/new GET /student_categories/new.json
def new # @student_category = StudentCategory.new respond_to do |format| format.html # new.html.erb format.json { render json: @student_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # @student_category = StudentCategory.new(params[:student_category])\n\n respond_to do |format|\n if @student_category.save\n format.html { redirect_to @student_category, notice: 'Student category was successfully created.' }\n format.json { render json: @student_category, stat...
[ "0.75486434", "0.7330655", "0.7260932", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72467655", "0.72153485", "0.7145538", "0.710887", "0.7052048", "0.6957772", "0.6948832", "0.6942383", "0.6942383", "0.694...
0.78738594
0
POST /student_categories POST /student_categories.json
def create # @student_category = StudentCategory.new(params[:student_category]) respond_to do |format| if @student_category.save format.html { redirect_to @student_category, notice: 'Student category was successfully created.' } format.json { render json: @student_category, status: :create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mg_student_category = MgStudentCategory.new(mg_create_student_category_params)\n @mg_student_category.save\n redirect_to '/student_categories'\n\n \n end", "def index\n # @student_categories = StudentCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.66422796", "0.65858465", "0.65275466", "0.63772106", "0.6323289", "0.6309006", "0.6262785", "0.62537557", "0.623655", "0.61883944", "0.6133598", "0.6127766", "0.6109378", "0.61086607", "0.6081514", "0.60611075", "0.60261834", "0.6024759", "0.6021749", "0.6009296", "0.59765...
0.7259163
0
PUT /student_categories/1 PUT /student_categories/1.json
def update # @student_category = StudentCategory.find(params[:id]) respond_to do |format| if @student_category.update_attributes(params[:student_category]) format.html { redirect_to @student_category, notice: 'Student category was successfully updated.' } format.json { head :ok } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci...
[ "0.6710342", "0.64764243", "0.6471951", "0.6228575", "0.61961347", "0.61764073", "0.6159607", "0.6087562", "0.6031057", "0.60020834", "0.5995422", "0.59750146", "0.59722286", "0.5968835", "0.5929871", "0.59199893", "0.5916816", "0.5897858", "0.588357", "0.58741325", "0.586639...
0.70322895
0
DELETE /student_categories/1 DELETE /student_categories/1.json
def destroy # @student_category = StudentCategory.find(params[:id]) @student_category.destroy respond_to do |format| format.html { redirect_to student_categories_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @student_category.destroy\n respond_to do |format|\n format.html { redirect_to mg_student_categories_url, notice: 'successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.delete\n respond_to do |format|\n format.html { redir...
[ "0.7558042", "0.7288963", "0.7162421", "0.7134572", "0.7134572", "0.7134572", "0.7134572", "0.7104059", "0.7089248", "0.7079892", "0.7051919", "0.7047926", "0.70442444", "0.70442444", "0.70442444", "0.70442444", "0.70442444", "0.70442444", "0.70442444", "0.70442444", "0.70327...
0.7850941
0
Execute a search query against a search index
def search(builder) send_and_receive connection_config[:url], builder.blacklight_params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(index, query, options = {})\n raise NotImplementedError, 'Search has not been implemented'\n end", "def execute_search(query)\n search_resource.retrieve(query)\n end", "def search(index, body)\n handler.search index: index, body: body\n end", "def search(query); end...
[ "0.7664244", "0.74799204", "0.7432244", "0.7231149", "0.71710896", "0.7119934", "0.70745397", "0.7041897", "0.6940841", "0.693646", "0.6836037", "0.68158954", "0.6806255", "0.6720312", "0.6710814", "0.6685125", "0.6685125", "0.66830516", "0.6675249", "0.6671008", "0.66688955"...
0.0
-1
end of action say
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end() end", "def end; end", "def end; end", "def end; end", "def end\n end", "def end\n end", "def end\n end", "def end\n end", "def at_end; end", "def ends_with_goodbye\n /WRITE ME/\n end", "def act\n exit 1\n end", "def act\n exit 1\n end", "def done!(m...
[ "0.7374835", "0.7194678", "0.7194678", "0.7194678", "0.7107693", "0.706036", "0.706036", "0.703784", "0.6919161", "0.6805067", "0.6761479", "0.6761479", "0.6737829", "0.6705001", "0.66922545", "0.66743594", "0.66459185", "0.6605531", "0.66036904", "0.65987283", "0.65784043", ...
0.0
-1
Chooses the words that make up the password.
def choose_words(size: 4) chosen = words.sample(size) block_given? ? (yield chosen) : chosen end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_secret_word\n\t\tFile.read(\"5desk.txt\").lines.select {|word| (4..9).cover?(word.size)}.sample.strip\n\tend", "def pick_secret_word\n\t\t@secret_word = @dictionary.sample.chomp.downcase\n\t\t@secret_word.length\n\tend", "def is_valid_passchars?(passphrase)\n words = passphrase.split(' ').map { |word...
[ "0.6634776", "0.66284984", "0.66254437", "0.65524787", "0.654974", "0.65060174", "0.6445963", "0.6393818", "0.63682526", "0.632968", "0.63202065", "0.6303105", "0.6294683", "0.6282696", "0.6260989", "0.62464064", "0.62313306", "0.6196371", "0.61936104", "0.61721146", "0.61668...
0.0
-1
GET /cake_flavors GET /cake_flavors.json
def index @cake_flavors = CakeFlavor.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flavors()\n return get_request(address(\"/flavors/detail\"), @token)\t\n end", "def index\n @flavors = Flavor.all\n end", "def list_flavors_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/flavors/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception...
[ "0.78807485", "0.71675557", "0.70889527", "0.69904155", "0.6783881", "0.670636", "0.6580068", "0.652218", "0.6369831", "0.6318258", "0.63060945", "0.62686247", "0.6204976", "0.6161162", "0.6123502", "0.61148125", "0.61148125", "0.60916233", "0.6086261", "0.6080107", "0.606751...
0.7617719
1
GET /cake_flavors/1 GET /cake_flavors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flavors()\n return get_request(address(\"/flavors/detail\"), @token)\t\n end", "def index\n @cake_flavors = CakeFlavor.all\n end", "def index\n @flavors = Flavor.all\n end", "def show\n @flavor = compute.get_flavor(params[:id])\n\n respond_to do |format|\n format.html # show.ht...
[ "0.76378876", "0.7489924", "0.70809793", "0.70580685", "0.6725686", "0.6595451", "0.6561023", "0.65489906", "0.65204555", "0.6498862", "0.63780916", "0.63780916", "0.63148826", "0.63035715", "0.6289663", "0.62692475", "0.62571025", "0.6246953", "0.6245626", "0.61637634", "0.6...
0.0
-1
POST /cake_flavors POST /cake_flavors.json
def create @cake_flavor = CakeFlavor.new(cake_flavor_params) respond_to do |format| if @cake_flavor.save format.html { redirect_to @cake_flavor, notice: 'Cake flavor was successfully created.' } format.json { render :show, status: :created, location: @cake_flavor } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @flavor = Flavor.new(flavor_params)\n\n respond_to do |format|\n if @flavor.save\n format.html { redirect_to @flavor, notice: 'Flavor was successfully created.' }\n format.json { render :show, status: :created, location: @flavor }\n else\n format.html { render :new...
[ "0.716318", "0.70878196", "0.6626092", "0.6584757", "0.65699923", "0.65650886", "0.6531805", "0.6441508", "0.6396541", "0.6383742", "0.629688", "0.61868054", "0.60363275", "0.6026922", "0.6013406", "0.6013406", "0.5935032", "0.5909869", "0.5831824", "0.58270085", "0.5799477",...
0.7437367
0
PATCH/PUT /cake_flavors/1 PATCH/PUT /cake_flavors/1.json
def update respond_to do |format| if @cake_flavor.update(cake_flavor_params) format.html { redirect_to @cake_flavor, notice: 'Cake flavor was successfully updated.' } format.json { render :show, status: :ok, location: @cake_flavor } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @flavor = Flavor.find(params[:id])\n\n respond_to do |format|\n if @flavor.update_attributes(params[:flavor])\n format.html { redirect_to @flavor, :notice => 'Flavor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"...
[ "0.6868971", "0.67433983", "0.65769887", "0.6314366", "0.6303884", "0.61911196", "0.6128536", "0.6128536", "0.60558414", "0.5978746", "0.5922216", "0.58937526", "0.5844243", "0.58376735", "0.5712817", "0.5701882", "0.5693686", "0.5693686", "0.5690351", "0.5690351", "0.5690351...
0.7133959
0
DELETE /cake_flavors/1 DELETE /cake_flavors/1.json
def destroy @cake_flavor.destroy respond_to do |format| format.html { redirect_to cake_flavors_url, notice: 'Cake flavor was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end", "def destroy\n @frosting_flavor.destroy\n respond_to do |format|\n format.html { redirect_to frosting_flavors_url, n...
[ "0.7586125", "0.7065672", "0.7026094", "0.6979786", "0.69694257", "0.68794614", "0.68777996", "0.682137", "0.6812025", "0.67566043", "0.6740801", "0.66935563", "0.6620424", "0.65605843", "0.6536122", "0.6529574", "0.64735293", "0.6461297", "0.6457156", "0.6454956", "0.6434088...
0.78703517
0
Use callbacks to share common setup or constraints between actions.
def set_cake_flavor @cake_flavor = CakeFlavor.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Only allow a list of trusted parameters through.
def cake_flavor_params params.require(:cake_flavor).permit(:flavor_name) 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
GET /product_classifies GET /product_classifies.json
def index search_txt = params['search_txt'] if search_txt != nil && search_txt != "" @search_txt = search_txt @product_classifies = ProductClassify.where("name LIKE '%#{search_txt}%'").order("created_at desc").page params[:page] else @product_classifies = ProductClassify.order("created_at ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product_classify = ProductClassify.new(product_classify_params)\n\n respond_to do |format|\n if @product_classify.save\n format.html { redirect_to :product_classifies, notice: '产品分类添加成功。' }\n format.json { render :show, status: :created, location: @product_classify }\n e...
[ "0.6844924", "0.6745986", "0.62244594", "0.60901225", "0.5894066", "0.5810741", "0.5747263", "0.57136434", "0.5658734", "0.5658734", "0.5609556", "0.556197", "0.5499586", "0.546859", "0.54645693", "0.5433276", "0.542446", "0.5407946", "0.53917056", "0.53910464", "0.5390255", ...
0.50745887
83
GET /product_classifies/1 GET /product_classifies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_product_classify\n @product_classify = ProductClassify.find(params[:id])\n end", "def create\n @product_classify = ProductClassify.new(product_classify_params)\n\n respond_to do |format|\n if @product_classify.save\n format.html { redirect_to :product_classifies, notice: '产品分类添加...
[ "0.67501", "0.6646705", "0.62797654", "0.61795616", "0.6048743", "0.5894845", "0.58254766", "0.58219004", "0.5773847", "0.5773847", "0.5762598", "0.5757497", "0.5748493", "0.5729011", "0.571064", "0.56998605", "0.5691853", "0.56774294", "0.5668963", "0.56607413", "0.5651636",...
0.0
-1
POST /product_classifies POST /product_classifies.json
def create @product_classify = ProductClassify.new(product_classify_params) respond_to do |format| if @product_classify.save format.html { redirect_to :product_classifies, notice: '产品分类添加成功。' } format.json { render :show, status: :created, location: @product_classify } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_product_classify\n @product_classify = ProductClassify.find(params[:id])\n end", "def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }...
[ "0.6588511", "0.64679235", "0.6444138", "0.639454", "0.6318923", "0.61670583", "0.6091584", "0.60356516", "0.6025881", "0.59911597", "0.5871508", "0.58268404", "0.57872295", "0.57741004", "0.5759996", "0.57037616", "0.5698544", "0.56933355", "0.5682692", "0.5638086", "0.56380...
0.75399023
0