query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
GET /user_biographies/1 GET /user_biographies/1.json | def show
@user_biography = UserBiography.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user_biography }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def new\n @user_biography = UserBiography.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json... | [
"0.644018",
"0.6396032",
"0.6361036",
"0.63073796",
"0.62759113",
"0.62329787",
"0.61055005",
"0.60451716",
"0.59533983",
"0.58362174",
"0.58237267",
"0.58040273",
"0.57759655",
"0.5772738",
"0.57715225",
"0.57408094",
"0.56855345",
"0.56695676",
"0.5669275",
"0.56559336",
"0... | 0.70377785 | 0 |
GET /user_biographies/new GET /user_biographies/new.json | def new
@user_biography = UserBiography.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_biography }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n ... | [
"0.6884423",
"0.688118",
"0.6829219",
"0.68197525",
"0.67852134",
"0.67106146",
"0.6710588",
"0.6694529",
"0.66929626",
"0.667535",
"0.66709125",
"0.66633976",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66444045",
"0.66369414",
"0.6634766",
"0.6634766",
"0.6618654",
"0.6609... | 0.75278735 | 0 |
PUT /user_biographies/1 PUT /user_biographies/1.json | def update
@user_biography = UserBiography.find(params[:id])
respond_to do |format|
if @user_biography.update_attributes(params[:user_biography])
format.html { redirect_to @user_biography, notice: 'User biography was successfully updated.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n if @bio.update_attributes(params[:bio])\n format.html { redirect_to @bio.user.profile, notice: 'Bio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edi... | [
"0.6728715",
"0.61430943",
"0.6076785",
"0.6006197",
"0.5944847",
"0.5944847",
"0.59333885",
"0.59219307",
"0.59190124",
"0.5903632",
"0.58626586",
"0.5792056",
"0.5694102",
"0.56844187",
"0.5684088",
"0.5627282",
"0.5609686",
"0.55957776",
"0.5563816",
"0.5562741",
"0.555432... | 0.69388103 | 0 |
DELETE /user_biographies/1 DELETE /user_biographies/1.json | def destroy
@user_biography = UserBiography.find(params[:id])
@user_biography.destroy
respond_to do |format|
format.html { redirect_to user_biographies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @biography.destroy\n respond_to do |format|\n format.html { redirect_to admin_biographies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to bios_u... | [
"0.7078497",
"0.684274",
"0.6570586",
"0.6549361",
"0.6459091",
"0.6452129",
"0.6434868",
"0.6414489",
"0.6368596",
"0.63259935",
"0.6324762",
"0.6265212",
"0.62557817",
"0.62532383",
"0.6248457",
"0.6214569",
"0.6174089",
"0.61298287",
"0.6116617",
"0.61144644",
"0.61012375"... | 0.7754777 | 0 |
GET /instructors GET /instructors.json | def index
@instructors = Instructor.all(:order => :name)
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @instructors }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @instructors = Instructor.all\n end",
"def index\n @section_instructors = SectionInstructor.all\n end",
"def show\n render json: @instructor\n end",
"def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format... | [
"0.7474448",
"0.72173893",
"0.7175054",
"0.70918465",
"0.70283026",
"0.6961625",
"0.69567657",
"0.69409734",
"0.69235194",
"0.69104546",
"0.68709964",
"0.684239",
"0.68309546",
"0.67133147",
"0.67078835",
"0.66748357",
"0.6630658",
"0.6601479",
"0.65697086",
"0.65195835",
"0.... | 0.7403752 | 1 |
DELETE /instructors/1 DELETE /instructors/1.json | def destroy
@instructor = Instructor.find(params[:id])
@instructor.destroy
respond_to do |format|
format.html { redirect_to instructors_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instruc... | [
"0.7996455",
"0.79741395",
"0.79579455",
"0.7898916",
"0.7898916",
"0.77079374",
"0.76391745",
"0.75418645",
"0.7397706",
"0.7370281",
"0.7235165",
"0.7205407",
"0.7058448",
"0.6970631",
"0.6963942",
"0.6914965",
"0.6912169",
"0.6902971",
"0.6870069",
"0.6862512",
"0.684864",... | 0.8137119 | 0 |
dscl . read /Groups/ladmins | def group_get_info(attribs, dir_info)
attribs = group_record_name_alternatives(attribs)
check_critical_attribute( attribs, :record_name )
command = {action: 'read', scope: 'Groups', value: nil}
user_attrs = attribs.merge(command)
dscl( user_attrs, dir_info )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end",
"def get_nodegroups()\n nodemgr_res... | [
"0.5869755",
"0.5858927",
"0.58041286",
"0.57643944",
"0.5731714",
"0.5700018",
"0.56217474",
"0.55706805",
"0.55501926",
"0.54923594",
"0.54857326",
"0.54787624",
"0.5444364",
"0.5424681",
"0.54155844",
"0.53593093",
"0.53563887",
"0.5346893",
"0.53294224",
"0.53145015",
"0.... | 0.61652225 | 0 |
dscl . delete /Groups/yourGroupName | def group_delete(attribs, dir_info)
attribs = group_record_name_alternatives(attribs)
check_critical_attribute( attribs, :record_name )
command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}
user_attrs = attribs.merge(command)
dscl( user_attrs, dir_info )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n ... | [
"0.7440654",
"0.7241825",
"0.7211262",
"0.7123508",
"0.7112543",
"0.7112543",
"0.71104467",
"0.70682937",
"0.7066243",
"0.7046521",
"0.7028241",
"0.701744",
"0.70083165",
"0.6990598",
"0.69859797",
"0.6957801",
"0.69464016",
"0.69464016",
"0.6940704",
"0.6863574",
"0.68242246... | 0.7430047 | 1 |
GET /charts/new GET /charts/new.xml | def new
@chart = Chart.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @chart }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @chart = Chart.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end",
"def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chart }\n end\n ... | [
"0.77033484",
"0.7309915",
"0.7306113",
"0.7275111",
"0.70852625",
"0.7053791",
"0.6977749",
"0.6737508",
"0.6737508",
"0.6737508",
"0.660809",
"0.66072446",
"0.6556984",
"0.6495462",
"0.6344661",
"0.6333267",
"0.63040686",
"0.63040686",
"0.6276543",
"0.625858",
"0.625858",
... | 0.77778155 | 1 |
Returns the connection that corresponds to the given EMS identifier and options. The connection will be created if doesn't exist yet. If the connection already exists, but the given options are different to the options that were used to create it, then it will be closed and created again. This is intended to support up... | def get(id, opts)
# Purge connections if needed:
purge if purge?
# Find the entry for the given id and return it if the options are compatible:
entry = @registry[id]
return entry.connection if entry && entry.compatible?(opts)
# If there is an entry but it isn't compatible, then close and remov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end",
"def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[WinRM] shutting previous conn... | [
"0.61312765",
"0.5736034",
"0.56035495",
"0.55937487",
"0.550592",
"0.549464",
"0.54722667",
"0.5441871",
"0.535668",
"0.52862924",
"0.52640533",
"0.52551687",
"0.5240386",
"0.5175389",
"0.5153329",
"0.5129178",
"0.5091268",
"0.50633556",
"0.5057974",
"0.5056725",
"0.5048977"... | 0.72336143 | 0 |
Closes the connection associated to the given EMS id. | def close(id)
entry = @registry.delete(id)
return unless entry
begin
$rhevm_log.info("Closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}'.")
entry.connection.close
rescue OvirtSDK4::Error => error
$rhevm_log.warn(
"Error while closing connection ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(id)\n wf_event_id?(id)\n api.post([id, 'close'].uri_concat)\n end",
"def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end",
"def close_conne... | [
"0.64190793",
"0.6231773",
"0.6159994",
"0.6136389",
"0.6118631",
"0.6106486",
"0.60919684",
"0.60472023",
"0.60431606",
"0.6028157",
"0.5995724",
"0.59579116",
"0.59545505",
"0.5945803",
"0.5933718",
"0.59191465",
"0.58832866",
"0.5883167",
"0.58707285",
"0.58483255",
"0.584... | 0.8365954 | 0 |
Checks if the this entry is compatible with the given options. A connection is compatible if it the options that were used to create it are exactly the same than the given options. | def compatible?(opts)
opts == @options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compatible?(other)\n false\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return f... | [
"0.6074165",
"0.6045599",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.561666",
"0.5525309",
"0.5525309",
"0.5525309",
"0.5499034",
"0.544034",
"0.54343796",
"0.54343796",
"0.542... | 0.75475293 | 0 |
Checks if it is time to purge connections that correspond to EMSs that no longer exist in the database. | def purge?
Time.current - @purge_time > @purge_interval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge\n # Get the identifiers of the EMS from the database and from the registry, and calculate the difference:\n database_ids = ManageIQ::Providers::Ovirt::InfraManager.pluck(:id)\n registry_ids = @registry.keys\n purged_ids = registry_ids - database_ids\n\n # Close the connections:\n purged... | [
"0.70933026",
"0.61687094",
"0.6096776",
"0.590582",
"0.5902677",
"0.58976835",
"0.58303976",
"0.57569265",
"0.5739425",
"0.57245564",
"0.5702364",
"0.5696099",
"0.56932616",
"0.5691575",
"0.5691043",
"0.5627115",
"0.5594837",
"0.55646896",
"0.55571216",
"0.55569404",
"0.5541... | 0.63257563 | 1 |
Returns the settings of the connection manager. | def settings
::Settings.ems.ems_ovirt.connection_manager
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings\n @settings_manager\n end",
"def get_settings\n settings.get\n end",
"def get_settings\n @bridge.get_settings\n end",
"def settings\n return @settings\n end",
"def settings\n return @settings\n end",
... | [
"0.7442025",
"0.6843902",
"0.6825964",
"0.6815452",
"0.6815452",
"0.6766492",
"0.67414266",
"0.6664022",
"0.66578126",
"0.6616409",
"0.6517596",
"0.6456353",
"0.6438402",
"0.64383745",
"0.63868517",
"0.63868517",
"0.638044",
"0.6369448",
"0.6369448",
"0.6365058",
"0.6349014",... | 0.71007746 | 1 |
GET /construction_expenses GET /construction_expenses.json | def index
@construction_expenses = ConstructionExpense.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def create\n @construction_expense = ConstructionExpense.new(construction_expense_params)\n\n respond_to do |format|\n if @construction_expense.save\n format.html { redirect_to root_path, notice: 'Construction ex... | [
"0.6659299",
"0.6520159",
"0.65055424",
"0.64795685",
"0.6426143",
"0.6382438",
"0.63674146",
"0.63465184",
"0.62532586",
"0.6242231",
"0.62382334",
"0.6213262",
"0.6213234",
"0.6207032",
"0.6184197",
"0.61797196",
"0.61617935",
"0.61617935",
"0.61617935",
"0.61617935",
"0.61... | 0.6559654 | 1 |
POST /construction_expenses POST /construction_expenses.json | def create
@construction_expense = ConstructionExpense.new(construction_expense_params)
respond_to do |format|
if @construction_expense.save
format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' }
format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n ... | [
"0.69896954",
"0.69765955",
"0.69157416",
"0.66434765",
"0.6574246",
"0.65408623",
"0.6496539",
"0.64624095",
"0.6363663",
"0.6356102",
"0.6346727",
"0.6338695",
"0.6337026",
"0.6293627",
"0.62786674",
"0.62495375",
"0.6247721",
"0.6238824",
"0.62264425",
"0.6225141",
"0.6202... | 0.7696556 | 0 |
DELETE /construction_expenses/1 DELETE /construction_expenses/1.json | def destroy
@construction_expense.destroy
respond_to do |format|
format.html { redirect_to construction_expenses_url, notice: 'Construction expense was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html ... | [
"0.7375016",
"0.7301809",
"0.73000616",
"0.73000616",
"0.7262738",
"0.7252981",
"0.7248885",
"0.7248885",
"0.7145355",
"0.7112137",
"0.70849514",
"0.7055886",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.69821775",
"0.6977332",
"0.695557",
... | 0.7442039 | 0 |
GET /everydays GET /everydays.json | def index
@everydays = Everyday.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n ... | [
"0.66841364",
"0.65996456",
"0.6409283",
"0.6333991",
"0.62007236",
"0.61959934",
"0.6188859",
"0.61742467",
"0.61663413",
"0.6161771",
"0.61412436",
"0.6059106",
"0.60513824",
"0.5995897",
"0.5991781",
"0.59844416",
"0.59807616",
"0.59723216",
"0.59380704",
"0.5926723",
"0.5... | 0.7274144 | 0 |
POST /everydays POST /everydays.json | def create
@everyday = Everyday.new(everyday_params)
respond_to do |format|
if @everyday.save
format.html { redirect_to :back, notice: 'Everyday was successfully created.' }
format.json { render :show, status: :created, location: :back }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params... | [
"0.60896844",
"0.59003717",
"0.58973724",
"0.57750404",
"0.57136077",
"0.5689553",
"0.56647605",
"0.5659476",
"0.5605483",
"0.54992175",
"0.5485113",
"0.5469261",
"0.54659045",
"0.54556376",
"0.5435531",
"0.54342586",
"0.5425583",
"0.54221326",
"0.5417237",
"0.540463",
"0.540... | 0.6630837 | 0 |
PATCH/PUT /everydays/1 PATCH/PUT /everydays/1.json | def update
respond_to do |format|
if @everyday.update(everyday_params)
format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }
format.json { render :show, status: :ok, location: :back }
else
format.html { render :edit }
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end",
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tas... | [
"0.6328196",
"0.6328081",
"0.6133792",
"0.611257",
"0.5963384",
"0.5951463",
"0.5947674",
"0.5879265",
"0.5850053",
"0.58497775",
"0.58165795",
"0.580463",
"0.5785597",
"0.5773269",
"0.5760348",
"0.57367593",
"0.5730971",
"0.57227343",
"0.57154465",
"0.56800395",
"0.56774",
... | 0.6927426 | 0 |
DELETE /everydays/1 DELETE /everydays/1.json | def destroy
@everyday.destroy
respond_to do |format|
format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.... | [
"0.69665116",
"0.67102396",
"0.66386753",
"0.6553476",
"0.65202314",
"0.6462715",
"0.646062",
"0.64455366",
"0.6442089",
"0.64065385",
"0.63933307",
"0.63892376",
"0.6362518",
"0.63495654",
"0.6343083",
"0.6332661",
"0.63257277",
"0.6316366",
"0.63014525",
"0.62983966",
"0.62... | 0.71945614 | 0 |
GET /resource_import_files GET /resource_import_files.json | def index
@resource_import_files = ResourceImportFile.page(params[:page])
respond_to do |format|
format.html # index.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if request.format.text?\n @resource_import_results = @resource_import_file.resource_import_results\n else\n @resource_import_results = @resource_import_fil... | [
"0.65673685",
"0.63847166",
"0.6238196",
"0.6160717",
"0.6133016",
"0.6123933",
"0.6122611",
"0.6096373",
"0.6085375",
"0.60096335",
"0.5826483",
"0.5823359",
"0.58093315",
"0.58054435",
"0.5777549",
"0.5763998",
"0.5763272",
"0.57436293",
"0.5695138",
"0.5695138",
"0.5695138... | 0.70251775 | 0 |
POST /resource_import_files POST /resource_import_files.json | def create
@resource_import_file = ResourceImportFile.new(resource_import_file_params)
@resource_import_file.user = current_user
respond_to do |format|
if @resource_import_file.save
if @resource_import_file.mode == 'import'
ResourceImportFileJob.perform_later(@resource_import_file)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_import_params\n params.permit(:file)\n end",
"def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestr... | [
"0.66359407",
"0.6210905",
"0.61485267",
"0.61209726",
"0.60407674",
"0.60240185",
"0.6018459",
"0.5925431",
"0.59234285",
"0.58760333",
"0.58420527",
"0.5828545",
"0.5824298",
"0.58238655",
"0.5813659",
"0.58081394",
"0.57994705",
"0.5795284",
"0.5773734",
"0.5766934",
"0.57... | 0.68423814 | 0 |
PUT /resource_import_files/1 PUT /resource_import_files/1.json | def update
respond_to do |format|
if @resource_import_file.update(resource_import_file_params)
if @resource_import_file.mode == 'import'
ResourceImportFileJob.perform_later(@resource_import_file)
end
format.html { redirect_to @resource_import_file, notice: t('controller.succe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @resource_import_file = ResourceImportFile.new(resource_import_file_params)\n @resource_import_file.user = current_user\n\n respond_to do |format|\n if @resource_import_file.save\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_i... | [
"0.6438908",
"0.6217954",
"0.6214161",
"0.6188599",
"0.60518265",
"0.60505116",
"0.60078007",
"0.59259033",
"0.589679",
"0.5834578",
"0.5829367",
"0.5814859",
"0.58146626",
"0.58146626",
"0.5807853",
"0.5791179",
"0.5754489",
"0.5743385",
"0.5727049",
"0.56840557",
"0.5667648... | 0.6792846 | 0 |
DELETE /resource_import_files/1 DELETE /resource_import_files/1.json | def destroy
@resource_import_file.destroy
respond_to do |format|
format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format... | [
"0.7266368",
"0.71524155",
"0.71393204",
"0.71231097",
"0.70842123",
"0.67905974",
"0.6733849",
"0.67136604",
"0.6695157",
"0.66710293",
"0.66710293",
"0.66710293",
"0.6636724",
"0.66088045",
"0.6603813",
"0.6593575",
"0.65913576",
"0.6543522",
"0.6518902",
"0.65058625",
"0.6... | 0.75656533 | 0 |
return the new version and the reasons | def new_version
%w(major minor patch).each do |level|
changes = git_changelog.select(&"#{level}?".to_sym)
return [ last_release.send("#{level}!"), changes ] if changes.size > 0
end
raise "No commit since last release (#{last_release})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_version; end",
"def get_version()\n\t\tend",
"def version_mismatch_detected\n end",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n des_version = Mixlib::Versioning.parse(desired_version)\n Chef::Log.debug(\"The current chef-client ... | [
"0.67777437",
"0.6207351",
"0.61994094",
"0.6154905",
"0.614534",
"0.6111828",
"0.61111784",
"0.6100825",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0... | 0.63348883 | 1 |
This confirmation method saves user's accont details | def confirm
@profiles=@current_user.user_profile.update_attributes(params[:body])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show \n @user.confirmed = true\n @user.save!\n Session.create(@user)\n flash[:notice] = \"Thanks, your email address has been confirmed.\" \n redirect_to dashboard_url \n end",
"def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.sa... | [
"0.6479514",
"0.6477246",
"0.639822",
"0.6364255",
"0.6328995",
"0.6306834",
"0.6261867",
"0.62605214",
"0.6229507",
"0.62193197",
"0.62167263",
"0.6208338",
"0.6168529",
"0.6163406",
"0.6126741",
"0.61217546",
"0.6110658",
"0.6105941",
"0.6090884",
"0.60697573",
"0.6065104",... | 0.6491109 | 0 |
We need to keep flipping pairs of right handed digits (lower weight digits) until we get a net big number Example for 144 iteration 1 Flip digit index 1 and index 2 Results in 144 which is still not greater than the input Flip digit index 2 and index 3 Results in 414 which is greater than the input When choosing right ... | def next_bigger(input)
puts "input = #{input}"
puts '------------------'
puts
puts
digits = input.to_s.chars.map(&:to_i)
return -1 if all_digits_are_the_same?(digits)
result = input
tail = -1
next_tail = -1
next_tail_digit = nil
puts 'Starting iterations to find the bigger number by permutatin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev_permutation(base_two_num)\n if has_dynamic_one?(base_two_num)\n shift_final_dynamic_one_right(base_two_num)\n else\n nil\n end\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the secon... | [
"0.6296871",
"0.6258146",
"0.6184225",
"0.6143546",
"0.6032066",
"0.6024654",
"0.595173",
"0.5880662",
"0.58781",
"0.58739847",
"0.58723515",
"0.5839862",
"0.5827098",
"0.582495",
"0.5812143",
"0.5776322",
"0.5770169",
"0.57680273",
"0.5763032",
"0.57508713",
"0.57406664",
... | 0.7155519 | 0 |
if all the digits are the same we dont need to compute since the number cant get bigger with permutations | def all_digits_are_the_same?(digits)
digits.uniq.length == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t... | [
"0.75402224",
"0.700527",
"0.6970922",
"0.69567573",
"0.6949266",
"0.6896659",
"0.68623435",
"0.6803344",
"0.6782188",
"0.6712885",
"0.6709224",
"0.6632845",
"0.6614503",
"0.6580868",
"0.6553198",
"0.6552078",
"0.6533141",
"0.65062344",
"0.64961547",
"0.64924717",
"0.64579296... | 0.7354844 | 1 |
returns hash of product_id to applicable_aptc mappings | def fetch_applicable_aptcs
raise "Cannot process without selected_aptc: #{@selected_aptc} and product_ids: #{@product_ids}" if @selected_aptc.nil? || @product_ids.empty?
@available_aptc ||= fetch_available_eligibility[:total_available_aptc]
# TODO: Return a has of plan_id, applicable aptcs.
@p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end",
"def product_attributes\n {:name => 'cute pants', :set_keywords => 'test,one,two,three', :product_type_id => 1, :prototype_id => nil, :shipping_category_id => 1, :per... | [
"0.6114954",
"0.6021619",
"0.60075164",
"0.59829146",
"0.5925083",
"0.58695465",
"0.5729365",
"0.5707065",
"0.5676723",
"0.56283903",
"0.56198275",
"0.5571299",
"0.5568204",
"0.554091",
"0.55207896",
"0.5483079",
"0.5442803",
"0.54305035",
"0.54273766",
"0.54226065",
"0.54206... | 0.6416084 | 0 |
Queue a block for later rendering, such as within a template. My overridden Step 2 | | Anonymous Step 4 Step 1 | Step 2 | Step 3 Options: [+args+] The options to pass in when this block is rendered. These will override any options provided to the actual block definition. Any or all of these options may be overriden by ... | def queue(*args, &block)
self.queued_blocks << self.define_block_container(*args, &block)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue(*args, &block)\n @queue << [block, args]\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end",
"def queue(cls, arg... | [
"0.6648659",
"0.5926518",
"0.5844823",
"0.5758021",
"0.5703705",
"0.5556514",
"0.544405",
"0.53941107",
"0.53938216",
"0.5380421",
"0.535426",
"0.534299",
"0.5342282",
"0.53134775",
"0.5243458",
"0.52186733",
"0.5210667",
"0.5175211",
"0.5163711",
"0.5163711",
"0.51481503",
... | 0.7304012 | 0 |
Determines the cosine similarity between two 2D points | def cosine_similarity(x1, y1, x2, y2)
dp = (x1 * x2) + (y1 * y2)
mag1 = Math.sqrt((x1 ** 2) + (y1 ** 2))
mag2 = Math.sqrt((x2 ** 2) + (y2 ** 2))
return 0 if mag1 == 0 || mag2 == 0
return (dp / (mag1 * mag2))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cosine_similarity(a, b)\n dot_product(a, b) / (magnitude(a) * magnitude(b))\n end",
"def cosine_similarity(a, b)\n dot_product(a, b) / (magnitude(a) * magnitude(b))\n end",
"def similarity(m1, m2)\n if m1.is_a?(SparseVector) && m2.is_a?(SparseVector)\n m1.cosine(m2)\n elsif m2.size... | [
"0.8034275",
"0.7986059",
"0.77400726",
"0.6768125",
"0.6572465",
"0.6499431",
"0.6405404",
"0.6400117",
"0.6396458",
"0.62918776",
"0.6283614",
"0.62747246",
"0.6256415",
"0.62494326",
"0.62181467",
"0.61797374",
"0.61274666",
"0.6113292",
"0.60792285",
"0.6063917",
"0.60317... | 0.84118295 | 0 |
Retorna el class del glyphicons segun el estado | def class_glyphicon
if self.state==0
return "plus"
elsif self.state==4
return "usd"
elsif self.state==2
return "ok"
elsif self.state==6
return "remove"
elsif self.state==5
return "ban-circle"
elsif self.state >= 10
return "repeat"
else
return "refres... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon_class\n icon_name = options[:name].to_s.gsub(\"_\",\"-\")\n %(glyphicon glyphicon-#{icon_name})\n end",
"def glyph(*names)\n content_tag :i, nil, :class => names.map{|name| \"icon-#{name.to_s.gsub('_','-')}\" }\n end",
"def glyph(*names)\n names.map! { |name| name.to_s.... | [
"0.7206846",
"0.6664937",
"0.65353954",
"0.65198654",
"0.6465797",
"0.6355318",
"0.6295455",
"0.62533677",
"0.62533677",
"0.62043613",
"0.616539",
"0.6163922",
"0.61540806",
"0.6143081",
"0.6136291",
"0.6088974",
"0.60736835",
"0.60709745",
"0.60358864",
"0.5956385",
"0.59470... | 0.7217255 | 0 |
GET /ingest_responses GET /ingest_responses.json | def index
@ingest_responses = IngestResponse.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ingest_response\n @ingest_response = IngestResponse.find(params[:id])\n end",
"def index\n \t @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def i... | [
"0.6515588",
"0.60847807",
"0.60614514",
"0.60614514",
"0.60614514",
"0.60614514",
"0.60614514",
"0.5902247",
"0.5891604",
"0.582929",
"0.56824917",
"0.56651634",
"0.557289",
"0.5526349",
"0.5506483",
"0.54971033",
"0.5465042",
"0.5457023",
"0.5453789",
"0.5446981",
"0.542826... | 0.81750965 | 0 |
POST /ingest_responses POST /ingest_responses.json | def create
@ingest_response = IngestResponse.new(ingest_response_params)
respond_to do |format|
if @ingest_response.save
format.html { redirect_to @ingest_response, notice: 'Ingest response was successfully created.' }
format.json { render :show, status: :created, location: @ingest_respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ingest_responses = IngestResponse.all\n end",
"def set_ingest_response\n @ingest_response = IngestResponse.find(params[:id])\n end",
"def ingest_response_params\n params.require(:ingest_response).permit(:as_text, :status, :response_time, :staging_key, :medusa_key, :uuid)\n end"... | [
"0.7223385",
"0.6324191",
"0.6312431",
"0.552291",
"0.552291",
"0.5518179",
"0.530941",
"0.5275091",
"0.52131504",
"0.518487",
"0.5158459",
"0.5145443",
"0.51450044",
"0.51450044",
"0.51450044",
"0.51450044",
"0.51450044",
"0.51211786",
"0.5107418",
"0.5050699",
"0.5036456",
... | 0.69198775 | 1 |
PATCH/PUT /ingest_responses/1 PATCH/PUT /ingest_responses/1.json | def update
respond_to do |format|
if @ingest_response.update(ingest_response_params)
format.html { redirect_to @ingest_response, notice: 'Ingest response was successfully updated.' }
format.json { render :show, status: :ok, location: @ingest_response }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n do_patch { return } # check if patch and do submission ... | [
"0.6083744",
"0.5950145",
"0.5934527",
"0.59344417",
"0.58723164",
"0.5792061",
"0.5656362",
"0.5656362",
"0.5656362",
"0.5656362",
"0.5606245",
"0.5606245",
"0.5606245",
"0.55593866",
"0.55476916",
"0.5492757",
"0.54772055",
"0.5461109",
"0.5461109",
"0.5461109",
"0.54610384... | 0.67990434 | 0 |
DELETE /ingest_responses/1 DELETE /ingest_responses/1.json | def destroy
@ingest_response.destroy
respond_to do |format|
format.html { redirect_to ingest_responses_url, notice: 'Ingest response was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.6731728",
"0.6626552",
"0.64880794",
"0.6423129",
"0.6399173",
"0.62966645",
"0.6229124",
"0.61818004",
"0.6180125",
"0.6163293",
"0.6163293",
"0.6163293",
"0.6156403",
"0.6150439",
"0.6148755",
"0.61337453",
"0.61186403",
"0.6112589",
"0.61070114",
"0.61032355",
"0.609237... | 0.73371166 | 0 |
Logs a message using RDFMapper::Logger | def log(severity, message)
timestamp = Time.now.strftime('%m-%d %H:%M:%S')
formatted = "[%s] %s | %s" % [timestamp, self.class.name, message]
RDFMapper::Logger::Configuration.target.add(severity, formatted)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(message); logger.info(message); end",
"def log_message(message)\r\n @log.log_message(message)\r\n end",
"def log(message)\n @logger.info message\n end",
"def log(msg)\n @logger.write(msg) if @logger\n end",
"def do_log( msg )\n log( msg )\n end",
"def log(msg)\n ... | [
"0.7080732",
"0.67737305",
"0.674578",
"0.6687699",
"0.6651415",
"0.66322875",
"0.66228396",
"0.6581298",
"0.6540793",
"0.6519941",
"0.6499634",
"0.6468031",
"0.6461623",
"0.6452612",
"0.6447722",
"0.64401096",
"0.64187324",
"0.6415404",
"0.6411733",
"0.637741",
"0.63615495",... | 0.71645135 | 0 |
get test tweet with given tweet ids | def get_test_tweet(tweet_ids)
data = Tweet.where(id: tweet_ids)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweet(postids)\n handle_response(get(\"/content/tweet.json\", :query => {:postids => postids}))\n end",
"def retweeters_of(id, options={})\n ids_only = !!(options.delete(:ids_only))\n perform_get(\"statuses/#{id}/retweeted_by#{\"/ids\" if ids_only}.#{Twitter.format}\", options)\n end",
... | [
"0.7020693",
"0.6747889",
"0.66181135",
"0.64552146",
"0.6424763",
"0.6413869",
"0.6283739",
"0.62591636",
"0.62306535",
"0.62152284",
"0.61893",
"0.6187976",
"0.61733675",
"0.6167148",
"0.6132367",
"0.61268806",
"0.61173344",
"0.60308075",
"0.60113484",
"0.60032547",
"0.5980... | 0.8826714 | 0 |
Case 1: Check Profile menu item visible in User dropdown | def test_00010_profilepage_profile_option
@profile_page.user_dropdown.when_present.click
assert @profile_page.profile_link.present?
ensure
# close up the context menu
@profile_page.user_dropdown.click if @profile_page.profile_link.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_profile_menu\n id(\"profile_menu_btn\").wait_until(&:present?)\n id(\"profile_menu_btn\").click\n @browser.nav(css: \".drop_menu_nav.active\").wait_until(&:present?)\n sleep 1\n end",
"def check_own_page(u)\n login_as(u, scope: :user)\n check_profile_enab... | [
"0.66012824",
"0.6420858",
"0.6390645",
"0.63868964",
"0.6378446",
"0.6376455",
"0.6352999",
"0.6343482",
"0.6328269",
"0.619763",
"0.6178944",
"0.6178439",
"0.6163682",
"0.6160614",
"0.6154906",
"0.6148201",
"0.61347455",
"0.61069334",
"0.61069334",
"0.6082732",
"0.6080188",... | 0.66955787 | 0 |
============ ADMIN USER PROFILE FEILD TESTS ========================== | def test_00070_add_feild_as_show_feild
first_name = @c.users[user_for_test].name.split(' ')[0]
# set first name feild as not show
@admin_profile_page.navigate_in
@admin_profile_page.custom_profile_feild "First Name", {0 => false }
# admin can't see first name feild
@profile_page.goto_profile
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user_profile\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !@app.is_admin or @app.is_admin === 0\n redirect_to '/error_page'\n end\n\n # Get User from DB\n @user = User.find(params[:user_id])\n\n # Get... | [
"0.6697282",
"0.66837656",
"0.6680589",
"0.66439736",
"0.6575091",
"0.654461",
"0.65170854",
"0.64440066",
"0.64037865",
"0.635303",
"0.635303",
"0.63437724",
"0.63131416",
"0.6312261",
"0.6304417",
"0.6304417",
"0.62786245",
"0.62638956",
"0.625678",
"0.6247448",
"0.62380755... | 0.7181815 | 0 |
Case 3: Check newly created question appears in Profile page as activity | def test_00120_profilepage_check_new_activity_feed
@topicdetail_page = @topiclist_page.go_to_topic("A Watir Topic")
title = "Test q created by Watir - #{get_timestamp}"
@topicdetail_page.create_conversation(type: :question,
title: title,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_00130_profilepage_check_activity_feed_link\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n @browser.wait_until { @profile_page.question_list_in_activity_pane.activity_list.size > 0 }\n activity_card = @profile_page.question_list_in_activi... | [
"0.629241",
"0.61136794",
"0.61099684",
"0.608267",
"0.59902734",
"0.595141",
"0.5930556",
"0.59250474",
"0.5861138",
"0.58571285",
"0.5845736",
"0.58255875",
"0.58255875",
"0.5823767",
"0.5821826",
"0.5807265",
"0.57772523",
"0.57772523",
"0.57761955",
"0.57707685",
"0.57658... | 0.67543834 | 0 |
Case 4: Check conversation link text in activity tab is the correct title. | def test_00130_profilepage_check_activity_feed_link
@profile_page.goto_profile
@browser.wait_until { @profile_page.profile_activity_item.present? }
@browser.wait_until { @profile_page.question_list_in_activity_pane.activity_list.size > 0 }
activity_card = @profile_page.question_list_in_activity_pane.ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n self.title = (st.yield :Title, st.sampleURL)[:Title] || \"\"\n self.title = self.trimmed_title\n else\n self.title\n end\n end",
"def test_00120_profilepage_check_new_activity_feed\n @topicdetail_page = @... | [
"0.6332013",
"0.60098773",
"0.57994413",
"0.57971084",
"0.5736216",
"0.57176596",
"0.56669134",
"0.5641956",
"0.5579777",
"0.5548925",
"0.55159205",
"0.54990965",
"0.54861456",
"0.5474683",
"0.5472574",
"0.546487",
"0.5450934",
"0.5438192",
"0.54363656",
"0.5431333",
"0.54282... | 0.63846993 | 0 |
Create a new message and send an SMS text. | def create
@message = Message.new(message_params)
if @message.save
@message.action = 'SEND'
@message.save
# Send SMS text
boot_twilio
sms = @client.messages.create(
body: @message.text,
from: Rails.application.secrets.twilio_number,
to: @message.number,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twilio_send_text_message!(client,phone_num,msg)\n begin\n sms = client.account.sms.messages.create(\n :from => TWILIO_PHONE,\n :to => phone_num,\n :body => msg)\n rescue Exception => e\n ... | [
"0.8168052",
"0.8104239",
"0.8043112",
"0.797992",
"0.7815659",
"0.75667125",
"0.7514859",
"0.75081027",
"0.75081027",
"0.74867016",
"0.7483985",
"0.73952705",
"0.73885745",
"0.73453254",
"0.73058844",
"0.7283449",
"0.7258611",
"0.7229281",
"0.71881044",
"0.7187127",
"0.71710... | 0.83327514 | 0 |
Webhook for Twilio to forward replies. Store any replies in the db and send back a a simple reply. | def reply
message_body = params["Body"]
from_number = params["From"]
@recent_msg = Message.where(number: from_number).last # Get the name of this user if possible
# Some random schmoe not in our db is trying to text me.
if @recent_msg.blank?
head 200, "content_type" => 'text/html'
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,... | [
"0.68369275",
"0.6497675",
"0.6397914",
"0.6032224",
"0.6014355",
"0.5987166",
"0.59555733",
"0.59529823",
"0.59413064",
"0.59219164",
"0.5912246",
"0.591011",
"0.5907606",
"0.588859",
"0.5840116",
"0.5835873",
"0.5798903",
"0.5788026",
"0.57879084",
"0.5768142",
"0.57342446"... | 0.7083581 | 0 |
Find using exciting method_missing finders attributes. Uses criteria chains under the hood to accomplish this neatness. | def method_missing(method, *args)
if method =~ /find/
finder = method.to_s.split('_by_').first
attributes = method.to_s.split('_by_').last.split('_and_')
chain = Dynamoid::Criteria::Chain.new(self)
chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index|... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to... | [
"0.6754671",
"0.6716648",
"0.6532506",
"0.6513471",
"0.64139366",
"0.63808244",
"0.6316885",
"0.62967867",
"0.620881",
"0.6196353",
"0.6181094",
"0.61756027",
"0.61300695",
"0.6127275",
"0.6070119",
"0.60488373",
"0.6042691",
"0.5993591",
"0.5946261",
"0.5920781",
"0.5919341"... | 0.72799927 | 0 |
Use a full text reader to initialize the data in this writer. This operation can happen before or after records have been added to the writer. | def merge(fulltext_reader)
fulltext_reader.dump_data do |data|
@io.write data
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(reader)\n @reader = reader\n end",
"def initializing_reader(key); end",
"def initialize(structured_reader,&block)\n @reader = structured_reader\n instance_eval( &block ) if block\n end",
"def initialize(line_reader, cleanse_header: true, **args)\n @tabular = IO... | [
"0.5739674",
"0.5406079",
"0.5326524",
"0.5278126",
"0.52205515",
"0.521685",
"0.5180182",
"0.5159452",
"0.5142232",
"0.51300263",
"0.5109225",
"0.50970906",
"0.5070527",
"0.50679934",
"0.5049411",
"0.5046865",
"0.50230974",
"0.49947837",
"0.49904034",
"0.49236354",
"0.490808... | 0.54918605 | 1 |
Write the field to the current input/output stream. Each field will be stored with a header that contains the field size (as longs) followed by the +data+ for the field (the actual text or value) and a trailing \0. This function returns the offset to the start of the offset of the field header in the input/output strea... | def store_field(data)
@io.write [data.size].pack("V")
offset = @io.pos
@io.write data
@io.write "\0"
offset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset\n fil_header[:offset]\n end",
"def write_hdr(field, value)\n @header_data.write_int(field, value)\n @header_modified = true\n end",
"def write_header(primary_key, fields)\n # 5 == field_header + field_footer size\n total_size = fields.inject(0){|sum,field| sum += (field || '').s... | [
"0.6046741",
"0.56584203",
"0.56548214",
"0.54105955",
"0.53932565",
"0.5211581",
"0.5184494",
"0.5178961",
"0.5177128",
"0.5155409",
"0.5146067",
"0.51132095",
"0.5107737",
"0.5037094",
"0.50356054",
"0.5032459",
"0.50075847",
"0.49992645",
"0.49942446",
"0.4993951",
"0.4978... | 0.71350044 | 0 |
this function searches for the port with fiber_in_id=0, considering this to be the first port in a connection trace | def get_first_port
flist = Fiberstrand.where("connection_id = " + self.id.to_s)
fportid=0
# binding.pry
flist.each do |fiber|
fport = Devport.find_by_id(fiber.porta)
fportid=fport.id
break if (fport.fiber_in_id==0)
fportid=0
end
fportid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend",
"def search_peers_by_port (port)\r\n $peers.length.times do |i|\r\n return $peers[i] if ($peers[i].port == port.to_i)\r\n end\r\n return -1\r\nend",
"def get_last_port\n flist = Fiberstrand.where(\"connectio... | [
"0.5997649",
"0.59651273",
"0.59253156",
"0.5897701",
"0.57866263",
"0.56884354",
"0.54501754",
"0.5445254",
"0.5331614",
"0.5327624",
"0.5290758",
"0.525217",
"0.5224758",
"0.5183297",
"0.5160699",
"0.51462764",
"0.51011467",
"0.5093354",
"0.50456524",
"0.5045396",
"0.504362... | 0.7092491 | 0 |
this function searches for the port with fiber_out_id=0, considering this to be the last port in a connection trace...so to get the destination | def get_last_port
flist = Fiberstrand.where("connection_id = " + self.id.to_s)
#binding.pry
fportid=0
# binding.pry
flist.each do |fiber|
fport = Devport.find_by_id(fiber.portb)
fportid=fport.id
break if (fport.fiber_out_id==0)
fportid=0
end
fportid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_port\n flist = Fiberstrand.where(\"connection_id = \" + self.id.to_s)\n \n fportid=0\n # binding.pry\n flist.each do |fiber|\n fport = Devport.find_by_id(fiber.porta)\n fportid=fport.id\n break if (fport.fiber_in_id==0)\n fportid=0\n end\n \n fportid\n \n ... | [
"0.61608636",
"0.58700716",
"0.5798319",
"0.57637346",
"0.5757455",
"0.56814474",
"0.56172824",
"0.56128216",
"0.55285764",
"0.5462376",
"0.5435647",
"0.5417723",
"0.5411878",
"0.5399129",
"0.5215265",
"0.5209555",
"0.52052194",
"0.5194207",
"0.51633036",
"0.5160503",
"0.5144... | 0.6652175 | 0 |
Validates the size of an uploaded prescription picture. | def image_size
if prescription.size > 5.megabytes
errors.add(:prescription, "should be less than 5MB")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > ... | [
"0.78779805",
"0.787309",
"0.78702503",
"0.7866202",
"0.78362525",
"0.78334844",
"0.78303653",
"0.78068",
"0.77948046",
"0.7790744",
"0.77865064",
"0.7782475",
"0.7765085",
"0.77393216",
"0.77343756",
"0.7732566",
"0.7732566",
"0.7732566",
"0.7732566",
"0.7732566",
"0.7732566... | 0.81014836 | 0 |
Send colored logs to the logger. Will only colorize output sent to STDOUT and will call the regular info method when writing to file. | def colorized_info(message, color)
unless @logdev.filename
return info("\e[#{color}m#{message}\e[0m")
end
info(message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorize_logging; end",
"def log(msg, color: \"default\", io: $stdout, &block)\n io.puts \"#{Time.now.strftime('%Y/%m/%d %H:%M:%S').colorize(:light_black)} #{msg.to_s.colorize(color.to_sym)}\"\nend",
"def log_green(message, newline = true)\n log @logger.green(message), newline\n end",
"def log( ... | [
"0.65499085",
"0.62453103",
"0.62424576",
"0.60473865",
"0.60316986",
"0.5799149",
"0.5762426",
"0.5756164",
"0.57115597",
"0.56845164",
"0.5676923",
"0.56659114",
"0.56658316",
"0.56478107",
"0.56343395",
"0.56226414",
"0.557555",
"0.5566307",
"0.55640715",
"0.5411988",
"0.5... | 0.65888923 | 0 |
Consolidate trays of the same phase | def consolidate_phase_trays(plans)
tray_plans = []
plans.each do |p|
tp = tray_plans.detect { |x| x[:phase] == p[:phase] }
if tp.present?
tp[:quantity] += p[:quantity]
tp[:trays] += p[:trays]
else
tray_plans << p
end
end
tray_plans
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tidy_up!\n antecedence.each_key do |entry|\n antecedence[entry].uniq!\n end\n end",
"def project_phase_deliverables\n project_phase_deliverables = []\n stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n project_phase_deliverables << d\n ... | [
"0.5377887",
"0.51905435",
"0.51615506",
"0.5076793",
"0.50539786",
"0.5052658",
"0.50282943",
"0.4958624",
"0.49293447",
"0.49135512",
"0.48869434",
"0.4864298",
"0.48549494",
"0.482563",
"0.481043",
"0.47877073",
"0.47665086",
"0.47517738",
"0.47472188",
"0.47305468",
"0.47... | 0.6625904 | 0 |
POST /user_accounts_groups POST /user_accounts_groups.json | def create
@user_accounts_group = UserAccountsGroup.new(user_accounts_group_params)
respond_to do |format|
if @user_accounts_group.save
format.html { redirect_to @user_accounts_group, notice: 'User accounts group was successfully created.' }
format.json { render :show, status: :created, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:gro... | [
"0.74226165",
"0.73680514",
"0.7174148",
"0.70906186",
"0.7046947",
"0.6980149",
"0.6980149",
"0.69399935",
"0.6907915",
"0.6907915",
"0.6898547",
"0.68582433",
"0.68555725",
"0.68551975",
"0.68493336",
"0.68402857",
"0.68396103",
"0.68238103",
"0.67827797",
"0.67663157",
"0.... | 0.73983836 | 1 |
must yield a valid route as defined below == SCOPES returns the ActionDispatch::Routing::Route for this role_route | def route
@route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route\n @route\n end",
"def timeline_route\n @timeline_route ||= begin\n result = @timeline.route_for_kind(Activr::Timeline::Route.kind_for_routing_and_activity(@routing_kind, @activity.kind))\n raise \"Failed to find a route for #{@routing_kind} / #{@activity.kind}: #{self.inspect}\... | [
"0.60644776",
"0.5965119",
"0.5847937",
"0.5583974",
"0.5568266",
"0.55642855",
"0.55642855",
"0.55587715",
"0.55432475",
"0.55398685",
"0.55173427",
"0.55137485",
"0.5513365",
"0.5495576",
"0.5467603",
"0.5449172",
"0.5441111",
"0.54266876",
"0.54241014",
"0.54211766",
"0.54... | 0.7114458 | 0 |
=> Hubspot destroy => This needs to be implemented into admin area => Destroys hubspot listings from hubspot_id | def hubspot_destroy
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @listing.destroy\n end",
"def destroy\n @spot = Spot.find(params[:id])\n @spot.mark_destroyed(current_admin)\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connector = Connector.find... | [
"0.6813851",
"0.68113875",
"0.67996943",
"0.679222",
"0.667996",
"0.66640145",
"0.66510624",
"0.66404974",
"0.6636274",
"0.6620512",
"0.6615548",
"0.6593372",
"0.65720886",
"0.65698195",
"0.6564775",
"0.65605927",
"0.6536889",
"0.652333",
"0.65203154",
"0.6495557",
"0.6495557... | 0.75243163 | 0 |
Return a new generateduid | def new_generateduid
CFUUIDCreateString(nil, CFUUIDCreate(nil))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end",
"def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end",
"def generate_uid\n [Time.now.s... | [
"0.850823",
"0.8205398",
"0.82017654",
"0.80643654",
"0.79963976",
"0.7799288",
"0.7789262",
"0.7745595",
"0.7724384",
"0.7689694",
"0.7663927",
"0.76461434",
"0.76276183",
"0.76168764",
"0.75199246",
"0.7472211",
"0.7452438",
"0.74369764",
"0.7379788",
"0.735951",
"0.7320901... | 0.8759782 | 1 |
Load the computer object Returns an NSDictionary representation of the the user.plist if it exists If it doesn't, it will return nil | def get_computer(name)
@file = "/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist"
NSMutableDictionary.dictionaryWithContentsOfFile(@file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end",
"def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsO... | [
"0.65846336",
"0.632198",
"0.61031497",
"0.5831744",
"0.56013286",
"0.55993444",
"0.5589866",
"0.5400026",
"0.5380556",
"0.53011453",
"0.5253398",
"0.52241194",
"0.519757",
"0.5196514",
"0.5191172",
"0.5180691",
"0.51286244",
"0.5122096",
"0.5077601",
"0.5044679",
"0.50346035... | 0.6734758 | 0 |
/update_version_select/1 Get the versions for the current product Then render the small versions drop down partial for index search This is used for searches on index pages with a product. Ex. see assignments and and results (execute) index page | def update_version_select
versions = Version.where(:product_id => params[:id]).order(:version) unless params[:id].blank?
render :partial => "versions", :locals => { :versions => versions }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_from_combobox\n @versions = Project.find(params[:project_id]).shared_versions\n @sorted_versions = []\n @versions.each do |version|\n @sorted_versions.push(version.name.to_s)\n end\n @natural_sorted_versions = \\\n Naturalsorter::Sorter.sort_version(@sorted_versions, false)\n ... | [
"0.6672751",
"0.6340233",
"0.6335548",
"0.6306724",
"0.622417",
"0.6133397",
"0.6099903",
"0.60944396",
"0.6087498",
"0.6010113",
"0.59525603",
"0.5943714",
"0.59316754",
"0.5914761",
"0.58474874",
"0.5846949",
"0.5791928",
"0.5751249",
"0.5698358",
"0.56675607",
"0.5591197",... | 0.8145799 | 0 |
Authorize product raises an exception if user tries to a access a product that they do not have access to This is used in controller. The check for views is in the application helper | def authorize_product!(product)
unless product.nil?
unless current_user.products.include?(product)
raise Exceptions::ProductAccessDenied
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\n if session[:user_id] != 3\n raise AccessDenied\n #render \"public/404\", status: :not_found, layout: false\n end\n end",
"def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice... | [
"0.6654826",
"0.6486122",
"0.6402508",
"0.6393314",
"0.6371291",
"0.63313234",
"0.63107234",
"0.63074964",
"0.6305529",
"0.6282004",
"0.6245829",
"0.62382656",
"0.62273705",
"0.62078995",
"0.6201282",
"0.6196096",
"0.61855185",
"0.617958",
"0.61782175",
"0.6176873",
"0.614276... | 0.6899302 | 0 |
token considered a multimatch if contains wildcard | def is_multimatch(s)
return s.match(/[*?]/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_token(token)\n return true\n end",
"def scan_for_and(token); end",
"def complex_token_matches?(token) # :nodoc:\n Matchers.matchers.any? {|matcher| matcher.matches?(token) }\n end",
"def match(keyword); end",
"def scan_for_in(token); end",
"def scan strOrRegexp\n @in.scan /\\s*/ # ... | [
"0.68923086",
"0.64468676",
"0.64329445",
"0.63277537",
"0.6297915",
"0.6271185",
"0.6249036",
"0.61375755",
"0.6063721",
"0.6050664",
"0.6050664",
"0.6050664",
"0.6042717",
"0.6012632",
"0.5965908",
"0.59550667",
"0.5942342",
"0.59106565",
"0.5900349",
"0.58793414",
"0.58793... | 0.65559316 | 1 |
Build a coll structure that matches conditions in a Hash | def make_coll_filters(values)
coll = Xmms::Collection.universe
unless values.empty?
values.each do |field, val|
matchop = make_coll_operator(field, val)
matchop.operands << coll
coll = matchop
end
end
return coll
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def criteria_from_hash(condition) # :nodoc:\n h = {}\n condition.each { |k,v|\n h[k] = case v\n when Array\n {:$in => k == 'id' || k == '_id' ? v.collect{ |val| val.to_oid} : v} # if id, can't pass in string; must be ObjectId\n when Range\n ... | [
"0.65586853",
"0.5975154",
"0.5974988",
"0.5974988",
"0.59626555",
"0.5905237",
"0.5857997",
"0.5810057",
"0.579916",
"0.5777743",
"0.5742093",
"0.5718929",
"0.5718929",
"0.5700071",
"0.5673351",
"0.5665763",
"0.5665763",
"0.562318",
"0.55832344",
"0.55558103",
"0.5538823",
... | 0.62219423 | 1 |
PUT /comments/1.xml PUT /comments/1.json | def update
@comment = Comment.find(params[:id])
respond_to do |format|
if @comment.update_attributes(params[:comment])
format.xml { head :ok }
format.json { head :ok }
else
format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def comments_put(resource, comment)\n merged_options = options.merge({ resource: resou... | [
"0.6638866",
"0.65790904",
"0.64167476",
"0.64138556",
"0.6344143",
"0.63400936",
"0.6307433",
"0.6296865",
"0.6282935",
"0.6265966",
"0.6259213",
"0.6230647",
"0.6226569",
"0.6203838",
"0.6201508",
"0.6183913",
"0.6177102",
"0.6169761",
"0.6163214",
"0.6159252",
"0.61578304"... | 0.70375973 | 0 |
DELETE /comments/1.xml DELETE /comments/1.json | def destroy
@comment = Comment.find(params[:id])
@comment.destroy
respond_to do |format|
format.xml { head :ok }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n form... | [
"0.7157358",
"0.7105928",
"0.70865405",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7057617",
"0.70268226",
"0.70266134",
"0.70258164",
"0.6991692",... | 0.7394572 | 0 |
POST /comments/exists.xml POST /comments/exists.json | def exists
@record = Record.new
comment = Comment.find_by_app_id_and_authorId(params[:app_id], params[:authorId], :select => :id)
if comment.nil?
@record.exists = false
else
@record.id = comment.id
@record.exists = true
end
respond_to do |format|
format.xml {render :xml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end",
"def exists?\n json['exists']\n end",
"def has_comments?\n comments.size > 0\n end",
"def has_comments?\n @comments_count > 0\n end",
"def are_there_comments?\n @comments.size > 0\n end",
... | [
"0.5792246",
"0.57162917",
"0.55497015",
"0.5435844",
"0.5434988",
"0.5340666",
"0.5332262",
"0.524309",
"0.52049863",
"0.51598275",
"0.51364136",
"0.5106553",
"0.5103431",
"0.5102602",
"0.5095069",
"0.50949126",
"0.5088419",
"0.5084685",
"0.50700164",
"0.50699264",
"0.505986... | 0.66348433 | 0 |
append to a prevous message | def append(msg="")
print "\r#{ONE_UP}#{ERASE}"
fmt_msg("#{@last_msg} #{msg.to_s.strip}", @last_lvl)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(message)\n @messages.unshift(message)\n end",
"def msg_add(c)\n\t@msg_buf << c\n end",
"def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].had... | [
"0.63109297",
"0.6144306",
"0.60070115",
"0.5981558",
"0.58327645",
"0.5831893",
"0.58218914",
"0.57724637",
"0.5697555",
"0.56834626",
"0.5627022",
"0.562596",
"0.56242305",
"0.5615866",
"0.5614353",
"0.56110567",
"0.5573142",
"0.55587715",
"0.55578226",
"0.55426",
"0.553836... | 0.6338534 | 0 |
PUBLIC METHODS RecipHeading gives the heading for the recipient | def recip_heading
identity.name.titleize.pluralize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading\n self.class.heading\n end",
"def heading\n render_citation(@document)\n end",
"def heading(title = @title, opts={})\n \n heading = @renderer.heading(title, opts)\n \n puts \"[Cutlist.heading]: #{heading}\" if $cutlister_debug\n \n heading\n \n end",
"def header\... | [
"0.59952956",
"0.5858531",
"0.5827221",
"0.57942903",
"0.5787826",
"0.57449955",
"0.57362586",
"0.57341605",
"0.57302696",
"0.56413484",
"0.56353164",
"0.56332666",
"0.56163836",
"0.5610164",
"0.56017655",
"0.559958",
"0.5560259",
"0.553343",
"0.553179",
"0.5518195",
"0.55096... | 0.6249098 | 0 |
Recip identity that is being judged | def recip
self.identity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_name\n return @identity_name\n end",
"def resident_key; end",
"def name\n \"identity\"\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = { candidate_id: current_candidate&.id }\n end",
"def name\n \"identity\"\n ... | [
"0.6275323",
"0.61383766",
"0.6095459",
"0.6064983",
"0.6063799",
"0.6013645",
"0.59582806",
"0.5957705",
"0.5936399",
"0.5892609",
"0.5882722",
"0.5880226",
"0.5835588",
"0.58191067",
"0.57909125",
"0.57909125",
"0.57909125",
"0.5785599",
"0.5779712",
"0.57378936",
"0.573461... | 0.75434965 | 0 |
Return the raw key in byte format | def to_bytes; @key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def to_bytes\n @public_key\n end",
"def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end",
"de... | [
"0.7833033",
"0.7480416",
"0.72746444",
"0.7259334",
"0.7242505",
"0.7066993",
"0.70399505",
"0.70025724",
"0.69956917",
"0.6946423",
"0.6918244",
"0.6883743",
"0.68622625",
"0.6799893",
"0.6768893",
"0.6750338",
"0.67335355",
"0.6729559",
"0.6729559",
"0.6728644",
"0.6717093... | 0.86449236 | 1 |
render html sourcecode with images | def render(content = 'No template provided')
# get Nokogiri object with html source
html = Nokogiri::HTML(htmlbody)
# pick image tags from source and inject the right images
mailskinassets.each do |mailskinasset|
html.css('img').each do |image|
# do we have the filename of our mailskinass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html\r\n return '' unless image?\r\n %(<div>\r\n <a href=\"#{@url}\" target=\"_blank\">\r\n <img src=\"#{@image_url}\">\r\n </a>\r\n </div>)\r\n end",
"def render_image\n render_image_iterm2\n end",
"def to_erb\n url = @img['src']\n url.sub!(\"/images/\",... | [
"0.66957337",
"0.6651247",
"0.657971",
"0.65756196",
"0.65285087",
"0.64639246",
"0.6457889",
"0.6348121",
"0.63435423",
"0.62210304",
"0.62159544",
"0.61641395",
"0.61073923",
"0.6093117",
"0.60884786",
"0.6087466",
"0.60777676",
"0.6064418",
"0.6046976",
"0.6038442",
"0.603... | 0.68433565 | 0 |
GET /family_histories GET /family_histories.json | def index
@family_histories = FamilyHistory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n ... | [
"0.71313196",
"0.66687083",
"0.65626675",
"0.6493162",
"0.6366066",
"0.6365955",
"0.6337237",
"0.6239882",
"0.6203846",
"0.62029326",
"0.6159766",
"0.6154554",
"0.6091634",
"0.6067703",
"0.6065467",
"0.60643333",
"0.60643333",
"0.6047217",
"0.60415894",
"0.6040515",
"0.603498... | 0.76875293 | 0 |
POST /family_histories POST /family_histories.json | def create
@family_history = FamilyHistory.new(family_history_params)
respond_to do |format|
if @family_history.save
format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' }
format.json { render :show, status: :created, location... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @family_history = FamilyHistory.new(params[:family_history])\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully created.' }\n format.json { render js... | [
"0.66057336",
"0.6605026",
"0.6574083",
"0.64806885",
"0.6414705",
"0.6218579",
"0.6141314",
"0.59926724",
"0.59926724",
"0.5957328",
"0.5945642",
"0.5911225",
"0.5866166",
"0.57638484",
"0.5754734",
"0.57402015",
"0.5734575",
"0.5723629",
"0.57108974",
"0.57061374",
"0.56613... | 0.6653563 | 0 |
PATCH/PUT /family_histories/1 PATCH/PUT /family_histories/1.json | def update
respond_to do |format|
if @family_history.update(family_history_params)
format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' }
format.json { render :show, status: :ok, location: @family_history }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n ... | [
"0.6985075",
"0.6592985",
"0.65639323",
"0.65639323",
"0.65053546",
"0.64841425",
"0.64764565",
"0.64654005",
"0.6414846",
"0.6368925",
"0.6331091",
"0.62963295",
"0.6273065",
"0.6264191",
"0.6253739",
"0.6142333",
"0.6139469",
"0.61380905",
"0.6137319",
"0.6135581",
"0.61091... | 0.7013667 | 0 |
DELETE /family_histories/1 DELETE /family_histories/1.json | def destroy
@family_history.destroy
respond_to do |format|
format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historia... | [
"0.77003956",
"0.7304784",
"0.7102137",
"0.70926046",
"0.7087947",
"0.7070217",
"0.70327663",
"0.69991046",
"0.6875669",
"0.6871906",
"0.68471956",
"0.6830725",
"0.6784044",
"0.67737746",
"0.6766836",
"0.6754331",
"0.67354196",
"0.67286074",
"0.6727467",
"0.67243314",
"0.6723... | 0.7507815 | 1 |
Returns an array of routes, ignoring exceptions | def my_routes
my_routes = []
exceptions = %w(Login Signin)
self.class.routes['GET'].each do |r|
route = r.first.to_s.gsub(/\W+|mix/,'').capitalize
my_routes << route unless exceptions.include?(route)
end
return my_routes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routes_normal\n return Array.new\n end",
"def get_routes\n raise \"Method not implemented\"\n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n end",
"def routes_unhighlighted\n return Array.ne... | [
"0.7562973",
"0.7328139",
"0.73165554",
"0.73165554",
"0.7283972",
"0.718276",
"0.7081735",
"0.70598453",
"0.6834728",
"0.6817335",
"0.6817335",
"0.6816099",
"0.67349327",
"0.66528654",
"0.6646333",
"0.6638214",
"0.6599385",
"0.6574866",
"0.6520511",
"0.6517264",
"0.650079",
... | 0.7773459 | 0 |
Do not make AutotestUser users visible | def visible_users
User.where.not(type: :AutotestUser)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off_org_users\n \n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def testNoAction\n executeTest('DummyUser', {})\n end",
"def include_public_users?\n true\n end",
"def show_users\n @user... | [
"0.67973125",
"0.64449453",
"0.63261586",
"0.632516",
"0.6189137",
"0.6185949",
"0.61498743",
"0.61498743",
"0.6094246",
"0.60853875",
"0.6016768",
"0.60043406",
"0.6004092",
"0.5987089",
"0.5983152",
"0.59766114",
"0.59692746",
"0.596323",
"0.5935923",
"0.5933732",
"0.592536... | 0.75043565 | 0 |
Average Revenue Per Order | def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)
orders_count = get_orders_count(order_type, start_date, end_date)
return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end",
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end... | [
"0.7875154",
"0.7629451",
"0.7084407",
"0.6970247",
"0.69223315",
"0.67495847",
"0.67010206",
"0.6605434",
"0.6582496",
"0.65723115",
"0.655904",
"0.6548161",
"0.64764345",
"0.64655304",
"0.64185876",
"0.6418556",
"0.6379762",
"0.63695186",
"0.6352476",
"0.6352476",
"0.632150... | 0.78708464 | 1 |
Average Revenue Per Order Item | def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)
(get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date... | [
"0.73492616",
"0.7346743",
"0.7330883",
"0.7138519",
"0.70750594",
"0.702968",
"0.69464535",
"0.6928561",
"0.68511236",
"0.681629",
"0.6796739",
"0.6688929",
"0.6666513",
"0.6660459",
"0.66324747",
"0.6626453",
"0.66040957",
"0.65604335",
"0.64406735",
"0.6434388",
"0.6410795... | 0.8286279 | 0 |
Average Orders Per Customer | def get_average_orders_per_customer(customer_type=nil)
(get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def index\n # uses the cus... | [
"0.7714796",
"0.6421369",
"0.6334133",
"0.62264735",
"0.5987185",
"0.5926142",
"0.5879872",
"0.58662117",
"0.58555657",
"0.58237153",
"0.5821276",
"0.5821276",
"0.5821276",
"0.5821276",
"0.58069533",
"0.58027786",
"0.5755036",
"0.5729838",
"0.57120043",
"0.5711469",
"0.570505... | 0.8391852 | 0 |
Average Order Items Per Customer | def get_average_order_items_per_customer(customer_type=nil)
(get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n ... | [
"0.7987969",
"0.7031677",
"0.69518197",
"0.69072133",
"0.64569676",
"0.6449781",
"0.6093867",
"0.60916364",
"0.60746455",
"0.60615057",
"0.60306484",
"0.6023318",
"0.60215765",
"0.6014028",
"0.6007907",
"0.5994727",
"0.59940296",
"0.597378",
"0.59695953",
"0.5968002",
"0.5966... | 0.8338892 | 0 |
Average Items Per Order | def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)
if get_orders_count(order_type, start_date, end_date) > 0
(get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)
else
0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def average_price\n su... | [
"0.74473006",
"0.71956444",
"0.70686513",
"0.691084",
"0.6897596",
"0.6855064",
"0.6811624",
"0.6795871",
"0.6785261",
"0.6724578",
"0.65883505",
"0.6569625",
"0.64554936",
"0.6412604",
"0.6408691",
"0.63903147",
"0.6371128",
"0.63479805",
"0.63293904",
"0.6308164",
"0.630050... | 0.7611944 | 0 |
return true if tracks have only one value for 'parameter_name' | def unique?( tracks, parameter_name )
values = []
tracks.each do |track|
values << track.send( parameter_name )
end
return values.uniq.length == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uses_par?(parameter); @params.values.include?(parameter); end",
"def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end",
"def has_param(name) \n return (@params.has_key? name)\n end",
"def has_param?(name)\n\n end",
"def ... | [
"0.6470434",
"0.62602895",
"0.62574023",
"0.62445563",
"0.61386085",
"0.6073199",
"0.60357475",
"0.60012776",
"0.5968408",
"0.5965425",
"0.59523284",
"0.5917802",
"0.5906149",
"0.5894024",
"0.58608276",
"0.5858045",
"0.5830624",
"0.5816976",
"0.5757066",
"0.5751734",
"0.57352... | 0.8034076 | 0 |
GET /categories/new GET /categories/new.xml | def new
@category = Category.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @category }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end",
"def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categ... | [
"0.760369",
"0.760369",
"0.760369",
"0.760369",
"0.7591787",
"0.74941653",
"0.7377025",
"0.73087305",
"0.7287367",
"0.72565544",
"0.7239733",
"0.72310567",
"0.7174033",
"0.7167501",
"0.7121368",
"0.711047",
"0.71100324",
"0.7090954",
"0.70723087",
"0.70644605",
"0.7063358",
... | 0.76277685 | 0 |
This is the controller method responsible for displaying all the reviews for a share | def index
@reviews = @share.reviews.order(priority: :asc)
@reviewToAlter = @share.reviews.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = @share.reviews.new(review_params)\n\t\t\n\t\tif @reviewToAlter.save\n\t\t\tredirect_to share_reviews_path(@share), notice: \"Review saved!\"\n\t\telse\n\t\t\tflash[:alert] = \"Error : #{@reviewToAlter.errors.full_messages.to_sent... | [
"0.7431748",
"0.74059606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7329606",
"0.7202078",
"0.7202078",
"0.7161231",
"0.711936",
"0.7092843",
"0.70846015",
"0.70543146",
... | 0.74671495 | 0 |
edit is the method which takes care of editing a review | def edit
@reviews = @share.reviews.order(priority: :asc)
@reviewToAlter = Review.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_review\n # client should be able to edit a review.\n puts \"Which review would you like to edit?\"\n pp Client.find_by(name: @@client_name).reviews\n puts \"Please enter the ID\"\n input = gets.strip\n selected_review = Review.find_by(id: input)\n puts... | [
"0.77618456",
"0.768884",
"0.76548994",
"0.7574851",
"0.7574851",
"0.7574851",
"0.7574851",
"0.7574851",
"0.7574851",
"0.7574851",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",
"0.756434",... | 0.81355745 | 0 |
Validate the constraint with the given name, which should have been added previously with NOT VALID. | def validate_constraint(name)
@operations << {:op => :validate_constraint, :name => name}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_constraint(table, name)\n current_instructions << Instructions::ValidateConstraint.new(\n table: table,\n name: name,\n )\n end",
"def validator_defined_for?(constraint_name)\n !!validator_for(constraint_name)\n end",
"def name_invalid\n errors.add(:name, :unk... | [
"0.7206155",
"0.6627902",
"0.65585315",
"0.6364898",
"0.6355886",
"0.6327348",
"0.62545794",
"0.6238708",
"0.61284125",
"0.60058",
"0.60058",
"0.5994172",
"0.5992439",
"0.5991104",
"0.5974525",
"0.59616953",
"0.59547657",
"0.5903176",
"0.58597124",
"0.5849842",
"0.58259225",
... | 0.7885657 | 0 |
Assumes hash partitioning, sets the modulus for this parition. | def modulus(v)
@modulus = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modulo(p0) end",
"def modulus\n distance_to(origin)\n end",
"def rehash(oldhash, size)\n (oldhash + 1) % size\n end",
"def divmod(p0) end",
"def partition_proposition(proposition)\n @remainder &= proposition\n @left &= proposition\n @right &= proposition\n ... | [
"0.6106353",
"0.59064716",
"0.58948857",
"0.5822578",
"0.57684463",
"0.55961597",
"0.55376786",
"0.54671663",
"0.5466879",
"0.54487014",
"0.5404215",
"0.5349049",
"0.53391105",
"0.53174484",
"0.526858",
"0.526858",
"0.5246383",
"0.52278817",
"0.5220499",
"0.5183994",
"0.51839... | 0.7081045 | 0 |
The from and to values of this partition for a range partition. | def range
[@from, @to]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range\n (@from..@to)\n end",
"def range\n @from..@to\n end",
"def collect\n [@range_low, @range_high]\n end",
"def range\n\t\t\t#(@end > @start) ? (@start .. @end) : (@end .. @start)\n\t\t\t(start .. self.end)\n\t\tend",
"def ranges\n attributes.fetch(:ranges)\n ... | [
"0.7436858",
"0.72955906",
"0.72890246",
"0.69145817",
"0.6898283",
"0.68982786",
"0.68723494",
"0.68503475",
"0.6847249",
"0.6791602",
"0.6756868",
"0.6735238",
"0.6723739",
"0.6713718",
"0.6713718",
"0.6713718",
"0.6713718",
"0.66967636",
"0.6638313",
"0.66310805",
"0.65523... | 0.81356955 | 0 |
Determine the appropriate partition type for this partition by which methods were called on it. | def partition_type
raise Error, "Unable to determine partition type, multiple different partitioning methods called" if [@from || @to, @list, @modulus || @remainder, @default].compact.length > 1
if @from || @to
raise Error, "must call both from and to when creating a partition of a table if c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsPartitionable(entry)\n entry = deep_copy(entry)\n Ops.get_symbol(entry, \"type\", :CT_UNKNOWN) == :CT_DMRAID ||\n Ops.get_symbol(entry, \"type\", :CT_UNKNOWN) == :CT_DMMULTIPATH ||\n Ops.get_symbol(entry, \"type\", :CT_UNKNOWN) == :CT_MDPART ||\n IsRealDisk(entry)\n end",
... | [
"0.554963",
"0.54393864",
"0.54320496",
"0.53941506",
"0.5306165",
"0.5259705",
"0.52464676",
"0.52419007",
"0.52418816",
"0.5201963",
"0.51878047",
"0.5146065",
"0.51062053",
"0.51016784",
"0.507593",
"0.5063504",
"0.5013748",
"0.50104105",
"0.4990257",
"0.49901363",
"0.4987... | 0.74603456 | 0 |
Set a conversion proc for the given oid. The callable can be passed either as a argument or a block. | def add_conversion_proc(oid, callable=nil, &block)
conversion_procs[oid] = callable || block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_object_conversion( oid, conversion=nil )\n\t\tconversion = Proc.new if block_given?\n\t\t@object_conversions[ oid ] = conversion\n\tend",
"def add_attribute_conversion( oid, conversion=nil )\n\t\tconversion = Proc.new if block_given?\n\t\t@attribute_conversions[ oid ] = conversion\n\tend",
"def to_proc... | [
"0.69231147",
"0.65239",
"0.63744646",
"0.6109321",
"0.6109321",
"0.6109321",
"0.6096786",
"0.6083638",
"0.599398",
"0.599398",
"0.5993846",
"0.5963998",
"0.5879365",
"0.5862984",
"0.5833793",
"0.5791118",
"0.5768658",
"0.56523377",
"0.56225663",
"0.5618568",
"0.5593497",
"... | 0.8385225 | 0 |
Add a conversion proc for a named type, using the given block. This should be used for types without fixed OIDs, which includes all types that are not included in a default PostgreSQL installation. | def add_named_conversion_proc(name, &block)
unless oid = from(:pg_type).where(:typtype=>['b', 'e'], :typname=>name.to_s).get(:oid)
raise Error, "No matching type in pg_type for #{name.inspect}"
end
add_conversion_proc(oid, block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_type_convert(type, &block)\n @conversions ||= {}\n @conversions[type] = block\n end",
"def register_type(type, &block)\n register CastWhenType.new(type, &block)\n end",
"def cast_with_proc(obj, type)\n if (type == :proc || obj.is_a?(::Proc)) && obj.respond_to?(:to_source)\n... | [
"0.69109946",
"0.6309396",
"0.5923431",
"0.5917636",
"0.5862878",
"0.57383573",
"0.5684644",
"0.55541337",
"0.5495757",
"0.54407096",
"0.54395115",
"0.54209137",
"0.53729755",
"0.53537726",
"0.5343672",
"0.533057",
"0.523242",
"0.5228982",
"0.5200437",
"0.5194037",
"0.5184918... | 0.8404523 | 0 |
A hash of metadata for CHECK constraints on the table. Keys are CHECK constraint name symbols. Values are hashes with the following keys: :definition :: An SQL fragment for the definition of the constraint :columns :: An array of column symbols for the columns referenced in the constraint, can be an empty array if the ... | def check_constraints(table)
m = output_identifier_meth
hash = {}
_check_constraints_ds.where_each(:conrelid=>regclass_oid(table)) do |row|
constraint = m.call(row[:constraint])
entry = hash[constraint] ||= {:definition=>row[:definition], :columns=>[]}
entry[:colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constraint_definition_sql(constraint)\n sql = String.new\n sql << \"CONSTRAINT #{quote_identifier(constraint[:name])} \" if constraint[:name] \n case constraint[:type]\n when :check\n check = constraint[:check]\n check = check.first if check.is_a?(Array) && check.length == 1\n... | [
"0.69810116",
"0.69258285",
"0.6856217",
"0.67866033",
"0.6391585",
"0.62114024",
"0.6107531",
"0.6050771",
"0.6030892",
"0.5981253",
"0.5973716",
"0.591812",
"0.58696294",
"0.5748742",
"0.5745037",
"0.57010984",
"0.56576616",
"0.5642085",
"0.5629582",
"0.5566976",
"0.5486948... | 0.7181034 | 0 |
Convert the first primary key column in the +table+ from being a serial column to being an identity column. If the column is already an identity column, assume it was already converted and make no changes. Only supported on PostgreSQL 10.2+, since on those versions Sequel will use identity columns instead of serial col... | def convert_serial_to_identity(table, opts=OPTS)
raise Error, "convert_serial_to_identity is only supported on PostgreSQL 10.2+" unless server_version >= 100002
server = opts[:server]
server_hash = server ? {:server=>server} : OPTS
ds = dataset
ds = ds.server(server) if server
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_key_sequence(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_key_sequences[quoted_table] if @primary_key_sequences.has_key?(quoted_table)}\n cond = {Sequel[:t][:oid] => regclass_oid(table, opts)}\n value = if pks = _select_se... | [
"0.6523442",
"0.6269975",
"0.6269304",
"0.6203986",
"0.6120233",
"0.6039965",
"0.60150903",
"0.5958063",
"0.5902873",
"0.58989686",
"0.5894372",
"0.58397007",
"0.5799071",
"0.57580894",
"0.57580894",
"0.5664597",
"0.5664597",
"0.56134826",
"0.56110376",
"0.56110376",
"0.56054... | 0.8096805 | 0 |
Creates the function in the database. Arguments: name :: name of the function to create definition :: string definition of the function, or object file for a dynamically loaded C function. opts :: options hash: :args :: function arguments, can be either a symbol or string specifying a type or an array of 13 elements: 1... | def create_function(name, definition, opts=OPTS)
self << create_function_sql(name, definition, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_function_sql(name, definition, opts=OPTS)\n args = opts[:args]\n if !opts[:args].is_a?(Array) || !opts[:args].any?{|a| Array(a).length == 3 and %w'OUT INOUT'.include?(a[2].to_s)}\n returns = opts[:returns] || 'void'\n end\n language = opts[:language] || 'SQL'\n ... | [
"0.7315047",
"0.70606333",
"0.66673636",
"0.6550817",
"0.64636093",
"0.6045642",
"0.58598155",
"0.5743289",
"0.55446565",
"0.550021",
"0.5414134",
"0.5371125",
"0.53436047",
"0.5325446",
"0.5200718",
"0.5181034",
"0.5116383",
"0.50801814",
"0.5057106",
"0.50351334",
"0.502805... | 0.7249979 | 1 |
Create the procedural language in the database. Arguments: name :: Name of the procedural language (e.g. plpgsql) opts :: options hash: :handler :: The name of a previously registered function used as a call handler for this language. :replace :: Replace the installed language if it already exists (on PostgreSQL 9.0+).... | def create_language(name, opts=OPTS)
self << create_language_sql(name, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_language_sql(name, opts=OPTS)\n \"CREATE#{' OR REPLACE' if opts[:replace] && server_version >= 90000}#{' TRUSTED' if opts[:trusted]} LANGUAGE #{name}#{\" HANDLER #{opts[:handler]}\" if opts[:handler]}#{\" VALIDATOR #{opts[:validator]}\" if opts[:validator]}\"\n end",
"def create_proc(name,... | [
"0.7619942",
"0.6248246",
"0.62357014",
"0.6163669",
"0.584984",
"0.5509536",
"0.53380984",
"0.5277645",
"0.5253506",
"0.52450913",
"0.51921475",
"0.5182267",
"0.51447105",
"0.50993854",
"0.50829625",
"0.5075793",
"0.5061333",
"0.5004424",
"0.5002058",
"0.5002025",
"0.4987358... | 0.7850673 | 0 |
Create a trigger in the database. Arguments: table :: the table on which this trigger operates name :: the name of this trigger function :: the function to call for this trigger, which should return type trigger. opts :: options hash: :after :: Calls the trigger after execution instead of before. :args :: An argument o... | def create_trigger(table, name, function, opts=OPTS)
self << create_trigger_sql(table, name, function, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_trigger_sql(table, name, function, opts=OPTS)\n events = opts[:events] ? Array(opts[:events]) : [:insert, :update, :delete]\n whence = opts[:after] ? 'AFTER' : 'BEFORE'\n if filter = opts[:when]\n raise Error, \"Trigger conditions are not supported for this database\" unles... | [
"0.75036204",
"0.71252567",
"0.71252567",
"0.6725345",
"0.63516825",
"0.6272723",
"0.59450215",
"0.5315169",
"0.51494783",
"0.5082",
"0.506205",
"0.5035983",
"0.50323826",
"0.49635643",
"0.49058893",
"0.48846143",
"0.4867852",
"0.48573887",
"0.48499548",
"0.4799055",
"0.47917... | 0.77001125 | 0 |
Use PostgreSQL's DO syntax to execute an anonymous code block. The code should be the literal code string to use in the underlying procedural language. Options: :language :: The procedural language the code is written in. The PostgreSQL default is plpgsql. Can be specified as a string or a symbol. | def do(code, opts=OPTS)
language = opts[:language]
run "DO #{"LANGUAGE #{literal(language.to_s)} " if language}#{literal(code)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_code(code, language)\n code\n end",
"def code(lang, &block)\n source_code = capture(&block).strip\n eval('_erbout', block.binding).concat %Q(<pre class=\"CodeRay\"><code class=\"language-#{lang}\">#{html_escape source_code}</code></pre>)\nend",
"def block_code(code, language)\n if ... | [
"0.6247023",
"0.5933642",
"0.5895321",
"0.5683034",
"0.56672835",
"0.5577568",
"0.5519545",
"0.5435928",
"0.54297894",
"0.5415428",
"0.5415428",
"0.5401936",
"0.5354501",
"0.5351753",
"0.5335078",
"0.5329581",
"0.53250164",
"0.530187",
"0.5296145",
"0.5272397",
"0.5240748",
... | 0.66809785 | 0 |
Drops a procedural language from the database. Arguments: name :: name of the procedural language to drop opts :: options hash: :cascade :: Drop other objects depending on this function. :if_exists :: Don't raise an error if the function doesn't exist. | def drop_language(name, opts=OPTS)
self << drop_language_sql(name, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_language_sql(name, opts=OPTS)\n \"DROP LANGUAGE#{' IF EXISTS' if opts[:if_exists]} #{name}#{' CASCADE' if opts[:cascade]}\"\n end",
"def drop_function_sql(name, opts=OPTS)\n \"DROP FUNCTION#{' IF EXISTS' if opts[:if_exists]} #{name}#{sql_function_args(opts[:args])}#{' CASCADE' if opts... | [
"0.771682",
"0.62814724",
"0.6009372",
"0.6009372",
"0.5947735",
"0.5887368",
"0.58383554",
"0.58220875",
"0.57442856",
"0.5699863",
"0.56750304",
"0.56655055",
"0.5662529",
"0.562056",
"0.5534475",
"0.551798",
"0.54874253",
"0.54649365",
"0.5445987",
"0.54157716",
"0.5367591... | 0.71211535 | 1 |
Return full foreign key information using the pg system tables, including :name, :on_delete, :on_update, and :deferrable entries in the hashes. Supports additional options: :reverse :: Instead of returning foreign keys in the current table, return foreign keys in other tables that reference the current table. :schema :... | def foreign_key_list(table, opts=OPTS)
m = output_identifier_meth
schema, _ = opts.fetch(:schema, schema_and_table(table))
h = {}
fklod_map = FOREIGN_KEY_LIST_ON_DELETE_MAP
reverse = opts[:reverse]
(reverse ? _reverse_foreign_key_list_ds : _foreign_key_list_ds).where_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_table_foreign_keys(table, options=OPTS)\n if supports_foreign_key_parsing?\n fks = foreign_key_list(table, options).sort_by{|fk| fk[:columns]}\n end\n\n if fks.nil? || fks.empty?\n ''\n else\n dump_add_fk_constraints(table, fks)\n end\n end",
"def foreign... | [
"0.72586703",
"0.70443857",
"0.7040204",
"0.65597934",
"0.64049715",
"0.6336679",
"0.6077278",
"0.60334164",
"0.60242915",
"0.60242915",
"0.60122025",
"0.5995262",
"0.5981016",
"0.5927055",
"0.5910303",
"0.5858759",
"0.58397806",
"0.5837277",
"0.5833357",
"0.5808299",
"0.5792... | 0.7318138 | 0 |
Dataset containing all current database locks | def locks
dataset.from(:pg_class).join(:pg_locks, :relation=>:relfilenode).select{[pg_class[:relname], Sequel::SQL::ColumnAll.new(:pg_locks)]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locks\n sql = %q(\n select\n pg_stat_activity.procpid,\n pg_class.relname,\n pg_locks.transactionid,\n pg_locks.granted,\n substr(pg_stat_activity.current_query,1,30) as query_snippet,\n age(now(),pg_stat_activity.query_start) as \"age\"\n from pg_stat_activity,pg_locks left\n ... | [
"0.6448412",
"0.63300234",
"0.6222221",
"0.5978553",
"0.5910206",
"0.58808726",
"0.57571405",
"0.5666715",
"0.56507355",
"0.56354165",
"0.5576385",
"0.5576385",
"0.5563828",
"0.55490714",
"0.55186725",
"0.54743737",
"0.5468267",
"0.54595023",
"0.54589605",
"0.5430492",
"0.540... | 0.80763364 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.