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 |
|---|---|---|---|---|---|---|
Power on VApp or VM | def power_on
target = entity_xml
class_name = self.class.name.split("::").last
Config.logger.debug "#{class_name} status: #{target[:status]}"
if is_status?(target, :POWERED_ON)
Config.logger.info "#{class_name} #{target.name} is already powered-on."
return
end
power_on_link = target.power_on_link
unless power_on_link
fail CloudError,
"#{class_name} #{target.name} not in a state able to power on."
end
Config.logger.info "Powering on #{class_name} #{target.name}."
task = connection.post(power_on_link, nil)
task = monitor_task task, @session.time_limit[:power_on]
Config.logger.info "#{class_name} #{target.name} is powered on."
task
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poweron_vapp(vAppId)\n power_action(vAppId, 'powerOn')\n end",
"def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end",
"def power_down\n send_to_vm('system_powerdown')\n end",
"def power_on\n requires :id\n begin\n response = service.post_power... | [
"0.76148784",
"0.7157031",
"0.6955295",
"0.6854255",
"0.67305183",
"0.65882814",
"0.6584114",
"0.6584114",
"0.6483614",
"0.6410738",
"0.6399086",
"0.6351483",
"0.6306742",
"0.6302656",
"0.6289361",
"0.6194608",
"0.6117783",
"0.60801023",
"0.6014777",
"0.6001871",
"0.5992439",... | 0.5528514 | 49 |
Power off VApp or VM | def power_off
target = entity_xml
class_name = self.class.name.split("::").last
Config.logger.debug "#{class_name} status: #{target[:status]}"
if is_status?(target, :SUSPENDED)
error_msg = "#{class_name} #{target.name} suspended, discard state before powering off."
fail class_name == "VApp" ? VappSuspendedError : VmSuspendedError,
error_msg
end
if is_status?(target, :POWERED_OFF)
Config.logger.info "#{class_name} #{target.name} is already powered off."
return
end
power_off_link = target.power_off_link
unless power_off_link
fail CloudError, "#{class_name} #{target.name} is not in a state that could be powered off."
end
task = connection.post(power_off_link, nil)
monitor_task task, @session.time_limit[:power_off]
Config.logger.info "#{class_name} #{target.name} is powered off."
undeploy(target, class_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end",
"def power_down\n send_to_vm('system_powerdown')\n end",
"def power_off\n requires :id\n begin\n response = service.post_power_off_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => e... | [
"0.828016",
"0.7356409",
"0.7319127",
"0.7077728",
"0.6955598",
"0.69265175",
"0.68636554",
"0.6856339",
"0.6841221",
"0.67000127",
"0.66659576",
"0.6656382",
"0.6607064",
"0.6527745",
"0.6511562",
"0.6508504",
"0.64613116",
"0.6440365",
"0.64341",
"0.64026225",
"0.63478804",... | 0.66241765 | 12 |
Get an array of the questions that this user has not recently answered for this project. | def get_unanswered_questions_for_user(user)
raise 'user is nil' if user.nil?
# Get questions the user has answered.
user_answered_questions = QuestionResponse.where(:user_id => user.id).map(&:question)
# Subtract those from the full set of questions to get the set of any that
# have not been answered.
questions - user_answered_questions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unanswered_questions\n Question.all.reject do |question|\n responsers_id = question.responses.pluck(:user_id)\n responsers_id.include?(self.id)\n end\n end",
"def unanswered_questions\n answered_ids = self.responses.map(&:beta_question_id)\n BetaQuestion.where.not(id: answered_ids)... | [
"0.73567826",
"0.71812195",
"0.68136287",
"0.65143096",
"0.65022033",
"0.6413687",
"0.63804454",
"0.62655747",
"0.62018496",
"0.61759347",
"0.6167666",
"0.6078338",
"0.6066839",
"0.6036349",
"0.5992762",
"0.59179235",
"0.5885822",
"0.58222455",
"0.57901466",
"0.57595575",
"0.... | 0.76982695 | 0 |
GET /customers/1 GET /customers/1.json | def show
@customer = Customer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @customer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def index\n @user = current_user\n @customers = @user.custom... | [
"0.78568625",
"0.78568625",
"0.7680524",
"0.76006114",
"0.7533196",
"0.7516672",
"0.7499743",
"0.7383202",
"0.73160666",
"0.7308929",
"0.7281901",
"0.71956944",
"0.71879476",
"0.7172753",
"0.71692395",
"0.71651024",
"0.71575785",
"0.7128045",
"0.70640624",
"0.70486444",
"0.70... | 0.7336955 | 13 |
GET /customers/new GET /customers/new.json | def new
@customer = Customer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @customer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @cust = Cust.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cust }\n end\n end",
"def new\n @customer = Customer.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.json { render :json=> @customer }\n en... | [
"0.7813316",
"0.7720536",
"0.7530002",
"0.75027776",
"0.74880755",
"0.7457381",
"0.7391458",
"0.738227",
"0.73290175",
"0.7322143",
"0.73083246",
"0.73078835",
"0.7296098",
"0.72327477",
"0.7211305",
"0.71389276",
"0.70626473",
"0.704246",
"0.70104134",
"0.70104134",
"0.70023... | 0.7972855 | 4 |
POST /customers POST /customers.json | def demo
@customer = Customer.find(params[:id])
@customer.demo_started
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n ... | [
"0.7583026",
"0.7368963",
"0.72758555",
"0.7225672",
"0.7224766",
"0.7142322",
"0.7116918",
"0.7109281",
"0.7102696",
"0.70753646",
"0.7068943",
"0.7054525",
"0.70359194",
"0.70359194",
"0.70350176",
"0.703466",
"0.70175",
"0.7017294",
"0.7017294",
"0.7017294",
"0.7017294",
... | 0.0 | -1 |
PUT /customers/1 PUT /customers/1.json | def update
@customer = Customer.find(params[:id])
respond_to do |format|
if @customer.update_attributes(params[:customer])
format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @customer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end",
"def update\n @customer = Customer.find(params[:id])\n\n if @customer.update(customer_params)\n head :no_content\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end",
"def u... | [
"0.7743715",
"0.7067938",
"0.69606483",
"0.6872385",
"0.6764466",
"0.6758928",
"0.67347896",
"0.6719386",
"0.66538876",
"0.658777",
"0.6585744",
"0.65855277",
"0.65826714",
"0.65451145",
"0.65451145",
"0.65451145",
"0.6544011",
"0.6541101",
"0.65346235",
"0.65346235",
"0.6534... | 0.6690351 | 14 |
DELETE /customers/1 DELETE /customers/1.json | def destroy
@customer = Customer.find(params[:id])
@customer.destroy
respond_to do |format|
format.html { redirect_to customers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |for... | [
"0.7459997",
"0.7459997",
"0.7435839",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7429404",
"0.7364333",
"0.732843",
"0.72985286",
"0.72831863",
"0.7236284",
"0.71671945",
"0.71460426",
"0.71443635",
"0.7143448",
"0.7143448",... | 0.74485695 | 8 |
n = 10, m = 20 | def mex(arr)
0.upto($n) do |nn|
if arr.any? nn
next
else
return nn
end
end
$n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cantor_pairing(n, m)\n (n + m) * (n + m + 1) / 2 + m\nend",
"def paperwork(n, m)\n if n>0&&m>0\n n*m\n else\n 0\n end\nend",
"def many_results(n)\r\n\treturn 1, n /2, n\r\nend",
"def test(m,n,&block)\n\tif (m > 20000)\n\t\treturn\n\tend\n\n\tyield(m,n)\n\ttest(2*m - n, m, &block)\n\ttest(2*m ... | [
"0.65577173",
"0.65526253",
"0.6494602",
"0.6464229",
"0.6448892",
"0.6374063",
"0.6348153",
"0.62825537",
"0.6221183",
"0.62202054",
"0.62170374",
"0.62156826",
"0.6184566",
"0.6139534",
"0.6132345",
"0.61201054",
"0.6113344",
"0.61109126",
"0.60873586",
"0.60779554",
"0.606... | 0.0 | -1 |
Returns the unused edges between start_node and end_node unused_paths('A', 'B', [['A', 'B', 40], ['A', 'B', 50]]) => ['A', 'B', 50] | def unused_paths(start_node, end_node, graph)
graph - shortest_path(start_node, end_node, graph)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvi... | [
"0.5949453",
"0.58409184",
"0.58347017",
"0.5822343",
"0.5772505",
"0.5659293",
"0.5659194",
"0.5646116",
"0.56432325",
"0.55690074",
"0.5551169",
"0.5494781",
"0.5470491",
"0.5461369",
"0.5437451",
"0.54272735",
"0.5340842",
"0.5303972",
"0.5290269",
"0.52886367",
"0.5284135... | 0.79973143 | 0 |
Returns the shortest path between start_node and end_node shortest_path('A', 'B', [['A', 'B', 40], ['A', 'B', 50]]) => ['A', 'B', 40] | def shortest_path(start_node, end_node, graph)
adjacent_edges = graph.select{ | edge | edge[NODES].include?(start_node) }
remaining_edges = graph - adjacent_edges
shortest_path = Path.new
adjacent_edges.each do | edge |
path = Path.new [edge]
neighbor_node = (edge[NODES] - [start_node])[0] # ['A', 'B'] - ['A'] => ['B']
unless neighbor_node == end_node
path_ahead = shortest_path(neighbor_node, end_node, remaining_edges)
(path_ahead.empty?)? path.clear : path.concat(path_ahead)
end
shortest_path = path if path.distance < shortest_path.distance
end
shortest_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_shortest_path(start_node, end_node)\n\n\t\tif (!start_node || !end_node)\n\t\t\traise \"start and end nodes must be specified\"\n\t\tend\n\n\t\tqueue = Hash[@edges.keys.map { |k| [k, nil] }]\n\t\tqueue[start_node] = 0\n\n\t\tdistances = queue.dup\n\t\tcrumbs = {}\n\n\t\twhile queue.size > 0\n\n\t\t\texpan... | [
"0.7734895",
"0.69417036",
"0.6900812",
"0.6783005",
"0.6681242",
"0.66746485",
"0.6572827",
"0.6556635",
"0.65192974",
"0.65025693",
"0.64050007",
"0.6377552",
"0.63288075",
"0.63217765",
"0.6229656",
"0.6156852",
"0.61536026",
"0.6064269",
"0.59659636",
"0.5946425",
"0.5895... | 0.7901966 | 0 |
GET /hardware_types GET /hardware_types.json | def index
@hardware_types = HardwareType.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @hardware_types }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def index\n @admin_hardware_types = Admin::HardwareType.all\n end",
"def index\n @hw_types = HwType.all\n ... | [
"0.72239244",
"0.693986",
"0.6900906",
"0.6740047",
"0.65518534",
"0.65321505",
"0.648507",
"0.6418593",
"0.6393993",
"0.63379925",
"0.6265403",
"0.62302667",
"0.6186797",
"0.6180384",
"0.61777145",
"0.6141426",
"0.61214244",
"0.6117595",
"0.61090887",
"0.6092717",
"0.6082697... | 0.7753563 | 0 |
GET /hardware_types/1 GET /hardware_types/1.json | def show
@hardware_type = HardwareType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @hardware_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f... | [
"0.76444364",
"0.6928848",
"0.6849027",
"0.6742154",
"0.66638184",
"0.62876123",
"0.62833846",
"0.62642837",
"0.62317044",
"0.62063015",
"0.6200888",
"0.6194364",
"0.6176144",
"0.6169172",
"0.6159052",
"0.6124469",
"0.61185646",
"0.60946584",
"0.6090264",
"0.60553586",
"0.604... | 0.7659474 | 0 |
GET /hardware_types/new GET /hardware_types/new.json | def new
@hardware_type = HardwareType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @hardware_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @hardware_type = HardwareType.new(params[:hardware_type])\n\n respond_to do |format|\n if @hardware_type.save\n format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully created.' }\n format.json { render json: @hardware_type, status: :created, location... | [
"0.7619883",
"0.74500954",
"0.73655015",
"0.71468383",
"0.69699097",
"0.6901712",
"0.6880511",
"0.68630713",
"0.684563",
"0.6834002",
"0.68322486",
"0.6826623",
"0.6825134",
"0.6774301",
"0.67733765",
"0.6763767",
"0.67545444",
"0.6752",
"0.67405146",
"0.67229205",
"0.67216",... | 0.812482 | 0 |
POST /hardware_types POST /hardware_types.json | def create
@hardware_type = HardwareType.new(params[:hardware_type])
respond_to do |format|
if @hardware_type.save
format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully created.' }
format.json { render json: @hardware_type, status: :created, location: @hardware_type }
else
format.html { render action: "new" }
format.json { render json: @hardware_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @admin_hardware_type = Admin::HardwareType.new(admin_hardware_type_params)\n\n respond_to do |format|\n if @admin_hardware_type.save\n format.html { redirect_to @admin_hardware_type, notice: 'Hardware type was successfully created.' }\n format.json { render :show, status: :cre... | [
"0.7160812",
"0.66329587",
"0.6609034",
"0.6508831",
"0.65066105",
"0.6465922",
"0.6433219",
"0.6433219",
"0.63940275",
"0.63555247",
"0.6249105",
"0.6231603",
"0.6130117",
"0.6101172",
"0.60981447",
"0.60594136",
"0.6034645",
"0.6025435",
"0.6018041",
"0.6018041",
"0.5962343... | 0.73184234 | 0 |
PUT /hardware_types/1 PUT /hardware_types/1.json | def update
@hardware_type = HardwareType.find(params[:id])
respond_to do |format|
if @hardware_type.update_attributes(params[:hardware_type])
format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @hardware_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @admin_hardware_type.update(admin_hardware_type_params)\n format.html { redirect_to @admin_hardware_type, notice: 'Hardware type was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_hardware_type }\n else\n ... | [
"0.69335425",
"0.6684399",
"0.66260016",
"0.64413035",
"0.6366817",
"0.6316761",
"0.6279399",
"0.6278987",
"0.6250296",
"0.6218136",
"0.62136185",
"0.6185926",
"0.6177108",
"0.6128269",
"0.6104964",
"0.6104964",
"0.6104964",
"0.6048798",
"0.6045209",
"0.6045209",
"0.6028638",... | 0.7261701 | 0 |
DELETE /hardware_types/1 DELETE /hardware_types/1.json | def destroy
@hardware_type = HardwareType.find(params[:id])
@hardware_type.destroy
respond_to do |format|
format.html { redirect_to hardware_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @admin_hardware_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_hardware_types_url, notice: 'Hardware type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hw_type.destroy\n respond_to do |format|\n ... | [
"0.7576788",
"0.7403699",
"0.7198661",
"0.7190408",
"0.7179217",
"0.7174791",
"0.7163171",
"0.70834446",
"0.7081023",
"0.7072385",
"0.7063371",
"0.7056536",
"0.69685745",
"0.6964571",
"0.69609165",
"0.69528604",
"0.69369555",
"0.69221264",
"0.6893848",
"0.68921083",
"0.686582... | 0.7924252 | 0 |
Capistrano Deployment on shared Webhosting by RailsHoster | def gemfile_exists?
File.exists? "Gemfile"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_n... | [
"0.6984195",
"0.6984195",
"0.6374058",
"0.6315977",
"0.6168766",
"0.60848963",
"0.60695577",
"0.5970377",
"0.59687454",
"0.5950669",
"0.5945068",
"0.59345317",
"0.59340096",
"0.5933808",
"0.5920771",
"0.5919152",
"0.5913871",
"0.5901861",
"0.58976966",
"0.5887765",
"0.5875849... | 0.0 | -1 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | def strip_empty_entries(hash)
return hash unless hash.is_a?(Hash)
hash.inject({}) do |m, (k, v)|
m[k] = strip_empty_entries(v) unless v&.empty?
m.delete(k) if m[k].nil? || m[k].empty?
m
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def implementation; end",
"def implementation; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; en... | [
"0.66186446",
"0.5638678",
"0.5638678",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
"0.5544485",
... | 0.0 | -1 |
Creates a user and signs them into the app | def login_user
password = Faker::Internet.password
with_versioning do
@logged_in_user = create(:user, password: password, password_confirmation: password)
end
sign_in_with_credentials(@logged_in_user.email, password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.create! user_params\n logger.info \"New User with id #{@user.id} ha... | [
"0.8004476",
"0.7802815",
"0.7801775",
"0.76841235",
"0.7674253",
"0.762815",
"0.7610934",
"0.76019293",
"0.7596841",
"0.7577362",
"0.7576442",
"0.75564444",
"0.7554394",
"0.75403816",
"0.75205165",
"0.7510708",
"0.7510227",
"0.75017357",
"0.7496442",
"0.7449844",
"0.743998",... | 0.0 | -1 |
Visits the new session path and signs in using `username` and `password`. The logged in user should normally appear at the Dashboard | def sign_in_with_credentials(username, password)
visit new_user_session_path
fill_in 'user_email', with: username
fill_in 'user_password', with: password
click_button 'Sign in'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end",
"def login_user\n visit \"/logi... | [
"0.7416623",
"0.7399929",
"0.737281",
"0.7271193",
"0.7202771",
"0.7176291",
"0.71444345",
"0.7128766",
"0.71148497",
"0.7077651",
"0.70445096",
"0.7040333",
"0.70122385",
"0.70089126",
"0.70059925",
"0.70059925",
"0.69957113",
"0.6974817",
"0.6944789",
"0.6923043",
"0.691932... | 0.69339645 | 19 |
The currently logged in user | def logged_in_user
@logged_in_user || raise('User has not been assigned')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n ... | [
"0.8670385",
"0.8628398",
"0.8628398",
"0.8551297",
"0.85308444",
"0.8525896",
"0.8500777",
"0.8494313",
"0.8492997",
"0.8490978",
"0.8485222",
"0.8485222",
"0.84357935",
"0.84212625",
"0.83955616",
"0.83955616",
"0.838462",
"0.8379498",
"0.8374879",
"0.8356595",
"0.8341948",... | 0.0 | -1 |
This method creates the undergraduate program object with its undergrad _department child object | def create
@undergraduateprogram = UndergraduateProgram.create(params[:undergraduateprogram])
@ugd=@undergraduateprogram.undergrad_departments.new(params[:undergraddepartment])
@ugd.save
#@undergraduatedeparment= @undergraduateprogram. undergrad_departments.build(params[:undergraddepartment])
#@showugd = @undergraduateprogram.undergrad_departments
if @undergraduateprogram.save
#Rails.logger.info("----testttttttt--------"+ @undergraduateprogram => params[:undergraduateprogram])
#flash[:notice] = "successfully saved"
#render :action => "new"
#@showugd = @undergraduateprogram.undergrad_departments
redirect_to :action => "show", :id => @undergraduateprogram.id
#redirect_to :action =>"show", :undergraduateprogram => @undergraduateprogram
else
flash[:notice] = "error saving the data"
render :action => "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_new\n @program = Program.new\n @department = Department.find(params[:id])\n end",
"def create\n @education_program = EducationProgram.new(education_program_params)\n\n respond_to do |format|\n if @education_program.save\n format.html { redirect_to @education_program, notice: ... | [
"0.6563392",
"0.6024359",
"0.5951677",
"0.59408396",
"0.58106387",
"0.5794931",
"0.5775016",
"0.5699851",
"0.5691478",
"0.56670934",
"0.5652702",
"0.5644694",
"0.56393313",
"0.55746746",
"0.5545124",
"0.5511091",
"0.5473964",
"0.54285485",
"0.5405715",
"0.53979075",
"0.539635... | 0.6848812 | 0 |
This method lists the undergraduate program object | def show
logger.info("!!!!!!!!!!! #{params[:id]} !!!!!!")
@undergraduateprogram = UndergraduateProgram.where(['id = ?', params[:id]])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_gym_programs\n system \"clear\"\n program = TTY::Prompt.new.select(\"Gym Program(s):\", self.programs.pluck(:name))\n found = (Program.find_by(name: program)).description\n puts found\n puts \"\"\n TTY::Prompt.new.select(\" \") do |menu|\n menu.choice \... | [
"0.6338951",
"0.6130939",
"0.61297005",
"0.60620934",
"0.6035521",
"0.5952781",
"0.58894837",
"0.582866",
"0.58191234",
"0.5818096",
"0.57664",
"0.5755957",
"0.5744342",
"0.57427174",
"0.5722506",
"0.5722506",
"0.5722506",
"0.5718918",
"0.57149166",
"0.5705786",
"0.5703618",
... | 0.6316468 | 1 |
This method updates the undergraduate program object | def update
@undergraduateprogram = UndergraduateProgram.find(params[:id])
@undergraduateprogram.update_attributes(params[:undergraduateprogram])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @program = Program.find(params[:id])\n [:program_subjects, :program_sizes].each do |attrib|\n params[:program][attrib] = ApplicationHelper.send(\"make_#{attrib.to_s}\", params[:program][attrib], @org_id, @progr)\n end\n params[:program][:program_cost_length_maps] = make_program_cost_l... | [
"0.6117073",
"0.60108703",
"0.600021",
"0.59096974",
"0.589441",
"0.5893076",
"0.5828123",
"0.5828123",
"0.5828123",
"0.5828123",
"0.5828123",
"0.5828123",
"0.5828123",
"0.58105916",
"0.5804418",
"0.58038265",
"0.5791235",
"0.579064",
"0.57535297",
"0.57301915",
"0.57185054",... | 0.71826947 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.report_mailer.report_data.subject | def report_data(name, email)
@greeting = "Hello!"
@assembly = Assembly.find_by_name(name)
@hits=Hit.where(subject: Gene.where(sequence: Sequence.where(assembly: @assembly))).order(percent_similarity: :desc)
@report=CSV.open("your-super-report.csv", "w+") do |csv|
csv << ["Assembly Name", "Assembly Date," "Sequence", "Sequence Quality", "Gene Sequence", "Gene Starting Position", "Gene Direction", "Hit Name", "Hit Sequence", "Hit Similarity"]
@hits.each do |h|
csv << h.match_gene_name, h.match_gene_dna.first(100), h.percent_similarity
end
end
mail to: email, subject: "Your Report", from: "mailgun@mailgun.org"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}... | [
"0.6880846",
"0.6754338",
"0.67094254",
"0.6671118",
"0.66159916",
"0.6556713",
"0.6551797",
"0.6486993",
"0.64455056",
"0.64407223",
"0.64350194",
"0.6434857",
"0.6428767",
"0.6381358",
"0.6279026",
"0.6234177",
"0.6223918",
"0.6209509",
"0.6209509",
"0.6209509",
"0.6209509"... | 0.0 | -1 |
has_many :products, :through => :line_items accepts_nested_attributes_for :line_items, :user , :address | def user_attributes=(attrs)
self.user = User.where(attrs).first_or_initialize(attrs)
@show_exists_message = !user.new_record?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_item_params\n params.require(:line_items).permit(:product,:references, :cart,:belongs_to)\n end",
"def line_item_params\n params.require(:line_item).permit(:product_id, :cart_id, product_attributes: [:title])\n end",
"def line_item_params\n params.require(:line_item).permit(:product_i... | [
"0.72657275",
"0.71236163",
"0.69455713",
"0.6847312",
"0.6813625",
"0.6784166",
"0.67717624",
"0.6770126",
"0.6768017",
"0.67624724",
"0.67523444",
"0.6749333",
"0.6712765",
"0.6702963",
"0.6702963",
"0.6670874",
"0.6649431",
"0.6622567",
"0.6622567",
"0.6610013",
"0.6602304... | 0.0 | -1 |
GET /backup_files GET /backup_files.json | def index
@backup_files = BackupFile.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @backup_files }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @backup_file = BackupFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backup_file }\n end\n end",
"def index\n # Get Backup\n @backup = Backup.find(params[:backup_id])\n @cfiles = @backup.cfiles\n end",
"def f... | [
"0.6859385",
"0.6674604",
"0.650939",
"0.63960075",
"0.63878787",
"0.62524635",
"0.6233078",
"0.6186767",
"0.6107563",
"0.607058",
"0.60638314",
"0.6026417",
"0.60209155",
"0.60073304",
"0.5995666",
"0.5962011",
"0.59566295",
"0.59362644",
"0.5919736",
"0.5918195",
"0.5897664... | 0.7547997 | 0 |
GET /backup_files/1 GET /backup_files/1.json | def show
@backup_file = BackupFile.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @backup_file }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @backup_files = BackupFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @backup_files }\n end\n end",
"def new\n @backup_file = BackupFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.74308914",
"0.67932457",
"0.6627962",
"0.6362998",
"0.6349252",
"0.6112543",
"0.60945815",
"0.6042114",
"0.5974754",
"0.5965668",
"0.59501547",
"0.5945156",
"0.5933256",
"0.59114695",
"0.5910824",
"0.5885216",
"0.5882864",
"0.5876932",
"0.58741677",
"0.58718014",
"0.586590... | 0.7345738 | 1 |
GET /backup_files/new GET /backup_files/new.json | def new
@backup_file = BackupFile.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @backup_file }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.72082794",
"0.7177181",
"0.68783057",
"0.6773562",
"0.6649069",
"0.66431165",
"0.6642892",
"0.66395307",
"0.6638969",
"0.66211057",
"0.6617738",
"0.6588421",
"0.6529999",
"0.6524035",
"0.64676994",
"0.64380705",
"0.6432499",
"0.6413123",
"0.64124054",
"0.64079195",
"0.6362... | 0.8006981 | 0 |
POST /backup_files POST /backup_files.json | def create
@backup_file = BackupFile.new(params[:backup_file])
respond_to do |format|
if @backup_file.save
format.html { redirect_to @backup_file, notice: 'Backup file was successfully created.' }
format.json { render json: @backup_file, status: :created, location: @backup_file }
else
format.html { render action: "new" }
format.json { render json: @backup_file.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_file(uploaded_file)\n uploaded_file(uploaded_file.to_json) do |file|\n file.data[\"storage\"] = backup_storage.to_s\n end\n end",
"def backup_request(client, filename, message)\n filename = \"BACKUP_#{filename}\"\n aFile = File.open(filename, 'w+')\n if aFi... | [
"0.65430826",
"0.6227462",
"0.62168837",
"0.5940969",
"0.5913331",
"0.58853513",
"0.58663833",
"0.5813734",
"0.5786023",
"0.57620883",
"0.57561165",
"0.5688921",
"0.56860954",
"0.5680397",
"0.56714463",
"0.5668111",
"0.5661155",
"0.56527627",
"0.5630207",
"0.5601517",
"0.5601... | 0.65586185 | 0 |
PUT /backup_files/1 PUT /backup_files/1.json | def update
@backup_file = BackupFile.find(params[:id])
respond_to do |format|
if @backup_file.update_attributes(params[:backup_file])
format.html { redirect_to @backup_file, notice: 'Backup file was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @backup_file.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{acc... | [
"0.63049597",
"0.6155437",
"0.60315865",
"0.6002609",
"0.59424514",
"0.59240615",
"0.57689625",
"0.5765241",
"0.576372",
"0.57509035",
"0.5706085",
"0.56987584",
"0.5698101",
"0.5693737",
"0.5689812",
"0.56732106",
"0.56675404",
"0.5665124",
"0.5663599",
"0.56427175",
"0.5587... | 0.6469363 | 0 |
DELETE /backup_files/1 DELETE /backup_files/1.json | def destroy
@backup_file = BackupFile.find(params[:id])
@backup_file.destroy
respond_to do |format|
format.html { redirect_to backup_files_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting... | [
"0.71258587",
"0.6992164",
"0.6835188",
"0.6711903",
"0.66981375",
"0.6698046",
"0.66947985",
"0.66738266",
"0.66524637",
"0.66265315",
"0.6614312",
"0.6607827",
"0.65945244",
"0.6584008",
"0.6575813",
"0.6567134",
"0.65548193",
"0.6548146",
"0.6548146",
"0.653675",
"0.653304... | 0.7463259 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def search_params
params.require(:search).permit(:search_string)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Function to strip spaces and hypens then return length. | def strip_length(isbn)
isbn.delete!('-' ' ')
isbn.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length()\n return to_s.gsub(\" \", \"\").gsub(\"-\", \"\").length\n end",
"def count_chars(str)\n p str.delete(' ').size\nend",
"def count(string)\n new_string = string.gsub(/[ ]/, '')\n new_string.size\nend",
"def number_of_chars\n html_remove.without_garbage.split(\"\\n\").join.split.join.len... | [
"0.7598337",
"0.68167907",
"0.6654297",
"0.65017337",
"0.63558316",
"0.63204885",
"0.6239798",
"0.62313265",
"0.619886",
"0.616023",
"0.6158596",
"0.6145069",
"0.6113527",
"0.6112061",
"0.6087296",
"0.604478",
"0.604478",
"0.604478",
"0.604478",
"0.60310066",
"0.601897",
"0... | 0.7103614 | 1 |
Function that detects characters other than digits 09, spaces, and hypens. Combined with strip_length to run 2 different versions of .match for 10 and 13 10 length uses [0...1], 3 dots in a range ignores the last index in the range Need to do this to check last character for X,x,09 later. 13 length checks the whole input because all characters must be 09, ' ', '' Used nested if statements to return false for a match instead of true. Want to use false because a match denotes an invalid ISBN. | def check_chars(isbn)
valid = true
isbn_length = strip_length(isbn)
#Set match to false, because a match means invalid ISBN.
if isbn_length == 10
$store_length = 10
if isbn[0...-1].match(/[^- 0-9]/)
valid = false
end
else isbn_length == 13
$store_length = 13
if isbn.match(/[^- 0-9]/)
valid = false
end
end
valid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def are_characters_valid?(isbn)\n isbn_array = isbn.split(\"\") # create an array from characters in isbn number\n valid_characters = \"0123456789 -xX\".split(\"\") # create an array of valid isbn number characters\n invalid_character_count = 0 # counter for invalid characters\n isbn_array.each do |characte... | [
"0.6969873",
"0.65894663",
"0.6514954",
"0.6422191",
"0.6402574",
"0.638358",
"0.6371126",
"0.63546693",
"0.63160425",
"0.62893194",
"0.62516314",
"0.61907524",
"0.6153641",
"0.6115755",
"0.61139464",
"0.6111488",
"0.60624915",
"0.603634",
"0.6021241",
"0.6001392",
"0.5985003... | 0.79789066 | 0 |
See ActionController::RequestForgeryProtection for details Scrub sensitive parameters from your log filter_parameter_logging :password | def check_session
if session[:user_id].nil?
session[:return_to] = request.request_uri
flash[:messgae] = "Please sign-in or sign-up to access any of these pages."
redirect_to :controller => 'user', :action => 'index'
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_c... | [
"0.7597521",
"0.6339036",
"0.6238056",
"0.6205284",
"0.61925",
"0.6082827",
"0.6082827",
"0.5998831",
"0.59729004",
"0.59719896",
"0.5938771",
"0.58915716",
"0.58537316",
"0.582283",
"0.5808207",
"0.57974946",
"0.5783645",
"0.5773033",
"0.57278234",
"0.57202744",
"0.57202744"... | 0.0 | -1 |
Valida que el viaje sea privado | def validate_travel_private
return unless travel.publicx?
errors.add(:travel_id, :public)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private?\n self.privacy == PASSWORD\n end",
"def validate_to_address\n to = validate_to\n unless to.nil? || to.bare == stream.user.jid.bare\n raise StanzaErrors::Forbidden.new(self, 'auth')\n end\n end",
"def priviledged?\n @priviledged\n end",
"def al... | [
"0.6158614",
"0.6060192",
"0.6004687",
"0.5962393",
"0.5928687",
"0.5885416",
"0.5885267",
"0.5880221",
"0.5865097",
"0.58207047",
"0.58145833",
"0.5807945",
"0.57983875",
"0.57844317",
"0.5775106",
"0.5765185",
"0.57624865",
"0.5761433",
"0.57541645",
"0.5753142",
"0.5747856... | 0.6136504 | 1 |
Valida que el usuario siga al creador del viaje. | def validate_user_following
return if user.follow?(travel.user)
return if user == travel.user
errors.add(:user_id, :not_follower)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validar_usuario(usuario_ingresado,clave_ingresada)\n usuario = buscar_usuario(usuario_ingresado)\n if @encriptador.validar_claves(usuario.clave_de_usuario,clave_ingresada)\n usuario\n else\n raise ClaveIncorrecta\n end\n end",
"def validate_usuario\n if current_usuar... | [
"0.6809841",
"0.6730141",
"0.6720732",
"0.6519352",
"0.6356331",
"0.6300129",
"0.6290974",
"0.62660515",
"0.6235552",
"0.62240577",
"0.61460894",
"0.61225206",
"0.60970265",
"0.59953606",
"0.59897554",
"0.5947717",
"0.59408784",
"0.59359807",
"0.59351814",
"0.5927661",
"0.592... | 0.0 | -1 |
Valida que el usuario no sea el creador del viaje. | def validate_user_not_same
return if user != travel.user
errors.add(:user_id, :authorize_himself)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valida_usuario(correo, clave)\n data = Usuario.find_by(correo: correo, estado: ACTIVO, validado: VALIDADO)\n if data.blank?\n data1 = Usuario.find_by(correo: correo, estado: ACTIVO)\n if data1.blank? != true\n return [false, 'El usuario no ha sido validado, hágalo desde el mensaje que ll... | [
"0.6861597",
"0.65126675",
"0.6199948",
"0.6184047",
"0.6177164",
"0.60201514",
"0.5959927",
"0.5945015",
"0.5925904",
"0.5907294",
"0.59045255",
"0.59031534",
"0.58945805",
"0.58944315",
"0.58819604",
"0.58506155",
"0.58231103",
"0.5807065",
"0.57710785",
"0.5740845",
"0.573... | 0.5834146 | 16 |
Get the avatar of the given user | def avatar_for(user, size = nil)
avatar_tag user.avatar, size, user.name if user.is_a? User
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_avatar\n u = User.find_by_id(self.id)\n if u.role == 'user'\n return u.avatar.url unless u.avatar.nil?\n else\n info = Info.find_by_email(self.email)\n return info.info_avatar.image.url unless info.nil?\n end\n return nil\n end",
"def user_avatar(user)\n user.avatar ? us... | [
"0.8013091",
"0.79181635",
"0.78469086",
"0.7805173",
"0.77747965",
"0.76707417",
"0.7650708",
"0.7592171",
"0.7576612",
"0.74400383",
"0.74068904",
"0.73799556",
"0.7361681",
"0.734638",
"0.734638",
"0.73397225",
"0.7336974",
"0.73294693",
"0.7313671",
"0.73054117",
"0.72452... | 0.7614825 | 7 |
Create a new PageList, without making any requests immediately | def initialize(client, api_model, query_params = {})
@client = client
@api_model = api_model
@uri = "#{Lexile.api_version}/#{api_model.api_path}"
@query_params = query_params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n #creates a new page only in memory\n @page = Page.new\n end",
"def new_page(record, values = [])\n idx = @page_counter\n @page_counter += 1\n mark_page_as_modified(IDListPage.new(self, record, idx, values))\n idx\n end",
"def create\n url = params['url']\n doc ... | [
"0.6633535",
"0.6521754",
"0.61651766",
"0.612409",
"0.6104944",
"0.6072501",
"0.6067942",
"0.60613656",
"0.6015164",
"0.5949132",
"0.59206945",
"0.59091145",
"0.5891882",
"0.5819365",
"0.58095044",
"0.5805669",
"0.58020186",
"0.5800788",
"0.5800788",
"0.5800788",
"0.57755846... | 0.0 | -1 |
Iterate through each page, making requests as you iterate | def each
page = Page.new( @client, @api_model, @uri, @query_params )
until page.nil?
yield page
page = page.next
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_page(&block)\n call_client(:each_page, &block)\n end",
"def each(&block)\n find_on_single_or_all_pages(http_request_parameters, block)\n end",
"def each_page(&block); end",
"def each\n page = Page.new @uri, @filters, @headers\n until page.nil?\n yie... | [
"0.7547293",
"0.74788225",
"0.72701424",
"0.72665364",
"0.7250398",
"0.7243579",
"0.71990764",
"0.71685845",
"0.7161811",
"0.70448",
"0.6958389",
"0.6915202",
"0.6865787",
"0.6865787",
"0.6865787",
"0.6865787",
"0.6861823",
"0.683867",
"0.6824977",
"0.6805306",
"0.67563814",
... | 0.7362116 | 2 |
GET /infos GET /infos.json | def index
if current_user.admin?
@infos = Info.all.by_message_type(@message_types).by_display_type(@display_type).recent.after(@timestamp).paginate(:page => @page,:per_page => @per_page)
elsif current_user.parent?
@infos = current_user.parent.infos_by_type(@message_types).by_display_type(@display_type).recent.after(@timestamp).paginate(:page => @page,:per_page => @per_page)
elsif current_user.supervisor?
@infos = current_user.supervisor.infos_by_type(@message_types).by_message_type(@message_types).by_display_type(@display_type).recent.after(@timestamp).paginate(:page => @page,:per_page => @per_page)
else
@infos = []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n response = from_server \"api/info.json\"\n response.data\n end",
"def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\... | [
"0.74006987",
"0.7390524",
"0.7390524",
"0.7360638",
"0.72469443",
"0.72044826",
"0.70949435",
"0.70629776",
"0.70065945",
"0.69521254",
"0.6898222",
"0.6888555",
"0.6762928",
"0.6745386",
"0.66563773",
"0.6623607",
"0.6600353",
"0.65996075",
"0.65996075",
"0.65961534",
"0.65... | 0.0 | -1 |
GET /infos/1 GET /infos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n get '/'\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information }\n end\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |fo... | [
"0.72284645",
"0.71156585",
"0.70876694",
"0.6984854",
"0.6971011",
"0.6971011",
"0.69490755",
"0.6925067",
"0.6796192",
"0.6761327",
"0.6715991",
"0.6714322",
"0.67031974",
"0.6674427",
"0.6661704",
"0.6661704",
"0.6627251",
"0.66115516",
"0.6589313",
"0.65656924",
"0.656569... | 0.0 | -1 |
POST /infos POST /infos.json | def create
@info = Info.new(info_params)
respond_to do |format|
if @info.save
format.html { redirect_to @info, notice: 'Info was successfully created.' }
format.json { render :show, status: :created, location: @info }
else
format.html { render :new }
format.json { render json: @info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @info = Info.new(params[:info])\n if @info.save\n redirect_to infos_path, :notice => 'Info was successfully created.'\n else\n render :action => \"new\"\n end\n end",
"def create\n @information = Information.new(information_params)\n\n if @information.save\n ... | [
"0.7026605",
"0.699627",
"0.6775661",
"0.6596137",
"0.6590161",
"0.650968",
"0.6472632",
"0.64686525",
"0.64227104",
"0.6339319",
"0.63207364",
"0.6309325",
"0.63080895",
"0.6298964",
"0.61816365",
"0.61383283",
"0.6098122",
"0.6093944",
"0.6092558",
"0.6074386",
"0.6074386",... | 0.7245169 | 1 |
PATCH/PUT /infos/1 PATCH/PUT /infos/1.json | def update
respond_to do |format|
if @info.update(info_params)
format.html { redirect_to @info, notice: 'Info was successfully updated.' }
format.json { render :show, status: :ok, location: @info }
else
format.html { render :edit }
format.json { render json: @info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-m... | [
"0.6790663",
"0.67402965",
"0.65885925",
"0.65185714",
"0.65072274",
"0.64917994",
"0.6453355",
"0.63754886",
"0.6357749",
"0.6330597",
"0.6309102",
"0.62764543",
"0.62725765",
"0.62684745",
"0.62637883",
"0.61999136",
"0.6107869",
"0.61064357",
"0.6073643",
"0.60728073",
"0.... | 0.66531545 | 3 |
DELETE /infos/1 DELETE /infos/1.json | def destroy
@info.destroy
respond_to do |format|
format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to(infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.7315097",
"0.7189284",
"0.7083733",
"0.70240605",
"0.69782364",
"0.6974288",
"0.6974288",
"0.69678646",
"0.6921267",
"0.689124",
"0.687554",
"0.68744934",
"0.68641484",
"0.6851575",
"0.6835712",
"0.679569",
"0.6795542",
"0.6781279",
"0.6763843",
"0.673854",
"0.6737893",
... | 0.7321862 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_info
@info = Info.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def info_params
params.require(:info).permit(:message_type, :timestamp, :received_at, :app_id, :playcelet_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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
finds list of all teams in Rabbit Cloud | def get_teams
team = Array.new
i = 1
while i < RC_A.num_rows
team[i-1] = RC_A[(i+1), 1]
i += 1
end
return team
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_teams\n TeamNode.get(node_object_id)\n end",
"def teams\n return [og, oo, cg, co];\n end",
"def all_teams_in_league\n \treturnArray = []\n\t\tbase_uri = 'https://www.thesportsdb.com/api/v1/json/1/search_all_teams.php?l=' + @league_name.to_s\n\t\tresponse = RestClient.get(base_uri)\n\t\tj... | [
"0.73151475",
"0.7310664",
"0.72894466",
"0.72811115",
"0.7224614",
"0.72014713",
"0.71368545",
"0.71295136",
"0.70907676",
"0.7082487",
"0.7015367",
"0.7002785",
"0.6929449",
"0.69019043",
"0.68963736",
"0.6871436",
"0.6864836",
"0.6838275",
"0.6829986",
"0.6796533",
"0.6785... | 0.0 | -1 |
fetches google sheet generated from form data | def get_sheet
sheet = Array.new
i = 1
while i < RC_C.num_rows
sheet[i-1] = RC_C.rows[i]
i += 1
end
return sheet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cellfeed(spreadsheet_key)\n cellfeed_uri = \"http://spreadsheets.google.com/feeds/cells/#{spreadsheet_key}/od6/private/full\"\n cellfeed_response = get_feed(cellfeed_uri) \n create_datastructure_from_xml(cellfeed_response.body)\n \n end",
"def set_googlesheet\n @googlesheet = Googles... | [
"0.6169943",
"0.59711754",
"0.5897102",
"0.5873721",
"0.584871",
"0.58206743",
"0.5819846",
"0.57997805",
"0.5764951",
"0.57318515",
"0.5725904",
"0.5725904",
"0.57019156",
"0.5670977",
"0.56446886",
"0.56322414",
"0.56280917",
"0.5622478",
"0.55868113",
"0.5556378",
"0.55408... | 0.49790075 | 91 |
returns index of row where week start | def week_start
i = 1
while i < RC_C.num_rows
tmp = RC_C.rows[i][0].split(" ")[0].split("/")
date = Date.parse(tmp[2] + '-' + tmp[0] + '-' + tmp[1])
if (Date.parse("monday") - 7) <= date
return i
end
i += 1
end
return i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_index\n @week_index ||= date.wday\n end",
"def week_start\n\ti = 1\n\twhile i < RC_C.num_rows\n\t\ttmp = RC_C.rows[i][0].split(\" \")[0].split(\"/\")\n\t\tdate = Date.parse(tmp[2] + '-' + tmp[0] + '-' + tmp[1])\n\t\t\t\tputs 'tmp is ' + tmp.to_s + ', date is ' + date.to_s\n\t\tif (Date.parse(\"monda... | [
"0.7617163",
"0.75818694",
"0.7041128",
"0.67452973",
"0.67006534",
"0.662983",
"0.65996546",
"0.65996546",
"0.6569358",
"0.6552126",
"0.6535826",
"0.651012",
"0.65084434",
"0.65031016",
"0.6474401",
"0.64519644",
"0.64380753",
"0.6420134",
"0.63755256",
"0.6357168",
"0.63471... | 0.8171703 | 0 |
returns list of teams that did their correction | def if_match(teams, start)
match = Array.new
test = FuzzyStringMatch::JaroWinkler.create( :native )
while start < RC_C.num_rows
teams.each do |team|
i = test.getDistance(team, RC_C.rows[start][1])
if i > 0.65
match.push(team)
# puts "match, #{team} matches #{RC_C.rows[start][1]}"
end
end
start += 1
end
return match
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teams\n return [og, oo, cg, co];\n end",
"def judge_teams\n pilot_flight.pfj_results.collect { |pfj_result| pfj_result.judge }\n end",
"def teams\n requests.where(is_accepted: true).map(&:team).flatten\n end",
"def getAllTeamNames\n return TestSuite.find_by_sql(\"select DISTINCT teamnam... | [
"0.6733134",
"0.6672529",
"0.6551242",
"0.6515259",
"0.64266026",
"0.63879687",
"0.6334592",
"0.62522024",
"0.612788",
"0.6096424",
"0.6070381",
"0.6050294",
"0.60436815",
"0.6042205",
"0.6024405",
"0.60194016",
"0.60061413",
"0.59634346",
"0.59452564",
"0.59224206",
"0.59111... | 0.0 | -1 |
prints list of every correction from a given week | def print_from(start)
while start < RC_C.num_rows
puts RC_C.rows[start][1]
start += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weeks\n rows = []\n rows << name_of_month.center(20) + \" \"\n rows << \"Su Mo Tu We Th Fr Sa\" + \" \"\n days = format_dates\n (0..7).each {|num|\n fields = days[num * 7, 7]\n rows << fields.join(\" \") + \" \" if fields\n }\n if rows.last.length < 22\n rows.last << \" \... | [
"0.6639231",
"0.63832766",
"0.6252173",
"0.6237993",
"0.6188145",
"0.6141943",
"0.6103552",
"0.60595566",
"0.60558033",
"0.6050012",
"0.60332936",
"0.60241115",
"0.600031",
"0.5995488",
"0.5990743",
"0.59644735",
"0.5867406",
"0.5812418",
"0.5798622",
"0.57891166",
"0.5775842... | 0.0 | -1 |
appends x to missed correction cell | def no_correction(teams)
teams.each do |team|
i = 0
j = RC_AP.num_cols
while i < RC_AP.num_rows
if RC_AP.rows[i][5] == team
tmp = RC_AP[(i + 1), j] + 'x'
RC_AP[(i + 1), j] = tmp
end
i += 1
end
end
RC_AP.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_missing_cells_optimized\n a_cells = self.answer_cells.ratings\n count = 0\n # find missing\n cells = a_cells.map {|a| [a.row, a.col] }\n cell_arr = cells.first\n return if !(cell_arr && cell_arr.size == 2) \n\n q_cells = self.question.question_cells.ratings.map {|a| [a.row, a.col] }\n ... | [
"0.5510395",
"0.53569114",
"0.52332747",
"0.515528",
"0.5109401",
"0.50967467",
"0.50443953",
"0.5035618",
"0.5015502",
"0.5008294",
"0.49782774",
"0.49402213",
"0.49280602",
"0.49183425",
"0.49072427",
"0.490152",
"0.48601276",
"0.48476827",
"0.4841601",
"0.4806536",
"0.4798... | 0.56493384 | 0 |
I worked on this challenge [by myself]. Your Solution Below | def array_concat(array_1, array_2)
new_array = []
array_1.each do |var|
new_array.push(var)
end
array_2.each do |var|
new_array.push(var)
end
return new_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def challenge; end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx]... | [
"0.6521786",
"0.6284676",
"0.61216164",
"0.6051475",
"0.603118",
"0.599682",
"0.599348",
"0.5986509",
"0.59092164",
"0.5905666",
"0.5899626",
"0.58978873",
"0.5894856",
"0.5882941",
"0.58741057",
"0.5864284",
"0.5862471",
"0.5860421",
"0.5859243",
"0.58570206",
"0.5852615",
... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.match_mailer.doublesMatch.subject | def declineEmail(creator, match)
@user = creator
@match = match
mail to: creator.email, subject: "Your challenge has been declined!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def subject\n self['subject'] || ms... | [
"0.66991174",
"0.66452026",
"0.6477627",
"0.63335115",
"0.6330432",
"0.62695956",
"0.6250367",
"0.624555",
"0.62110096",
"0.6187667",
"0.61807454",
"0.61496",
"0.6144867",
"0.60787266",
"0.60375893",
"0.603585",
"0.6034071",
"0.6009954",
"0.6007427",
"0.60008174",
"0.5995049"... | 0.0 | -1 |
Sends an email for singles' score validation. | def validationEmail(player, match)
@user = player
@match = match
mail to: player.email, subject: "Please validate score update."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalidScoreEmail(player, match)\n @user = player\n @match = match\n \n mail to: player.email, subject: \"Scores deemed invalid!\"\n end",
"def send_evaluation_email\n EvaluationMailer.evaluation(self).deliver_now\n end",
"def send_notice_certification(score, wrongs)\n UserMailer.ce... | [
"0.65704525",
"0.64078367",
"0.6177594",
"0.6127811",
"0.6064973",
"0.5913231",
"0.58941084",
"0.588133",
"0.5844388",
"0.58236057",
"0.5808502",
"0.57407016",
"0.5734931",
"0.57317704",
"0.571978",
"0.57044965",
"0.57029676",
"0.5700495",
"0.5689645",
"0.5674544",
"0.5671521... | 0.6991888 | 0 |
Sends an email in the event of an invalid score. | def invalidScoreEmail(player, match)
@user = player
@match = match
mail to: player.email, subject: "Scores deemed invalid!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validationEmail(player, match)\n @user = player\n @match = match\n \n mail to: player.email, subject: \"Please validate score update.\"\n end",
"def send_error(email, message, queue)\n @errors = message\n mail(to: email, subject: 'Ostagram error')\n end",
"def fail\n @score = 0.0\n ... | [
"0.66534835",
"0.6627514",
"0.64007",
"0.63662773",
"0.62148374",
"0.6191811",
"0.6187362",
"0.60375714",
"0.60035974",
"0.59678495",
"0.5966249",
"0.5951538",
"0.59316224",
"0.5910145",
"0.58548826",
"0.5849038",
"0.5823988",
"0.5813844",
"0.57894087",
"0.57235485",
"0.57083... | 0.78753245 | 0 |
GET /clients GET /clients.json | def index
add_breadcrumb(I18n.t('model.list', model: Client.model_name.human))
@clients = Client.all()
respond_to do |format|
format.html # index.html.erb
format.json { render json: @clients }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @clients = Client.all\n render json: @clients\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cli... | [
"0.815345",
"0.80064076",
"0.7788253",
"0.7724174",
"0.7566752",
"0.7566752",
"0.75521046",
"0.7488455",
"0.7442235",
"0.7392883",
"0.73510796",
"0.7308465",
"0.7292686",
"0.7289082",
"0.7289082",
"0.7289082",
"0.7289082",
"0.7289082",
"0.7289082",
"0.7289082",
"0.727821",
... | 0.7117922 | 38 |
GET /clients/new GET /clients/new.json | def new
add_breadcrumb t('model.create', model: Client.model_name.human)
@client = Client.new
@client.created_by = current_user.id
respond_to do |format|
format.html # new.html.erb
format.json { render json: @client }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end",
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n... | [
"0.80932397",
"0.80932397",
"0.80932397",
"0.80932397",
"0.77258414",
"0.7722324",
"0.7691028",
"0.7670705",
"0.76302737",
"0.7529203",
"0.74632746",
"0.7408724",
"0.7408724",
"0.7381288",
"0.7381288",
"0.7381288",
"0.7381288",
"0.7381288",
"0.7370841",
"0.7341797",
"0.732624... | 0.75812006 | 9 |
POST /clients POST /clients.json | def create
new_file_name = upload_file(params[:client][:logo], "/public/files/logo_files/")
params[:client][:logo] = new_file_name
params[:client][:updated_by] = current_user.id
@client = Client.new(params[:client])
respond_to do |format|
Client.transaction do
if @client.save
format.html { redirect_to clients_path, notice: 'Client was successfully created.' }
format.json { render json: @client, status: :created, location: @client }
else
format.html { render action: "new" }
format.json { render json: @client.errors, status: :unprocessable_entity }
end
# Medium.all.each do |medium|
# MediumPolicy.create!({
# medium_id: medium.id,
# client_id: @client.id,
# medium_discount: 1,
# company_discount: 1,
# medium_bonus_ratio: 0,
# company_bonus_ratio: 0
# }) unless MediumPolicy.exists?(client_id: @client.id, medium_id: medium.id)
# end
end
# else
# format.html { render action: "new" }
# format.json { render json: @client.errors, status: :unprocessable_entity }
# end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render... | [
"0.72085994",
"0.71753484",
"0.7120956",
"0.7116921",
"0.710099",
"0.6981326",
"0.6981326",
"0.6981326",
"0.6979284",
"0.6971666",
"0.6971666",
"0.6971666",
"0.6970004",
"0.69603",
"0.6956069",
"0.69386387",
"0.69206727",
"0.691133",
"0.689539",
"0.6878896",
"0.6864519",
"0... | 0.0 | -1 |
PATCH/PUT /clients/1 PATCH/PUT /clients/1.json | def update
@client = Client.find(params[:id])
respond_to do |format|
if params[:client][:logo].blank?
params[:client][:logo] = @client.logo
else
new_file_name = upload_file(params[:client][:logo], "/public/files/logo_files/")
FileUtils.rm Dir["#{Rails.root}/public/files/logo_files/"+@client.logo.to_s]
params[:client][:logo] = new_file_name
end
params[:client][:updated_by] = current_user.id
@client.attributes = params[:client]
if @client.save
format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @client.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @client.update(client_params)\n render json: @client\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n ... | [
"0.7246776",
"0.7098947",
"0.7001019",
"0.7001019",
"0.6907153",
"0.6907153",
"0.6898349",
"0.68953735",
"0.68737906",
"0.68383723",
"0.6836901",
"0.6832358",
"0.68251896",
"0.68093616",
"0.6761033",
"0.67596495",
"0.6749836",
"0.6744567",
"0.6742964",
"0.6738345",
"0.6662724... | 0.6247299 | 63 |
DELETE /clients/1 DELETE /clients/1.json | def destroy
@client = Client.find(params[:id])
Client.transaction do
FileUtils.rm Dir["#{Rails.root}/public/files/logo_files/"+@client.logo.to_s]
@client.destroy
respond_to do |format|
format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n fo... | [
"0.779878",
"0.779878",
"0.7783867",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.77729654",
"0.7769128",
"0.7714479",
"0.7636294",
"0.76231486",
"0.7586893",
"0.75828475",
"0.7539195",
"0.7536755",
"0.7536... | 0.68536377 | 97 |
Take in a presplit array | def merge_sort array
return array if array.length <= 1
# arr1, arr2 = array.each_slice((array.size/2.0).round).to_a # Seems to be a bit slower than the method below
arr1 = array[0..((array.length/2 - 1))]
arr2 = array[(array.length/2)..(array.length-1)]
return merge_arrays(merge_sort(arr1), merge_sort(arr2)) # Divide and conquer!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by(array, delim)\n ret = []\n a = []\n array.each do |i|\n if i == delim then\n ret << a\n a = []\n else\n a << i\n end\n end\n ret << a unless a.empty?\n return ret\n end",
"def my_array_splitting_method(source)\nend",
... | [
"0.6930009",
"0.689155",
"0.68294185",
"0.6791168",
"0.6760499",
"0.66596526",
"0.65551686",
"0.6526668",
"0.6518466",
"0.6456104",
"0.64289075",
"0.638443",
"0.63179475",
"0.6311908",
"0.630192",
"0.6298159",
"0.6247744",
"0.6238977",
"0.62303334",
"0.61664605",
"0.61569685"... | 0.0 | -1 |
GET /api/missions/1 GET /api/missions/1.json | def show
if not @mission = Mission.find(params[:id])
render json: "Mission not found for id: " + params[:id]
else
respond_to do |format|
format.json { render json: @mission }
format.xml { render xml: @mission }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html... | [
"0.7264681",
"0.7264681",
"0.7264681",
"0.7264681",
"0.7159186",
"0.71207535",
"0.67657155",
"0.67599994",
"0.6747329",
"0.667005",
"0.6653515",
"0.6588407",
"0.65121603",
"0.6509459",
"0.6458616",
"0.64315814",
"0.6369404",
"0.63502127",
"0.63401103",
"0.6261289",
"0.6246807... | 0.69812125 | 6 |
POST /api/missions.xml POST /api/missions.json | def create
#When creating a new mission, current point should default to zero
@mission = Mission.new()
# @mission = Mission.new({"name" => params[:name], "goal_points" => params[:goal_points].to_i, "current_points" => 0, "image" => params[:image]})
@mission.name = params[:name]
@mission.goal_points = params[:goal_points].to_i
@mission.current_points = 0
@mission.image = params[:image]
if @mission.valid?
@mission.save!
respond_to do |format|
format.json { render json: @mission }
format.xml { render xml: @mission }
end
else
respond_to do |format|
#format.json { render action: 'index' }
format.json { render json: @mission.errors,status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mission = Mission.new(mission_params)\n\n respond_to do |format|\n if @mission.save\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render :show, status: :created, location: @mission }\n else\n format.html { rend... | [
"0.6356449",
"0.6356449",
"0.6356316",
"0.6297782",
"0.6276181",
"0.59821904",
"0.59507686",
"0.5866351",
"0.5838475",
"0.58272564",
"0.58272564",
"0.58272564",
"0.58272564",
"0.580404",
"0.5753277",
"0.57497996",
"0.5742802",
"0.5740636",
"0.5712702",
"0.56991374",
"0.564316... | 0.57239497 | 18 |
Never trust parameters from the scary internet, only allow the white list through. | def mission_params
params.require(:mission).permit(:name, :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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
paraphrased from spreecore (create_units), with changes to assign inventory units to electronic shipment or create new electronic shipment | def create_electronic_units(order, variant, quantity)
shipment = order.shipments.electronic.first
inventory_units = quantity.times.map do
order.inventory_units.create( { variant: variant, state: "sold", shipment: shipment }, without_protection: true)
end
# create new shipment if none existed and assign inventory units
order.shipments.electronic.create!(inventory_units: inventory_units) if shipment.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end",
"def inventory_unit1\n Spree::InventoryUnit.new(variant: variant1)\n end",
"def create\n @item = Item.find(params[:item_id])\n... | [
"0.68948126",
"0.6232722",
"0.620948",
"0.60422283",
"0.5998168",
"0.5928565",
"0.5916572",
"0.5903156",
"0.583519",
"0.57630473",
"0.5746571",
"0.57208",
"0.5715365",
"0.5709474",
"0.56926495",
"0.56883126",
"0.5687775",
"0.5684718",
"0.5682156",
"0.5679274",
"0.56772393",
... | 0.7175858 | 0 |
menu item show page | def show
@category = Category.find(params[:category_id])
@item = @category.items.find(params[:id])
@includes = @item.ingredients.all.sort_by{ |k| k["name"] }
@ingredients = Ingredient.all.sort_by{ |k| k["name"] }
# used for includes#create
@include = @item.includes.new
# used for orders#create
@order = Order.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @menu_item = current_site.menu_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @menu_item }\n end\n end",
"def show # Show method\n menu # Show menu method above\n end",
"def mostrar_item(menu)\n\n\t\t# Si el ite... | [
"0.71975577",
"0.7145132",
"0.69668174",
"0.6836805",
"0.67997956",
"0.6798892",
"0.67764723",
"0.6770644",
"0.66938365",
"0.6622493",
"0.65861636",
"0.6579829",
"0.6576442",
"0.6564743",
"0.65611297",
"0.6558495",
"0.65193695",
"0.65130466",
"0.6483814",
"0.64820373",
"0.648... | 0.0 | -1 |
create new menu item | def create
@category = Category.find(params[:category_id])
@items = @category.items.all
@item = @category.items.new(item_params)
if @item.save
redirect_to category_items_path(@category), notice: 'Menu item created!'
return
end
render :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createMenu _obj, _args\n \"_obj createMenu _args;\" \n end",
"def create\n @menu_item = uhook_create_menu_item\n\n respond_to do |format|\n if @menu_item.valid?\n flash[:notice] = t('ubiquo.menu_item.created')\n format.html { redirect_to(ubiquo.edit_menu_path(@menu_item.menu)... | [
"0.7429402",
"0.7350775",
"0.73321193",
"0.7319506",
"0.72620857",
"0.7248905",
"0.72400016",
"0.723905",
"0.72084814",
"0.7188522",
"0.7151894",
"0.7112497",
"0.7076064",
"0.7053323",
"0.7027458",
"0.7010445",
"0.6974175",
"0.69302124",
"0.69193494",
"0.69024956",
"0.6883375... | 0.65422416 | 58 |
Create a new instance with the file to analyze | def initialize(output_file, threshold)
@output_file = output_file
@threshold = threshold
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(file)\n @file = parse(file)\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @fi... | [
"0.7629833",
"0.74673975",
"0.74673975",
"0.74673975",
"0.7428163",
"0.7410702",
"0.7410702",
"0.7151949",
"0.7140265",
"0.7067611",
"0.7062356",
"0.70217043",
"0.6984255",
"0.6969909",
"0.69572425",
"0.6928478",
"0.6928478",
"0.6921963",
"0.69115907",
"0.68994915",
"0.688749... | 0.0 | -1 |
The reported coverage for the tests (uses the overall code coverage number) | def coverage
@_coverage ||= if File.exist?(@output_file)
# <td><tt class='coverage_code'>78.95%</tt> </td>
# <div class="percent_graph_legend"><tt class='coverage_total'>78.95%</tt></div>
#
# content = File.read(@output_file)
# matches = content.scan(/<td><tt class='coverage_code'>78.95%</tt> </td>/)
content = File.read(@output_file)
matches = content.scan(/<td><tt class='coverage_code'>(\d+\.\d+)%<\/tt> <\/td>/)
if matches.empty?
matches = content.scan(/<div class="percent_graph_legend"><tt class='coverage_total'>(\d+\.\d+)%<\/tt><\/div>/)
end
matches.first.to_s.to_f
end
@_coverage ||= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coverage; end",
"def coverage; end",
"def coverage\n empty? ? 1 : Rational(successful, total)\n end",
"def covered_percent\n coverage_statistics[:line]&.percent\n end",
"def coverage_text\n 'YARD-Coverage: %.1f%%' % YARD::Cov.round_percentage(coverage * 100)\n end",
"def repor... | [
"0.80008954",
"0.80008954",
"0.78885967",
"0.7761137",
"0.7576049",
"0.7411632",
"0.74050456",
"0.73082095",
"0.7256424",
"0.72302943",
"0.72292656",
"0.7165284",
"0.71562326",
"0.70072985",
"0.69609076",
"0.69563067",
"0.69068086",
"0.68587637",
"0.6855181",
"0.68167835",
"0... | 0.7332553 | 7 |
Is the current coverage below the configured threshold? (see Configuration.threshold) | def below_threshold?
coverage < threshold
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covered?\n coverage.positive?\n end",
"def test_coverage_threshold(matches)\n if matches.to_f >= coverage\n true\n else\n 'Insufficient Coverage.'\n end\n end",
"def passed?\n config.threshold.nil? ||\n (config.threshold_must_match && percen... | [
"0.79639065",
"0.7661023",
"0.7367815",
"0.73317057",
"0.7317295",
"0.7113401",
"0.6792229",
"0.66815346",
"0.667924",
"0.66613245",
"0.65402555",
"0.65236884",
"0.6503445",
"0.6432208",
"0.6410072",
"0.6394075",
"0.63593084",
"0.63471156",
"0.6307729",
"0.62737143",
"0.62517... | 0.8980325 | 0 |
Ensure that the coverage is at an acceptable level, raise an exception if it is not | def ensure!
if below_threshold?
message = "Reported coverage of #{coverage}% is less than the required #{threshold}%"
raise(Cover::InsufficientCoverageError, message)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coverage_exceeding_source_warn; end",
"def test_coverage_threshold(matches)\n if matches.to_f >= coverage\n true\n else\n 'Insufficient Coverage.'\n end\n end",
"def coverage; end",
"def coverage; end",
"def covered?; end",
"def covered?\n coverage.p... | [
"0.682684",
"0.6718323",
"0.66528964",
"0.66528964",
"0.65171784",
"0.64314246",
"0.64286137",
"0.61803305",
"0.6084162",
"0.6013292",
"0.59427625",
"0.5910063",
"0.5838621",
"0.58334243",
"0.57987213",
"0.57863414",
"0.5738586",
"0.56715137",
"0.5639819",
"0.55999434",
"0.55... | 0.768958 | 0 |
Create a query object on the given plan | def initialize(plan)
@scope = :global
@plan = plan
super()
@plan_predicates = Array.new
@neg_plan_predicates = Array.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_query( relation )\n Query.new(relation)\n end",
"def query(options={})\n qry = Query.new(table)\n options[:transformer] ||= begin\n lambda { |ct_record|\n instance = allocate\n instance.init_with(ct_record)\n instance\n }\n ... | [
"0.667824",
"0.6671444",
"0.6354387",
"0.6290204",
"0.6189533",
"0.6129123",
"0.6098146",
"0.6061961",
"0.60073173",
"0.592671",
"0.59191567",
"0.58545625",
"0.57802",
"0.57569325",
"0.57501096",
"0.5749001",
"0.5743091",
"0.57427675",
"0.5740421",
"0.57385504",
"0.5712973",
... | 0.5880191 | 11 |
Changes the scope of this query. See scope. | def local_scope; @scope = :local end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def set_scope(val)\n @scope = val\n build_path_query\n @scope\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"de... | [
"0.7400702",
"0.72640264",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.69913393",
"0.67415076",
"0.6689652",
"0.6689652",
"0.66861135",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",... | 0.0 | -1 |
Changes the scope of this query. See scope. | def global_scope; @scope = :global end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def set_scope(val)\n @scope = val\n build_path_query\n @scope\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"de... | [
"0.7400702",
"0.72640264",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.7084408",
"0.69913393",
"0.67415076",
"0.6689652",
"0.6689652",
"0.66861135",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",
"0.6605899",... | 0.0 | -1 |
Changes the plan this query works on. This calls reset (obviously) | def plan=(new_plan)
reset
@plan = new_plan
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_cache!\n super\n # Make sure all query plans are *really* gone\n @connection.execute 'DEALLOCATE ALL' if active?\n end",
"def reset\n self.query = Query.new\n end",
"def reset_for_next_execute!\n @stmt_api.reset!\n @stmt_api.clear_bindings!\n @blobs_to_write.c... | [
"0.65783995",
"0.63602984",
"0.6290329",
"0.61598545",
"0.6107136",
"0.603212",
"0.60195136",
"0.5964879",
"0.5963441",
"0.58956844",
"0.58594936",
"0.5793245",
"0.57891667",
"0.57827586",
"0.5717894",
"0.5717894",
"0.56502026",
"0.56388265",
"0.56342554",
"0.55509007",
"0.55... | 0.565126 | 16 |
The set of tasks which match in plan. This is a cached value, so use reset to actually recompute this set. | def result_set
@result_set ||= plan.query_result_set(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def tasks_list\n ... | [
"0.6652628",
"0.6204416",
"0.6150871",
"0.60059816",
"0.5896432",
"0.58854926",
"0.5870113",
"0.5855356",
"0.583577",
"0.58084786",
"0.57566184",
"0.5754349",
"0.5754349",
"0.5754349",
"0.56810987",
"0.56746733",
"0.5665967",
"0.5663271",
"0.56618553",
"0.5658174",
"0.5630061... | 0.0 | -1 |
Reinitializes the cached query result. Queries cache their result, i.e. each will always return the same task set. reset makes sure that the next call to each will return the same value. | def reset
@result_set = nil
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @results = {}\n @success = false\n end",
"def reset_results\n @loaded = false\n @results = ResultSet.new\n @solr_response = nil\n end",
"def reset\n self.query = Query.new\n end",
"def reset\n @conditions.reset\n @results = []\n end",
"def res... | [
"0.7047971",
"0.69667256",
"0.68245566",
"0.67101127",
"0.66926116",
"0.66926116",
"0.66787183",
"0.6320946",
"0.6224597",
"0.6206228",
"0.6168828",
"0.61325353",
"0.61137295",
"0.605622",
"0.60469246",
"0.6030894",
"0.59927434",
"0.5983761",
"0.5966971",
"0.5945615",
"0.5912... | 0.7417886 | 0 |
Filters tasks which have no parents in the query itself. Will filter out tasks which have parents in +relation+ that are included in the query result. | def roots(relation)
@result_set = plan.query_roots(result_set, relation)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_parents(relation = nil)\n if !relation\n for rel in sorted_relations\n remove_parents(rel)\n end\n return\n end\n\n parents = parent_objects(relation).to_a\n for parent in parents\n ... | [
"0.6265321",
"0.6040066",
"0.57736635",
"0.5766694",
"0.55170935",
"0.54628867",
"0.5315568",
"0.527734",
"0.52312976",
"0.5215165",
"0.51876163",
"0.51757866",
"0.51167476",
"0.50952744",
"0.5082466",
"0.5052837",
"0.50356865",
"0.5030185",
"0.5018782",
"0.49378383",
"0.4932... | 0.4906927 | 23 |
True if +task+ matches the query. Call result_set to have the set of tasks which match in the given plan. | def ===(task)
for pred in plan_predicates
return unless plan.send(pred, task)
end
for neg_pred in neg_plan_predicates
return if plan.send(neg_pred, task)
end
return unless super
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_task?(task)\n self.project_tasks.each do |project_task|\n return true if project_task.task == task\n end\n false\n end",
"def matches_requirement?(query, option, requirement); end",
"def exists?(task, &block)\n @tasks.synchronize {\n if (result = @tasks.index { |t| t.task... | [
"0.6252602",
"0.56525344",
"0.5636913",
"0.56329894",
"0.53550386",
"0.53077835",
"0.5269975",
"0.5235226",
"0.518909",
"0.51845765",
"0.51793855",
"0.5107569",
"0.5105551",
"0.5091791",
"0.50634146",
"0.5003457",
"0.4973881",
"0.49621055",
"0.49533135",
"0.49404794",
"0.4937... | 0.62630403 | 0 |
Iterates on all the tasks in the given plan which match the query This set is cached, i.e. each will yield the same task set until reset is called. | def each(&block)
plan.query_each(result_set, &block)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_each(result_set) # :nodoc:\n\t result_set.each do |task|\n\t\tyield(task)\n\t end\n\n\tensure\n\t Roby.synchronize do\n\t\tif result_set\n\t\t result_set.each do |task|\n\t\t\tDistributed.keep.deref(task)\n\t\t end\n\t\tend\n\t end\n\tend",
"def query_result_set(query)\n\t result =... | [
"0.641061",
"0.59941477",
"0.5642696",
"0.5562271",
"0.55068636",
"0.530383",
"0.528208",
"0.5268943",
"0.513764",
"0.5134535",
"0.51141393",
"0.51141393",
"0.5102025",
"0.5097307",
"0.508586",
"0.5075453",
"0.5067564",
"0.5062308",
"0.50439364",
"0.5036759",
"0.5018478",
"... | 0.5983247 | 2 |
Returns an intermediate representation of +self+ suitable to be sent to the +dest+ peer. | def droby_dump(dest)
droby = super
droby.plan_predicates.concat(plan_predicates)
droby.neg_plan_predicates.concat(neg_plan_predicates)
droby
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dest\n self[:ip_dest]\n end",
"def dest_ip\n self[:dest_ip]\n end",
"def to_s\n \"#{ self.sender }/#{ self.identifier }/#{ self.sent }\"\n end",
"def to_orig\n @orig\n end",
"def to_orig\n @orig\n end",
"def to_orig\n @orig\n end",
... | [
"0.61207545",
"0.5862141",
"0.5623512",
"0.55625623",
"0.55625623",
"0.55625623",
"0.5502169",
"0.54105616",
"0.5376061",
"0.5344602",
"0.5344602",
"0.531768",
"0.5298803",
"0.5279191",
"0.5265241",
"0.52644455",
"0.52513367",
"0.5224813",
"0.5224813",
"0.5215262",
"0.5151784... | 0.0 | -1 |
Write a method that when passed an integer between 1 and 3000 (or so) returns a string containing the proper oldschool Roman numeral. In other words, old_roman_numeral 4 should return 'IIII'. | def roman_numeral number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_roman_numeral num\n\troman = ''\n\n\troman = roman + 'M' * (num / 1000)\n\troman = roman + 'D' * (num % 1000 / 500)\n\troman = roman + 'C' * (num % 500 / 100)\n\troman = roman + 'L' * (num % 100 / 50)\n\troman = roman + 'X' * (num % 50 / 10)\n\troman = roman + 'V' * (num % 10 / 5)\n\troman = roman + 'I' * ... | [
"0.8353133",
"0.8334903",
"0.8298204",
"0.81950146",
"0.8189857",
"0.8168268",
"0.8161486",
"0.81273246",
"0.8101244",
"0.8086519",
"0.80739135",
"0.8071444",
"0.8046886",
"0.80226773",
"0.80204684",
"0.8015888",
"0.80126446",
"0.7981102",
"0.7933678",
"0.7921385",
"0.7919411... | 0.72573066 | 60 |
NO CREO QUE SEA NECESARIO IMPLEMENTAR ESTE METODO | def get_by_id
# Parse query string
access_token = params[:access_token]
refresh_token = params[:refresh_token]
product_id = params[:id]
# Create the Meli instance
meli = MeliFactory.create(access_token, refresh_token)
# Get the item using the MeLi API
url = Url.get_item(product_id)
response = meli.get(url)
item = JSON.parse response.body
# Get the item questions using the MeLi API
item_response = meli.get(url)
item_json = JSON.parse item_response.body
# Get the questions
q_url = "/my/received_questions/search?access_token=#{access_token}"
q_response = meli.get(q_url)
questions = JSON.parse q_response.body
my_questions = []
questions["questions"].each { | question |
if question["item_id"] == product_id
my_questions.push question
end
}
p = Product.new(Integer(item["initial_quantity"]), Integer(item["available_quantity"]), Integer(item["price"]), Date.parse(item["start_time"]), my_questions.length)
# Creates the Product instance
respond_to do |format|
format.json {render :json => p}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mi_carrera\n\n\tend",
"def informacoes_da_conta(local)\n\t\t\t\t\traise NotImplementedError.new('Sobreescreva este método na classe referente ao banco que você esta criando')\n\t\t\t\tend",
"def suivre; end",
"def asignar_titulo_propiedad()\n \n end",
"def set_inventario\n end",
"def... | [
"0.64961857",
"0.6345576",
"0.6225655",
"0.6111893",
"0.6078867",
"0.5985648",
"0.5963186",
"0.59553957",
"0.59553957",
"0.59553957",
"0.59553957",
"0.5952931",
"0.58731157",
"0.586635",
"0.5851742",
"0.5813417",
"0.5786243",
"0.56942534",
"0.56821936",
"0.5671667",
"0.566210... | 0.0 | -1 |
def errors results = [] | def errors
results = []
@validation_store.each do |b|
results << {
builder: b.class.to_s.sub("ActionBlocks::",""),
key: b.key,
fields: b.errors.keys,
messages: b.errors.map {|k,v| [k,v]}
} if b.invalid?
end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"def errors\n validate_or_get_results :errors\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"... | [
"0.7714751",
"0.7714751",
"0.7680777",
"0.7644676",
"0.7644676",
"0.763627",
"0.76143825",
"0.7543851",
"0.75408214",
"0.74122113",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7398791",
"0.7340483",
"0.72509485",
... | 0.0 | -1 |
GET /msds/1 GET /msds/1.json GET /msds/new | def index
respond_to do |format|
format.html
format.json { render json: MsdsDatatables.new(view_context) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @sid = params[:sid]\n @series = @sid.present? ? Series.find_or_new_from_sid(@sid) : Series.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @series }\n end\n end",
"def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html... | [
"0.688795",
"0.6524566",
"0.64624953",
"0.63666064",
"0.6288959",
"0.62691724",
"0.6236682",
"0.6221728",
"0.6210684",
"0.6208147",
"0.61796564",
"0.6160293",
"0.615261",
"0.61449677",
"0.6106176",
"0.6088854",
"0.6077952",
"0.6076545",
"0.6064372",
"0.6058225",
"0.6040337",
... | 0.0 | -1 |
DELETE /msds/1 DELETE /msds/1.json | def destroy
@msd.destroy
respond_to do |format|
format.html { redirect_to coas_url, notice: 'Msd was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @method_sdm.destroy\n respond_to do |format|\n format.html { redirect_to method_sdms_url, notice: 'Method sdm was successfully ... | [
"0.686982",
"0.6694625",
"0.6622695",
"0.66214514",
"0.6569122",
"0.65651125",
"0.65423054",
"0.6519989",
"0.65137726",
"0.64825666",
"0.6482308",
"0.64437515",
"0.64301956",
"0.64242107",
"0.6411436",
"0.6402744",
"0.6392488",
"0.63556856",
"0.6334883",
"0.6321268",
"0.63176... | 0.686895 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_msd
@msd = Msd.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 msds_uploads_params
params.require(:msd).permit({msds_pdfs: []})
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
keg_only 'to coexist multiple flavor' | def install
system 'sed -i -e "s/std::filesystem/std::__fs::filesystem/" src/modelHandler_OpenCL.cpp'
system 'sed -i -e "s/std::filesystem/std::__fs::filesystem/" src/main.cpp'
system 'sed -i -e "s/\/usr\/local\/opt\/llvm\//\/usr\/local\/opt\/llvm@8\//g" CMakeLists.txt'
system 'sed -E -i -e "s/CMAKE_CXX_COMPILER_VERSION VERSION_LESS [0-9\.]+/TRUE/" CMakeLists.txt'
system "cmake . -DCMAKE_INSTALL_PREFIX=#{prefix}"
system 'make'
system 'make install'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_in_flavor(*flavors, &block)\n if flavors.last.kind_of?(Hash)\n options = flavors.pop\n options, other_options = Kernel.filter_options options, :strict => true\n options = options.merge(other_options)\n else\n options = { :st... | [
"0.7200483",
"0.6170668",
"0.6081839",
"0.5997411",
"0.59726167",
"0.590089",
"0.58719516",
"0.586914",
"0.58328694",
"0.57601416",
"0.5738394",
"0.5706102",
"0.5649317",
"0.5631639",
"0.56316364",
"0.563028",
"0.5621258",
"0.56191117",
"0.56148493",
"0.56048316",
"0.55911046... | 0.0 | -1 |
GET /character_traits/1 GET /character_traits/1.xml | def show
@character_trait = CharacterTrait.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @character_trait }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skills\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def feats\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def index\n @characters =... | [
"0.68988454",
"0.6867948",
"0.6773246",
"0.6686553",
"0.66218054",
"0.65913475",
"0.6544072",
"0.6533807",
"0.65111566",
"0.6450345",
"0.63384354",
"0.63327557",
"0.61587185",
"0.60948557",
"0.60366166",
"0.60266984",
"0.59704393",
"0.59356016",
"0.58648187",
"0.5864425",
"0.... | 0.73683774 | 0 |
GET /character_traits/new GET /character_traits/new.xml | def new
@character_trait = CharacterTrait.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @character_trait }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @... | [
"0.7289629",
"0.7289629",
"0.72732955",
"0.7071897",
"0.7019768",
"0.6917561",
"0.68632233",
"0.68551576",
"0.6819092",
"0.67348754",
"0.6632413",
"0.65959907",
"0.6590539",
"0.65802485",
"0.654969",
"0.654892",
"0.6498342",
"0.6484149",
"0.64631784",
"0.64474136",
"0.6438987... | 0.7671081 | 0 |
POST /character_traits POST /character_traits.xml | def create
@character_trait = CharacterTrait.new(params[:character_trait])
respond_to do |format|
if @character_trait.save
flash[:notice] = 'CharacterTrait was successfully created.'
format.html { redirect_to(@character_trait) }
format.xml { render :xml => @character_trait, :status => :created, :location => @character_trait }
else
format.html { render :action => "new" }
format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @character_trait = CharacterTrait.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_trait }\n end\n end",
"def character_params\n params.require(:character).permit(:name, \n :image, \n ... | [
"0.6144352",
"0.5899326",
"0.5820206",
"0.5796738",
"0.57727605",
"0.5754632",
"0.57377124",
"0.57355046",
"0.57255566",
"0.5724858",
"0.570444",
"0.5677326",
"0.56568563",
"0.5653163",
"0.5645812",
"0.5642515",
"0.5624327",
"0.56166416",
"0.561188",
"0.56002814",
"0.56002814... | 0.7062613 | 0 |
PUT /character_traits/1 PUT /character_traits/1.xml | def update
@character_trait = CharacterTrait.find(params[:id])
respond_to do |format|
if @character_trait.update_attributes(params[:character_trait])
flash[:notice] = 'CharacterTrait was successfully updated.'
format.html { redirect_to(@character_trait) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trait = Trait.find(params[:id])\n\n respond_to do |format|\n if @trait.update_attributes(params[:trait])\n format.html { redirect_to([:scaffold, @trait], :notice => 'Trait was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :acti... | [
"0.62405854",
"0.60752743",
"0.60657024",
"0.60106003",
"0.59868014",
"0.5924894",
"0.5924476",
"0.5902907",
"0.58926564",
"0.58800346",
"0.5859759",
"0.5829755",
"0.5806636",
"0.57570237",
"0.5743751",
"0.5741541",
"0.57281995",
"0.57245594",
"0.56958514",
"0.5667285",
"0.56... | 0.7162147 | 0 |
DELETE /character_traits/1 DELETE /character_traits/1.xml | def destroy
@character_trait = CharacterTrait.find(params[:id])
@character_trait.destroy
respond_to do |format|
format.html { redirect_to(character_traits_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @characteristic = Characteristic.find(params[:id])\n @characteristic.destroy\n\n respond_to do |format|\n format.html... | [
"0.68811285",
"0.68306875",
"0.68190354",
"0.67988414",
"0.67872894",
"0.67872894",
"0.6763585",
"0.67467195",
"0.6661602",
"0.6450763",
"0.63833374",
"0.6351216",
"0.63143015",
"0.62571055",
"0.62259114",
"0.62107104",
"0.62091106",
"0.6197078",
"0.6173608",
"0.6171961",
"0.... | 0.7432969 | 0 |
Returns the code for the comment for this class | def genFileComment(cls, bld)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment\n cyc.comment(self.to_sym)\n end",
"def comment_string\n @comment_syntax.string_for_method_entity self\n end",
"def comment\n return @comment\n end",
"def comment\n return @comment\n end",
"def comment\n decode_string_member(:co... | [
"0.74794865",
"0.74702823",
"0.7299039",
"0.7299039",
"0.7276126",
"0.6976735",
"0.6944771",
"0.6919808",
"0.67773163",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0.67465854",
"0... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.