query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.require(:event).permit(:title, :description, :event_date, :location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /gig_rosters GET /gig_rosters.json | def index
@gig_rosters = GigRoster.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def index\n @rosters = Roster.all\n end",
"def index\n @rosters = Roster.all\n end",
"def index\n @r... | [
"0.65916413",
"0.64172494",
"0.64172494",
"0.64172494",
"0.6379612",
"0.6309769",
"0.60598445",
"0.60334337",
"0.6032572",
"0.6008764",
"0.6003748",
"0.6003748",
"0.5969598",
"0.596937",
"0.5965246",
"0.59634304",
"0.59591174",
"0.59420156",
"0.59392005",
"0.5916362",
"0.5913... | 0.72896755 | 0 |
GET /gig_rosters/1 GET /gig_rosters/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @gig_rosters = GigRoster.all\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n res... | [
"0.6990739",
"0.67363274",
"0.62975204",
"0.6267945",
"0.6267945",
"0.6267945",
"0.6252503",
"0.62397003",
"0.6185698",
"0.6144007",
"0.61423606",
"0.6142068",
"0.6090699",
"0.604706",
"0.60177773",
"0.6002566",
"0.6001811",
"0.59938943",
"0.5991962",
"0.59916234",
"0.5974791... | 0.0 | -1 |
POST /gig_rosters POST /gig_rosters.json | def create
@gig_roster = GigRoster.new(gig_roster_params)
respond_to do |format|
if @gig_roster.save
format.html { redirect_to @gig_roster, notice: 'Gig roster was successfully created.' }
format.json { render :show, status: :created, location: @gig_roster }
else
format.html { render :new }
format.json { render json: @gig_roster.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rigging = Rigging.new(rigging_params)\n\n respond_to do |format|\n if @rigging.save\n format.html { redirect_to @rigging, notice: 'Rigging was successfully created.' }\n format.json { render :show, status: :created, location: @rigging }\n else\n format.html { rend... | [
"0.6435959",
"0.6203761",
"0.57345134",
"0.5713185",
"0.57082677",
"0.56806153",
"0.5640973",
"0.5598938",
"0.5576061",
"0.5535237",
"0.55335325",
"0.5497338",
"0.5493931",
"0.54831547",
"0.5470487",
"0.5462567",
"0.5458965",
"0.5448089",
"0.544026",
"0.5428171",
"0.5377553",... | 0.6308921 | 1 |
PATCH/PUT /gig_rosters/1 PATCH/PUT /gig_rosters/1.json | def update
respond_to do |format|
if @gig_roster.update(gig_roster_params)
format.html { redirect_to @gig_roster, notice: 'Gig roster was successfully updated.' }
format.json { render :show, status: :ok, location: @gig_roster }
else
format.html { render :edit }
format.json { render json: @gig_roster.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @rigging.update(rigging_params)\n format.html { redirect_to @rigging, notice: 'Rigging was successfully updated.' }\n format.json { render :show, status: :ok, location: @rigging }\n else\n format.html { render :edit }\n format.json {... | [
"0.64761394",
"0.6422662",
"0.6358383",
"0.6266577",
"0.6238321",
"0.6231431",
"0.62157834",
"0.619248",
"0.61745423",
"0.6137368",
"0.61289",
"0.60328996",
"0.6001447",
"0.5999661",
"0.5976048",
"0.5971105",
"0.59478647",
"0.59478647",
"0.5945901",
"0.59276575",
"0.5902739",... | 0.6115092 | 11 |
DELETE /gig_rosters/1 DELETE /gig_rosters/1.json | def destroy
@gig_roster.destroy
respond_to do |format|
format.html { redirect_to gig_rosters_url, notice: 'Gig roster was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { render json: nil, status: :ok }\n end\n end",
"def destroy\n @rigging.destroy\n respond_to do |format|\n format.html { redirect_to riggings... | [
"0.70874345",
"0.7072451",
"0.69721663",
"0.6918801",
"0.6892003",
"0.6892003",
"0.68843687",
"0.6880985",
"0.68417174",
"0.6837426",
"0.6835648",
"0.68214744",
"0.68024623",
"0.6779224",
"0.67733085",
"0.67506975",
"0.6744599",
"0.6730223",
"0.6730102",
"0.67246675",
"0.6708... | 0.6836711 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_gig_roster
@gig_roster = GigRoster.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def gig_roster_params
params.require(:gig_roster).permit(:gig_id, :roster_id, :uniform, :in_time, :out_time, :accepted)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
TODO Make sure help blocks work correctly. | def to_html
bootstrap_wrapping do
hidden_field_for_all << # Might need to remove this guy.
collection.map { |choice|
choice_html(choice)
}.join("\n").html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help\n \n end",
"def help; end",
"def help; end",
"def help; end",
"def help\r\n end",
"def help\r\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n ... | [
"0.8030844",
"0.80230457",
"0.80230457",
"0.80230457",
"0.80125",
"0.80125",
"0.800298",
"0.79321665",
"0.79321665",
"0.79321665",
"0.79321665",
"0.79321665",
"0.79321665",
"0.79321665",
"0.77064776",
"0.76954746",
"0.7622786",
"0.7534276",
"0.74402016",
"0.74223685",
"0.7376... | 0.0 | -1 |
Pure Ruby instance methods | def show_decimal_budget()
return Money.convert_to_decimal_string(@budget)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_method(p0) end",
"def instance; end",
"def instance; end",
"def instance; end",
"def methods() end",
"def instance_methods; end",
"def class() end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def me... | [
"0.69663507",
"0.688563",
"0.688563",
"0.688563",
"0.68223846",
"0.6749521",
"0.66748625",
"0.66111577",
"0.66111577",
"0.66111577",
"0.66111577",
"0.6534621",
"0.6534621",
"0.6534621",
"0.6534621",
"0.6515938",
"0.6515938",
"0.6515938",
"0.6515938",
"0.6515938",
"0.6515938",... | 0.0 | -1 |
GET /operating_hours GET /operating_hours.json | def index
@operating_hours = OperatingHour.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def hours\n response[\"hours\"]\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end",
"def venue_hours venue_id\n response ... | [
"0.77675194",
"0.6915026",
"0.6870751",
"0.6722812",
"0.6709238",
"0.66452754",
"0.6640017",
"0.663736",
"0.6567424",
"0.6560896",
"0.65436554",
"0.64627033",
"0.64618456",
"0.6422234",
"0.63852084",
"0.6296425",
"0.6276442",
"0.62562305",
"0.6254565",
"0.6218148",
"0.6203615... | 0.73309386 | 1 |
GET /operating_hours/1 GET /operating_hours/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def index\n @operating_hours = OperatingHour.all\n end",
"def show\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officehour }\n en... | [
"0.7644183",
"0.7159949",
"0.69849145",
"0.69371396",
"0.69145554",
"0.6780261",
"0.66310656",
"0.6533028",
"0.6525139",
"0.6504493",
"0.6438296",
"0.63622314",
"0.6361963",
"0.63285553",
"0.6315946",
"0.62583035",
"0.6250996",
"0.62372184",
"0.62236947",
"0.6169397",
"0.6158... | 0.0 | -1 |
POST /operating_hours POST /operating_hours.json | def create
@operating_hour = OperatingHour.new(operating_hour_params)
respond_to do |format|
if @operating_hour.save
format.html { redirect_to @operating_hour, notice: 'Operating hour was successfully created.' }
format.json { render :show, status: :created, location: @operating_hour }
else
format.html { render :new }
format.json { render json: @operating_hour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @operation_hour = OperationHour.create(params[:operation_hour])\n end",
"def operating_hour_params\n params.require(:operating_hour).permit(:monday_from, :monday_to, :tuesday_fro... | [
"0.7029278",
"0.6969807",
"0.696099",
"0.668269",
"0.66538256",
"0.6569062",
"0.65684414",
"0.6528205",
"0.6489911",
"0.64667356",
"0.6458775",
"0.645536",
"0.63673955",
"0.6336778",
"0.6315144",
"0.6312436",
"0.62817925",
"0.6260089",
"0.62549",
"0.62451255",
"0.6218185",
... | 0.7498469 | 0 |
PATCH/PUT /operating_hours/1 PATCH/PUT /operating_hours/1.json | def update
respond_to do |format|
if @operating_hour.update(operating_hour_params)
format.html { redirect_to @operating_hour, notice: 'Operating hour was successfully updated.' }
format.json { render :show, status: :ok, location: @operating_hour }
else
format.html { render :edit }
format.json { render json: @operating_hour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n if @officehour.update_attributes(params[:officehour])\n\tformat.html { redirect_to @officehour, notice: 'Officehour was successfully updated.' }\n\tformat.json { head :no_content }\n else\n\tformat.html { render ac... | [
"0.6957177",
"0.6809584",
"0.67332685",
"0.6700032",
"0.66670865",
"0.6665308",
"0.65441567",
"0.65397495",
"0.65312797",
"0.6507327",
"0.64885247",
"0.64714897",
"0.6471246",
"0.64312595",
"0.64300615",
"0.6399684",
"0.6390729",
"0.6374497",
"0.63423795",
"0.6340942",
"0.623... | 0.7313313 | 0 |
DELETE /operating_hours/1 DELETE /operating_hours/1.json | def destroy
@operating_hour.destroy
respond_to do |format|
format.html { redirect_to operating_hours_url, notice: 'Operating hour was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @operation_hour = OperationHour.find(params[:operation_hour_id])\n end",
"def destroy\n @officehour = Officehour.find(params[:id])\n @officehour.destroy\n\n respond_to do |format|\n format.html { redirect_to officehours_url }\n format.json { head :no_content }\n end\n end"... | [
"0.7393105",
"0.73661083",
"0.7305524",
"0.72960526",
"0.71667707",
"0.71382725",
"0.7083069",
"0.70824856",
"0.70786387",
"0.7032269",
"0.6990246",
"0.6966996",
"0.69027466",
"0.6892751",
"0.68895733",
"0.68853384",
"0.6829551",
"0.68104416",
"0.68099415",
"0.6790999",
"0.67... | 0.7612083 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_operating_hour
@operating_hour = OperatingHour.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def operating_hour_params
params.require(:operating_hour).permit(:monday_from, :monday_to, :tuesday_from, :tuesday_to, :wednesday_from, :wednesday_to, :thursday_from, :thursday_to, :friday_from, :friday_to, :sat_from, :sat_to, :sunday_from, :sunday_to, :warehouse_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
The "window" for this object | def gtk_window
@gtk_main_window
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window\r\n return $window\r\n end",
"def get_window; @window; end",
"def window\n @win\n end",
"def window\n Window\n end",
"def window\n Window_Base.new(0, 0, 0, 0)\n end",
"def window\n @window || create_window\n end",
"def window\n self\n end",
"def element\... | [
"0.87045443",
"0.85526675",
"0.83218944",
"0.83094686",
"0.8062539",
"0.79717994",
"0.7877534",
"0.76322734",
"0.7568737",
"0.73934984",
"0.73577327",
"0.72826767",
"0.72357786",
"0.72145176",
"0.71585894",
"0.71442235",
"0.71442235",
"0.7065718",
"0.7065718",
"0.7063512",
"0... | 0.645807 | 44 |
Show the window and start the main loop. Also starts the window given in parameters. (Used for VimWindow) | def start(start_window)
gtk_window.show_all
start_window.start
Gtk.main_with_queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.... | [
"0.7169551",
"0.70637137",
"0.7041796",
"0.7041715",
"0.70123523",
"0.65191764",
"0.63550496",
"0.6334149",
"0.6309114",
"0.6265318",
"0.62008744",
"0.61828953",
"0.6163721",
"0.6139799",
"0.61134076",
"0.6090274",
"0.60805815",
"0.605429",
"0.60373545",
"0.6036179",
"0.59933... | 0.73490226 | 0 |
Takes a number and checks to see if it is in any of the ranges given | def in_ranges?(num, ranges)
result = false
ranges.each do |range|
if range.include?(num)
result = true
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_in_ranges?(nums, ranges)\n if nums.empty?\n return false\n end\n nums.each do |num|\n if !in_ranges?(num, ranges)\n return false\n end\n end\n true\nend",
"def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= rang... | [
"0.77839947",
"0.77281946",
"0.7620122",
"0.75642455",
"0.75542367",
"0.7548862",
"0.7440546",
"0.7440546",
"0.7386601",
"0.73120075",
"0.7290764",
"0.7260176",
"0.7239734",
"0.7208907",
"0.7207142",
"0.71877927",
"0.7149205",
"0.7149205",
"0.71406585",
"0.7124057",
"0.712071... | 0.85276127 | 0 |
Checks to see if every num in nums is in the ranges given | def all_in_ranges?(nums, ranges)
if nums.empty?
return false
end
nums.each do |num|
if !in_ranges?(num, ranges)
return false
end
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_ranges?(num, ranges)\n result = false\n ranges.each do |range|\n if range.include?(num)\n result = true\n end\n end\n return result\nend",
"def in_ranged_array?(ranged_ary, num)\n !!ranged_ary.find {|n| n === num }\n end",
"def OverlappingRanges(arr)\n first_num = arr[0]\n secon... | [
"0.85513437",
"0.7055554",
"0.6961255",
"0.68587863",
"0.6835786",
"0.68346953",
"0.6824846",
"0.67745215",
"0.67015386",
"0.6700452",
"0.6654732",
"0.6644599",
"0.65470695",
"0.65087354",
"0.647819",
"0.645934",
"0.64191777",
"0.64030087",
"0.63996524",
"0.6397252",
"0.63972... | 0.87066746 | 0 |
Takes a map of fields to ranges and an array of numbers and returns a set of fields are possible candidates for the numbers | def possible_fields(map, nums)
result = Set.new()
map.each do |field, ranges|
if all_in_ranges?(nums, ranges)
result << field
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_valid_numbers(fields)\n bounds = fields.map { |line| line.scan(/\\d+/).map(&:to_i) }\n valid_numbers = []\n bounds.each do |set|\n pair = []\n (0..set.length - 1).step(2) { |ind| pair += (set[ind]..set[ind + 1]).to_a }\n valid_numbers << pair\n end\n valid_numbers\n end",
... | [
"0.72231054",
"0.6411788",
"0.634999",
"0.60745585",
"0.5802601",
"0.57660764",
"0.5691889",
"0.56850946",
"0.5672138",
"0.5663853",
"0.5661722",
"0.56319577",
"0.56286985",
"0.5620134",
"0.5618506",
"0.5618176",
"0.5602175",
"0.5592634",
"0.55566716",
"0.55435187",
"0.553392... | 0.87087697 | 0 |
Takes a 2D matrix and returns the transpose | def transpose(matrix)
if matrix.empty? || matrix.first.empty?
raise ArgumentError
end
result = Array.new(matrix.first.length) { Array.new(matrix.length, 0) }
matrix.each_with_index do |row, x|
row.each_with_index do |val, y|
result[y][x] = val
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose_of_matrix matrix\n\treturn Matrix.new(matrix.line, matrix.col, matrix.values.transpose)\nend",
"def transpose(matrix)\n size = matrix.first.size\n matrix.each_with_index.with_object(Array.new(size) {[]}) do |(arr, idx), trans_arr|\n arr.each_with_index do |el, i|\n trans_arr[i] << el\n ... | [
"0.8549761",
"0.8145293",
"0.8130179",
"0.8044132",
"0.8036772",
"0.80194366",
"0.78922045",
"0.78857267",
"0.78701156",
"0.7835674",
"0.77904093",
"0.7743675",
"0.7709621",
"0.7679929",
"0.76343864",
"0.7625317",
"0.7614516",
"0.76110506",
"0.75981283",
"0.75806314",
"0.7516... | 0.82158756 | 1 |
Prints a 2D matrix | def print_matrix(matrix)
matrix.each do |row|
p row
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end",
"def print_matrix\n width = @rows.flatten.max.to_s.size\n if width > 4 then\n width = width - 0.5\n end\n puts @rows.map { |a|\n \"|#{ a.map { |i|\n outp = \"\"\n num, den = i.to_fraction\n i... | [
"0.8365684",
"0.83364475",
"0.80127895",
"0.77586156",
"0.76027465",
"0.7550865",
"0.74663484",
"0.7452271",
"0.72738564",
"0.7190153",
"0.7120935",
"0.71123135",
"0.70747215",
"0.7028918",
"0.6994751",
"0.6969398",
"0.69626296",
"0.69481415",
"0.6877916",
"0.6870029",
"0.683... | 0.74614334 | 7 |
controls application logs transaction calculates balance use class instead of hash ! | def print_statement
account_statement = StatementDisplay.new(@transaction)
account_statement.print_statment_header
account_statement.display
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance\n super\n end",
"def balance\n super\n end",
"def balance_hash\n @money\n end",
"def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end",
"def balance\n\t\tbalance = 0.00\n\t\t@tran... | [
"0.7183701",
"0.7183701",
"0.7072086",
"0.69360226",
"0.6920141",
"0.6919485",
"0.69194645",
"0.6882263",
"0.68309087",
"0.68242",
"0.67880034",
"0.67547977",
"0.6688635",
"0.66851866",
"0.66739845",
"0.66623527",
"0.66584",
"0.6655751",
"0.660038",
"0.65990794",
"0.6546211",... | 0.0 | -1 |
If plugins successfully installed, restart vagrant to detect changes. | def continue
exec("vagrant #{ARGV[0]}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_plugins(plugins)\n plugins.each do |plugin|\n needs_restart = false\n unless Vagrant.has_plugin? plugin\n system \"vagrant plugin install #{ plugin }\"\n needs_restart = true\n end\n exec \"vagrant #{ ARGV.join ' ' }\" if needs_restart\n end\nend",
"def ensure_plugins(plugins)... | [
"0.79404646",
"0.7931553",
"0.79290783",
"0.77577674",
"0.77577674",
"0.77577674",
"0.77577674",
"0.77577674",
"0.7479775",
"0.7350261",
"0.728334",
"0.71197504",
"0.71009606",
"0.707834",
"0.70095354",
"0.70095354",
"0.69671136",
"0.68325543",
"0.6677157",
"0.6558509",
"0.65... | 0.54581404 | 50 |
you want to find the product of every integer except the integer at that index. Write a function get_products_of_all_ints_except_at_index() that takes an array of integers and returns an array of the products. O(n2) | def product(array)
products = []
current = 0
while (current < array.length)
i = 0
product = 1
while (i < array.length)
if i != current
product *= array[i]
end
i += 1
end
products << product
current += 1
end
products
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_products_of_all_ints_except_at_index_brute(arr)\n result = []\n arr.each_with_index do |el, i|\n arr.delete_at(i)\n product = arr.inject(1) {|product, int| product*int}\n arr.insert(i, el)\n result << product\n end\n result\nend",
"def get_products_of_all_ints_except_at_index(array)\n\n ... | [
"0.92594284",
"0.92340213",
"0.9224134",
"0.92037857",
"0.9174237",
"0.8993432",
"0.8820518",
"0.8685326",
"0.86513716",
"0.85306793",
"0.8448524",
"0.844002",
"0.823903",
"0.8217375",
"0.7987949",
"0.79485893",
"0.7917612",
"0.7874252",
"0.7739332",
"0.7612062",
"0.75830114"... | 0.71233237 | 29 |
O(n) time and O(n) space | def get_products_of_all_ints_except_at_index(array)
before_prod = 1
prod = []
after_prod = 1
after = []
after[array.length - 1] = 1
i = array.length - 1
while (i > 0)
# find products after
after_prod *= array[i]
after[i - 1] = after_prod
i -= 1
end
i = 0
while (i < array.length)
# find products before
prod[i] = after[i] * before_prod
before_prod *= array[i]
i += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6489874",
"0.618138",
"0.6124072",
"0.5913071",
"0.5838433",
"0.5814427",
"0.58132255",
"0.5784249",
"0.5779359",
"0.5776657",
"0.57710296",
"0.57705677",
"0.57591045",
"0.5752177",
"0.57371336",
"0.57119316",
"0.5689318",
"0.56884044",
"0.5640254",
"0.5633082",
"0.5631133... | 0.0 | -1 |
Einstieg in die Applikation, rendert nur das layout (default.rhtml), sonst nichts | def index
# Test ob sich client_key-Cookie entschlüsseln lässt
begin
database_helper_decrypt_value(cookies[:client_key])
rescue Exception
cookies.delete(:client_key) # Verwerfen des nicht entschlüsselbaren Cookies
cookies.delete(:client_salt)
end
unless cookies[:client_key] # Erster Zugriff in neu gestartetem Browser oder Cookie nicht mehr verfügbar
loop_count = 0
while loop_count < MAX_NEW_KEY_TRIES
loop_count = loop_count+1
new_client_key = rand(10000000)
unless get_client_info_store.exist?(new_client_key) # Dieser Key wurde noch nie genutzt
# Salt immer mit belegen bei Vergabe des client_key, da es genutzt wird zur Verschlüsselung des Client_Key im cookie
cookies[:client_salt] = { :value => rand(10000000000), :expires => 1.year.from_now } # Lokaler Schlüsselbestandteil im Browser-Cookie des Clients, der mit genutzt wird zur Verschlüsselung der auf Server gespeicherten Login-Daten
cookies[:client_key] = { :value => database_helper_encrypt_value(new_client_key), :expires => 1.year.from_now }
get_client_info_store.write(new_client_key, 1) # Marker fuer Verwendung des Client-Keys
break
end
end
raise "Cannot create client key after #{MAX_NEW_KEY_TRIES} tries" if loop_count >= MAX_NEW_KEY_TRIES
else
cookies[:client_salt] = { :value => cookies[:client_salt], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung
cookies[:client_key] = { :value => cookies[:client_key], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung
end
# Entfernen evtl. bisheriger Bestandteile des Session-Cookies
cookies.delete(:locale) if cookies[:locale]
cookies.delete(:last_logins) if cookies[:last_logins]
session.delete(:locale) if session[:locale]
session.delete(:last_used_menu_controller) if session[:last_used_menu_controller]
session.delete(:last_used_menu_action) if session[:last_used_menu_action]
session.delete(:last_used_menu_caption) if session[:last_used_menu_caption]
session.delete(:last_used_menu_hint) if session[:last_used_menu_hint]
session.delete(:database) if session[:database]
session.delete(:dbid) if session[:dbid]
session.delete(:version) if session[:version]
session.delete(:db_block_size) if session[:db_block_size]
session.delete(:wordsize) if session[:wordsize]
session.delete(:dba_hist_cache_objects_owner) if session[:dba_hist_cache_objects_owner]
session.delete(:dba_hist_blocking_locks_owner) if session[:dba_hist_blocking_locks_owner]
session.delete(:request_counter) if session[:request_counter]
session.delete(:instance) if session[:instance]
session.delete(:time_selection_start) if session[:time_selection_start]
session.delete(:time_selection_end) if session[:time_selection_end]
set_I18n_locale(get_locale) # ruft u.a. I18n.locale = get_locale auf
write_to_client_info_store(:last_used_menu_controller, 'env')
write_to_client_info_store(:last_used_menu_action, 'index')
write_to_client_info_store(:last_used_menu_caption, 'Start')
write_to_client_info_store(:last_used_menu_hint, t(:menu_env_index_hint, :default=>"Start of application without connect to database"))
rescue Exception=>e
set_current_database(nil) # Sicherstellen, dass bei naechstem Aufruf neuer Einstieg
raise e # Werfen der Exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout; end",
"def default_render\n render(html: \"\", layout: true)\n end",
"def layouts; end",
"def layouts; end",
"def default_layout\n 'default' if html?\n end",
"def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end",
"def layout\n nil\n end"... | [
"0.7875126",
"0.7643069",
"0.76406586",
"0.76406586",
"0.7407023",
"0.72067815",
"0.7134122",
"0.71131593",
"0.69126964",
"0.6880035",
"0.6879067",
"0.68566036",
"0.6804666",
"0.6769785",
"0.6740734",
"0.67037",
"0.6691115",
"0.6691115",
"0.6683467",
"0.66799945",
"0.66655153... | 0.0 | -1 |
Wechsel der Sprache in Anmeldedialog | def set_locale
set_I18n_locale(params[:locale]) # Merken in Client_Info_Cache
respond_to do |format|
format.js {render :js => "window.location.reload();" } # Reload der Sganzen Seite
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sauvegarder(unNom)\n\t\tif nbSaves() >= 8\n\t\t\tdialog = Gtk::Dialog.new(\"Alerte\",\n \t $main_application_window,\n \t :destroy_with_parent,\n \t [ Gtk::Stock::OK, :none ])\n \t\t\tdialog.set_window_position(:center_always)\... | [
"0.6203741",
"0.6133549",
"0.5861024",
"0.5836665",
"0.5835097",
"0.5835097",
"0.58041936",
"0.5749358",
"0.5744608",
"0.5663621",
"0.56408346",
"0.5613051",
"0.556924",
"0.5554364",
"0.5528029",
"0.5527398",
"0.55240047",
"0.5521133",
"0.5511275",
"0.5509028",
"0.5507135",
... | 0.0 | -1 |
Erstes Anmelden an DB | def set_database
# Test auf Lesbarkeit von X$-Tabellen
def x_memory_table_accessible?(table_name_suffix, msg)
begin
sql_select_all "SELECT /* Panorama Tool Ramm */ * FROM X$#{table_name_suffix} WHERE RowNum < 1"
return true
rescue Exception => e
msg << "<div>#{t(:env_set_database_xmem_line1, :user=>get_current_database[:user], :table_name_suffix=>table_name_suffix, :default=>'DB-User %{user} has no right to read on X$%{table_name_suffix} ! Therefore a very small number of functions of Panorama is not usable!')}<br/>"
msg << "<a href='#' onclick=\"jQuery('#xbh_workaround').show(); return false;\">#{t(:moeglicher, :default=>'possible')} workaround:</a><br/>"
msg << "<div id='xbh_workaround' style='display:none; background-color: lightyellow; padding: 20px;'>"
msg << "#{t(:env_set_database_xmem_line2, :default=>'Alternative 1: Connect with role SYSDABA')}<br/>"
msg << "#{t(:env_set_database_xmem_line3, :default=>'Alternative 2: Execute as user SYS')}<br/>"
msg << "> create view X_$#{table_name_suffix} as select * from X$#{table_name_suffix};<br/>"
msg << "> create public synonym X$#{table_name_suffix} for sys.X_$#{table_name_suffix};<br/>"
msg << t(:env_set_database_xmem_line4, :table_name_suffix=>table_name_suffix, :default=>'This way X$%{table_name_suffix} becomes available with role SELECT ANY DICTIONARY')
msg << "</div>"
msg << "</div>"
return false
end
end
def select_any_dictionary?(msg)
if sql_select_one("SELECT COUNT(*) FROM Session_Privs WHERE Privilege = 'SELECT ANY DICTIONARY'") == 0
msg << t(:env_set_database_select_any_dictionary_msg, :user=>get_current_database[:user], :default=>"DB-User %{user} doesn't have the grant 'SELECT ANY DICTIONARY'! Many functions of Panorama may be not usable!<br>")
false
else
true
end
end
write_to_client_info_store(:last_used_menu_controller, "env")
write_to_client_info_store(:last_used_menu_action, "set_database")
write_to_client_info_store(:last_used_menu_caption, "Login")
write_to_client_info_store(:last_used_menu_hint, t(:menu_env_set_database_hint, :default=>"Start of application after connect to database"))
current_database = params[:database].symbolize_keys # Puffern in lokaler Variable, bevor in client_info-Cache geschrieben wird
if params[:database][:modus] == 'tns' # TNS-Alias auswerten
tns_records = read_tnsnames # Hash mit Attributen aus tnsnames.ora für gesuchte DB
tns_record = tns_records[current_database[:tns]]
unless tns_record
respond_to do |format|
format.js {render :js => "$('#content_for_layout').html('#{j "Entry for DB '#{current_database[:tns]}' not found in tnsnames.ora"}'); $('#login_dialog').effect('shake', { times:3 }, 100);"}
end
set_dummy_db_connection
return
end
current_database[:host] = tns_record[:hostName] # Erweitern um Attribute aus tnsnames.ora
current_database[:port] = tns_record[:port] # Erweitern um Attribute aus tnsnames.ora
current_database[:sid] = tns_record[:sidName] # Erweitern um Attribute aus tnsnames.ora
current_database[:sid_usage] = tns_record[:sidUsage] # :SID oder :SERVICE_NAME
else # Host, Port, SID auswerten
current_database[:sid_usage] = :SID unless current_database[:sid_usage] # Erst mit SID versuchen, zweiter Versuch dann als ServiceName
current_database[:tns] = "#{current_database[:host]}:#{current_database[:port]}:#{current_database[:sid]}" # Evtl. existierenden TNS-String mit Angaben von Host etc. ueberschreiben
end
# Temporaerer Schutz des Produktionszuganges bis zur Implementierung LDAP-Autorisierung
if current_database[:host].upcase.rindex("DM03-SCAN") && current_database[:sid].upcase.rindex("NOADB")
if params[:database][:authorization]== nil || params[:database][:authorization]==""
respond_to do |format|
format.js {render :js => "$('#content_for_layout').html('#{j "zusätzliche Autorisierung erforderlich fuer NOA-Produktionssystem"}'); $('#login_dialog_authorization').show(); $('#login_dialog').effect('shake', { times:3 }, 100);"}
end
set_dummy_db_connection
return
end
if params[:database][:authorization]== nil || params[:database][:authorization]!="meyer"
respond_to do |format|
format.js {render :js => "$('#content_for_layout').html('#{j "Autorisierung '#{params[:database][:authorization]}' ungueltig fuer NOA-Produktionssystem"}'); $('#login_dialog').effect('shake', { times:3 }, 100);"}
end
set_dummy_db_connection
return
end
end
set_current_database(current_database) # Persistieren im Cache
current_database = nil # Diese Variable nicht mehr verwenden ab jetzt, statt dessen get_current_database verwenden
# First SQL execution opens Oracle-Connection
# Test der Connection und ruecksetzen auf vorherige wenn fehlschlaegt
begin
# Test auf Funktionieren der Connection
begin
sql_select_one "SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL"
rescue Exception => e # 2. Versuch mit alternativer SID-Deutung
Rails.logger.error "Error connecting to database: URL='#{jdbc_thin_url}' TNSName='#{get_current_database[:tns]}' User='#{get_current_database[:user]}'"
Rails.logger.error e.message
Rails.logger.error 'Switching between SID and SERVICE_NAME'
database_helper_switch_sid_usage
begin
# Oracle-Connection aufbauen mit Wechsel zwischen SID und ServiceName
sql_select_one("SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL") # Ruft implizit open_oracle_connection
rescue Exception => e # 3. Versuch mit alternativer SID-Deutung
Rails.logger.error "Error connecting to database: URL='#{jdbc_thin_url}' TNSName='#{get_current_database[:tns]}' User='#{get_current_database[:user]}'"
Rails.logger.error e.message
Rails.logger.error 'Error persists, switching back between SID and SERVICE_NAME'
database_helper_switch_sid_usage
# Oracle-Connection aufbauen mit Wechsel zurück zwischen SID und ServiceName, sql_select_all ruft implizit open_oracle_connection
sql_select_all "SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL" # Provozieren der ursprünglichen Fehlermeldung wenn auch zweiter Versuch fehlschlägt
end
end
rescue Exception => e
set_dummy_db_connection
respond_to do |format|
format.js {render :js => "$('#content_for_layout').html('#{j "Fehler bei Anmeldung an DB: <br>
#{e.message}<br>
URL: '#{jdbc_thin_url}'<br>
Host: #{get_current_database[:host]}<br>
Port: #{get_current_database[:port]}<br>
SID: #{get_current_database[:sid]}"
}');
$('#login_dialog').effect('shake', { times:3 }, 100);
"
}
end
return # Fehler-Ausgang
end
set_current_database(get_current_database.merge({:database_name => ConnectionHolder.current_database_name})) # Merken interner DB-Name ohne erneuten DB-Zugriff
@dictionary_access_msg = "" # wird additiv belegt in Folge
@dictionary_access_problem = false # Default, keine Fehler bei Zugriff auf Dictionary
begin
@banners = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable
@instance_data = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable
@dbids = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable
@platform_name = "" # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable
# Einlesen der DBID der Database, gleichzeitig Test auf Zugriffsrecht auf DataDictionary
read_initial_db_values
@banners = sql_select_all "SELECT /* Panorama Tool Ramm */ Banner FROM V$Version"
@instance_data = sql_select_all ["SELECT /* Panorama Tool Ramm */ gi.*, i.Instance_Number Instance_Connected,
(SELECT n.Value FROM gv$NLS_Parameters n WHERE n.Inst_ID = gi.Inst_ID AND n.Parameter='NLS_CHARACTERSET') NLS_CharacterSet,
(SELECT n.Value FROM gv$NLS_Parameters n WHERE n.Inst_ID = gi.Inst_ID AND n.Parameter='NLS_NCHAR_CHARACTERSET') NLS_NChar_CharacterSet,
(SELECT p.Value FROM GV$Parameter p WHERE p.Inst_ID = gi.Inst_ID AND LOWER(p.Name) = 'cpu_count') CPU_Count,
d.Open_Mode, d.Protection_Mode, d.Protection_Level, d.Switchover_Status, d.Dataguard_Broker, d.Force_Logging,
ws.Snap_Interval_Minutes, ws.Snap_Retention_Days
FROM GV$Instance gi
JOIN v$Database d ON 1=1
LEFT OUTER JOIN v$Instance i ON i.Instance_Number = gi.Instance_Number
LEFT OUTER JOIN (SELECT DBID, MIN(EXTRACT(HOUR FROM Snap_Interval))*60 + MIN(EXTRACT(MINUTE FROM Snap_Interval)) Snap_Interval_Minutes, MIN(EXTRACT(DAY FROM Retention)) Snap_Retention_Days FROM DBA_Hist_WR_Control GROUP BY DBID) ws ON ws.DBID = ?
", get_dbid ]
@control_management_pack_access = sql_select_one "SELECT Value FROM V$Parameter WHERE name='control_management_pack_access'" # ab Oracle 11 belegt
@instance_data.each do |i|
if i.instance_connected
@instance_name = i.instance_name
@host_name = i.host_name
end
end
@dbids = sql_select_all ["SELECT s.DBID, MIN(Begin_Interval_Time) Min_TS, MAX(End_Interval_Time) Max_TS,
(SELECT MIN(DB_Name) FROM DBA_Hist_Database_Instance i WHERE i.DBID=s.DBID) DB_Name,
(SELECT COUNT(DISTINCT Instance_Number) FROM DBA_Hist_Database_Instance i WHERE i.DBID=s.DBID) Instances,
MIN(EXTRACT(MINUTE FROM w.Snap_Interval)) Snap_Interval_Minutes,
MIN(EXTRACT(DAY FROM w.Retention)) Snap_Retention_Days
FROM DBA_Hist_Snapshot s
LEFT OUTER JOIN DBA_Hist_WR_Control w ON w.DBID = s.DBID
GROUP BY s.DBID
ORDER BY MIN(Begin_Interval_Time)"]
@platform_name = sql_select_one "SELECT /* Panorama Tool Ramm */ Platform_name FROM v$Database" # Zugriff ueber Hash, da die Spalte nur in Oracle-Version > 9 existiert
rescue Exception => e
@dictionary_access_problem = true # Fehler bei Zugriff auf Dictionary
@dictionary_access_msg << "<div> User '#{get_current_database[:user]}' has no right for read on data dictionary!<br/>#{e.message}<br/>Functions of Panorama will not or not completely be usable<br/>
</div>"
end
@dictionary_access_problem = true unless select_any_dictionary?(@dictionary_access_msg)
@dictionary_access_problem = true unless x_memory_table_accessible?("BH", @dictionary_access_msg )
write_connection_to_last_logins
initialize_unique_area_id # Zaehler für eindeutige IDs ruecksetzen
timepicker_regional = ""
if get_locale == "de" # Deutsche Texte für DateTimePicker
timepicker_regional = "prevText: '<zurück',
nextText: 'Vor>',
monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'],
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
timeText: 'Zeit',
hourText: 'Stunde',
minuteText: 'Minute',
currentText: 'Jetzt',
closeText: 'Auswählen',"
end
respond_to do |format|
format.js {render :js => "$('#current_tns').html('#{j "<span title='TNS=#{get_current_database[:tns]},Host=#{get_current_database[:host]},Port=#{get_current_database[:port]},#{get_current_database[:sid_usage]}=#{get_current_database[:sid]}, User=#{get_current_database[:user]}'>#{get_current_database[:user]}@#{get_current_database[:tns]}</span>"}');
$('#main_menu').html('#{j render_to_string :partial =>"build_main_menu" }');
$.timepicker.regional = { #{timepicker_regional}
ampm: false,
firstDay: 1,
dateFormat: '#{timepicker_dateformat }'
};
$.timepicker.setDefaults($.timepicker.regional);
numeric_decimal_separator = '#{numeric_decimal_separator}';
var session_locale = '#{get_locale}';
$('#content_for_layout').html('#{j render_to_string :partial=> "env/set_database"}');
$('#login_dialog').dialog('close');
"
}
end
rescue Exception=>e
set_dummy_db_connection # Rückstellen auf neutrale DB
raise e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db; end",
"def db; end",
"def select(db); end",
"def select(db); end",
"def select_db(name)\n #This is a stub, used for indexing\n end",
"def orm; end",
"def getDB\n @db\n end",
"def select_db(db)\n query \"use #{db}\"\n self\n end",
"def db(*args)\n adapter = ... | [
"0.7503319",
"0.7503319",
"0.7234955",
"0.7234955",
"0.6880299",
"0.6773026",
"0.67666745",
"0.6741359",
"0.6729088",
"0.67028457",
"0.6691277",
"0.66829133",
"0.66430026",
"0.6627663",
"0.66204166",
"0.6595281",
"0.6558294",
"0.6558294",
"0.655064",
"0.6541154",
"0.65361845"... | 0.0 | -1 |
Schreiben der aktuellen Connection in last logins, wenn neue dabei | def write_connection_to_last_logins
database = read_from_client_info_store(:current_database)
last_logins = read_last_logins
min_id = nil
last_logins.each do |value|
last_logins.delete(value) if value && value[:sid] == database[:sid] && value[:host] == database[:host] && value[:user] == database[:user] # Aktuellen eintrag entfernen
end
if params[:saveLogin] == "1"
last_logins = [database] + last_logins # Neuen Eintrag an erster Stelle
write_last_logins(last_logins) # Zurückschreiben in client-info-store
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_completed\n\tend",
"def connection_completed\n end",
"def session_reconnect_state\n super\n end",
"def checkin_connection(*)\n conn = super\n @connection_timestamps[conn] = Sequel.start_timer\n conn\n end",
"def connection_status_mcnet_login; end",
"def nic... | [
"0.64820606",
"0.6450973",
"0.62735546",
"0.6263115",
"0.6245871",
"0.6197363",
"0.60673416",
"0.59512275",
"0.59512275",
"0.59512275",
"0.59430104",
"0.59274954",
"0.59274954",
"0.59274954",
"0.5922495",
"0.59065956",
"0.582445",
"0.5822487",
"0.5807724",
"0.5801186",
"0.578... | 0.7601629 | 0 |
DBID explizit setzen wenn mehrere verschiedene in Historie vorhande | def set_dbid
set_cached_dbid(params[:dbid])
respond_to do |format|
format.js {render :js => "$('##{params[:update_area]}').html('#{j "DBID for access on AWR history set to #{get_dbid}"}');"}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_database_id\n @ole.TrackDatabaseID\n end",
"def track_database_id\n @ole.TrackDatabaseID\n end",
"def track_database_id\n @ole.TrackDatabaseID\n end",
"def track_database_id\n @ole.TrackDatabaseID\n end",
"def getid\n @dbtop+=1\n end",
"def db_key\n\t\t\tself... | [
"0.67526346",
"0.67526346",
"0.67526346",
"0.67526346",
"0.6473767",
"0.61151266",
"0.60542905",
"0.6021306",
"0.59280974",
"0.5847269",
"0.58369416",
"0.5835084",
"0.5817392",
"0.57747823",
"0.57747823",
"0.57673705",
"0.57543296",
"0.5754045",
"0.5754045",
"0.57350045",
"0.... | 0.572168 | 20 |
repeat last called menu action | def repeat_last_menu_action
controller_name = read_from_client_info_store(:last_used_menu_controller)
action_name = read_from_client_info_store(:last_used_menu_action)
# Suchen des div im Menü-ul und simulieren eines clicks auf den Menü-Eintrag
respond_to do |format|
format.js {render :js => "$('#menu_#{controller_name}_#{action_name}').click();"}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat_menu\n puts \"\\n-----------------------\".colorize(:blue)\n puts \"You currently have $#{@player.wallet} left.\".colorize(:red)\n puts \"What do you want to do?\".colorize(:red)\n puts \"1)Add more money to my wallet\".colorize(:blue)\n puts \"2)Play another game\".colorize(:blue)\n p... | [
"0.7005092",
"0.65725285",
"0.6523264",
"0.647607",
"0.64039874",
"0.63643485",
"0.63577473",
"0.63189715",
"0.63114065",
"0.62921345",
"0.6250853",
"0.6189849",
"0.61826587",
"0.61795837",
"0.6158655",
"0.61436075",
"0.61418915",
"0.61282444",
"0.61279035",
"0.6114345",
"0.6... | 0.7359739 | 0 |
Returns a hash representation of the serializable object links. | def include_links!
return if options[:links] == false
key = configuration_for(:links).fetch :key, :_links
prepare_links!
@node.merge!(key => links) if links.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [links, organization_id].hash\n end",
"def hash\n [rel, href].hash\n end",
"def hash\n\t\treturn [ self.subject, self.predicate, self.object ].hash\n\tend",
"def hash\n [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, populari... | [
"0.7182875",
"0.7038139",
"0.63129836",
"0.6245377",
"0.6240718",
"0.61267585",
"0.612632",
"0.6125655",
"0.61029357",
"0.6100584",
"0.606982",
"0.60530144",
"0.6049339",
"0.6030536",
"0.60302866",
"0.60256726",
"0.6024449",
"0.6023507",
"0.60229737",
"0.59952676",
"0.5994651... | 0.0 | -1 |
Setup hypermedia links by invoking their blocks | def prepare_links!(*args)
compile_links_for(_link_configs, *args).each do |link|
rel = link.delete :rel
links[rel] = link
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_links!\n links_def = find_links_definition or return\n \n links_def.rel2block.each do |link|\n links.update_link(Feature::Hypermedia::Hyperlink.new.tap do |hyperlink| # create Hyperlink representer.\n hyperlink.rel = link[:rel]\n ... | [
"0.7453498",
"0.7094221",
"0.6627272",
"0.6627272",
"0.64992857",
"0.64992857",
"0.64109993",
"0.6194785",
"0.60299706",
"0.60255325",
"0.60152775",
"0.5996744",
"0.5990297",
"0.5987193",
"0.59810024",
"0.59810024",
"0.595275",
"0.59221697",
"0.5900052",
"0.5853816",
"0.58210... | 0.5858568 | 19 |
get the team code check if team code exists in database if it exists, redirect to new student user path if not, throw an error stating invalid team code | def parse_comments
team_code = params['team_code']
# result = AdvisorUser.where(team_code: team_code).take
result = Team.find_by(team_code: team_code)
if(result == nil)
session[:team_code_valid] = false
redirect_to join_team_index_path
else
session[:team_code_valid] = true
session[:team_code] = team_code
redirect_to "/student_users/new?student_level=High"
end
#redirect_to new_student_user_path
#do your stuff with comments_from_form here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_team\n set_team_from_team_id\n unless ( @team )\n flash[:error] = I18n.t(:invalid_action_request) + ' - ' + I18n.t('meeting.errors.missing_team_id')\n redirect_to( meetings_current_path() ) and return\n end\n end",
"def check_use_team\r\n if !params[:team_id].nil?\r\n users... | [
"0.65180635",
"0.6420315",
"0.6361816",
"0.6345052",
"0.6324049",
"0.6263744",
"0.62610877",
"0.62146115",
"0.6209806",
"0.6166357",
"0.61184293",
"0.60623777",
"0.60522366",
"0.603641",
"0.6026481",
"0.5990543",
"0.5979056",
"0.59318143",
"0.59313095",
"0.5886543",
"0.587073... | 0.0 | -1 |
This method creates a new `Node` using `data`, and inserts it at the end of the list. | def add_to_tail(node)
if self.tail == nil
self.tail = node
self.head = node
node.next = nil
return
end
old_tail = self.tail
old_tail.next = node
node.next = nil
self.tail = node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(data)\n node = Node.new data\n\n if @head.nil?\n node.next_node = node\n else\n # the new node will have the same trailing node as old\n node.next_node = @head.next_node\n # the old head will become the tail\n @head.next_node = node\n end\n\n @... | [
"0.8308698",
"0.8247943",
"0.8239432",
"0.81293553",
"0.80927175",
"0.8074037",
"0.80644155",
"0.80509025",
"0.79239196",
"0.7918815",
"0.79041415",
"0.78975517",
"0.78829336",
"0.7876351",
"0.786807",
"0.78648305",
"0.78505915",
"0.7803414",
"0.77253866",
"0.77229077",
"0.77... | 0.0 | -1 |
This method removes the last node in the lists and must keep the rest of the list intact. | def remove_tail
retval = self.tail
if self.head == self.tail
self.head = nil
self.tail = nil
return retval
end
node = self.head
until node.next == retval do
node = node.next
end
node.next = nil
self.tail = node
return retval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second ele... | [
"0.7568185",
"0.7223491",
"0.7223491",
"0.7116486",
"0.7111025",
"0.70929784",
"0.69784075",
"0.6892222",
"0.68800265",
"0.6868323",
"0.68375057",
"0.6771561",
"0.67545986",
"0.67500013",
"0.6726881",
"0.6705629",
"0.66911924",
"0.66699106",
"0.6613078",
"0.66000044",
"0.6570... | 0.6540636 | 24 |
This method prints out a representation of the list. | def print
retval = "["
node = self.head
until node == nil do
retval += "#{node.value}"
node = node.next
if node != nil
retval += ", "
end
end
retval += "]"
puts retval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_list; end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.ea... | [
"0.78834105",
"0.774563",
"0.774563",
"0.75637674",
"0.74403816",
"0.7367925",
"0.72690237",
"0.7222558",
"0.71940017",
"0.71452534",
"0.71394694",
"0.71394694",
"0.71307045",
"0.7120213",
"0.7116719",
"0.70976114",
"0.7060826",
"0.7054907",
"0.70359814",
"0.7001138",
"0.7001... | 0.6577018 | 74 |
This method removes `node` from the list and must keep the rest of the list intact. | def delete(node)
if node == self.head
if self.head == self.tail
self.head = nil
self.tail = nil
node.next = nil
return node
end
self.head = node.next
node.next = nil
return node
end
self.print
node1 = self.head
until node1.next == node do
if node1.next == nil
return nil # not on the list
end
node1 = node1.next
end
node1.next = node.next
if node == self.tail
self.tail = node1
end
node.next = nil
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(node)\n end",
"def remove_node(node)\n\t\t\tif has_node?(node)\n\t\t\t\tpull_edges_of(node)\n\t\t\t\t@nodes.delete(node)\n\t\t\t\t@order -= 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end",
"def re... | [
"0.7827693",
"0.7665672",
"0.7595631",
"0.7578332",
"0.7514646",
"0.74869066",
"0.74359757",
"0.74340177",
"0.743196",
"0.7410933",
"0.7404785",
"0.7379001",
"0.7350996",
"0.73318905",
"0.72788984",
"0.7269746",
"0.7269483",
"0.72557163",
"0.7246284",
"0.72445863",
"0.7221512... | 0.73315173 | 14 |
This method removes and returns the first node in the Linked List and must set Linked List's head to the second node. | def remove_front
node = self.head
if node == self.tail
self.tail = nil
end
self.head = node.next
node.next = nil
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end",
"def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn... | [
"0.7722269",
"0.739533",
"0.7326662",
"0.73219603",
"0.73059607",
"0.7236986",
"0.7229386",
"0.7221796",
"0.71602464",
"0.71060896",
"0.70952016",
"0.7090669",
"0.7042859",
"0.70349824",
"0.699761",
"0.6994844",
"0.6986392",
"0.69855326",
"0.69282323",
"0.6916709",
"0.6909721... | 0.67870486 | 30 |
make sure you set this | def pluralize amount, singular
"#{amount} #{singular}#{amount == 1 ? '' : 's'}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def ini... | [
"0.73432803",
"0.68643606",
"0.68643606",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694",
"0.66496694"... | 0.0 | -1 |
GET /graphics GET /graphics.json | def index
@projects = Project.all
@statuses = Status.all
i = 0
j=0
cont=0
graphs = Array.new(@projects.length)
@charts = Array.new(@projects.length)
@projects.each do |p|
graphs[j] = GoogleVisualr::DataTable.new
graphs[j].new_column('string', 'Estatus')
graphs[j].new_column('number', 'Hours per Day')
graphs[j].add_rows(4)
graphs[j].set_cell(0, 0, 'No Iniciado' )
graphs[j].set_cell(1, 0, 'Aceptado' )
graphs[j].set_cell(2, 0, 'No Aceptado' )
graphs[j].set_cell(3, 0, 'Listo' )
@statuses.each do |st|
s = Story.where("status_id = ? AND project_id = ?", st.id, p.id)
graphs[j].set_cell(i, 1, s.length )
cont+=s.length
i+=1
end
opts = { :width => 600, :height => 400, :title => p.nombre + ' - Total Features: '+ cont.to_s, :colors => ['#dc3912', '#109618', '#ff9900', '#3366cc'], :is3D => true, :backgroundColor => '#f5f5f5' }
@charts[j] = GoogleVisualr::Interactive::PieChart.new(graphs[j], opts)
i = 0
cont = 0
j+=1
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @charts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso... | [
"0.7448132",
"0.7448132",
"0.7265818",
"0.7132463",
"0.7110957",
"0.6600178",
"0.6550299",
"0.6550299",
"0.6515574",
"0.6490883",
"0.6480113",
"0.6480113",
"0.6336206",
"0.62874675",
"0.62858784",
"0.62684005",
"0.6252954",
"0.6212031",
"0.6206706",
"0.61616254",
"0.61500853"... | 0.0 | -1 |
GET /graphics/1 GET /graphics/1.json | def show
@graphic = Graphic.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @graphic }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end",
"def index\n @graphics = Graphic.fetch_ordered_by_page(params[\"page\"])\n end",
"def get_game_graphics_with_http_info(opts = {})... | [
"0.71110284",
"0.6976917",
"0.6875089",
"0.67676455",
"0.6766882",
"0.6766882",
"0.6689983",
"0.6537907",
"0.64281446",
"0.6420917",
"0.64197826",
"0.6398936",
"0.6398936",
"0.6395809",
"0.63739014",
"0.63421196",
"0.63392407",
"0.6324268",
"0.630673",
"0.62881243",
"0.623386... | 0.7641829 | 1 |
a = Scraper.new("Essential Decadent Chocolate Brownie with Greek Yogurt Chips Naturally Flavored", 78100, 110, 2, 15, 11) b = Scraper.new("Essential Decadent Chocolate Brownie with Greek Yogurt Chips2 Naturally Flavored", 78101, 110, 2, 15, 11) | def initialize(number)
@@all << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scraper(keyword)\n #in this example I get an empty array selecting the .c16H9d class\n url = \"https://www.lazada.vn/catalog/?q=#{keyword}&_keyori=ss&from=input&spm=a2o4n.home.search.go.1905e1822eN5XO\"\n html_file = open(url).read\n html_doc = Nokogiri::HTML(html_file)\n keywords = []\n\n ht... | [
"0.6186652",
"0.61565745",
"0.61365855",
"0.6052331",
"0.58965707",
"0.5852861",
"0.58464736",
"0.57693875",
"0.5715033",
"0.5708145",
"0.56893134",
"0.5668627",
"0.5637688",
"0.5635966",
"0.56314445",
"0.5602669",
"0.55943286",
"0.55835193",
"0.5560925",
"0.5474126",
"0.5453... | 0.0 | -1 |
Retrieves the next encounter for bound patient | def next_encounter
state = INITIAL_STATE
loop do
state = next_state state
break if state == END_STATE
LOGGER.debug "Loading encounter type: #{state}"
encounter_type = EncounterType.find_by(name: state)
return EncounterType.new name: EXAMINATION\
if go_to_examination?
# prevent diagonis is lab order has been selected
return EncounterType.new name: DIAGNOSIS\
if patient_should_go_for_diagnosis?
return EncounterType.new name: LAB_ORDERS\
if patient_should_go_for_lab_order?
return EncounterType.new name: LAB_RESULTS\
if patient_should_go_for_lab_results?
return encounter_type if valid_state?(state)
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_encounter\n state = INITIAL_STATE\n loop do\n state = next_state state\n break if state == END_STATE\n\n LOGGER.debug \"Loading encounter type: #{state}\"\n encounter_type = EncounterType.find_by(name: state)\n\n return encounter_type if valid_state?(state)\n ... | [
"0.62114567",
"0.62114567",
"0.6168569",
"0.55435693",
"0.55312634",
"0.54928786",
"0.54856104",
"0.54759085",
"0.54370743",
"0.54179215",
"0.53413236",
"0.53375024",
"0.5333356",
"0.5333356",
"0.5327856",
"0.52845246",
"0.5274529",
"0.52589446",
"0.51964945",
"0.51957935",
"... | 0.61382484 | 3 |
Check if a relevant encounter of given type exists for given patient. NOTE: By `relevant` above we mean encounters that matter in deciding what encounter the patient should go for in this present time. | def encounter_exists?(type)
# Vitals may be collected from a different program so don't check
# for existence of an encounter rather check for the existence
# of the actual vitals.
return false if type.name == VITALS
Encounter.where(type: type, patient: @patient, program: @program)\
.where('encounter_datetime BETWEEN ? AND ?', *TimeUtils.day_bounds(@date))\
.exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encounter_exists?(type)\n Encounter.where(type: type, patient: @patient)\\\n .where('encounter_datetime BETWEEN ? AND ?', *TimeUtils.day_bounds(@date))\\\n .exists?\n end",
"def encounter_exists?(type)\n Encounter.where(type: type, patient: @patient)\\\n ... | [
"0.6986266",
"0.6986266",
"0.55290514",
"0.54396576",
"0.54148734",
"0.5191949",
"0.5113055",
"0.509446",
"0.50830734",
"0.5069062",
"0.5064489",
"0.4943027",
"0.49399996",
"0.4893817",
"0.4877564",
"0.48285052",
"0.48224702",
"0.4811259",
"0.4806268",
"0.472354",
"0.47001582... | 0.68180025 | 2 |
if minor found TB negative through DIAGONIS, give them ITP | def patient_is_under_five?
person = Person.find_by(person_id: @patient.patient_id)
((Time.zone.now - person.birthdate.to_time) / 1.year.seconds).floor < UNDER_FIVE_AGE_LIMIT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minor; end",
"def minor; end",
"def minor; end",
"def minor=(_arg0); end",
"def target_tb_lmt\n return 0 if (b=battler).nil?\n b.target_tb_lmt + target_lmt_equip_mod\n end",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 ... | [
"0.6048206",
"0.6048206",
"0.6048206",
"0.5658443",
"0.5586637",
"0.54840016",
"0.5347137",
"0.5347136",
"0.5245033",
"0.5197787",
"0.51512146",
"0.51436746",
"0.51358783",
"0.51221156",
"0.51154816",
"0.5113061",
"0.5113061",
"0.5113061",
"0.5052149",
"0.50505817",
"0.500917... | 0.0 | -1 |
return to the patient dashboard if patient lab test has been ordered within 1 hour | def patient_should_proceed_after_lab_order?
test_type = concept 'Test type'
tb_concept = concept 'Tuberculous'
observation = Observation.joins(:encounter).where(
'person_id = ? AND concept_id = ? AND value_coded = ? AND encounter.encounter_type = ?',
@patient.patient_id, test_type.concept_id, tb_concept.concept_id, encounter_type(LAB_ORDERS).id
).order(obs_datetime: :desc).first
begin
time_diff = ((Time.now - observation.obs_datetime.to_time)).to_i
(time_diff >= 12)
rescue StandardError
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_test\n virtualtest_status = current_user.sk.test_status(@virtualtest)\n render 'errors/access_refused' and return if virtualtest_status == \"not_started\"\n redirect_to virtualtests_path and return if virtualtest_status == \"finished\" # Smoothly redirect because it can happen when timer stops\n e... | [
"0.5937826",
"0.57870626",
"0.5786309",
"0.57496786",
"0.5606584",
"0.5595736",
"0.5577767",
"0.5557089",
"0.5510528",
"0.54581636",
"0.5450569",
"0.541663",
"0.5366033",
"0.53527725",
"0.53487706",
"0.5346876",
"0.5345055",
"0.5323697",
"0.53066516",
"0.5300956",
"0.52988535... | 0.6458008 | 0 |
patient worklow should proceed after 10 minutes | def patient_should_proceed_after_diagnosis?
procedure_type = concept 'Procedure type'
x_ray = concept 'Xray'
clinical = concept 'Clinical'
ultrasound = concept 'Ultrasound'
observation = Observation.joins(:encounter).where(
'person_id = ? AND concept_id = ? AND (value_coded = ? || value_coded = ? || value_coded = ?) AND encounter.encounter_type = ?',
@patient.patient_id, procedure_type.concept_id, x_ray.concept_id, clinical.concept_id, ultrasound.concept_id, encounter_type(DIAGNOSIS).id
).order(obs_datetime: :desc).first
begin
time_diff = (Time.current - observation.obs_datetime)
minutes = (time_diff / 60)
(minutes >= 1 / 60)
rescue StandardError
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend",
"def typhoeus_timeout\n\t \t\t10\n\t \tend",
"def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \te... | [
"0.613992",
"0.6030918",
"0.59746933",
"0.58295095",
"0.5822202",
"0.5814416",
"0.57991976",
"0.57255983",
"0.57120204",
"0.57120204",
"0.57120204",
"0.57120204",
"0.5704908",
"0.5699917",
"0.56950307",
"0.5657013",
"0.5657013",
"0.56335866",
"0.56248295",
"0.56248295",
"0.56... | 0.0 | -1 |
Send the TB patient for a lab order on the 56th/84th/140th/168th day | def should_patient_go_lab_examination_at_followup?
first_dispensation = Encounter.joins(:type).where(
'encounter_type.name = ? AND encounter.patient_id = ? AND encounter.program_id = ?',
DISPENSING,
@patient.patient_id,
@program.program_id
).order(encounter_datetime: :asc).first
begin
first_dispensation_date = first_dispensation.encounter_datetime
number_of_days = (Time.current.to_date - first_dispensation_date.to_date).to_i
(number_of_days == 56 || number_of_days == 84 || number_of_days == 140 || number_of_days == 168)
rescue StandardError
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def send_order order_id\n order_to_send = @current_orders.find {|order| order.id.to_i == order_id.to_i}\n @order_history.push(@current_orders.delete(ord... | [
"0.6162591",
"0.5979957",
"0.5944701",
"0.59194416",
"0.5843076",
"0.5792522",
"0.5732725",
"0.5731386",
"0.5710641",
"0.5607974",
"0.5575205",
"0.5572806",
"0.55705214",
"0.55692035",
"0.5551878",
"0.5544476",
"0.554407",
"0.55421376",
"0.5538726",
"0.55243313",
"0.5519518",... | 0.0 | -1 |
CLEAN UP THIS ONE | def should_patient_tested_through_diagnosis?
procedure_type = concept('Procedure type')
x_ray = concept('Xray')
clinical = concept('Clinical')
ultrasound = concept('Ultrasound')
Observation.joins(:encounter).where(
'person_id = ? AND concept_id = ? AND (value_coded = ? || value_coded = ? || value_coded = ?) AND encounter.encounter_type = ?',
@patient.patient_id, procedure_type.concept_id, x_ray.concept_id, clinical.concept_id, ultrasound.concept_id, encounter_type(EXAMINATION).id
).order(obs_datetime: :desc).exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup!; end",
"def cleanup!; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def c... | [
"0.79912174",
"0.79912174",
"0.7925388",
"0.7925388",
"0.7925388",
"0.7925388",
"0.77884847",
"0.77884847",
"0.77884847",
"0.7781651",
"0.7781651",
"0.7781651",
"0.7781651",
"0.774741",
"0.7726321",
"0.7726321",
"0.7647412",
"0.75905967",
"0.75905967",
"0.74834317",
"0.748343... | 0.0 | -1 |
patient should get diagnised through lab order | def alternate_test_procedure_type
begin
last_time_diagnosis_selected.obs_datetime > last_time_lab_order_selected.obs_datetime
rescue StandardError
return true if last_time_lab_order_selected.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patient_should_proceed_after_lab_order?\n test_type = concept 'Test type'\n tb_concept = concept 'Tuberculous'\n observation = Observation.joins(:encounter).where(\n 'person_id = ? AND concept_id = ? AND value_coded = ? AND encounter.encounter_type = ?',\n @patient.patient_id, test... | [
"0.6589105",
"0.63766426",
"0.63148224",
"0.61355364",
"0.5977252",
"0.5509335",
"0.5509047",
"0.5454047",
"0.544968",
"0.54035056",
"0.5393992",
"0.5331882",
"0.5317752",
"0.53044164",
"0.52860916",
"0.52404547",
"0.5240151",
"0.5237152",
"0.5186199",
"0.51755273",
"0.516982... | 0.0 | -1 |
iterate over the character hash to find the collection of `films` for the given `character` collect those film API urls, make a web request to each URL to get the info for that film return value of this method should be collection of info about each film. i.e. an array of hashes in which each hash reps a given film this collection will be the argument given to `parse_character_movies` and that method will do some nice presentation stuff: puts out a list of movies by title. play around with puts out other info about a given film | def parse_character_movies(films_hash)
films_hash.each_with_index do | film, index |
puts "#{index + 1} #{film["title"]}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_character_movies(character)\n urls_of_films = get_character_movies_from_api(character)\n films_hash = add_film_urls(urls_of_films)\n parse_character_movies(films_hash)\nend",
"def get_character_movies_from_api(character_name)\n #make the web request\n\n response_string = RestClient.get('http://www.... | [
"0.796758",
"0.7963785",
"0.7825746",
"0.7723475",
"0.7679142",
"0.7624706",
"0.75895137",
"0.7521909",
"0.75184345",
"0.7497967",
"0.749589",
"0.7487098",
"0.7464824",
"0.7322385",
"0.726702",
"0.72108006",
"0.7207704",
"0.6977728",
"0.69609106",
"0.69478554",
"0.69268864",
... | 0.58369666 | 45 |
GET /size_groups/1 GET /size_groups/1.xml | def show
@size_group = SizeGroup.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @size_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @size_group = SizeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @size_group }\n end\n end",
"def create\n @size_group = SizeGroup.new(params[:size_group])\n result = @size_group.save\n if result\n for size in params[:s... | [
"0.65454197",
"0.62095326",
"0.6137497",
"0.6137497",
"0.61343664",
"0.61343664",
"0.6099301",
"0.6062929",
"0.60226846",
"0.6018285",
"0.5973926",
"0.59366924",
"0.5931665",
"0.5912144",
"0.58946514",
"0.5890749",
"0.58822984",
"0.5878934",
"0.5878934",
"0.58274955",
"0.5813... | 0.7347719 | 1 |
GET /size_groups/new GET /size_groups/new.xml | def new
@size_group = SizeGroup.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @size_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @size_group = SizeGroup.new(params[:size_group])\n result = @size_group.save\n if result\n for size in params[:size]\n new_size = Size.new(size)\n new_size.save\n @size_group.sizes << new_size\n end\n end\n respond_to do |format|\n if result\n ... | [
"0.70232415",
"0.70123994",
"0.6879285",
"0.68778497",
"0.68778497",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.67709875",
"0.6763431",
"0.67387205",
"0.6655991",
"0.66238534",
"0.6618393",
... | 0.795332 | 0 |
POST /size_groups POST /size_groups.xml | def create
@size_group = SizeGroup.new(params[:size_group])
result = @size_group.save
if result
for size in params[:size]
new_size = Size.new(size)
new_size.save
@size_group.sizes << new_size
end
end
respond_to do |format|
if result
flash[:notice] = 'SizeGroup was successfully created.'
format.html { redirect_to([:admin, @size_group]) }
format.xml { render :xml => @size_group, :status => :created, :location => @size_group }
else
format.html { render :action => "new" }
format.xml { render :xml => @size_group.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @size_group = SizeGroup.find(params[:id])\n result = @size_group.update_attributes(params[:size_group])\n if result\n for size in params[:size]\n new_size = Size.new(size)\n new_size.save\n @size_group.sizes << new_size\n end\n for id,size in params[:existi... | [
"0.5995169",
"0.58783054",
"0.5840016",
"0.56524163",
"0.55683625",
"0.55562866",
"0.5534543",
"0.55304486",
"0.5512635",
"0.5499622",
"0.54731584",
"0.5427323",
"0.5425655",
"0.5409382",
"0.5392204",
"0.53908646",
"0.53552854",
"0.53524065",
"0.5310443",
"0.52829945",
"0.527... | 0.7314921 | 0 |
PUT /size_groups/1 PUT /size_groups/1.xml | def update
@size_group = SizeGroup.find(params[:id])
result = @size_group.update_attributes(params[:size_group])
if result
for size in params[:size]
new_size = Size.new(size)
new_size.save
@size_group.sizes << new_size
end
for id,size in params[:existing_size]
if size.has_key? :delete
Size.delete(id)
else
this_size = Size.find(id)
this_size.update_attributes(size)
end
end if params[:existing_size]
end
respond_to do |format|
if result
flash[:notice] = 'SizeGroup was successfully updated.'
format.html { redirect_to([:admin, @size_group]) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @size_group.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n if @size_group.update_attributes(params[:size_group])\n flash[:notice] = 'SizeGroup was successfully updated.'\n render :partial => 'show', :object => @size_group\n else\n render :partial => 'edit', :object => @size_group, :status => 409\n end\n end",
"def create\n @siz... | [
"0.70120364",
"0.69220966",
"0.64207184",
"0.6169009",
"0.61627525",
"0.61554444",
"0.6005169",
"0.5867542",
"0.5837684",
"0.5837",
"0.5837",
"0.582717",
"0.582717",
"0.58034146",
"0.57465315",
"0.57335705",
"0.57080644",
"0.56834555",
"0.568102",
"0.5675042",
"0.5661914",
... | 0.72886235 | 0 |
DELETE /size_groups/1 DELETE /size_groups/1.xml | def destroy
@size_group = SizeGroup.find(params[:id])
@size_group.destroy
respond_to do |format|
format.html { redirect_to(admin_size_groups_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @size_group.destroy\n\n render :nothing => true\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n e... | [
"0.68580616",
"0.6644248",
"0.65351576",
"0.6386295",
"0.63792574",
"0.6376121",
"0.63417333",
"0.63287413",
"0.62927246",
"0.62733734",
"0.62576354",
"0.62544245",
"0.6248362",
"0.6243852",
"0.62153274",
"0.62153274",
"0.6206107",
"0.6206107",
"0.6206107",
"0.6206107",
"0.62... | 0.7525298 | 0 |
Get API URL for projects | def project_url project_id
server = lookup_server_from_project(project_id)
pivotal_url = server[:url]
{ :url => "#{pivotal_url}/projects/#{project_id}", :token => server[:token] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_url\n \"#{@@base_url}/#{format}/#{resource}?apikey=#{@@api_key}#{parameters}\"\n end",
"def api_url\n \"#{protocol}://api:#{api_key}@#{host}/#{api_version}\"\n end",
"def url\n api_url\n end",
"def api_url(url = '')\n configuration.api_base + url\n end",
"def api_url... | [
"0.74141026",
"0.7386156",
"0.7374278",
"0.7340665",
"0.73117703",
"0.73117703",
"0.7289823",
"0.7239361",
"0.72179276",
"0.7103249",
"0.7100108",
"0.7074547",
"0.70710313",
"0.70709234",
"0.7026073",
"0.70146257",
"0.69928813",
"0.69693124",
"0.6960771",
"0.6940271",
"0.6929... | 0.8046829 | 0 |
Get API URL for stories | def stories_url project_id
server = lookup_server_from_project(project_id)
pivotal_url = server[:url]
{ :url => "#{pivotal_url}/projects/#{project_id}/stories", :token => server[:token] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def story_url(story_id)\n \"https://www.pivotaltracker.com/story/show/#{story_id}\"\n end",
"def url\n api_url\n end",
"def url(path)\n \"#{API}/#{path}\"\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n base_url.concat api_query_param... | [
"0.7448583",
"0.72236496",
"0.6772528",
"0.67207557",
"0.67207557",
"0.67196035",
"0.6717534",
"0.6714422",
"0.67048585",
"0.66923547",
"0.666768",
"0.66118526",
"0.6591959",
"0.6572398",
"0.65012187",
"0.64627016",
"0.6439124",
"0.64307356",
"0.6406254",
"0.6401658",
"0.6390... | 0.7973754 | 0 |
Given a project id, get the server's information | def lookup_server_from_project pid
PT2TODO_CONFIG.each do |token, p|
if p[:project_ids].include? pid
return {:token => token, :url => p[:url], :project_ids => p[:project_ids], :append => p[:append]}
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end",
"def project_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}\", :token => server[:to... | [
"0.67969173",
"0.648968",
"0.64702517",
"0.6435057",
"0.64251554",
"0.64251554",
"0.6384335",
"0.63254493",
"0.6290833",
"0.62401676",
"0.62401676",
"0.619968",
"0.61897004",
"0.61771",
"0.61661965",
"0.61661965",
"0.6119398",
"0.61099523",
"0.61099523",
"0.61099523",
"0.6091... | 0.6733728 | 1 |
Given a Pivotal Tracker `state`, give back a task prioritization. | def map_state(state)
@state_mapping.each do |key, value|
return key if value.include? state
end
:today
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_state(state)\n val = state.is_a?(Integer) ? state : STATES[state]\n\n case\n when val.nil?\n raise \"Invalid task state #{state.inspect}\"\n when val >= ERROR_STATE_THRESHOLD\n return val - ERROR_STATE_THRESHOLD\n when val >= STEADY_STATE_THRESHOLD... | [
"0.6274295",
"0.57839906",
"0.57239395",
"0.5586477",
"0.5463893",
"0.54568666",
"0.5427778",
"0.5398577",
"0.5335542",
"0.52960336",
"0.52771366",
"0.52760226",
"0.5241638",
"0.52231234",
"0.5212394",
"0.51902133",
"0.5189937",
"0.518529",
"0.51753217",
"0.51475793",
"0.5142... | 0.0 | -1 |
Call the Pivotal Tracker API with the given `url`. This method provides the API Token as a HTTP Header. | def pivotal_tracker(server)
clnt = HTTPClient.new
clnt.get(server[:url], nil, { "X-TrackerToken" => server[:token] })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_gh_api(url)\n auth = \"Bearer #{session[:access_token]}\"\n HTTParty.get(url, headers: { 'Authorization' => auth })\n end",
"def get(url)\n login unless token\n response = client.request(request(url, token))\n end",
"def get_token(url)\n req = Net::HTTP::Post.new('/... | [
"0.68637234",
"0.6151754",
"0.6093218",
"0.60747206",
"0.60580873",
"0.6014395",
"0.59499055",
"0.592737",
"0.5898902",
"0.5775516",
"0.57221746",
"0.56850064",
"0.5679265",
"0.5676035",
"0.56410974",
"0.5560159",
"0.5545748",
"0.55317",
"0.54871213",
"0.5484402",
"0.5480123"... | 0.6553887 | 1 |
Given a project's id (`pid`), get the project's name. | def project_name(pid)
Nokogiri::HTML(pivotal_tracker(project_url(pid)).content).css('project > name').text.split(' ').join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_name\n return project.nil? ? \"nil\" : project.name\n end",
"def name\n project.name\n end",
"def name\n project.name\n end",
"def get_project_name\n project_id = params[:project_id]\n name_from_repository = payload.fetch(\"repository\", {}).fetch(\"name\", nil)\n ... | [
"0.72045237",
"0.7092095",
"0.7092095",
"0.7077162",
"0.69105375",
"0.6875942",
"0.6819747",
"0.6638206",
"0.66316247",
"0.6622742",
"0.65775937",
"0.654773",
"0.64752764",
"0.64124054",
"0.64104426",
"0.64066786",
"0.6398371",
"0.6375751",
"0.63715607",
"0.636676",
"0.635479... | 0.74874276 | 0 |
Given a project's id, and the body of the response from Pivotal Tracker's Stories API, return a list of strings in todo.txt format. | def my_todos(project_id, body)
body.css('stories > story').select do |s|
s.css('owned_by').text == OWNER
end.inject({}) do |tasks, s|
state = map_state s.css('current_state').text
tasks[state] ||= []
tasks[state] << s
tasks
end.map do |priority_group, stories|
stories.map{|s| format_todotxt project_id, priority_group, s}
end.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end",
"def get_completed(projectid)\n get(\"projects/#{projectid}/todolists/completed.json\")\n end",
"def todos(project_id)\n return [] if project_id.blank? || !basecamp\n @todos[project_id] ||= ... | [
"0.6820073",
"0.67624336",
"0.6753962",
"0.66622216",
"0.64492136",
"0.6207838",
"0.6175382",
"0.60986507",
"0.60693455",
"0.5954329",
"0.5948362",
"0.58631736",
"0.5756917",
"0.57211804",
"0.57176006",
"0.5713984",
"0.5556455",
"0.55495805",
"0.5544898",
"0.55428237",
"0.554... | 0.63672274 | 5 |
Formats a Pivotal Tracker story in the todo.txt format. Letterbased priorities are given to it depending on what the story's current status is. The story's labels and story type are todo.txt's contexts, while the story's project name is the todo's story. The URL of the story is also added to the | def format_todotxt(project_id, priority_group, story)
task_priority =
case priority_group
when :today then "(A)"
when :next then "(B)"
when :someday then "(C)"
end
done = task_priority.nil?
# TODO: escape newlines...
title = story.css('name').text
url = story.css('url').text
story_id = story.css('id').text
story_type = story.css('story_type').text
labels = story.css('labels').text.split(',')
d = Date.parse(story.css('updated_at').text)
updated_at = d.strftime("%Y-%m-%d")
pname = project_name(project_id)
append = lookup_server_from_project(project_id)[:append]
task = ""
task << "x #{updated_at} " if done
task << "#{task_priority} " unless task_priority.blank?
task << title
task << " @#{story_type}" unless story_type.blank?
task << labels.map{|l| " @#{l}"}.join
task << " +#{pname}" unless pname.blank?
task << " url:#{url}" unless url.blank?
task << " @frompivotal"
task << " #{append}" unless append.blank?
task
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_todos(project_id, body)\n body.css('stories > story').select do |s|\n s.css('owned_by').text == OWNER\n end.inject({}) do |tasks, s|\n state = map_state s.css('current_state').text\n tasks[state] ||= []\n tasks[state] << s\n tasks\n end.map do |priority_group, sto... | [
"0.5548532",
"0.5497139",
"0.5434224",
"0.54246116",
"0.5349843",
"0.5301151",
"0.5189603",
"0.51767135",
"0.5167253",
"0.5122934",
"0.5066005",
"0.5065631",
"0.5051362",
"0.4954177",
"0.49262172",
"0.4900673",
"0.48756233",
"0.4872546",
"0.4846569",
"0.48429677",
"0.48277056... | 0.6737708 | 0 |
GET /extrainfos GET /extrainfos.json | def index
@extrainfos = Extrainfo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render... | [
"0.70912194",
"0.6750656",
"0.6750656",
"0.6717262",
"0.6717262",
"0.66976696",
"0.6588717",
"0.6588717",
"0.65684223",
"0.65508723",
"0.6548687",
"0.65482914",
"0.6543604",
"0.6428262",
"0.63707566",
"0.6364797",
"0.6351876",
"0.63381296",
"0.63135093",
"0.63132095",
"0.6263... | 0.6415768 | 14 |
GET /extrainfos/1 GET /extrainfos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end",
"def index\n @exercises = Exercise.all\n\n ... | [
"0.68307173",
"0.66964424",
"0.6681035",
"0.6681035",
"0.66382146",
"0.6577036",
"0.6500297",
"0.6496961",
"0.6496961",
"0.643135",
"0.6421866",
"0.63804084",
"0.6380173",
"0.6364772",
"0.6364772",
"0.6352904",
"0.6352904",
"0.6300894",
"0.62972283",
"0.6280225",
"0.62801474"... | 0.0 | -1 |
POST /extrainfos POST /extrainfos.json | def create
@extrainfo = Extrainfo.new(extrainfo_params)
respond_to do |format|
if @extrainfo.save
format.html { redirect_to @extrainfo, notice: 'Extrainfo was successfully created.' }
format.json { render :show, status: :created, location: @extrainfo }
else
format.html { render :new }
format.json { render json: @extrainfo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @exura = Exura.new(params[:exura])\n\n respond_to do |format|\n if @exura.save\n format.html { redirect_to @exura, :notice => 'Exura was successfully created.' }\n format.json { render :json => @exura, :status => :created, :location => @exura }\n else\n format.html... | [
"0.6477917",
"0.6452822",
"0.6386044",
"0.63467216",
"0.6341108",
"0.62873137",
"0.62272525",
"0.61360425",
"0.6111131",
"0.61053085",
"0.60925347",
"0.5999772",
"0.597448",
"0.5958246",
"0.5928762",
"0.592325",
"0.5868088",
"0.5863465",
"0.5855971",
"0.58298975",
"0.5807835"... | 0.699139 | 0 |
PATCH/PUT /extrainfos/1 PATCH/PUT /extrainfos/1.json | def update
respond_to do |format|
if @extrainfo.update(extrainfo_params)
format.html { redirect_to @extrainfo, notice: 'Extrainfo was successfully updated.' }
format.json { render :show, status: :ok, location: @extrainfo }
else
format.html { render :edit }
format.json { render json: @extrainfo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"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 put!\n request! :put\n... | [
"0.6490018",
"0.63941336",
"0.6353184",
"0.62906724",
"0.6274898",
"0.6227476",
"0.608346",
"0.6076439",
"0.6041",
"0.60309714",
"0.6018341",
"0.6018341",
"0.60180306",
"0.60087246",
"0.5976015",
"0.5969854",
"0.5966978",
"0.59630626",
"0.5961317",
"0.5929762",
"0.5929762",
... | 0.64578694 | 1 |
DELETE /extrainfos/1 DELETE /extrainfos/1.json | def destroy
@extrainfo.destroy
respond_to do |format|
format.html { redirect_to extrainfos_url, notice: 'Extrainfo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to d... | [
"0.7043066",
"0.7011445",
"0.6942014",
"0.69308174",
"0.6903876",
"0.6897384",
"0.68756527",
"0.6838577",
"0.6838577",
"0.6838577",
"0.6838577",
"0.6828904",
"0.68108577",
"0.6798737",
"0.6778925",
"0.67766374",
"0.6763466",
"0.67148453",
"0.67148453",
"0.67074263",
"0.670496... | 0.7034075 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_extrainfo
@extrainfo = Extrainfo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def extrainfo_params
params.require(:extrainfo).permit(:house_id, :managebool, :managefee, :internet, :television, :cleanfee, :waterfee, :parking, :enterdate, :aircon, :laundary, :pet)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
This is a good place to test this stuff, since the filters are simplified. | def test_filters
@request.env['HTTP_ACCEPT_LANGUAGE'] = "pt-pt,pt;q=0.5"
good_ajax_request(:test)
assert_nil(@controller.instance_variable_get('@user'))
assert_nil(User.current)
assert_equal(:pt, I18n.locale)
assert_equal(0, cookies.count)
assert_equal({'locale'=>'pt'}, session)
session.delete('locale')
@request.env['HTTP_ACCEPT_LANGUAGE'] = "pt-pt,xx-xx;q=0.5"
good_ajax_request(:test)
assert_equal(:pt, I18n.locale)
session.delete('locale')
@request.env['HTTP_ACCEPT_LANGUAGE'] = "pt-pt,en;q=0.5"
good_ajax_request(:test)
assert_equal(:pt, I18n.locale)
session.delete('locale')
@request.env['HTTP_ACCEPT_LANGUAGE'] = "en-xx,en;q=0.5"
good_ajax_request(:test)
assert_equal(:en, I18n.locale)
@request.env['HTTP_ACCEPT_LANGUAGE'] = "zh-*"
good_ajax_request(:test)
assert_equal(:en, I18n.locale)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filters; end",
"def filters; end",
"def filters\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def strict_filters; end",
"def apply_filter\n end",
"def bench_filters\n skip 'TODO'\n end",
"def filter\n end",
"def filters=(_arg0); end",
"def filters=(_arg0);... | [
"0.79483217",
"0.79483217",
"0.7522553",
"0.74829394",
"0.74829394",
"0.74829394",
"0.7412993",
"0.73165345",
"0.7308621",
"0.7274344",
"0.72340125",
"0.72340125",
"0.7215026",
"0.7143447",
"0.71086794",
"0.6999384",
"0.6875659",
"0.6875659",
"0.68176144",
"0.68048793",
"0.67... | 0.0 | -1 |
genera la secuencia sugerida para la nueva cuenta a crear, dependiendo del nivel, grupo y antesosor(padre) | def secuenciasugerida
#recupera los hijos del padre de la cuenta a crear
hijos = Catalogo.where("padre_id = ? AND activo = ?", idcuenta, true)
#configuracion del nivel a crear
idnivel = Catalogo.find_by(id: idcuenta).nivel_id
nivelh = Nivel.find_by(id: idnivel).numnivel + 1
nivel = Nivel.find_by(numnivel: nivelh)
nrodigitos = nivel.nrodigitos
nrodigitostotal = nivel.nrodigitostotal
digito = 0
aux = 0
hijos.each do |e|
aux = e.codigo.last(nrodigitos).to_i
if digito < aux
digito = aux
end
end
digito = digito + 1
c =""
nrodigitos.times { c = c + "0" }
c = c.to_s + digito.to_s
#codigo sugerido
return c.last(nrodigitos).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crear_cuotas\n case params[:adquisicion][:tipo_pago].to_s\n when TIPOS_PAGO[:unico].to_s\n @adquisicion.cuotas.destroy_all\n cuotas = params[:cant_cuotas]\n monto_cuota = @adquisicion.precio / cuotas.to_d\n cuotas.to_i.times do |i|\n @adquisicion.cuotas.create(monto: monto_cuot... | [
"0.6265763",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.6134717",
"0.6045473",
"0.6026282",
"0.60232174",
"0.6023134",
"0.59959847",
"0.5969039",
"0.596721",
"0.59435815",
"0.5931124",
"0.5926837",
"0.5911679",
"0.591013",
"0.590389... | 0.71432227 | 0 |
only considers quickerydefined attributes that has corresponding _is_synced attribute | def autoload_unsynced_quickery_attributes!
model = self.class
new_values = {}.with_indifferent_access
defined_quickery_attribute_names = model.quickery_builders.keys
defined_quickery_attribute_names.each do |defined_quickery_attribute_name|
if has_attribute?(:"#{defined_quickery_attribute_name}_is_synced") && !send(:"#{defined_quickery_attribute_name}_is_synced")
new_values[defined_quickery_attribute_name] = determine_quickery_value(defined_quickery_attribute_name)
new_values[:"#{defined_quickery_attribute_name}_is_synced"] = true
end
end
update_columns(new_values) if new_values.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _synced?(foreign_key)\n !!_synced[foreign_key]\n end",
"def scrub_synchronization_attribute(deal,attr)\n if deal.class.respond_to?(:textiled_attributes) && deal.class.textiled_attributes.include?(attr)\n new_value = deal.send(\"#{attr}_source\")\n else\n new_value = deal.send(... | [
"0.6095924",
"0.59599996",
"0.58271426",
"0.5730572",
"0.5705877",
"0.5695839",
"0.5673582",
"0.55953157",
"0.5543445",
"0.55270517",
"0.5524354",
"0.5520179",
"0.5516502",
"0.551319",
"0.55001205",
"0.54952997",
"0.5477083",
"0.5475733",
"0.5455401",
"0.5431728",
"0.5431087"... | 0.71277004 | 0 |
Public: resolves a template file by looking in the template path. template the template name. extension the extension of the desired template. Returns a string with the full path of the template file, or nil if it is not found. | def which(template, extension)
template_with_extension = with_extension(template, extension)
path = absolute_paths.find do |path|
File.exists?(File.join(path, template_with_extension))
end
if path
File.join(path, template_with_extension)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_generic_base_path_for(template_path, extension)\r\n self.generic_view_paths.each do |generic_path|\r\n template_file_name = File.basename(\"#{template_path}.#{extension}\")\r\n generic_file_path = File.join(generic_path, template_file_name)\r\n return generic_file_path if File.file?(gene... | [
"0.68350315",
"0.67410886",
"0.6671121",
"0.6603019",
"0.6590045",
"0.65762275",
"0.6571085",
"0.65390545",
"0.6436278",
"0.64287364",
"0.6421778",
"0.6420174",
"0.6385109",
"0.63465685",
"0.63382506",
"0.63286084",
"0.62684655",
"0.6265778",
"0.6265469",
"0.62527573",
"0.624... | 0.776013 | 0 |
Internal: retrieves a list of paths that should be searched by looking the `SNP_PATH` environment variable or falling back to the default path. | def dir_list
path_from_env || default_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_from_env\n ENV['SNP_PATH'] && ENV['SNP_PATH'].split(':')\n end",
"def search_paths\n if Facter::Util::Config.is_windows?\n ENV['PATH'].split(File::PATH_SEPARATOR)\n else\n # Make sure facter is usable even for non-root users. Most commands\n # in /sbin (l... | [
"0.72445565",
"0.68553615",
"0.6469568",
"0.64056104",
"0.639273",
"0.6331441",
"0.6125215",
"0.6104536",
"0.60263735",
"0.59498423",
"0.5897598",
"0.588875",
"0.5884232",
"0.57936925",
"0.5776198",
"0.57615453",
"0.57575643",
"0.5755106",
"0.57244617",
"0.57162446",
"0.56857... | 0.6612498 | 2 |
Internal: parses the SNP_PATH environment variable, if it is set. The format of this variable follows the same convention of the shell's PATH variable: a series of directories separated by a collon. | def path_from_env
ENV['SNP_PATH'] && ENV['SNP_PATH'].split(':')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_components\n ENV[\"PATH\"].split(File::PATH_SEPARATOR)\n end",
"def search_paths\n if Facter::Util::Config.is_windows?\n ENV['PATH'].split(File::PATH_SEPARATOR)\n else\n # Make sure facter is usable even for non-root users. Most commands\n # in /sbin ... | [
"0.6350788",
"0.61692876",
"0.6108359",
"0.60479987",
"0.6006013",
"0.56962854",
"0.560953",
"0.54449874",
"0.5419041",
"0.53316724",
"0.5322733",
"0.52796775",
"0.523518",
"0.52253497",
"0.52247226",
"0.52175707",
"0.514121",
"0.5131753",
"0.5096797",
"0.5081887",
"0.5060693... | 0.76109356 | 0 |
Internal: The default path to be used when the SNP_PATH environment variable is not set. | def default_path
['~/.snp']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def default_path\n [ (std_path || key).to_s ]\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def default_location(path)\n @default_l... | [
"0.720874",
"0.7201132",
"0.6855536",
"0.68170434",
"0.65672755",
"0.65531117",
"0.65386796",
"0.6502629",
"0.64971036",
"0.6458221",
"0.6452482",
"0.6447052",
"0.64297146",
"0.636688",
"0.63502985",
"0.6346362",
"0.6315723",
"0.63072366",
"0.6253574",
"0.623244",
"0.6228113"... | 0.78266937 | 0 |
Internal: checks if the given name ends with the passed `extension`. template the template file name. | def has_extension?(template, extension)
comparison_length = extension.size + 1 # account for the separator `.`
template[-comparison_length, comparison_length] == ".#{extension}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_extension(template, extension)\n if has_extension?(template, extension)\n template\n else\n [template, extension].join(\".\")\n end\n end",
"def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_t... | [
"0.6975325",
"0.6791653",
"0.66175735",
"0.6517187",
"0.6449324",
"0.63726413",
"0.6355915",
"0.63004774",
"0.6284425",
"0.6154373",
"0.6081745",
"0.6077228",
"0.6063268",
"0.6059363",
"0.6023971",
"0.60202056",
"0.59951144",
"0.5989277",
"0.5966371",
"0.5961906",
"0.5943594"... | 0.7559135 | 0 |
Internal: appends a given extension to the template file name, unless it is already present. template the template name. extension the extension to be appended. Examples with_extension('template', 'erb') => 'template.erb' with_extension('template.erb', 'erb') => 'template.erb' | def with_extension(template, extension)
if has_extension?(template, extension)
template
else
[template, extension].join(".")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extension(extension)\n @parts[-1] += extension\n self\n end",
"def has_extension?(template, extension)\n comparison_length = extension.size + 1 # account for the separator `.`\n template[-comparison_length, comparison_length] == \".#{extension}\"\n end",
"def add_extension(extension... | [
"0.6594336",
"0.65772706",
"0.63158554",
"0.63143957",
"0.61433566",
"0.6132027",
"0.61304796",
"0.6016413",
"0.6016127",
"0.59928286",
"0.59236294",
"0.57205904",
"0.56855106",
"0.5682433",
"0.5664156",
"0.5629763",
"0.5608832",
"0.56020075",
"0.55786294",
"0.55632615",
"0.5... | 0.8158917 | 0 |
equation type: dx + ey + f = 0 | def initialize(x:, y:, k:)
@x_coeff, @y_coeff, @k_coeff = x.to_r, y.to_r, k.to_r
validation
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equation\n \"du/dt + #{@a} * du/dx = 0, #{@x[0]} < x < #{@x[-1]} and #{@t[0]} < t < #{@t[-1]}, u(0,t) = u(#{@x[-1]}, t)\"\n end",
"def linear_equation(equation)\n #TODO:: calculate\n end",
"def equationValue(a, b, c, d, x)\n\t\tf = ((a+x)/(b+x))**(b + x)\n\t\tf = f - (c/d)\n\t\treturn f\n\t... | [
"0.657003",
"0.6253532",
"0.6112311",
"0.5964109",
"0.56531453",
"0.5639497",
"0.56327915",
"0.5600428",
"0.5560593",
"0.55492884",
"0.5546164",
"0.55413586",
"0.5513886",
"0.5510171",
"0.54946834",
"0.5494127",
"0.5471322",
"0.54445285",
"0.53842735",
"0.53809494",
"0.537771... | 0.0 | -1 |
We need to sign the customer in ourselves, since iVeri is not sending the relevant data back to us to do so. | def sign_the_customer_in
transaction = ::Refinery::Transactions::Transaction.find_by_unique_guid(params['REFERENCE'])
sign_in(:customer, ::Refinery::Customers::Customer.find(transaction.order.customer_id))
@current_cart = get_cart # get the cart again now that the customer is signed in.
#@order = Order.find(params[:order_id])
#if params['CUSTOMER_ID'].present? and @order.customer.id.to_s == params['CUSTOMER_ID'].to_s
# sign_in(:customer, ::Refinery::Customers::Customer.find(params['CUSTOMER_ID']))
# @current_cart = get_cart # get the cart again now that the customer is signed in.
#else
# flash[:alert] = "You are not authorised to view that order's details"
# redirect_to refinery.root_path
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_customer\n if signed_in?\n # technically we need nothing here\n end\n end",
"def signing_input; end",
"def signing_input; end",
"def yes_email_customer_from_authorizes_side\n add_field 'x_email_customer', 'TRUE'\n end",
"def sign_key; end",
"def authenticate_customer ... | [
"0.6846734",
"0.63465387",
"0.63465387",
"0.63450724",
"0.6340723",
"0.63189065",
"0.6277125",
"0.6246811",
"0.6063762",
"0.60343224",
"0.60134095",
"0.60134095",
"0.60125744",
"0.59851396",
"0.59639746",
"0.59639627",
"0.5956256",
"0.5952504",
"0.590299",
"0.5901953",
"0.589... | 0.71816576 | 0 |
============================================================= Array of commands for text area toolbar, arranged into command groups. | def command_list
options[:commands] || SimpleFormEpicEditor::EpicEditorInput.configuration.commands
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editor_toolbar\n [\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'Paste... | [
"0.69749165",
"0.6785098",
"0.67527103",
"0.66377825",
"0.65820795",
"0.6544469",
"0.6330386",
"0.63066477",
"0.62974465",
"0.6295889",
"0.6289949",
"0.62580293",
"0.6246095",
"0.6214037",
"0.6201597",
"0.61950517",
"0.61791986",
"0.616637",
"0.6159494",
"0.6140782",
"0.61385... | 0.6497417 | 6 |
GET /events GET /events.json | def index
# @events = Event.all
if params[:id]
# get all records with id less than 'our last id'
# and limit the results to 5
@events = Event.where('id < ?', params[:id]).limit(5)
else
@events = Event.limit(5)
end
respond_to do |format|
format.html
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.8337474",
"0.8240041",
"0.7943668",
"0.79278964",
"0.7768141",
"0.7740975",
"0.7670209",
"0.7665706",
"0.765914",
"0.76425344",
"0.7621046",
"0.761625",
"0.761625",
"0.76141375",
"0.75690866",
"0.75230986",
"0.7489482",
"0.74811614",
"0.7470508",
"0.7442612",
"0.74410146",... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
@event = Event.find_by_id(params[:id])
@users = DetailedUser.joins('JOIN event_registers ON event_registers.user_id = detailed_users.user_id WHERE event_id = ' + params[:id])
@comments = Comment.where(event_id: params[:id]).order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.719221... | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params)
respond_to do |format|
if @event.save
# When a host adds an event, he/she gets automatically joined
EventRegister.create(:user_id => current_user.id, :event_id => @event.id)
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.75308925",
"0.7372846",
"0.71773857",
"0.71726954",
"0.7171285",
"0.71428627",
"0.7096435",
"0.7083602",
"0.7083602",
"0.70582867",
"0.7021309",
"0.6990082",
"0.6982827",
"0.6977965",
"0.6960428",
"0.69546765",
"0.69546765",
"0.6952509",
"0.69216263",
"0.69216263",
"0.6921... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
event = Event.find_by_id(params[:id])
sailing = Sailing.find_by_id(event.sailing_id).cruise_ship_name
@event.destroy
respond_to do |format|
format.html { redirect_to user_dashboard_path, notice: "#{event.event_name} Event in #{sailing} cruise was successfully deleted."}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.769268",
"0.76872975",
"0.76872975",
"0.76872975",
"0.7680665",
"0.7585337",
"0.75682765",
"0.7560537",
"0.75407815",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7540473",
"0.7539941",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.fetch(:event, {}).permit(:creator_id,:sailing_id, :event_name, :start_date , :end_date, :location, :max_participants, :sailing_id, :description, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
TODO: Dynamically get all rows rather than pass 'range' | def rows(range = 'Sheet1!A1:E')
get_spreadsheet_data('1eu1Dk67gKnrIgQQ9Fm0Y-RCMzRfZf1UaTQzEt7hjWp0', range)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rows_range(first = 0, last = nil) # :nodoc:\n raise UserError, 'first must be <= last' unless first <= last\n\n rows = []\n unless columns.empty?\n first.upto(last) do |rnum|\n row = {}\n columns.each do |col|\n row[col.header] = col[rnum]\n end\n ... | [
"0.672839",
"0.67164075",
"0.6694675",
"0.66362226",
"0.6615368",
"0.66138285",
"0.6606335",
"0.6586247",
"0.6586247",
"0.6586247",
"0.6510116",
"0.65025324",
"0.6498556",
"0.6463678",
"0.6440741",
"0.64182705",
"0.6337631",
"0.6328529",
"0.6287581",
"0.6259047",
"0.6258721",... | 0.7596468 | 0 |
returns array with hospital id, medication_id, number of times medication_id was used at hospital [42, 16765295]=>111 | def specific_type_of_medication_per_hospital
self.group(:hospital_id, :medication_id).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_difficulties\n hash = {}\n i = 0\n while i < 20\n hash[i] = 0\n i += 1\n end\n Drink.all.each do |drink|\n hash[drink.ingredient_cards.count] += 1\n end\n puts hash\nend",
"def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ?... | [
"0.58500665",
"0.58138436",
"0.58138436",
"0.576875",
"0.57653105",
"0.5693156",
"0.565424",
"0.56382746",
"0.56226605",
"0.5613709",
"0.55733454",
"0.5559981",
"0.5547532",
"0.55389106",
"0.553436",
"0.55102015",
"0.54824936",
"0.54754084",
"0.5461262",
"0.5435352",
"0.53868... | 0.72497386 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def conversation_params
params.require(:conversation).permit(:participant_id).merge(user_id: current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /driver_records/1 GET /driver_records/1.json | def show
@driver_record = DriverRecord.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @driver_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # Show one record\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end",
"def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb... | [
"0.6861106",
"0.6809781",
"0.6809781",
"0.6574814",
"0.6574814",
"0.65286845",
"0.64505",
"0.64355457",
"0.6401136",
"0.62814564",
"0.62053055",
"0.6124168",
"0.60773325",
"0.6062787",
"0.5990919",
"0.5952037",
"0.5906692",
"0.58758545",
"0.58706003",
"0.5868208",
"0.5864481"... | 0.7367887 | 0 |
GET /driver_records/new GET /driver_records/new.json | def new
@driver_record = DriverRecord.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @driver_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record }\n end\n end",
"def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record }\n end\n... | [
"0.7258903",
"0.72587854",
"0.7236554",
"0.718399",
"0.69215286",
"0.6864256",
"0.68528205",
"0.68060476",
"0.67966753",
"0.6787377",
"0.67457736",
"0.6743945",
"0.668736",
"0.66867137",
"0.667267",
"0.66495174",
"0.66326463",
"0.66323626",
"0.66277874",
"0.6599418",
"0.65901... | 0.7901467 | 0 |
POST /driver_records POST /driver_records.json | def create
@driver_record = DriverRecord.new(params[:driver_record])
respond_to do |format|
if @driver_record.save
format.html { redirect_to @driver_record, notice: 'Driver record was successfully created.' }
format.json { render json: @driver_record, status: :created, location: @driver_record }
else
format.html { render action: "new" }
format.json { render json: @driver_record.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # Logic to create a driver and submit to DB\n @driver = Driver.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, locatio... | [
"0.6331399",
"0.62563723",
"0.61658174",
"0.6081424",
"0.60665923",
"0.59789217",
"0.5924245",
"0.5627075",
"0.5605765",
"0.5591048",
"0.5588457",
"0.5579364",
"0.5578564",
"0.557839",
"0.5564735",
"0.55064946",
"0.5502049",
"0.5485057",
"0.5479977",
"0.54617584",
"0.5436395"... | 0.69242376 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.