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 |
|---|---|---|---|---|---|---|
Complexity is O(1), because the vertices are kept in a Hash containing as values the lists of adjacent vertices of _v_. | def has_vertex?(v)
@forward_edges_with_info.key?(v)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mes(v,g)\n l_succ = Set.new\n g.adjacent_vertices(v).each { |sv| l_succ << @l[sv] }\n i = 0\n i += 1 until l_succ.member?(i) == false\n @l[v] = i \n end",
"def add_vertex(v)\n @from_store[v] ||= Set.new\n @to_store[v] ||= Set.new\n v\n end",
"def add_vertex(v)\n ... | [
"0.6957346",
"0.6644609",
"0.6624642",
"0.6613752",
"0.6510932",
"0.6431158",
"0.63513064",
"0.6344265",
"0.63227713",
"0.63182086",
"0.62859344",
"0.6245728",
"0.62424564",
"0.619509",
"0.6154189",
"0.6140417",
"0.6104931",
"0.60440856",
"0.6032261",
"0.6015816",
"0.59978396... | 0.5533563 | 56 |
Complexity is O(1), if a Set is used as adjacency list. Otherwise, complexity is O(out_degree(v)). MutableGraph interface. | def has_edge?(u, v)
@forward_edges_with_info[u]&.key?(v)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_use_graph\n graph = Graph.new\n\n index_to_vertex = build_index\n index_to_vertex.each do |(vrow, vcol), v|\n neighbours_in_use(vrow, vcol)\n .map { |index| index_to_vertex[index] }\n .each { |w| graph.add_edge(v, w) }\n end\n\n graph\n end",
"def kruskal\n # initiali... | [
"0.6219192",
"0.61894596",
"0.6143544",
"0.61337566",
"0.60928047",
"0.6015699",
"0.60078263",
"0.59726244",
"0.5943218",
"0.5933301",
"0.5912633",
"0.58945024",
"0.5891796",
"0.58629644",
"0.58224505",
"0.57794106",
"0.5755987",
"0.5667545",
"0.56674755",
"0.56621593",
"0.56... | 0.0 | -1 |
See MutableGraphadd_vertex. If the vertex is already in the graph (using eql?), the method does nothing. | def add_vertex(v)
@forward_edges_with_info[v] ||= IdentityHash.new
@backward_edges[v] ||= IdentityHash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex!(vertex)\n\tend",
"def add_vertex!(vertex)\n\tend",
"def add_vertex(vertex)\n @reversal = nil\n return false if vertex?(vertex)\n setup_vertex(vertex)\n true # don't return the VertexWrapper instance.\n end",
"def add_vertex(vertex)\n raise TypeError, 'Argumen... | [
"0.74958473",
"0.74958473",
"0.7421182",
"0.71078694",
"0.7088259",
"0.702472",
"0.70147485",
"0.69052625",
"0.6884719",
"0.6799699",
"0.67764837",
"0.6745886",
"0.6740436",
"0.6654969",
"0.66147137",
"0.6587481",
"0.6575567",
"0.64521307",
"0.6451795",
"0.64486104",
"0.64126... | 0.6525592 | 17 |
Returns a set of removed edges and a set of new edges between elements of +vertices+ in +self+ and +other_graph+. If a block is given, +vertices+ are vertices in +graph+ and this block is used to translate them into vertices in +other_graph+. Otherwise, we assume that both graphs include the same vertices. +other_graph... | def difference(other_graph, self_vertices, &mapping)
mapping ||= ->(v) { v }
other_vertices = Set.new
new = []
removed = []
updated = []
seen_vertices = IdentityHash.new
seen_connections = IdentityHash.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff_with(other, &block)\n m, i, a = [], [], []\n u_s = self.make_uniq_by(&block)\n u_o = other.make_uniq_by(&block)\n u_s.each do |e| \n if u_o.find{|x| yield(e,x)} then i.push(e) # intersection\n else m.push(e) end # missing\n end\n u_o.each { |e| a.push(e) unless u_s.find{|x| ... | [
"0.5632795",
"0.5558956",
"0.5492673",
"0.54475236",
"0.54460025",
"0.53642565",
"0.52860326",
"0.5166024",
"0.5157959",
"0.5059155",
"0.50008893",
"0.4989922",
"0.497896",
"0.4935075",
"0.4894518",
"0.48769867",
"0.48723",
"0.48527652",
"0.48249656",
"0.48182935",
"0.4809288... | 0.7496374 | 0 |
Initializes the Variable and attaches it to the Goal. | def initialize(name, goal)
raise GoalError, "Not a Goal: #{goal.inspect}" unless goal.is_a?(Goal)
@goal = goal
name = name.to_sym if name.is_a?(String)
case name
when Symbol
@name = name
@values = []
when Variable
@name = name.name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def declare_init(variable, name)\r\n @init << variable.declare(name)\r\n end",
"def main_variable\r\n super\r\n main_battledata # Setup Battle Temp Data & Interpreter\r\n main_troopdata # Setup Troop Data\r\n # Initialize wait count\r\n @wait_count = 0\r\n end",
"de... | [
"0.67364836",
"0.64475167",
"0.6332104",
"0.6240574",
"0.6217647",
"0.6202492",
"0.61562365",
"0.6091643",
"0.59750926",
"0.5959766",
"0.5927555",
"0.5927038",
"0.5813952",
"0.58130145",
"0.58014053",
"0.5786256",
"0.57704985",
"0.57704985",
"0.5767166",
"0.57638127",
"0.5724... | 0.5821127 | 12 |
Converts a Variable back to a Symbol. | def to_sym
@name&.to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_symbol\n case node\n in SyntaxTree::Label[value:]\n value.chomp(\":\").to_sym\n in SyntaxTree::SymbolLiteral[value: SyntaxTree::Ident[value:]]\n value.to_sym\n in SyntaxTree::SymbolLiteral[value:]\n raise CompilationError, \"Unexpected symbol value type... | [
"0.6810172",
"0.67600983",
"0.6376654",
"0.6338804",
"0.6338804",
"0.6338804",
"0.6232401",
"0.6133396",
"0.61089987",
"0.6035728",
"0.60326135",
"0.6023077",
"0.6023077",
"0.6023077",
"0.5991745",
"0.59685886",
"0.5961027",
"0.5951417",
"0.5939405",
"0.5935894",
"0.5934436",... | 0.579849 | 29 |
Instantiates Variable to another experssion. | def instantiate(other, index_into_other = nil, index_into_self = nil)
raise SelfReferentialError, "Cannot instantiate self-referential definition for #{(self.variables & other.variables).inspect}" unless (self.variables & other.variables).empty?
# -- Check Instantiation is Unifiable --
unless ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variable(*args)\n Variable.new(self, *args)\n end",
"def variable(*args)\n Variable.new(self, *args)\n end",
"def new_variable(name, type, memory, is_cte = false) #method\n @variables[name] = ObjectVariable.new(name, type, memory, is_cte)\n end",
"def set_variable\n var_name=EvalBlock.lasg... | [
"0.71041894",
"0.71041894",
"0.6927128",
"0.6742245",
"0.6592648",
"0.6464675",
"0.6464675",
"0.64209986",
"0.630028",
"0.61814374",
"0.61700076",
"0.6077791",
"0.6067047",
"0.604542",
"0.599007",
"0.59426653",
"0.5927214",
"0.5905416",
"0.586043",
"0.5824833",
"0.5808374",
... | 0.5720805 | 29 |
Removes this Variable by removing all of its insantiations. | def remove
@instantiations.dup.each(&:remove)
@instantiations[0..-1] = []
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove\n instance_variables.map{|v| instance_variable_get(v) }\n .keep_if{|v| v.respond_to? :remove }\n .each(&:remove)\n end",
"def clear\n instance_variables.each do |instance_variable|\n instance_variable_set(instance_variable, ... | [
"0.6954977",
"0.6321364",
"0.6090148",
"0.6003307",
"0.5995221",
"0.599138",
"0.5911996",
"0.58710414",
"0.5828889",
"0.5802615",
"0.577403",
"0.57697326",
"0.57358485",
"0.5690383",
"0.565127",
"0.56418365",
"0.56362045",
"0.56246763",
"0.56241256",
"0.561303",
"0.561167",
... | 0.59748995 | 6 |
Removes instantiations from another goal. | def uninstantiate(other_goal)
@instantiations.delete_if do |instantiation|
instantiation.remove if instantiation.other_goal_to(self) == other_goal
end
@values.delete_if{|value| value.goal == other_goal }
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end",
"def deintersect\n [self]\n end",
"def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n ... | [
"0.67113477",
"0.6069704",
"0.5780489",
"0.57433844",
"0.5686406",
"0.56003445",
"0.5566493",
"0.5560267",
"0.54836184",
"0.54565376",
"0.54362965",
"0.54201263",
"0.5403173",
"0.5402818",
"0.53903234",
"0.5361394",
"0.536036",
"0.532777",
"0.5319456",
"0.53018737",
"0.529400... | 0.7738941 | 0 |
Indexes the value of the Variable. | def [](index)
value = self.value
value = value.value if value.is_a?(Value)
case value
when Array
case index
when Integer
value[index]
when Symbol
case index
when :head
value[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indexvalue\n if multiple?\n @value.map {|v| single_indexvalue v }\n else\n single_indexvalue @value\n end\n end",
"def value_index\n return nil unless self.value\n VALUES.index(self.value.downcase)\n end",
"def indexed=(val)\n self['indexed'] = 'val'\n end",
"def [... | [
"0.6446142",
"0.64453787",
"0.63432586",
"0.6259648",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6178858",
"0.6165056",
"0.6085303",
"0.6074007",
"0.6070438",
"0.60555285",
"0.6015349",
"0.5938426",
"0.5905381",
"0.59016836",... | 0.5502339 | 67 |
GET /ingpizzas GET /ingpizzas.json | def index
@ingpizzas = Ingpizza.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @pizzatoppings = Pizzatopping.all\n end",
"def index\n @pizzas = Pizza.all\n end",
"def index\n @pizzas = Pizza.all\n end",
"def index\n @pizzas = Pizza.all\n end",
"def index\n @pizzas = Pizza.all()\n ... | [
"0.74558353",
"0.6915496",
"0.6600556",
"0.6600556",
"0.6600556",
"0.65843904",
"0.6432975",
"0.6422959",
"0.6407219",
"0.6338065",
"0.6294207",
"0.6274481",
"0.62577593",
"0.6256031",
"0.6252388",
"0.62252367",
"0.61981714",
"0.6197401",
"0.617102",
"0.6167456",
"0.6146729",... | 0.7270751 | 1 |
GET /ingpizzas/1 GET /ingpizzas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @ingpizzas = Ingpizza.all\n end",
"def index\n @pizzatoppings = Pizzatopping.all\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @innings = Inning.all\n\n res... | [
"0.70985234",
"0.7005034",
"0.6441287",
"0.63573664",
"0.63450223",
"0.6317788",
"0.6288648",
"0.62804234",
"0.62804234",
"0.62804234",
"0.62620986",
"0.62573713",
"0.62558806",
"0.6251954",
"0.6176697",
"0.6173568",
"0.61666715",
"0.6139443",
"0.6118017",
"0.61176395",
"0.61... | 0.0 | -1 |
POST /ingpizzas POST /ingpizzas.json | def create
@ingpizza = Ingpizza.new(ingpizza_params)
respond_to do |format|
if @ingpizza.save
format.html { redirect_to @ingpizza, notice: 'Ingpizza was successfully created.' }
format.json { render :show, status: :created, location: @ingpizza }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pizzatopping = Pizzatopping.new(pizzatopping_params)\n\n respond_to do |format|\n if @pizzatopping.save\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizzatoppi... | [
"0.6225869",
"0.616042",
"0.6073763",
"0.60172164",
"0.5821407",
"0.58193547",
"0.58156407",
"0.57953876",
"0.5782935",
"0.57128847",
"0.5696784",
"0.56960297",
"0.56561166",
"0.5602819",
"0.55512524",
"0.5517267",
"0.5444024",
"0.540273",
"0.53882056",
"0.53647393",
"0.53645... | 0.6250061 | 0 |
PATCH/PUT /ingpizzas/1 PATCH/PUT /ingpizzas/1.json | def update
respond_to do |format|
if @ingpizza.update(ingpizza_params)
format.html { redirect_to @ingpizza, notice: 'Ingpizza was successfully updated.' }
format.json { render :show, status: :ok, location: @ingpizza }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @pizzatopping.update(pizzatopping_params)\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json {... | [
"0.6543338",
"0.63815427",
"0.62830937",
"0.62756205",
"0.6242164",
"0.62364143",
"0.6197876",
"0.6197876",
"0.616763",
"0.6165653",
"0.6132712",
"0.61255336",
"0.6110706",
"0.60655206",
"0.60397536",
"0.59947014",
"0.5992412",
"0.59814894",
"0.5977995",
"0.59722555",
"0.5969... | 0.623992 | 5 |
DELETE /ingpizzas/1 DELETE /ingpizzas/1.json | def destroy
@ingpizza.destroy
respond_to do |format|
format.html { redirect_to ingpizzas_url, notice: 'Ingpizza was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @pizzatopping.destroy\n respon... | [
"0.711311",
"0.7082492",
"0.7059551",
"0.69946367",
"0.6965735",
"0.695438",
"0.69007343",
"0.68896633",
"0.68823326",
"0.6825312",
"0.6825312",
"0.6813564",
"0.6813564",
"0.6813564",
"0.6813564",
"0.68006337",
"0.6771392",
"0.67627114",
"0.67544264",
"0.67431366",
"0.674037"... | 0.70461386 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_ingpizza
@ingpizza = Ingpizza.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 ingpizza_params
params.require(:ingpizza).permit(:ingredient_id, :pizza_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Reload the stack data from the API | def stack_reload(stack)
if(stack.persisted?)
result = request(
:method => :get,
:path => "/stacks/#{stack.name}/#{stack.id}",
:expects => 200
)
stk = result.get(:body, :stack)
stack.load_data(
:id => stk[:i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_reload\n api.stack_reload(self)\n end",
"def stack_reload(stack)\n logger.debug(\"reloading stack `#{stack.id}`\")\n if stack.persisted?\n ustack = Stack.new(self)\n ustack.id = stack.id\n load_stack_data(ustack)\n if ustac... | [
"0.7717218",
"0.7257653",
"0.70935035",
"0.7082922",
"0.70701367",
"0.7038426",
"0.7038426",
"0.70270514",
"0.6930498",
"0.67789984",
"0.673942",
"0.6693954",
"0.6642986",
"0.66300267",
"0.6473655",
"0.6473655",
"0.6423422",
"0.63752306",
"0.6364604",
"0.63637763",
"0.6355856... | 0.7802955 | 0 |
Return all resources for stack | def resource_all(stack)
result = request(
:method => :get,
:path => "/stacks/#{stack.name}/#{stack.id}/resources",
:expects => 200
)
result.fetch(:body, :resources, []).map do |resource|
Stack::Resource.new(
stack,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name =... | [
"0.8385998",
"0.83211017",
"0.82584506",
"0.7933473",
"0.7512831",
"0.7481882",
"0.7481882",
"0.7481882",
"0.74451673",
"0.723617",
"0.72299147",
"0.7131638",
"0.70995015",
"0.70403385",
"0.70345443",
"0.70080197",
"0.69085974",
"0.68713415",
"0.6860474",
"0.68174386",
"0.676... | 0.859784 | 0 |
Reload the stack resource data from the API | def resource_reload(resource)
resource.stack.resources.reload
resource.stack.resources.get(resource.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack_reload(stack)\n if(stack.persisted?)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}\",\n :expects => 200\n )\n stk = result.get(:body, :stack)\n stack.load_data(\n ... | [
"0.76818675",
"0.7433895",
"0.73262084",
"0.70230377",
"0.69016075",
"0.68822896",
"0.67636967",
"0.67636967",
"0.66815346",
"0.66766083",
"0.6564236",
"0.655793",
"0.6507201",
"0.64262086",
"0.6400393",
"0.63777834",
"0.6272263",
"0.6272263",
"0.6269329",
"0.6193525",
"0.617... | 0.724604 | 3 |
Return all events for stack | def event_all(stack, marker = nil)
params = marker ? {:marker => marker} : {}
result = request(
:path => "/stacks/#{stack.name}/#{stack.id}/events",
:method => :get,
:expects => 200,
:params => params
)
result.fetch(:body, :events, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_all(stack)\n raise NotImplementedError\n end",
"def event_all(stack, evt_id = nil)\n evt_id = stack.last_event_token if evt_id\n results = all_result_pages(evt_id, :body,\n \"DescribeStackEventsResponse\", \"DescribeStackEventsResult\",\... | [
"0.79948014",
"0.7795928",
"0.7691098",
"0.76356024",
"0.7480808",
"0.7480808",
"0.7472861",
"0.74672675",
"0.74519634",
"0.73349977",
"0.72983027",
"0.72931767",
"0.7258856",
"0.7225407",
"0.70728445",
"0.7068914",
"0.7054057",
"0.6987858",
"0.6976128",
"0.6965209",
"0.69652... | 0.7809804 | 1 |
Return all new events for event collection | def event_all_new(events)
event_all(events.stack, events.all.first.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_all_new(events)\n raise NotImplementedError\n end",
"def all_events\n @events = Event.all\n end",
"def events\n collection(\"events\")\n end",
"def get_events()\n\t\tevents = []\n\n\t\t@DB[:events].order(:date).each do |event|\n\t\t\tnewTimeslots = []\n\t\t\t@DB[:timeslots].... | [
"0.75519466",
"0.7436476",
"0.7329337",
"0.72541505",
"0.7247019",
"0.7246737",
"0.7216016",
"0.7197598",
"0.71040666",
"0.7016994",
"0.6935491",
"0.69233745",
"0.69233745",
"0.6886346",
"0.6882774",
"0.68762857",
"0.6829994",
"0.6829039",
"0.6819019",
"0.6803695",
"0.6750977... | 0.77475137 | 1 |
Reload the stack event data from the API | def event_reload(event)
event.stack.events.reload
event.stack.events.get(event.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_events\n resp = cfn.describe_stack_events(stack_name: @stack_name)\n @events = resp[\"stack_events\"]\n rescue Aws::CloudFormation::Errors::ValidationError => e\n if e.message =~ /Stack .* does not exis/\n @stack_deletion_completed = true\n else\n raise\n end\n... | [
"0.69430196",
"0.68845636",
"0.68116707",
"0.64816636",
"0.6457325",
"0.64123917",
"0.6369653",
"0.6336262",
"0.633447",
"0.62547654",
"0.6179738",
"0.6179738",
"0.61616105",
"0.6066889",
"0.60121876",
"0.6007273",
"0.59703285",
"0.5956986",
"0.5956264",
"0.59417367",
"0.5937... | 0.74238646 | 1 |
from the static page artdelete the details of articles to be deleted from the database are taken from the admin based on the input the articles and their metadata deleted from the database | def artclear
# select articles to be deleted
@articles= Feedentry.where(pubon: /#{params[:date]}/,type: /#{params[:type]}/,article: /#{params[:article]}/)
prev=Feedentry.count
# deletion of articles from database
@articles.destroy
new=Feedentry.count
@artcount=prev-new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@article = Article.find(params[:id])\n #se sutituira por el uso de methodo set_article\n @article.destroy\n flash[:notice] = \"Article was successfully deleted\"\n redirect_to articles_path\n end",
"def destroy\n\t\t\t@article= Article.find(params[:id])\n\t\t\t@article.destroy #Des... | [
"0.68747973",
"0.6791782",
"0.6752324",
"0.665937",
"0.66537035",
"0.66488206",
"0.6633576",
"0.66334665",
"0.66260993",
"0.66212314",
"0.6620784",
"0.65843314",
"0.65804535",
"0.65761364",
"0.65674007",
"0.6551763",
"0.6540919",
"0.65398335",
"0.6536258",
"0.652929",
"0.6513... | 0.70826596 | 0 |
start of cthulu_room block | def cthulu_room
puts "Here you see the great evil Cthulu."
puts "He, it, whatever stares at you and you go insane."
puts "Do you flee for your life or eat your head?"
print "> "
choice = $stdin.gets.chomp
#
if choice.include? "flee"
start
elsif choice.include? "head"
dead("Well that was tasty!"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_starting_block\n nil\n end",
"def enter(room) \n # Obtain hazard for the room \n hazardsInRoom = room.hazardRoom\n #Check that hazard room is not nil and has pit\n if (hazardsInRoom and hazardsInRoom.include?(:pit))\n @@blockEncounters[2].call()\n end\n ... | [
"0.64633423",
"0.6209624",
"0.6203009",
"0.6072545",
"0.6031288",
"0.5993219",
"0.5934148",
"0.59232616",
"0.59232616",
"0.5903063",
"0.5818347",
"0.5818347",
"0.5818347",
"0.5811843",
"0.577479",
"0.5724633",
"0.5724633",
"0.5724633",
"0.5724633",
"0.5724633",
"0.5724633",
... | 0.0 | -1 |
setter method, this sets the passed song's .artist object association to be whatever instance of artist the method is called on. | def songs
Song.all.select {|songs|songs.artist == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artist=(artist) #assigns an artist to the song (song belongs to artist)\n @artist = artist #artist is reading from Song class artist method(reader)\n artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end",
"def artist=(artist)\n ... | [
"0.8392991",
"0.83918554",
"0.83531994",
"0.8310858",
"0.8172839",
"0.8139116",
"0.8127633",
"0.8116001",
"0.8116001",
"0.8116001",
"0.80707526",
"0.805427",
"0.7992598",
"0.79691917",
"0.7963294",
"0.7812072",
"0.7789041",
"0.7736893",
"0.7726706",
"0.7673397",
"0.7673397",
... | 0.0 | -1 |
GET /ads GET /ads.json | def index
@ads = @org.ads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def... | [
"0.7752131",
"0.7749316",
"0.7291679",
"0.7224467",
"0.71702427",
"0.71702427",
"0.71702427",
"0.71702427",
"0.71702427",
"0.712877",
"0.712877",
"0.712877",
"0.7110715",
"0.6884924",
"0.68810844",
"0.68610626",
"0.6854222",
"0.68104106",
"0.67929673",
"0.67929673",
"0.678210... | 0.726539 | 3 |
GET /ads/1 GET /ads/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def... | [
"0.75970733",
"0.7587807",
"0.730965",
"0.730965",
"0.730965",
"0.71618325",
"0.7091579",
"0.7060379",
"0.698387",
"0.698387",
"0.698387",
"0.698387",
"0.698387",
"0.6965706",
"0.69487184",
"0.6883612",
"0.68527615",
"0.6832596",
"0.6781336",
"0.6744042",
"0.67338634",
"0.6... | 0.0 | -1 |
POST /ads POST /ads.json | def create
fix_tokenized_input_params
@ad = @org.ads.build(ad_params)
respond_to do |format|
if @ad.save
format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully created.' }
format.json { render :show, status: :created, location: [@ad.org, @ad] }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ad = Ad.new(ad_params)\n\n if @ad.save\n render :show, status: :created, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ad = Ad.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n format.html ... | [
"0.71051663",
"0.7014856",
"0.69783634",
"0.6958402",
"0.687992",
"0.6796889",
"0.6729126",
"0.66890365",
"0.6644174",
"0.66278136",
"0.649528",
"0.64633185",
"0.64579415",
"0.6427978",
"0.64220244",
"0.6417364",
"0.63306385",
"0.63099897",
"0.6308368",
"0.62947494",
"0.62825... | 0.70117784 | 2 |
PATCH/PUT /ads/1 PATCH/PUT /ads/1.json | def update
fix_tokenized_input_params
respond_to do |format|
if @ad.update(ad_params)
format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully updated.' }
format.json { render :show, status: :ok, location: [@ad.org, @ad] }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n form... | [
"0.69383",
"0.69383",
"0.67188334",
"0.66695863",
"0.66695863",
"0.66695863",
"0.6641892",
"0.6612114",
"0.6575076",
"0.6553201",
"0.6546139",
"0.65125585",
"0.6492367",
"0.6475903",
"0.64591247",
"0.64585716",
"0.64578116",
"0.64555466",
"0.6452212",
"0.6446261",
"0.6434833"... | 0.65049094 | 12 |
DELETE /ads/1 DELETE /ads/1.json | def destroy
@ad.destroy
respond_to do |format|
format.html { redirect_to org_ads_url(@ad.org), notice: 'Ad was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home_indices_... | [
"0.7637339",
"0.7542011",
"0.75137264",
"0.73285",
"0.72981167",
"0.7294329",
"0.7290231",
"0.7290231",
"0.72807807",
"0.72807807",
"0.7275584",
"0.7233481",
"0.72154176",
"0.72154176",
"0.72154176",
"0.72122157",
"0.7211167",
"0.7211167",
"0.7211167",
"0.7187984",
"0.7177121... | 0.7201754 | 19 |
Use callbacks to share common setup or constraints between actions. | def set_org
@org = Org.find_by_permalink(params[:org_id])
raise ActiveRecord::RecordNotFound unless @org
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 |
Use callbacks to share common setup or constraints between actions. | def set_ad
@ad = @org.ads.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 ad_params
params.require(:ad).permit(:creative_id, :bid_type, :bid_in_cents, {locations: [ {countries: [ {only: []}, {excluding: []} ]}, {states_provinces_regions: [ {only: []}, {excluding: []} ]}, {cities: [ {only: []}, {excluding: []} ]}, {zips_postal_codes: [ {only: []}, {excluding: []} ]}, {locales: [ {on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
This takes tokenized fields from parameters and changes them into arrays | def fix_tokenized_input_params
[:cities, :zips_postal_codes].each do |sublocation|
[:only, :excluding].each do |subcategory|
if params[:ad] && params[:ad][:locations] && params[:ad][:locations][sublocation] && params[:ad][:locations][sublocation][subcategory] && params[:ad][:locations][sublocation][su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params_array_from(raw_params); end",
"def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def params_array_from... | [
"0.69697344",
"0.68385524",
"0.6740701",
"0.6709891",
"0.6531894",
"0.62712604",
"0.6152233",
"0.5944956",
"0.5926065",
"0.59164935",
"0.5893682",
"0.5888876",
"0.5832685",
"0.5772937",
"0.5732869",
"0.57326925",
"0.5710198",
"0.56949645",
"0.5680163",
"0.5649959",
"0.5617251... | 0.5939924 | 8 |
Returns +true+ if one of the players has reached the finish line, +false+ otherwise | def finished?
@players.each do |current_player|
return true if current_player.position >= @length
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end?\n players.any?(&:bankrupt?)\n end",
"def finished?\n player_positions.any? { |player, position| position >= length}\n end",
"def finished?\n @players.any? do |player|\n @position[player] == @length\n end\n end",
"def finished?\n if @player_positions [\"b\"] > 80 \n r... | [
"0.76804084",
"0.76791155",
"0.76077443",
"0.75772023",
"0.7488161",
"0.745646",
"0.7372385",
"0.72411567",
"0.72171926",
"0.71529156",
"0.71183556",
"0.70959085",
"0.708301",
"0.7079374",
"0.70177364",
"0.6999355",
"0.69923884",
"0.69735914",
"0.6845867",
"0.6831933",
"0.680... | 0.77563196 | 0 |
Returns the winner if there is one, +nil+ otherwise | def winner
@players.each do |current_player|
if current_player.position >= length
#puts "#{current_player.name} JUST WON!!!"
return "#{current_player.name}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end",
"def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end",
"def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end... | [
"0.85865",
"0.85793227",
"0.8561836",
"0.8548561",
"0.84920555",
"0.84422237",
"0.8439409",
"0.8360294",
"0.83490294",
"0.8326038",
"0.82964504",
"0.8277494",
"0.825846",
"0.82131517",
"0.82092726",
"0.8186078",
"0.8176684",
"0.81112015",
"0.80923903",
"0.80606264",
"0.805886... | 0.0 | -1 |
Rolls the die and advances +player+ accordingly | def advance_player(player)
player.advance(die.roll)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance_player(player)\n player[\"player_position\"] += die.roll\n player[\"player_position\"] = 29 if player[\"player_position\"] > 29\n end",
"def advance_player(player)\n @position[player] += @die.roll\n end",
"def advance_player!(player)\n die = Die.new.roll\n @players[player]<<die\n ... | [
"0.7839597",
"0.77220786",
"0.76215446",
"0.75018513",
"0.7302336",
"0.71503663",
"0.7066261",
"0.70516783",
"0.7017454",
"0.67789847",
"0.6746115",
"0.67278916",
"0.66893315",
"0.6685391",
"0.66583633",
"0.661933",
"0.6614758",
"0.65299356",
"0.64470994",
"0.6436042",
"0.643... | 0.8291052 | 0 |
Returns the current state of the game as a string that can be printed on the command line. The board should have the same dimensions each time. | def board_visualization
@players.each do|x|
print_lane
x.print_progress
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_state_string\n string = \"\"\n\n (@size * @size).times{ |i|\n if i % @size == 0\n string << \"\\n\\t\"\n end\n if @state[i]\n string << \"1 \"\n else\n string << \"0 \"\n end\n }\n string << \"\\n\"\n\n return string\n end",
"def board\n ... | [
"0.7603655",
"0.720089",
"0.7081979",
"0.7010267",
"0.6961297",
"0.69537103",
"0.69226724",
"0.6895021",
"0.68457514",
"0.6803359",
"0.67959416",
"0.67853475",
"0.6776055",
"0.6773726",
"0.6629894",
"0.6622305",
"0.6571684",
"0.6533128",
"0.6529361",
"0.64957625",
"0.64957625... | 0.0 | -1 |
Create a new stack. | def create_stack(stack_definition, organization, name, opts = {})
data, _status_code, _headers = create_stack_with_http_info(stack_definition, organization, name, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_stack(name, template, parameters)\n cfm = AWS::CloudFormation.new\n\n stack = cfm.stacks.detect { |s| s.name == name }\n\n # Helpful when spinning up and down the stack for testing.\n unless stack.nil?\n wait_statuses = %w{DELETE_IN_PROGRESS ROLLBACK_IN_PROGRESS}\n ... | [
"0.72269005",
"0.71057963",
"0.70041144",
"0.6993908",
"0.6934453",
"0.68110675",
"0.67036",
"0.6701096",
"0.665061",
"0.6612904",
"0.64981633",
"0.6456394",
"0.6448694",
"0.6448694",
"0.6433995",
"0.6417667",
"0.6402047",
"0.63164186",
"0.6211851",
"0.6203102",
"0.61887187",... | 0.6871737 | 5 |
Create a new stack. | def create_stack_with_http_info(stack_definition, organization, name, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: StacksApi.create_stack ..."
end
# verify the required parameter 'stack_definition' is set
if @api_client.config.client_side_valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_stack(name, template, parameters)\n cfm = AWS::CloudFormation.new\n\n stack = cfm.stacks.detect { |s| s.name == name }\n\n # Helpful when spinning up and down the stack for testing.\n unless stack.nil?\n wait_statuses = %w{DELETE_IN_PROGRESS ROLLBACK_IN_PROGRESS}\n ... | [
"0.72269005",
"0.71057963",
"0.70041144",
"0.6993908",
"0.6934453",
"0.6871737",
"0.68110675",
"0.67036",
"0.6701096",
"0.665061",
"0.6612904",
"0.64981633",
"0.6456394",
"0.6448694",
"0.6448694",
"0.6433995",
"0.6417667",
"0.6402047",
"0.63164186",
"0.6211851",
"0.6203102",
... | 0.0 | -1 |
Get a single stack. | def get_stack(organization, name, opts = {})
data, _status_code, _headers = get_stack_with_http_info(organization, name, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top()\n @stack[0]\n end",
"def peek\n @stack[0]\n end",
"def peek\n if empty?\n nil\n else\n @stack.first\n end\n end",
"def pop\n return @stack.pop\n end",
"def pop\n return @stack.pop\n end",
"def top()\n @stack.last\n end",
"def top()\n ... | [
"0.7067047",
"0.70306796",
"0.6927735",
"0.6909545",
"0.6882539",
"0.6713131",
"0.669459",
"0.669459",
"0.6682037",
"0.668122",
"0.66612345",
"0.6643397",
"0.6642649",
"0.6634852",
"0.66338015",
"0.66199166",
"0.66060203",
"0.65981317",
"0.6558262",
"0.65569955",
"0.65468",
... | 0.6092106 | 63 |
Get a single stack. | def get_stack_with_http_info(organization, name, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: StacksApi.get_stack ..."
end
# verify the required parameter 'organization' is set
if @api_client.config.client_side_validation && organization.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top()\n @stack[0]\n end",
"def peek\n @stack[0]\n end",
"def peek\n if empty?\n nil\n else\n @stack.first\n end\n end",
"def pop\n return @stack.pop\n end",
"def pop\n return @stack.pop\n end",
"def top()\n @stack.last\n end",
"def top()\n ... | [
"0.7067047",
"0.70306796",
"0.6927735",
"0.6909545",
"0.6882539",
"0.6713131",
"0.669459",
"0.669459",
"0.6682037",
"0.668122",
"0.66612345",
"0.6643397",
"0.6642649",
"0.6634852",
"0.66338015",
"0.66199166",
"0.66060203",
"0.65981317",
"0.6558262",
"0.65569955",
"0.65468",
... | 0.0 | -1 |
Listing all available operations that can be used in stacks. | def list_operations(opts = {})
data, _status_code, _headers = list_operations_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_operations()\n\t\treturn @service.operations\n\tend",
"def operations\n @scope.operations\n end",
"def operations\n @operations\n end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"d... | [
"0.7391478",
"0.733199",
"0.72402513",
"0.69411576",
"0.69411576",
"0.69411576",
"0.69411576",
"0.69411576",
"0.67094743",
"0.669582",
"0.66253",
"0.6570752",
"0.65098846",
"0.65098846",
"0.64871895",
"0.6383646",
"0.6028108",
"0.60131025",
"0.60008115",
"0.59895486",
"0.5969... | 0.63505125 | 16 |
Listing all available operations that can be used in stacks. | def list_operations_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: StacksApi.list_operations ..."
end
# resource path
local_var_path = "/operations"
# query parameters
query_params = {}
# header parameters
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_operations()\n\t\treturn @service.operations\n\tend",
"def operations\n @scope.operations\n end",
"def operations\n @operations\n end",
"def operations\n return @operations\n end",
"def operations\n return @operations\n end",
"d... | [
"0.7391478",
"0.733199",
"0.72402513",
"0.69411576",
"0.69411576",
"0.69411576",
"0.69411576",
"0.69411576",
"0.67094743",
"0.669582",
"0.66253",
"0.6570752",
"0.65098846",
"0.65098846",
"0.64871895",
"0.63505125",
"0.6028108",
"0.60131025",
"0.60008115",
"0.59895486",
"0.596... | 0.6383646 | 15 |
List all available options that can be set on stacks. | def list_stack_options(opts = {})
data, _status_code, _headers = list_stack_options_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @options\n end",
"def all_options\n Config::Options.all\n end",
"def show_effective_options\n puts \"Options:\\n\"\n\n @options.marshal_dump.each do |name, val|\n puts \" #{name} = #{val}\"\n end\n end",
"def option_names\n standard_option_names\nend",
"def listOption... | [
"0.6881183",
"0.68140495",
"0.66231513",
"0.6598765",
"0.65324664",
"0.6442754",
"0.6380556",
"0.6337539",
"0.62755144",
"0.626874",
"0.62673205",
"0.62083364",
"0.6193694",
"0.61817217",
"0.6145359",
"0.61408365",
"0.6136129",
"0.6106839",
"0.61009103",
"0.6083951",
"0.60828... | 0.6863603 | 1 |
List all available options that can be set on stacks. | def list_stack_options_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: StacksApi.list_stack_options ..."
end
# resource path
local_var_path = "/stackoptions"
# query parameters
query_params = {}
# header paramete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @options\n end",
"def list_stack_options(opts = {})\n data, _status_code, _headers = list_stack_options_with_http_info(opts)\n return data\n end",
"def all_options\n Config::Options.all\n end",
"def show_effective_options\n puts \"Options:\\n\"\n\n @options.marshal_du... | [
"0.6881183",
"0.6863603",
"0.68140495",
"0.66231513",
"0.6598765",
"0.65324664",
"0.6442754",
"0.6380556",
"0.6337539",
"0.62755144",
"0.62673205",
"0.62083364",
"0.6193694",
"0.61817217",
"0.6145359",
"0.61408365",
"0.6136129",
"0.6106839",
"0.61009103",
"0.6083951",
"0.6082... | 0.626874 | 10 |
Get all stacks of an organization. | def list_stacks(organization, opts = {})
data, _status_code, _headers = list_stacks_with_http_info(organization, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_stacks\n client.describe_stacks.stacks\n end",
"def stacks\n response = OpenStack::Heat::Connection.heat_conn.req('GET', '/stacks')\n stacks_hash = JSON.parse(response.body)[\"stacks\"]\n stacks_hash.inject([]){|res, current| res << OpenStack::Heat::Stack.new(curre... | [
"0.6982389",
"0.68256027",
"0.64855415",
"0.61743385",
"0.6030494",
"0.59666425",
"0.58503306",
"0.5784852",
"0.56641597",
"0.5654815",
"0.5545304",
"0.55117893",
"0.54563624",
"0.54292935",
"0.54267424",
"0.5423077",
"0.53282773",
"0.5249769",
"0.5239011",
"0.5189185",
"0.51... | 0.7513913 | 0 |
Get all stacks of an organization. | def list_stacks_with_http_info(organization, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: StacksApi.list_stacks ..."
end
# verify the required parameter 'organization' is set
if @api_client.config.client_side_validation && organization.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_stacks(organization, opts = {})\n data, _status_code, _headers = list_stacks_with_http_info(organization, opts)\n return data\n end",
"def list_stacks\n client.describe_stacks.stacks\n end",
"def stacks\n response = OpenStack::Heat::Connection.heat_conn.req('GET', '/s... | [
"0.7513913",
"0.6982389",
"0.68256027",
"0.64855415",
"0.6030494",
"0.59666425",
"0.58503306",
"0.5784852",
"0.56641597",
"0.5654815",
"0.5545304",
"0.55117893",
"0.54563624",
"0.54292935",
"0.54267424",
"0.5423077",
"0.53282773",
"0.5249769",
"0.5239011",
"0.5189185",
"0.513... | 0.61743385 | 4 |
Adds the routes to the host app to point everything to caboose | def init_routes
puts "Adding the caboose store routes..."
filename = File.join(@app_path,'config','routes.rb')
return if !File.exists?(filename)
return if !@force
str = ""
str << "\t# Catch everything with caboose\n"
str << "\tmount CabooseStore::Engine => '/'\n"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app\n routes = Routes\n routes.set :public_folder, 'public'\n routes.set :environment, :test\n routes\n end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",... | [
"0.658821",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.64791256",
"0.6473985",
"0.6377371",
"0.63272995",
"0.6296796",
"0.6296796",
"0.62775856",
"0.62246263",
"0.6203928",
"0.... | 0.71354496 | 0 |
GET /profiles GET /profiles.json | def index
if current_user.role == 2
redirect_to '/profiles/adminindex'
else
@profiles_draft = Profile.where(user_id: current_user.id, status: "Draft").order(:name)
@profiles_pending = Profile.where(user_id: current_user.id, status: "Pending").order(:name)
@profiles_approved = Profile.whe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access... | [
"0.7720244",
"0.7511753",
"0.7511205",
"0.7474065",
"0.747391",
"0.7429771",
"0.7368022",
"0.7368022",
"0.7277252",
"0.72754085",
"0.72646606",
"0.7194632",
"0.71890444",
"0.7109752",
"0.7068873",
"0.7061951",
"0.7061951",
"0.7061951",
"0.7036681",
"0.70242476",
"0.699903",
... | 0.0 | -1 |
GET /profiles/1 GET /profiles/1.json | def show
if current_user.role == 2 || @profile.user_id == current_user.id
respond_to do |format|
format.docx do
render docx: 'show'
end
format.pdf do
render :pdf => "#{@profile.name} Profile", :template => "profiles/show.html.erb", layout: 'pdf'
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def index\n authorize Profile\n @profi... | [
"0.7775649",
"0.74931335",
"0.74876684",
"0.736598",
"0.7305961",
"0.7302657",
"0.7301793",
"0.72450936",
"0.72319347",
"0.72319347",
"0.72319347",
"0.72181976",
"0.72181976",
"0.71651715",
"0.71410364",
"0.7114219",
"0.70800215",
"0.7046293",
"0.70175827",
"0.69905627",
"0.6... | 0.0 | -1 |
POST /profiles POST /profiles.json | def create
@profile = Profile.new(profile_params)
@profile.user_id = current_user.id
@profile.name = "#{current_user.first_name} #{current_user.last_name}"
@profile.email = "#{(current_user.email).downcase}"
if profile_params[:status] == "Approved" || profile_params[:status] == "Rejected"
@pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n ... | [
"0.73701555",
"0.7367171",
"0.72288865",
"0.71786684",
"0.7172963",
"0.7170674",
"0.71145105",
"0.7096289",
"0.707034",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.6997514",
"0.69700205",
"0.69617796",
"0.6937631",
"0.6937631"... | 0.0 | -1 |
PATCH/PUT /profiles/1 PATCH/PUT /profiles/1.json | def update
if profile_params[:status] == "Approved" || profile_params[:status] == "Rejected"
@profile.approved_by = "#{current_user.first_name} #{current_user.last_name}"
else
@profile.approved_by = ""
end
if profile_params[:status] == "Pending" # This condition sends an email if profile st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n ... | [
"0.7385554",
"0.7121749",
"0.7113102",
"0.7096679",
"0.7091465",
"0.7091465",
"0.7091465",
"0.7076842",
"0.707045",
"0.7063198",
"0.70600575",
"0.7022012",
"0.70120174",
"0.699651",
"0.6985236",
"0.6985236",
"0.6985236",
"0.6985236",
"0.6979028",
"0.697453",
"0.6968044",
"0... | 0.0 | -1 |
DELETE /profiles/1 DELETE /profiles/1.json | def destroy
@profile.destroy
respond_to do |format|
format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n ... | [
"0.7739456",
"0.7739456",
"0.7739456",
"0.7707937",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.7706363",
"0.7704212",
"0.769637",
"0.7687797",
"0.7687588",
"0.7687588",
"0.76273435",
"0.7588475",
"0.75627... | 0.75018144 | 23 |
Use callbacks to share common setup or constraints between actions. | def set_profile
@profile = Profile.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 profile_params
params.require(:profile).permit(
:summary,
:degree,
:stream,
:status,
section_ids: [],
project_ids: [],
employment_ids:[],
certification_ids: [],
education_ids: [],
custom_ids: []
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /resource/sign_up def new super end POST /resource | def create
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_up(resource_name, resource)\n end",
"def create\n build_resource(sign_up_params)\n\n resource.save\n render_resource(resource)\n end",
"def sign_up(resource_name, resource)\n redirect_to users_url\n end",
"def create\n build_resource(configure_sign_up_params)\n resource.save\n ... | [
"0.802381",
"0.79407203",
"0.7855574",
"0.78512365",
"0.7847869",
"0.77352446",
"0.76984376",
"0.76961756",
"0.76653403",
"0.7656444",
"0.7655498",
"0.7641147",
"0.7629752",
"0.76207453",
"0.76207453",
"0.7601901",
"0.7593272",
"0.75696474",
"0.7566873",
"0.7546625",
"0.75424... | 0.0 | -1 |
Create from devise module rewrite method for create company Create company and add admin | def build_resource(hash = nil)
# Строка из шаблона
self.resource = resource_class.new_with_session(hash || {}, session)
# Создание и привязка компании если параметры переданы
self.resource.company_id = Company.create(company_params).id if company_params.present?
# Добавляем админские права если перв... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n @company.company_admins.create(:user_id => current_user.id, :company_id => @company.id, :user_role => 'admin')\n format.html { redirect_to @company, flash: {:success => 'Company was successf... | [
"0.8015664",
"0.7774366",
"0.76424366",
"0.7549996",
"0.7384109",
"0.735545",
"0.7308631",
"0.7297803",
"0.7233666",
"0.72165847",
"0.72125584",
"0.72101825",
"0.7206235",
"0.7170676",
"0.7168295",
"0.7151474",
"0.71503276",
"0.7149215",
"0.71232206",
"0.7106018",
"0.70722276... | 0.0 | -1 |
Params for create company in sign_up | def company_params
params.require(:company).permit(:title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company_create_params\r\n params.require(:company).permit(:company_name, :first_name, :last_name,\r\n :phone, :contract_start, :contract_end, :owner_id)\r\n end",
"def companycreation_params\n params.require(:companycreation).permit(:companyname)\n end",
"def ... | [
"0.79722583",
"0.7863511",
"0.76934123",
"0.7676",
"0.7561451",
"0.75412935",
"0.7538673",
"0.7500764",
"0.7489482",
"0.74839866",
"0.74760026",
"0.74716586",
"0.7463955",
"0.74522907",
"0.7433155",
"0.73937523",
"0.7382473",
"0.7381438",
"0.736719",
"0.7333647",
"0.7325378",... | 0.6905858 | 85 |
callback target so we know when a build starts | def call(guard_class, event, *args)
status = if event == :start_begin
'idle'
else
'running'
end
self.class.set_rbg status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prebuild(build, listener)\n end",
"def prebuild(build, listener)\n end",
"def prebuild(build, listener)\n end",
"def started(build, listener)\n end",
"def prebuild(build, listener)\n # do any setup that needs to be done before this build runs.\n end",
"def my_post_build_step\n puts 'post-b... | [
"0.74110824",
"0.74110824",
"0.74110824",
"0.7041321",
"0.6779151",
"0.6692496",
"0.66687953",
"0.6368604",
"0.6304963",
"0.6291809",
"0.62117034",
"0.62063473",
"0.6070797",
"0.6050584",
"0.59719956",
"0.59498066",
"0.59034747",
"0.5888898",
"0.58715725",
"0.583443",
"0.5804... | 0.0 | -1 |
def swap(string) word_array = string.split word_array.each_with_index do |word, index| char_array = word.chars return char_array[0] if word_array.size == 1 && char_array.size == 1 first_letter = char_array[0] last_letter = char_array[char_array.size 1] char_array[0] = last_letter char_array[char_array.size 1] = first_l... | def swap_first_last_characters(word)
word[0], word[-1] = word[-1], word[0]
word
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(str)\n array_of_words = str.split\n\n array_of_words.each do |word|\n first_char = word[0]\n last_char = word[-1]\n\n word[0] = last_char\n word[-1] = first_char\n end\n\n array_of_words.join(' ')\n\nend",
"def swap(string)\n string_arr = string.split.map do |word|\n first... | [
"0.898335",
"0.89569587",
"0.88882345",
"0.8795965",
"0.87125736",
"0.8653735",
"0.8649118",
"0.85881937",
"0.856063",
"0.8543642",
"0.8543607",
"0.8538841",
"0.85359174",
"0.8514997",
"0.84836334",
"0.8479071",
"0.8478339",
"0.8452142",
"0.8437031",
"0.8434128",
"0.842049",
... | 0.75765765 | 51 |
if the accumulator parameter is assigned to in the block, then we can't convert to each_with_object | def accumulator_param_assigned_to?(body, args)
first_arg, = *args
accumulator_var, = *first_arg
body.each_descendant.any? do |n|
next unless n.assignment?
lhs, _rhs = *n
lhs.equal?(accumulator_var)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_with_object(collection, object)\n collection.each { |item| yield(item, object) }\n object\nend",
"def each_with_object(arr, object)\n arr.each do |element|\n yield(element, object)\n end\n object\nend",
"def each_with_object(collection, obj)\n collection.each { |el| yield(el, obj) }\n obj\ne... | [
"0.65867627",
"0.65627813",
"0.6485654",
"0.6408129",
"0.6315816",
"0.6260813",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
"0.62425315",
... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome_email.subject | def welcome_email(user)
@greeting = "Hi"
mail to: user.email
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 set_EmailSubject(value)\n s... | [
"0.6765255",
"0.67279863",
"0.6726151",
"0.6717693",
"0.67126894",
"0.6711559",
"0.66976076",
"0.6694258",
"0.6673168",
"0.66285807",
"0.6601156",
"0.6542027",
"0.65407807",
"0.65006226",
"0.6485323",
"0.6457651",
"0.64264846",
"0.6402966",
"0.6356709",
"0.6316435",
"0.631643... | 0.5904985 | 75 |
GET /comments GET /comments.xml | def index
redirect_to(books_path) and return false unless params[:user_id]
@user = User.find(params[:user_id], :include => :comments)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @user.comments }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def comments; rest_query(:comment); end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def index\n @comments = Comment.find(:all)\n\n ... | [
"0.76349247",
"0.7078839",
"0.7050343",
"0.7050343",
"0.694906",
"0.694906",
"0.69271475",
"0.6917307",
"0.68833375",
"0.6871063",
"0.6871063",
"0.6871063",
"0.6771832",
"0.6762841",
"0.67415357",
"0.6717631",
"0.6705388",
"0.66543263",
"0.66304934",
"0.65904164",
"0.6585651"... | 0.0 | -1 |
GET /comments/1 GET /comments/1.xml | def show
@comment = Comment.find(params[:id])
redirect_to(url_for_commentable(@comment))
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end",
"def comments; rest_query(:comment); end",
"def index\... | [
"0.7356179",
"0.693498",
"0.69100016",
"0.69024384",
"0.69024384",
"0.6886102",
"0.6866949",
"0.68133646",
"0.68121976",
"0.68071795",
"0.68071795",
"0.68071795",
"0.6759974",
"0.6747049",
"0.66933143",
"0.66808176",
"0.66478235",
"0.66478235",
"0.66478235",
"0.66478235",
"0.... | 0.0 | -1 |
GET /comments/new GET /comments/new.xml | def new
use_tinymce(:simple)
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\... | [
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.76575094",
"0.7657479",
"0.7639736",
"0.7534258",
"0.75013924",
"0.7196515",
"0.7188317",
"0.71087503",
"0.7062022",
"0... | 0.0 | -1 |
POST /comments POST /comments.xml | def create
if params[:sub_chapter_id]
commentable = SubChapter.find(params[:sub_chapter_id])
elsif params[:chapter_id]
commentable = Chapter.find(params[:chapter_id])
elsif params[:book_id]
commentable = Book.find(params[:book_id])
end
@comment = commentable.comments.build(par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
"def post_comment(comment, poi=\"4f4f4c27d4374e800100001d\")\n uri = URI.parse(\"http://mashweb.fokus.fraunhofer.de:3008/api/comment\")\n response = Net::HTTP.post_form(uri, {\n :title => 'Autocomment',\n :body => co... | [
"0.6438144",
"0.63944346",
"0.6314433",
"0.6279525",
"0.6177414",
"0.61582184",
"0.61582184",
"0.6117951",
"0.6052219",
"0.6050391",
"0.604765",
"0.60258925",
"0.60258925",
"0.60258925",
"0.5955842",
"0.594936",
"0.59480053",
"0.5906261",
"0.58979017",
"0.5835288",
"0.5829491... | 0.0 | -1 |
PUT /comments/1 PUT /comments/1.xml | def update
use_tinymce(:simple) # in case of errors
respond_to do |format|
if @comment.update_attributes(params[:comment])
flash[:notice] = 'Comment was successfully updated.'
format.html { redirect_to_commentable(@comment) }
format.xml { head :ok }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity ... | [
"0.6987354",
"0.6470188",
"0.639144",
"0.63796103",
"0.6373086",
"0.634739",
"0.634739",
"0.634739",
"0.634739",
"0.634739",
"0.6338675",
"0.63336104",
"0.63336104",
"0.63336104",
"0.63336104",
"0.63336104",
"0.63336104",
"0.63336104",
"0.63336104",
"0.6332264",
"0.6315601",
... | 0.57765424 | 90 |
DELETE /comments/1 DELETE /comments/1.xml | def destroy
@comment.destroy
respond_to do |format|
format.html { redirect_to_commentable(@comment, false) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_comments\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end",
"def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end",
"def ... | [
"0.70702124",
"0.7065266",
"0.69843125",
"0.6935191",
"0.6934264",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.6914566",
"0.68816155",
"0.68749785",
"0.6872061",... | 0.6798191 | 25 |
Parse an SRTformat subtitle file and add the records to this class. | def add_srt_data(text)
language = Language.detect(text)
text.gsub(/\r\n/, "\n").split(/\n\n/).each do |block|
index, times, text = block.split(/\n/, 3)
start_time, end_time = parse_srt_times(times)
# TODO: Is this the best way to add records to an unsaved has_many?
self.subtitles <<
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def srt_file_to_data(srt_filename, opts={})\n fmt = (opts[:format] || 'csv').to_s.reverse.chomp('.').reverse.to_sym\n \n # this should raise an error\n SubtitleProcessor.validate_format(fmt)\n\n txt = open(srt_filename, 'r') do |f|\n f.read\n end\n\n objs = SubtitleProces... | [
"0.58768827",
"0.57450396",
"0.56821185",
"0.5677796",
"0.562766",
"0.56245786",
"0.5512959",
"0.537014",
"0.53695744",
"0.53640866",
"0.5302732",
"0.530167",
"0.5277362",
"0.5255",
"0.5242749",
"0.52426714",
"0.52249813",
"0.522193",
"0.52066284",
"0.51894367",
"0.518747",
... | 0.6754668 | 0 |
Parse an SRT time range. | def parse_srt_times(times)
times =~ /^([0-9:,]+) --> ([0-9:,]+)/ # May have trailing data.
[$1, $2].map {|t| parse_srt_time(t) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time_range(time_string)\n return nil if time_string.nil?\n\n start_time =\n Chronic.parse(time_string.split('-').first.strip).seconds_since_midnight\n end_time =\n Chronic.parse(time_string.split('-').last.strip).seconds_since_midnight\n\n start_time...end_time\nend",
"def parse_time_span\n ... | [
"0.73327637",
"0.6994474",
"0.6599271",
"0.6542953",
"0.6257849",
"0.6183207",
"0.6104176",
"0.606972",
"0.60207",
"0.60158056",
"0.5995975",
"0.5976906",
"0.5928947",
"0.58694303",
"0.5843697",
"0.5835057",
"0.57827455",
"0.5780472",
"0.5751114",
"0.5747738",
"0.57048476",
... | 0.6592611 | 3 |
Parse an SRT time. We don't try to do support WebVTT (yet). | def parse_srt_time(time)
time =~ /^(\d+):(\d+):(\d+),(\d{3})$/
hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)
hh*3600 + mm*60 + ss + ms/1000.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(time)\n time = \"0#{time}\" if time.match(/^\\d:\\d\\d/)\n time = time.gsub(/u/, '') if utime?\n time = time.gsub(/s/, '') if stime?\n\n time\n end",
"def time_parsing str\n Time.parse(str) if str && str != \"<null>\"\n end",
"def parse_time\n time_str = @re... | [
"0.7538896",
"0.74502295",
"0.73937374",
"0.73855615",
"0.7297702",
"0.7255724",
"0.71652186",
"0.7140674",
"0.6995904",
"0.6995904",
"0.6995904",
"0.69259214",
"0.69060326",
"0.68538064",
"0.68538064",
"0.68538064",
"0.68538064",
"0.68538064",
"0.68538064",
"0.68538064",
"0.... | 0.77471066 | 0 |
validates :email, :uniqueness => true | def fullname
"#{fname} #{lname}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end",
"def validates_email_uniqueness\n if validate_attributes == true\n if email and (Contact.find_by_e... | [
"0.8617073",
"0.8293208",
"0.826302",
"0.8139634",
"0.8113435",
"0.7912196",
"0.7911838",
"0.7813384",
"0.758618",
"0.7288748",
"0.72548336",
"0.7182896",
"0.7112252",
"0.70518136",
"0.6974869",
"0.69709945",
"0.6905534",
"0.688979",
"0.68360496",
"0.6833438",
"0.6826698",
... | 0.0 | -1 |
Return the highlight string for a given page | def excerpt_for(page)
if @raw_results[page.id] && hl = @raw_results[page.id][:highlights]
ERB::Util.html_escape((hl.join("..."))).gsub('{{{', "<mark>").gsub("}}}", "</mark>").html_safe
else
page.content[0,255].gsub(/[\n\r]/, '') + "..."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def highlight_if_clicked(url)\n current_page?(url) ? \"hilite\" : \"\"\n end",
"def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :clas... | [
"0.715687",
"0.715687",
"0.715687",
"0.6615009",
"0.64817125",
"0.64151776",
"0.6393214",
"0.6393214",
"0.6290394",
"0.6256759",
"0.6183969",
"0.61802346",
"0.61758184",
"0.6134949",
"0.612474",
"0.61220616",
"0.6117886",
"0.6062856",
"0.60176015",
"0.60045576",
"0.59940886",... | 0.6414679 | 6 |
Is the result set empty? | def empty?
self.results.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n @rows.empty?\n end",
"def empty?\n rows.empty?\n end",
"def empty?\n @data.rows_count <= 0\n end",
"def empty?\n @rows.empty?\n end",
"def empty?\n @rows.empty?\n end",
"def empty?\n @rows.empty?\n end",
"def empty?\n @rows.emp... | [
"0.8197642",
"0.81812924",
"0.813985",
"0.8126682",
"0.8126682",
"0.8126682",
"0.8022337",
"0.7912651",
"0.79110634",
"0.7813282",
"0.77512115",
"0.77173096",
"0.77120286",
"0.767702",
"0.7587981",
"0.7538369",
"0.7531124",
"0.7527662",
"0.74786294",
"0.7476948",
"0.7436925",... | 0.8199761 | 0 |
The total number of pages in the result set | def total_pages
(total_results / per_page.to_f).ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count\n @total_pages\n end",
"def page_count\n @page_count ||= ( @total_results / @query.page_size.to_f ).ceil\n end",
"def total_pages\n ( total_results.to_f / limit ).ceil\n end",
"def total_pages\n f = total_results.to_f / RESULTS_PER_PAGE\n f.ceil\n end",
"de... | [
"0.86514235",
"0.85200447",
"0.85040545",
"0.85033435",
"0.8471078",
"0.84265894",
"0.832821",
"0.8317514",
"0.831529",
"0.83001363",
"0.82364887",
"0.82133275",
"0.8211956",
"0.82022625",
"0.8180255",
"0.81716084",
"0.81510365",
"0.81510365",
"0.81510365",
"0.81510365",
"0.8... | 0.8239766 | 10 |
The number of the first result on the current page | def start_result_number
((page - 1) * per_page) + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_number\n\t\t\t\treturn 0 if @total_results == 0\n\t\t\t\t@offset + 1\n\t\t\tend",
"def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"def first_page_number\n 1\n end",
"def current_page\n first(@raw_page['records'].size)\n end",
"def page_count\n ... | [
"0.80770695",
"0.78968376",
"0.78482467",
"0.7842402",
"0.7745287",
"0.7615616",
"0.759368",
"0.7447496",
"0.724962",
"0.72131944",
"0.7186354",
"0.7122119",
"0.70293695",
"0.7004743",
"0.7001297",
"0.6942822",
"0.6942386",
"0.6920208",
"0.6892496",
"0.6862115",
"0.6805812",
... | 0.8324483 | 0 |
The number of the last result on the current page | def end_result_number
start_result_number + (results.size) - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count\n pages.last\n end",
"def last_page_number\n number_of_pages\n end",
"def last_page_index\n num_pages() - 1\n end",
"def last_in_page\n return total if current_page == total_pages\n\n current_page * per_page\n end",
"def last_page\n ... | [
"0.80080813",
"0.79047936",
"0.7802636",
"0.7685108",
"0.765956",
"0.75966334",
"0.7545156",
"0.7541674",
"0.74687946",
"0.7459632",
"0.7380297",
"0.7353842",
"0.72970814",
"0.7289979",
"0.7236131",
"0.7221115",
"0.7214014",
"0.7200055",
"0.7200055",
"0.70840037",
"0.7075919"... | 0.73392266 | 12 |
Is this the first page of the result set? | def first_page?
page == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_page?\n page_number > first_page_number\n end",
"def is_first_page?\n p_index.to_i == 1\n end",
"def first_page?\n return true if total_pages < 1\n return (page == 1)\n end",
"def first_page?\n current_page == pages.begin\n end",
"def first_page?\n cu... | [
"0.80159",
"0.79611653",
"0.7940312",
"0.7795399",
"0.7761623",
"0.7640417",
"0.7640417",
"0.7623867",
"0.7623867",
"0.7623867",
"0.7623867",
"0.741166",
"0.7395814",
"0.7389593",
"0.73452073",
"0.7115687",
"0.71013963",
"0.7096349",
"0.70813864",
"0.70552766",
"0.700556",
... | 0.82002914 | 0 |
Is this the last page of the result set? | def last_page?
page == total_pages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_page?\n page_number < last_page_number\n end",
"def last_page?\n last_page_number.nil?\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def last_page?\n return true if total_p... | [
"0.83848166",
"0.82176685",
"0.819241",
"0.81616116",
"0.81591004",
"0.814301",
"0.8137539",
"0.8123496",
"0.810533",
"0.80876905",
"0.8072551",
"0.80674356",
"0.8061902",
"0.8061902",
"0.8056437",
"0.8048862",
"0.79783005",
"0.7956264",
"0.7809974",
"0.7731367",
"0.7731367",... | 0.8256188 | 1 |
an example URL to be generated | def drive_time_in_minutes
if @status != "OK"
drive_time = 0
else
drive_time = @doc.css("duration value").last.text
convert_to_minutes(drive_time)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generated_url; end",
"def generate_url(template); end",
"def make_url\n # This works for most of the twitter calls\n \"http://ws.audioscrobbler.com/2.0/?method=#{resource_path}&artist=#{identifier}&limit=100&page=#{page}&api_key=#{api_key}&format=json\"\n end",
"def link() ... | [
"0.76766694",
"0.7445992",
"0.73361623",
"0.7329616",
"0.7329616",
"0.7303301",
"0.72279984",
"0.72070295",
"0.7169061",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",
"0.7153171",... | 0.0 | -1 |
the distance.value field always contains a value expressed in meters. | def distance
return @distance if @distance
unless @status == 'OK'
@distance = 0
else
@distance = @doc.css("distance value").last.text
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance\n @data['distance']['value']\n end",
"def distance\n properties['distance']\n end",
"def set_Distance(value)\n set_input(\"Distance\", value)\n end",
"def set_Distance(value)\n set_input(\"Distance\", value)\n end",
"def set_Distance(value)\n ... | [
"0.7477724",
"0.7263669",
"0.72116095",
"0.72116095",
"0.72116095",
"0.72116095",
"0.72116095",
"0.6766104",
"0.67069304",
"0.6672562",
"0.6604032",
"0.64983684",
"0.64983684",
"0.6409447",
"0.63708127",
"0.63470244",
"0.6342711",
"0.6329993",
"0.6327269",
"0.6296223",
"0.626... | 0.7010262 | 7 |
should not be dependent, don't destroy delivery if route is destroyed | def initialize
@waypoint = Array.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_delivery\n Rails.logger.info \"Attempting to destroy deliverable_id = #{id} \" \\\n \"AND deliverable_type = '#{self.class}'\"\n Delivery.where(\"deliverable_id = #{id} AND deliverable_type = \" \\\n \"'#{self.class}'\").each(&:destroy)\n end",
"def remove\n transaction do\n ... | [
"0.63152546",
"0.6300616",
"0.6257501",
"0.61700034",
"0.60391176",
"0.6035029",
"0.59545356",
"0.5902805",
"0.5902805",
"0.58865905",
"0.5876472",
"0.5868352",
"0.5819634",
"0.57933754",
"0.5783185",
"0.57819164",
"0.5769674",
"0.5736014",
"0.5731148",
"0.57047343",
"0.57001... | 0.0 | -1 |
Only logged in users can modify reviews | def create
# Creates a new review & sends them back to their updated page
review = current_user.reviews.create(review_params)
if review.save
redirect_to :back
else
redirect_to product_path(id: params[:product_id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_user_review\n session[:return_to] ||= request.referer\n if current_user != @review.user\n flash[:notice] = \"You didn't write that review\"\n redirect_to session.delete(:return_to)\n end\n\n end",
"def update\n @review = Review.find(params[:id])\n unless curren... | [
"0.7054856",
"0.6978011",
"0.697686",
"0.697686",
"0.6906583",
"0.69009703",
"0.68871284",
"0.6886172",
"0.68602574",
"0.6854459",
"0.68479264",
"0.68351316",
"0.6816891",
"0.68076926",
"0.6748968",
"0.6711043",
"0.67106193",
"0.6655418",
"0.66416955",
"0.6637617",
"0.6590653... | 0.0 | -1 |
returns a corresponding word given a corresponding_script. | def corresponding(corr_script)
all_associates.each { |w| return w if w.script_id == corr_script.id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word\n dictionary.get_word\n end",
"def get_word(dictionary)\n word = dictionary[rand(dictionary.length)]\n # Ensure that the word is between 5 and 12 letters long.\n if word.length.between?(5,12)\n return word.downcase.strip\n else\n get_word(dic... | [
"0.67226255",
"0.671788",
"0.63208944",
"0.6240772",
"0.62145275",
"0.6183476",
"0.6137287",
"0.6137058",
"0.60167783",
"0.5980935",
"0.59754926",
"0.5940596",
"0.5889802",
"0.5843345",
"0.57911944",
"0.5750999",
"0.5745813",
"0.57239574",
"0.5720004",
"0.5716612",
"0.5710677... | 0.0 | -1 |
An error occurs in line 11 when attempting to reference 'limit' which is outside of the method scope. To fix this, limit can be initialized within the definition of the fib method: | def fib(first_num, second_num)
limit = 15
while first_num + second_num < limit
sum = first_num + second_num
first_num = second_num
second_num = sum
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib(limit)\n\tfib = 0\n\tprev = 1\n\tcurrent = 1\n\twhile current < limit\n\t\tif (prev + current).even? && (current + prev) < limit\n\t\t\tfib += (prev + current)\n\t\tend\n\n\t\told_current = current\n\t\tcurrent = prev + current\n\t\tprev = old_current\n\tend\n\tfib\nend",
"def fibs(limit, n=2)\n\t@a ||= ... | [
"0.7871704",
"0.7615062",
"0.75186044",
"0.7428073",
"0.74080247",
"0.73850423",
"0.73803496",
"0.73710346",
"0.7363754",
"0.7345704",
"0.734039",
"0.7339992",
"0.72984016",
"0.72984016",
"0.7242943",
"0.72166264",
"0.7208931",
"0.71982133",
"0.714678",
"0.714678",
"0.714678"... | 0.68366617 | 38 |
GET /my_models/1 GET /my_models/1.json | def show
@my_model = MyModel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @my_model }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rend... | [
"0.652174",
"0.6515473",
"0.6515473",
"0.6515473",
"0.6396488",
"0.6333802",
"0.6322844",
"0.62638617",
"0.6234887",
"0.6222685",
"0.61994857",
"0.615423",
"0.61270475",
"0.6081532",
"0.60537136",
"0.59972686",
"0.5975163",
"0.5890724",
"0.5866681",
"0.5866681",
"0.58492434",... | 0.66765535 | 0 |
GET /my_models/new GET /my_models/new.json | def new
@my_model = MyModel.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @my_model }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end"... | [
"0.77350014",
"0.77350014",
"0.77350014",
"0.77350014",
"0.72681135",
"0.714431",
"0.7083901",
"0.70422214",
"0.7039434",
"0.70337737",
"0.70332474",
"0.6981759",
"0.69699925",
"0.692816",
"0.692816",
"0.692816",
"0.692816",
"0.692816",
"0.69006336",
"0.69005466",
"0.68755907... | 0.7610097 | 4 |
POST /my_models POST /my_models.json | def create
@my_model = MyModel.new(params[:my_model])
respond_to do |format|
if @my_model.save
format.html { redirect_to @my_model, notice: 'My model was successfully created.' }
format.json { render json: @my_model, status: :created, location: @my_model }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @my_model = MyModel.new(my_model_params)\n\n respond_to do |format|\n if @my_model.save\n format.html { redirect_to @my_model, notice: 'My model was successfully created.' }\n format.json { render :show, status: :created, location: @my_model }\n else\n format.html ... | [
"0.63176674",
"0.61186224",
"0.6057613",
"0.6057613",
"0.6027306",
"0.5989376",
"0.5984538",
"0.59412676",
"0.5931145",
"0.5904401",
"0.5819594",
"0.58087116",
"0.57926834",
"0.57858545",
"0.5758565",
"0.56846637",
"0.5658995",
"0.56525075",
"0.5591964",
"0.55811244",
"0.5569... | 0.64251876 | 0 |
PUT /my_models/1 PUT /my_models/1.json | def update
@my_model = MyModel.find(params[:id])
respond_to do |format|
if @my_model.update_attributes(params[:my_model])
format.html { redirect_to @my_model, notice: 'My model was successfully updated.' }
format.json { head :no_content }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n ... | [
"0.6326845",
"0.62491155",
"0.6064946",
"0.6061932",
"0.6015638",
"0.6015638",
"0.6015638",
"0.6009193",
"0.6003952",
"0.59800696",
"0.5900492",
"0.5863267",
"0.5839542",
"0.5770506",
"0.57554007",
"0.5753365",
"0.57371265",
"0.57292706",
"0.5701416",
"0.570126",
"0.57007897"... | 0.6016301 | 4 |
DELETE /my_models/1 DELETE /my_models/1.json | def destroy
@my_model = MyModel.find(params[:id])
@my_model.destroy
respond_to do |format|
format.html { redirect_to my_models_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n f... | [
"0.726762",
"0.726762",
"0.726762",
"0.71920955",
"0.7179038",
"0.71560293",
"0.7139463",
"0.7138785",
"0.7082702",
"0.70492095",
"0.7016412",
"0.7016215",
"0.70000076",
"0.6990308",
"0.68894506",
"0.68871045",
"0.6874108",
"0.68672895",
"0.68301505",
"0.68301505",
"0.6830094... | 0.74238104 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_task
@task = Task.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 task_params
params.require(:task).permit(:description, :start, :end, :title, :category_ids, attachment: :flat)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Gives the list of projects of the application as JSon | def index
p=current_user.project_role_users
@projects = Array.new
p.each do |pru|
if pru.invitation_confirmed != false
@projects << Project.find(pru.project_id)
end
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @projects }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listprojects\n get('listprojects.json')['projects']\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\... | [
"0.825049",
"0.8073406",
"0.78211725",
"0.77836466",
"0.7771988",
"0.7701862",
"0.76814216",
"0.76329577",
"0.7581388",
"0.7549501",
"0.7529259",
"0.74993354",
"0.7471798",
"0.7422311",
"0.74149644",
"0.74017763",
"0.7386443",
"0.7377209",
"0.734845",
"0.7343932",
"0.73365176... | 0.0 | -1 |
Gives information about a certain project | def show
@project = Project.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details\n get(\"project/details\")[\"project\"]\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n ... | [
"0.8017073",
"0.76466113",
"0.74293154",
"0.73689854",
"0.73689854",
"0.7251446",
"0.7216163",
"0.7164585",
"0.71588135",
"0.7157245",
"0.7074533",
"0.7042533",
"0.70198375",
"0.7006489",
"0.7006489",
"0.7003133",
"0.69936025",
"0.696958",
"0.69599783",
"0.6940768",
"0.688960... | 0.0 | -1 |
Gives the template for creating a new project and, if it is possible, link it to Dropbox and Github | def new
@linkDropbox = false
@linkGithub = false
if session[:dropbox_session]
@linkDropbox = true
@dropbox_token = session[:dropbox_session]
session.delete :dropbox_session
send_confirmation_doc
end
if session[:github_session]
@linkGithub = true
@g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(project_name, repo_name, description) ; end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask... | [
"0.7021494",
"0.7004923",
"0.6857515",
"0.68409353",
"0.67706025",
"0.6681485",
"0.66506094",
"0.65881187",
"0.658447",
"0.658229",
"0.65385",
"0.6520414",
"0.6472453",
"0.6464796",
"0.6462747",
"0.64431894",
"0.64347684",
"0.6433004",
"0.6428435",
"0.64254254",
"0.6414209",
... | 0.6613146 | 7 |
Gives the template for edit a bug, and modifies information about the link of the project with Dropbox or Github | def edit
@project = Project.find(params[:id])
if session[:dropbox_session]
@linkDropbox = true
@dropbox_token = session[:dropbox_session]
session.delete :dropbox_session
elsif @project.dropbox_token
@linkDropbox = true
@dropbox_token = @project.dropbox_token
end
if se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_bug_link( bug_id )\n # For bugzilla, assume url is base URL plus show by bug ID\n if Setting.value(\"Ticket System\") == 'Bugzilla'\n url = Setting.value('Ticket System Url') + 'show_bug.cgi?id=' + bug_id.to_s\n # For mantis, base url plus view id\n elsif Setting.value(\"Ticket System... | [
"0.6773575",
"0.66712445",
"0.64532715",
"0.64136994",
"0.6410927",
"0.6309351",
"0.61794084",
"0.60968393",
"0.60759467",
"0.6072172",
"0.60602295",
"0.60287076",
"0.59804565",
"0.59643954",
"0.5950915",
"0.59216857",
"0.59163857",
"0.5910462",
"0.5894482",
"0.5857952",
"0.5... | 0.0 | -1 |
Creates the hook of a commit | def hook
@project = Project.find(params[:id])
c = JSON.parse(params[:payload])
@project.do_hook(c)
#respond 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\... | [
"0.69550383",
"0.6587762",
"0.65709114",
"0.64693236",
"0.64170295",
"0.63331103",
"0.6321363",
"0.62944216",
"0.6265995",
"0.62540764",
"0.6179374",
"0.6149886",
"0.61053103",
"0.60829484",
"0.60815513",
"0.60688823",
"0.60509187",
"0.5999096",
"0.59946793",
"0.5988064",
"0.... | 0.0 | -1 |
Sets the hook of a commit | def set_hook
@project = Project.find(params[:project_id])
@new_repo_name = params[:repo_name]
@new_user_name = params[:user_name]
@is_linked = false
json_repos = {}
begin
json_repos = JSON.parse(@project.repo_name)
rescue
end
json_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_commit\n @commit = Commit.find_by_sha(params[:sha])\n end",
"def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"au... | [
"0.64536864",
"0.63719535",
"0.6199894",
"0.6197751",
"0.6006865",
"0.6001109",
"0.6001109",
"0.59626096",
"0.59259367",
"0.5874103",
"0.5803982",
"0.5787974",
"0.5749308",
"0.574716",
"0.57377726",
"0.56583893",
"0.5658152",
"0.5647082",
"0.56101966",
"0.5600845",
"0.5600845... | 0.536536 | 37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.