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 |
|---|---|---|---|---|---|---|
COUNTER TO IGNORE THE 'puts stringsHash[:start_date]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER | def getStartDate(eventName)
counter = 0
start_date_check = ""
@startDate = ""
while start_date_check != 'y' || start_date_check != "exit"
if counter == 0
puts @@stringsHash[:start_date]
end
counter += 1
start_date = gets.strip
if start_date == 'exit'
return
end
puts "\n"
puts "Is '#{start_date}' the correct start date? ---> ex. (??/??/????)\nPress 'y' for 'Yes' or 'n' for 'No' and press 'Enter'."
start_date_check = gets.strip
if start_date_check == 'exit'
return
end
if start_date_check == 'y'
@startDate = start_date
break
end
if start_date_check == 'n'
puts "\n"
puts "-------------------------------------------------------"
puts "Re-Enter the Start Date of '#{@eventName}' and press 'Enter':"
redo
end
if start_date_check != 'y' || start_date_check != 'n'
puts "\n"
puts "Please press 'y' for 'Yes' or 'n' for 'No' and hit the 'Enter' Key."
puts "If you'd like to exit the program, type 'exit' and hit the 'Enter' Key."
puts "\n"
puts "**** Now Re-Enter the Start Date of '#{@eventName}' and hit 'Enter'. ****"
redo
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time_idx() return (self.start_date.strftime(\"%Y%m%d%H%M\") rescue nil); end",
"def classStart()\n ((self.date.strftime(\"%y\") == DateTime.now.strftime(\"%y\")) && \n (self.date.strftime(\"%m\") == DateTime.now.strftime(\"%m\")) && \n (self.date.strftime(\"%d\") == DateTime.now.s... | [
"0.56199473",
"0.54287827",
"0.53694415",
"0.5353047",
"0.53209764",
"0.5209749",
"0.51826984",
"0.5119688",
"0.510041",
"0.5026047",
"0.50255984",
"0.5024649",
"0.50157815",
"0.49879625",
"0.49699816",
"0.49606282",
"0.49587578",
"0.49352416",
"0.48904616",
"0.4843789",
"0.4... | 0.54278487 | 2 |
COUNTER TO IGNORE THE 'puts stringsHash[:total_days]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER | def getTotalDays(eventName)
counter = 0
total_days_check = ""
@totalDays = ""
while total_days_check != 'y' || total_days_check != "exit"
if counter == 0
puts @@stringsHash[:total_days]
end
counter += 1
total_days = gets.strip
if total_days == 'exit'
return
end
puts "\n"
puts "Is '#{total_days}' the total amount of days of #{@eventName}?\nPress 'y' for 'Yes' or 'n' for 'No' and press 'Enter'."
total_days_check = gets.strip
if total_days_check == "exit"
return
end
if total_days_check == 'y'
@totalDays = total_days
break
end
if total_days_check == 'n'
puts "\n"
puts "-------------------------------------------------------"
puts "Re-Enter the correct amount of days for '#{@eventName}' and press 'Enter':"
redo
end
if total_days_check != 'y' || total_days_check != 'n'
puts "Please press 'y' for 'Yes' or 'n' for 'No' and hit the 'Enter' Key."
puts "If you'd like to exit the program, type 'exit' and hit the 'Enter' Key."
puts "\n"
puts "**** Now Re-Enter the amount of days for '#{@eventName}' and hit 'Enter'. ****"
redo
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countPresents(days)\n\tcount = sum = 0\n\tdays.times do\n\t\tcount += 1\n\t\tcountdown = count\n\t\tcount.times do\n\t\t\t#puts \"Adding #{countdown} to #{sum}\"\n\t\t\tsum += countdown\n\t\t\tcountdown -= 1\n\t\tend\n\tend\n\tputs \"after #{days} days of christmas you'd receive #{sum.to_s} presents!\"\nend",
... | [
"0.55449504",
"0.5464194",
"0.5410608",
"0.53638107",
"0.5330613",
"0.52116936",
"0.5118696",
"0.5083235",
"0.5075419",
"0.50424284",
"0.50354594",
"0.5028951",
"0.5008341",
"0.4965378",
"0.49121645",
"0.49115393",
"0.48953375",
"0.48889992",
"0.48869395",
"0.48756734",
"0.48... | 0.6000548 | 0 |
COUNTER TO IGNORE THE 'puts stringsHash[:band_num]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER | def getBandNum(eventName)
counter = 0
band_num_check = ""
@bandNum = ""
while band_num_check != 'y' || band_num_check != "exit"
if counter == 0
puts @@stringsHash[:band_num]
end
counter += 1
band_num = gets.strip
if band_num == "exit"
return
end
puts "\n"
puts "Is '#{band_num}' the correct BAND number for #{@eventName}?\nPress 'y' for 'Yes' or 'n' for 'No' and press 'Enter'."
band_num_check = gets.strip
if band_num_check == "exit"
return
end
if band_num_check == 'y'
@bandNum = band_num
break
end
if band_num_check == 'n'
puts "\n"
puts "-------------------------------------------------------"
puts "Re-Enter the correct BAND number for '#{@eventName}' and press 'Enter':"
redo
end
if band_num_check != 'y' || band_num_check != 'n'
puts "Please press 'y' for 'Yes' or 'n' for 'No' and hit the 'Enter' Key."
puts "If you'd like to exit the program, type 'exit' and hit the 'Enter' Key."
puts "\n"
puts "**** Now Re-Enter the BAND number for #{@eventName} 'Enter'. ****"
redo
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_count_experiment\n @letters_two.dump\n lines = @letters_two.xlate(@line_count_map)\n lines << @extra_digits\n lines.flatten!\n lines.dump('append')\n lines.chunk(2).to_i.collect { |d| d.to_s(5) }.dump(:from_base_5).to_i.to_letter\nend",
"def main\n results = {}\n strings = Hash.new(Array.new... | [
"0.5538354",
"0.5352194",
"0.50657946",
"0.49728096",
"0.496525",
"0.49447787",
"0.49235386",
"0.4869195",
"0.48553243",
"0.48549515",
"0.48541936",
"0.4850281",
"0.4849404",
"0.48452908",
"0.48217136",
"0.48202857",
"0.48188376",
"0.48031962",
"0.48030567",
"0.48015586",
"0.... | 0.5766622 | 0 |
Compute the size via Carrierwave Set a value to 0 if something goes wrong So that size won't be "blank" | def compute_size
return false if self.mp3_file.blank?
self.size = self.mp3_file.size || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size!\n @size = nil\n self.size\n end",
"def size size = nil\n @size = size.to_i if size\n @size\n end",
"def size\n @size ... | [
"0.7068882",
"0.6993421",
"0.69619656",
"0.69619656",
"0.6867582",
"0.67240024",
"0.6692501",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
"0.66816366",
... | 0.6730728 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = ::Event.find(params[:event_id] || params[:rollcall][:event_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 |
Only allow a trusted parameter "white list" through. | def rollcall_params
params.fetch(:rollcall, {}).permit(:attendance, :unregistered)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
given a Rack::Request object, find which Route matches the requested path by using a regular expression via a `Regexp` object then, instantiate the Route's controller, and run the appropriate method | def initialize(pattern, http_method, controller_class, action_name)
@pattern = pattern
@http_method = http_method
@controller_class = controller_class
@action_name = action_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end",
"def run(request, response)\n\n match_data = @pattern.ma... | [
"0.77231866",
"0.7621417",
"0.7260797",
"0.7239324",
"0.71949935",
"0.7081032",
"0.7033232",
"0.6927674",
"0.68186677",
"0.67729425",
"0.6658452",
"0.6621485",
"0.65781134",
"0.6573535",
"0.6513002",
"0.65113986",
"0.65094686",
"0.6483362",
"0.64708066",
"0.64500195",
"0.6424... | 0.0 | -1 |
true if pattern matches request path and http method matches request method | def matches?(req)
pattern.match(req.path) && req.request_method.downcase == http_method.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(req)\n @pattern.match?(req.path) && @http_method.to_s.downcase == req.request_method.downcase\n end",
"def matches?(req)\n req.path =~ pattern && http_method == req.request_method.downcase.to_sym\n end",
"def matches?(req)\n match_method = req.request_method.downcase.to_sym == @http_m... | [
"0.8694062",
"0.8691883",
"0.86916023",
"0.8680453",
"0.8507347",
"0.84543496",
"0.84454685",
"0.8444336",
"0.84255177",
"0.84204125",
"0.84002584",
"0.7951292",
"0.76980054",
"0.70834005",
"0.70634305",
"0.7055721",
"0.7008742",
"0.6931867",
"0.6877601",
"0.67988724",
"0.678... | 0.8767666 | 0 |
instantiates an instance of the controller class calls the controller's action via `ControllerBaseinvoke_action` | def run(req, res)
if matches?(req)
controller_instance = controller_class.new(req, res, route_params(req))
controller_instance.invoke_action(action_name)
else
# extra precaution! won't be hit if `Router#run` is used
res.status = 404
res.write("No route matches for #{http_method} on #{controller_class}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(controller, action)\n lambda {\n controller = Object.const_get(controller)\n action ||= Configuration::Base.app.default_action\n\n instance = controller.new\n request.controller = instance\n request.action = action\n\n instance.send(action)\n }\n ... | [
"0.7474626",
"0.72478616",
"0.7019688",
"0.68259573",
"0.6815727",
"0.6815727",
"0.67436266",
"0.67423713",
"0.6707092",
"0.6687487",
"0.6666688",
"0.6666688",
"0.66661525",
"0.657121",
"0.65226966",
"0.65173906",
"0.65009356",
"0.64606637",
"0.64088315",
"0.63938195",
"0.634... | 0.6194275 | 37 |
append new route to the list of routes | def add_route(pattern, method, controller_class, action_name)
@routes << Route.new(pattern, method, controller_class, action_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(new)\n @routes << new\n end",
"def add_route(route)\n @routes << route\n route\n end",
"def append(&block)\n prepare(routes, [], &block)\n end",
"def add_route(*p, &b)\n @routes ||= routes.dup\n @routes.route(*p, &b)\n end",
"def add_route(*args)\n custom_routes... | [
"0.814691",
"0.7889601",
"0.75391996",
"0.7270183",
"0.71935594",
"0.6888049",
"0.6882136",
"0.6855779",
"0.68339396",
"0.67256325",
"0.6723671",
"0.6703784",
"0.6680658",
"0.6605853",
"0.65420145",
"0.65420145",
"0.6529651",
"0.6513503",
"0.64754647",
"0.64754647",
"0.647546... | 0.665532 | 16 |
return the route that matches this request | def match(req)
@routes.find { |route| route.matches?(req) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end",
"def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( requ... | [
"0.8132401",
"0.77498764",
"0.7607261",
"0.753187",
"0.7494161",
"0.72898215",
"0.7284538",
"0.7282092",
"0.7270861",
"0.7245141",
"0.72393835",
"0.7237337",
"0.71793336",
"0.7179079",
"0.7058991",
"0.7018041",
"0.69962186",
"0.6936506",
"0.691659",
"0.691659",
"0.6871855",
... | 0.6835848 | 22 |
call run on the first matching route. find the requested URL match it to the path regex of one Route object ask the Route to instantiate the appropriate controller and call the appropriate method corresponding to the action else if no matched route, throw 404 & add message | def run(req, res)
first_matched_route = match(req)
if first_matched_route
first_matched_route.run(req, res)
else
res.status = 404
res.write("No route matches for #{req.request_method} for #{req.path}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end",
"def run(req, res)\n route = match(req)\n if rout... | [
"0.73926985",
"0.71203727",
"0.70796734",
"0.7006488",
"0.6895496",
"0.68064445",
"0.6767146",
"0.67607725",
"0.6737907",
"0.6676973",
"0.66755813",
"0.65358615",
"0.6520496",
"0.64698565",
"0.64448565",
"0.6409749",
"0.639779",
"0.6356208",
"0.6295131",
"0.6277916",
"0.62606... | 0.7081169 | 2 |
Time complexity O(1) Space complexity O(1) | def add_first(data)
@head = Node.new(data, head)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.65076977",
"0.6224968",
"0.59870076",
"0.59614",
"0.592963",
"0.5878061",
"0.5871787",
"0.58503795",
"0.58141303",
"0.5810536",
"0.5783606",
"0.5758984",
"0.5741224",
"0.57400525",
"0.5717067",
"0.5695446",
"0.56916237",
"0.5682769",
"0.56791544",
"0.56744385",
"0.56462455... | 0.0 | -1 |
Time complexity O(1) Space complexity O(1) | def get_first
return @head if @head.nil?
return @head.data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.65076977",
"0.6224968",
"0.59870076",
"0.59614",
"0.592963",
"0.5878061",
"0.5871787",
"0.58503795",
"0.58141303",
"0.5810536",
"0.5783606",
"0.5758984",
"0.5741224",
"0.57400525",
"0.5717067",
"0.5695446",
"0.56916237",
"0.5682769",
"0.56791544",
"0.56744385",
"0.56462455... | 0.0 | -1 |
Time complexity O(n) n is the size of the list Space complexity O(1) | def length
count = 0
current = head
until current.nil?
count += 1
current = current.next
end
return count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend",
"def max_in_list(list, n = 1)\n list.group_by { |v| v }.sort_by do |_, s|\... | [
"0.6275876",
"0.6265622",
"0.6179918",
"0.6111067",
"0.60622835",
"0.60542345",
"0.6053093",
"0.6053093",
"0.6053093",
"0.6053093",
"0.60321534",
"0.60281676",
"0.6019597",
"0.6019358",
"0.59654766",
"0.5963915",
"0.5962168",
"0.594031",
"0.5933971",
"0.5926341",
"0.5917202",... | 0.0 | -1 |
Time complexity O(n) n is the length of the list Space complexity O(1) | def add_last(data)
if !@head
@head = Node.new(data)
else
current = @head
while current.next
current = current.next
end
current.next = Node.new(data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twist length\n # Compute the subset of the list\n sub = (0...length).map do |i|\n @list[(@position + i) % @list.size]\n end\n\n # Replace the subset with its reverse\n sub.reverse.each_with_index do |el, i|\n @list[(@position + i) % @list.size] = el\n end\n\n @position = (@positi... | [
"0.6534956",
"0.63627845",
"0.6354613",
"0.6354613",
"0.6354613",
"0.6269643",
"0.62626785",
"0.6261166",
"0.61547714",
"0.60820186",
"0.6080095",
"0.6059509",
"0.60406107",
"0.6009159",
"0.5997664",
"0.59689486",
"0.5934405",
"0.592205",
"0.5921917",
"0.59205085",
"0.5871424... | 0.0 | -1 |
Time complexity O(n) where n is the length of the list Space complexity O(1) | def get_last
return nil unless @head
current = @head
while current.next
current = current.next
end
return current.data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twist length\n # Compute the subset of the list\n sub = (0...length).map do |i|\n @list[(@position + i) % @list.size]\n end\n\n # Replace the subset with its reverse\n sub.reverse.each_with_index do |el, i|\n @list[(@position + i) % @list.size] = el\n end\n\n @position = (@positi... | [
"0.6483076",
"0.6482063",
"0.6443559",
"0.63825905",
"0.6204356",
"0.6191089",
"0.61864936",
"0.6075261",
"0.60657686",
"0.6055977",
"0.60048425",
"0.5979811",
"0.59785426",
"0.5963864",
"0.5944869",
"0.59355223",
"0.5926216",
"0.5924984",
"0.5924171",
"0.5924171",
"0.5924171... | 0.0 | -1 |
Time complexity O(n) where n is the index Space complexity O(1) | def get_at_index(index)
return nil unless @head
current = @head
index.times do
return nil unless current.next
current = current.next
end
return current.data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(element); end",
"def slow_dance(tile, array)\n array.each_with_index do |el, i|\n return i if el == tile\n end\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n ... | [
"0.64947075",
"0.6469912",
"0.63268155",
"0.63093156",
"0.6266377",
"0.6220291",
"0.6213645",
"0.6201271",
"0.619608",
"0.61645323",
"0.6153693",
"0.61362296",
"0.60819685",
"0.60739404",
"0.6073693",
"0.6065342",
"0.6031495",
"0.6013581",
"0.59994996",
"0.5984989",
"0.598237... | 0.0 | -1 |
Creamos una lista e inicializamos los valores | def initialize (head, tail)
@head = head
@tail = tail
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_listas\n #@locais = Local.all.map{|l| [l.nome,l.id]}\n @locais = Local.all\n @periodos = ['Manhã','Tarde','Noite']\n @publicos = ['Infantil','Adulto']\n end",
"def initialize\n @lista_contas = []\n end",
"def init_value_list \n unless @value_list.nil?\n ... | [
"0.7043068",
"0.67493373",
"0.6499564",
"0.6489405",
"0.6418114",
"0.63373804",
"0.6271528",
"0.62527937",
"0.6196765",
"0.6179144",
"0.6167553",
"0.6158723",
"0.61073613",
"0.61045855",
"0.6083225",
"0.60636425",
"0.60548544",
"0.605378",
"0.60305357",
"0.60293376",
"0.60036... | 0.0 | -1 |
Metodo insertar nodo por cola | def insertar_por_cola(value)
nodo=Node.new(value,nil,nil)
if(@tail==nil)
@tail=nodo
@head=nodo
else
nodo.prev=@tail
@tail.nest=nodo
@tail=nodo
nodo.nest=nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(nodo, pos)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la posicion la debe indicar un entero\" unless ( pos.instance_of? Integer)\n raise \"Error posicion inadecuada\" unless ( pos <= @nodos )\n if pos == 0\n insert_head(nodo)\n ... | [
"0.6946411",
"0.6882428",
"0.6740654",
"0.6694569",
"0.662445",
"0.6572449",
"0.6569499",
"0.656519",
"0.65568364",
"0.6477227",
"0.6469679",
"0.64676845",
"0.64276177",
"0.64200675",
"0.64142686",
"0.63971347",
"0.6332909",
"0.6323786",
"0.628781",
"0.62370896",
"0.62359214"... | 0.6509025 | 9 |
Metodo insertar nodo por cabeza | def insertar_por_cabeza(value)
nodo=Node.new(value,nil,nil)
if(@head==nil)
@tail=nodo
@head=nodo
else
nodo.nest=@head
@head.prev=nodo
@head=nodo
nodo.prev=nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert()\n\n end",
"def insert(clave, valor)\r\n @grafo[clave] = valor\r\n end",
"def insert(value)\n #YOUR WORK HERE\n end",
"def insert(value)\n # YOUR WORK HERE\n end",
"def insertar_elemento(nodo)\n \n @nodo = Nodo_.new(nil, nodo, nil)\n \n if @tail == nil\n ... | [
"0.6854826",
"0.6695791",
"0.6641629",
"0.6634402",
"0.6599649",
"0.6591634",
"0.6576441",
"0.6574138",
"0.6571803",
"0.6536611",
"0.64992374",
"0.6355666",
"0.63382196",
"0.6319927",
"0.6307169",
"0.6279133",
"0.6272425",
"0.6271726",
"0.6259754",
"0.62520206",
"0.62463754",... | 0.6386132 | 11 |
Metodo extraer nodo por cabeza | def extraer_por_cabeza
if(@head==nil)
puts "No hay nada que extraer (lista vacia)"
else
aux=@head
@head=@head.nest
if(head!=nil)
@head.prev=nil
end
aux.nest=nil
if(@head==nil)
@tail=nil
end
end
return aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sonido()\n return super << \" miaaauuu\"\n end",
"def extra; end",
"def sigla; @nome; end",
"def mi_carrera\n\n\tend",
"def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend",
"def suivre; end",
"def donizetti; end",
"def asignar_titulo_propiedad()\n \n ... | [
"0.65126777",
"0.6200819",
"0.61943936",
"0.6159478",
"0.61465544",
"0.61164594",
"0.6062954",
"0.59990954",
"0.5984348",
"0.5984348",
"0.5984348",
"0.59673977",
"0.5958856",
"0.58051735",
"0.5801822",
"0.5801822",
"0.5748059",
"0.5747469",
"0.57197785",
"0.57197785",
"0.5719... | 0.0 | -1 |
Metodo extraer nodo por cola | def extraer_por_cola
if(@tail==nil)
puts "No hay nada que extraer (lista vacia)"
else
aux=@tail
@tail=@tail.prev
aux.prev=nil
if(@tail!=nil)
@tail.nest=nil
end
end
return aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metodo\n #corpo do metodo\n puts 'corpo do metodo'\n end",
"def metodo\n #corpo do metodo\n puts 'corpo do metodo'\n end",
"def metodo\n #corpo do metodo\n puts 'corpo do metodo'\n end",
"def sonido()\n return super << \" miaaauuu\"\n end",
"def do... | [
"0.6318074",
"0.6318074",
"0.6318074",
"0.6210854",
"0.60286134",
"0.59805936",
"0.5865697",
"0.58568704",
"0.5832501",
"0.5832501",
"0.5824129",
"0.5805948",
"0.5756682",
"0.57355636",
"0.5728636",
"0.5644247",
"0.5642884",
"0.55677015",
"0.5548537",
"0.5533236",
"0.5533236"... | 0.0 | -1 |
Metodo convertir a cadena | def to_s
puntero=@head
cadena='['
if(@head!=nil)
while (puntero!= nil) do
cadena+=puntero.value.to_s + ']'
if(puntero.nest!=nil)
puntero=puntero.nest
cadena+= '['
else
puntero=nil
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pasar_cadena(cadena)\n letra = \"\"\n i = 0\n aux =\"\"\n \n cadena.bytes do |c|\n # 32 es el espacio Se pone un 0 para que se de 8 bit\n i = i + 1\n if( i==8) then\n aux << c\n ... | [
"0.66062087",
"0.6274999",
"0.6262965",
"0.6042937",
"0.592585",
"0.5918859",
"0.5918859",
"0.5918859",
"0.5918859",
"0.5842082",
"0.5799133",
"0.5790587",
"0.57016593",
"0.5669223",
"0.56667763",
"0.5662757",
"0.5631286",
"0.55696297",
"0.5501721",
"0.5468187",
"0.54591894",... | 0.0 | -1 |
GET /lists/1 GET /lists/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end",
"def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end",
"def show\n @list = current_project.lists.f... | [
"0.8099958",
"0.7619997",
"0.761726",
"0.75235164",
"0.7344148",
"0.73051035",
"0.7288008",
"0.72827184",
"0.7276825",
"0.7225588",
"0.7191228",
"0.7191228",
"0.7191228",
"0.7191228",
"0.7183411",
"0.70508593",
"0.6998307",
"0.6960058",
"0.69095707",
"0.68436193",
"0.6841866"... | 0.0 | -1 |
Edit takes you TO the form to be edited GET /lists/1/edit | def edit
@list = current_user.lists.find params[:list_id]
@item = @list.items.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @list = List.find(params[:id])\n end",
"def edit\n @list = List.find(params[:id])\n end",
"def edit\n @list = List.find(params[:id])\n end",
"def editList\n\t\t@list = List.find(params[:id])\n\tend",
"def edit\n\t\t@todolist = Todolist.find(params[:id])\n\tend",
"def edit\n\n ... | [
"0.86814773",
"0.8553767",
"0.8553767",
"0.8379192",
"0.7918611",
"0.7615994",
"0.7549246",
"0.74886066",
"0.74688184",
"0.74496806",
"0.74235564",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0.74207413",
"0... | 0.8196853 | 4 |
New takes you TO the form to be created Does not create, shows new | def new
@list = current_user.lists.find params[:list_id]
@item = @list.items.build
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t# no code needed here; all handled in the view\n\tend",
"def new\n \n @form =Forms.new \n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n end",
"def new\n\n en... | [
"0.8284708",
"0.82449496",
"0.80218345",
"0.80218345",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79622835",
"0.79350597",
"0.793403",
"0.793403",
"0.793403",
"0.793403",
"0.79... | 0.0 | -1 |
Actually creates after form is filled out | def create
@list = current_user.lists.find params[:list_id]
@item = @list.items.build(item_params)
respond_to do |format|
if @item.save
format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }
#format.json { render :show, status: :created, location: @item }
else
format.html { render :new }
#format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\r\n\r\n\r\n end",
"def create_form\n new_form = Form.create_form(current_user[\"id\"])\n\n if new_form[:status] \n return redirect_to \"/f/#{new_form[:form_code]}/create\"\n end \n end",
"def create\r\n end",
"def create\n \n end",
"def create\n... | [
"0.71176445",
"0.7005531",
"0.68967515",
"0.6782489",
"0.67694694",
"0.66864693",
"0.66864693",
"0.66864693",
"0.6662378",
"0.66586185",
"0.664274",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749",
"0.6626749... | 0.0 | -1 |
Update actually updates the edited form PATCH/PUT /lists/1 PATCH/PUT /lists/1.json | def update
@list = current_user.lists.find params[:list_id]
@item = @list.items.find(params[:id])
respond_to do |format|
if @item.update(item_params)
format.html { redirect_to list_items_path(@list), notice: 'Item was successfully updated.' }
#format.json { render :show, status: :ok, location: @item }
else
format.html { render :edit }
#format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.82539254",
"0.8233802",
"0.8233802",
"0.8157004",
"0.8157004",
"0.8147768",
"0.81287605",
"0.80909014",
"0.80861956",
"0.80861956",
"0.80861956",
"0.80861956",
"0.80861956",
"0.80807054",
"0.8056709",
"0.8055855",
"0.80550617",
"0.80249447",
"0.8015926",
"0.801169",
"0.797... | 0.78546494 | 26 |
DELETE /lists/1 DELETE /lists/1.json | def destroy
@list = current_user.lists.find params[:list_id]
@item = @list.items.find(params[:id])
@item.destroy
respond_to do |format|
format.html { redirect_to list_items_path(@list), notice: 'Item was successfully removed.' }
#format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect... | [
"0.7905714",
"0.7809364",
"0.7780575",
"0.77566075",
"0.77566075",
"0.77566075",
"0.77175426",
"0.77175426",
"0.77175426",
"0.75786066",
"0.750991",
"0.7501654",
"0.7501654",
"0.7501654",
"0.7501654",
"0.7501654",
"0.7501654",
"0.7501654",
"0.7498501",
"0.7476957",
"0.7471059... | 0.7221024 | 32 |
Never trust parameters from the scary internet, only allow the white list through. Protects from people passing in something they shouldn't, only accept these parameters | def item_params
params.require(:item).permit(:name, :max_price, :url, :notes, :model_number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def valid_params_request?; end",
"def param_whitelist\... | [
"0.7140684",
"0.70953345",
"0.7071303",
"0.7022501",
"0.70146924",
"0.6992742",
"0.6945231",
"0.683342",
"0.6793334",
"0.6788039",
"0.67348784",
"0.67133284",
"0.66921747",
"0.6647876",
"0.6647047",
"0.6633178",
"0.6609358",
"0.660617",
"0.6591118",
"0.6590045",
"0.657402",
... | 0.0 | -1 |
Flush Memcache Author: Aman Date: 30/05/2019 Reviewed By: | def memcache_flush
customer_memcache_key = Customer.get_memcache_key_object.key_template % {id: self.id}
Memcache.delete(customer_memcache_key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memcache_flush\n memcache_key = self.singleton_class.get_memcache_key_object.key_template % {\n shard_identifier: self.singleton_class.shard_identifier,\n aml_search_uuid: aml_search_uuid\n }\n Memcache.delete(memcache_key)\n end",
"def memcache_flush\n ... | [
"0.81474984",
"0.8116679",
"0.80214494",
"0.77528214",
"0.7752181",
"0.76064587",
"0.752923",
"0.7505315",
"0.7474541",
"0.7429203",
"0.7372363",
"0.7306038",
"0.72701627",
"0.7215428",
"0.7210591",
"0.71594685",
"0.7099951",
"0.6777171",
"0.67485064",
"0.67278665",
"0.666812... | 0.7665477 | 5 |
Uses model's publisher's country_codes to determine how to validate zip | def validates_zip_code_according_to_publisher(*config)
validates_each(:zip_code, *config) do |model, attr, zip|
if zip.present?
valid = false
if model.publisher
model.publisher.country_codes.each do |country_code|
regex = postal_code_regex(country_code)
if regex.present?
valid = true if regex =~ zip
else
# valid if there's no validation regex
valid = true
end
end
else
valid = true
end
unless valid
model.errors.add(attr, I18n.t("activerecord.errors.messages.invalid"))
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_zip_code(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n regex = postal_code_regex(model.country_code)\n if regex.present?\n unless regex =~ zip\n model.errors.add(attr, I18n.t(\"activerecord.errors.mes... | [
"0.7138594",
"0.66672224",
"0.65053076",
"0.6392671",
"0.6359189",
"0.6359189",
"0.63049567",
"0.62893486",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.62141407",
"0.61871076",
"0.61671257",
"0.61671257",
"0.6137648",
"0.60821",
"0.6071982... | 0.8111252 | 0 |
If there's no country code at all, pretend us If there is a country code, the regex might still be nil.... | def postal_code_regex(country_code)
return us_regex if country_code.nil?
Country.postal_code_regex(country_code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_country_code?\n country_code.nil?\n end",
"def drop_country(affi_string)\n found_ctry = get_country_any(affi_string)\n dropped_country = affi_string.gsub(found_ctry,\"\").strip\n return dropped_country\nend",
"def phone_number_with_country_code; end",
"def has_valid_postal_code_pattern\n ... | [
"0.6206724",
"0.6167595",
"0.6135322",
"0.61207247",
"0.61026204",
"0.608198",
"0.60280263",
"0.60259247",
"0.6023773",
"0.5996231",
"0.59501666",
"0.59468794",
"0.5934802",
"0.59014714",
"0.5863764",
"0.5859394",
"0.5856711",
"0.5856711",
"0.5839878",
"0.5838371",
"0.5837967... | 0.74367326 | 0 |
Uses the model''s country code to determine how to validate zip | def validates_zip_code(*config)
validates_each(:zip_code, *config) do |model, attr, zip|
if zip.present?
regex = postal_code_regex(model.country_code)
if regex.present?
unless regex =~ zip
model.errors.add(attr, I18n.t("activerecord.errors.messages.invalid"))
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_zip_code_according_to_publisher(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n valid = false\n if model.publisher\n model.publisher.country_codes.each do |country_code|\n regex = postal_code_regex(coun... | [
"0.72119874",
"0.6951393",
"0.6922878",
"0.68609256",
"0.6722515",
"0.66517246",
"0.66517246",
"0.64409167",
"0.6356393",
"0.6340032",
"0.6340032",
"0.6303804",
"0.626417",
"0.62593275",
"0.6254714",
"0.61897707",
"0.6180971",
"0.61758363",
"0.6165169",
"0.6156843",
"0.615495... | 0.74451184 | 0 |
PUT /cursuses/1 PUT /cursuses/1.xml | def update
respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = 'User was successfully updated.'
format.html { redirect_to(users_path) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n flas... | [
"0.56058353",
"0.53983086",
"0.5222361",
"0.515674",
"0.5100553",
"0.5046217",
"0.5015402",
"0.5015402",
"0.5015402",
"0.5015208",
"0.49572614",
"0.49538562",
"0.49081543",
"0.49070477",
"0.49025142",
"0.48895276",
"0.48760718",
"0.48535058",
"0.4822368",
"0.48049316",
"0.477... | 0.0 | -1 |
GET /projects/1 GET /projects/1.json | 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 list\n get 'projects'\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def projects\n... | [
"0.7868971",
"0.76979554",
"0.7680216",
"0.7611453",
"0.75334454",
"0.75258976",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74924207",
"0.7484109",
"0.7479275",
"0.7444873",
"0.74294627",
"0.74224764",
"0.7414947",
"0.... | 0.7361155 | 37 |
GET /projects/new GET /projects/new.json | def new
@project = Project.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @... | [
"0.81725097",
"0.81171846",
"0.80850273",
"0.80848",
"0.8061288",
"0.8030936",
"0.79504395",
"0.792672",
"0.79045373",
"0.7865987",
"0.7758509",
"0.7751187",
"0.77291125",
"0.7706384",
"0.7698888",
"0.7685731",
"0.7672869",
"0.7655707",
"0.76342",
"0.7632482",
"0.7619905",
... | 0.8165836 | 22 |
POST /projects POST /projects.json | def create
@project = Project.new(params[:project])
@project.user_id =current_user.id
respond_to do |format|
if @project.save
format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.json { render json: @project, status: :created, location: @project }
else
format.html { render action: "new" }
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new... | [
"0.7338948",
"0.73139244",
"0.7308003",
"0.7299582",
"0.7227503",
"0.7225945",
"0.71982473",
"0.71170384",
"0.7104803",
"0.7095263",
"0.7070636",
"0.70408624",
"0.70358187",
"0.7024969",
"0.70191896",
"0.7009597",
"0.698481",
"0.697517",
"0.6963753",
"0.6963096",
"0.6948756",... | 0.66877806 | 77 |
PUT /projects/1 PUT /projects/1.json | def update
@project = Project.find(params[:id])
respond_to do |format|
if @project.update_attributes(params[:project])
format.html { redirect_to @project, notice: 'Project was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end",
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n re... | [
"0.7379903",
"0.730825",
"0.7180619",
"0.71665376",
"0.71320134",
"0.71245116",
"0.7082403",
"0.70080924",
"0.70050913",
"0.69997466",
"0.6990245",
"0.6988755",
"0.6988755",
"0.6988755",
"0.6988755",
"0.6983069",
"0.69799423",
"0.69799423",
"0.6976596",
"0.6962526",
"0.695544... | 0.6969676 | 28 |
DELETE /projects/1 DELETE /projects/1.json | def destroy
@project = Project.find(params[:id])
@project.destroy
respond_to do |format|
format.html { redirect_to projects_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pr... | [
"0.78951",
"0.78593713",
"0.7778056",
"0.7771693",
"0.77585995",
"0.7730887",
"0.77305084",
"0.77305084",
"0.77305084",
"0.77305084",
"0.77305084",
"0.77244985",
"0.7718401",
"0.7718401",
"0.7718401",
"0.7718401",
"0.7700103",
"0.76993084",
"0.7682566",
"0.7669082",
"0.765967... | 0.7704753 | 32 |
plex last episode of a show | def thetvdb_missing_plex_last_ep(show)
log_debug
last_ep = '0;0'
$plex.episodes[show].keys.each do |season|
$plex.episodes[show][season].keys.each do |episode|
last_ep = "#{season};#{episode}"
end
end
return last_ep.split(';')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_episode(index=0)\n latest_ep = nil\n\n\n# self.live_episodes.each do |ep|\n## puts \"#{__FILE__}:#{__LINE__} #{__method__} #{ep.release_date_unix} - #{ep.name}\"\n# latest_ep = ep if latest_ep == nil\n# latest_ep = ep if latest_ep.release_date_unix.to_i < ep.release_date_u... | [
"0.7042593",
"0.70366925",
"0.6770952",
"0.66725326",
"0.65757227",
"0.65757227",
"0.65757227",
"0.65757227",
"0.6516167",
"0.647702",
"0.63450396",
"0.6166348",
"0.61621815",
"0.6115442",
"0.6099597",
"0.60675365",
"0.6003067",
"0.5946553",
"0.5941841",
"0.59389234",
"0.5876... | 0.69161004 | 2 |
plex first episode of a show | def thetvdb_missing_plex_first_ep(show)
log_debug
first_ep = '0;0'
$plex.episodes[show].keys.each do |season|
$plex.episodes[show][season].keys.each do |episode|
if first_ep == '0;0'
first_ep = "#{season};#{episode}"
end
end
end
return first_ep.split(';')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_episode_number\n @first_episode_number || 1\n end",
"def next_episodes(show, name, id)\n db_show = TvShows.where(:user => session[:username]).where(:name => name).first\n\n if !db_show.nil?\n last_season = TvShows.where(:user => session[:username]).where(:name => name).first.season\n ... | [
"0.7179375",
"0.68348485",
"0.6698081",
"0.6390671",
"0.6390671",
"0.6390671",
"0.6390671",
"0.6311379",
"0.6061875",
"0.6050348",
"0.6022803",
"0.59962916",
"0.5989896",
"0.5973696",
"0.5932805",
"0.5904213",
"0.57907444",
"0.57901776",
"0.57812834",
"0.57653815",
"0.5727365... | 0.6759812 | 2 |
remove episodes that are found in plex | def thetvdb_missing_plex_found(show,season,episode)
plex_has = false
# remove shows that we have
if $plex.episodes.has_key? show
if $plex.episodes[show].has_key?(season.to_i)
if $plex.episodes[show][season.to_i].has_key?(episode.to_i)
plex_has = true
end
end
end
plex_has
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune\n @set.clear\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 @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end",
"def remove_idea_events(events)\n events.d... | [
"0.5777581",
"0.57602966",
"0.5732618",
"0.5636568",
"0.55728316",
"0.549267",
"0.54691",
"0.5452294",
"0.54078877",
"0.5385365",
"0.53606415",
"0.5344986",
"0.53356004",
"0.5295978",
"0.5294535",
"0.5268267",
"0.5239667",
"0.52054423",
"0.5203759",
"0.52014816",
"0.52011436"... | 0.5839707 | 0 |
handle the range of where we loop up to for episodes | def thetvdb_missing_range(season, season_first, episode, episode_first)
missing = true
# for now we are only interested in episodes greater than our first one and
# inclusive of the whole season
if season.to_i < season_first.to_i
missing = false
end
if $config["missing"]["start_at_first_found"]
if episode_first.to_i > episode.to_i
missing = false
end
end
missing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def episode; end",
"def episode; end",
"def episode; end",
"def episode; end",
"def next_episodes(show, name, id)\n db_show = TvShows.where(:user => session[:username]).where(:name => name).first\n\n if !db_show.nil?\n last_season = TvShows.where(:user => session[:username]).where(:name => name).f... | [
"0.64978206",
"0.64978206",
"0.64978206",
"0.64978206",
"0.5998188",
"0.5801927",
"0.5790353",
"0.5756773",
"0.5714188",
"0.55238515",
"0.5520462",
"0.54880637",
"0.54632616",
"0.53707284",
"0.53678775",
"0.53678775",
"0.53495806",
"0.5339623",
"0.53347844",
"0.5318255",
"0.5... | 0.5805307 | 5 |
loop through all the episodes found in thetvdb for a show remove those that exists in plex ignore specials for now TODO: terrible method name | def thetvdb_missing_last_process(show)
log_debug
$thetvdb.show(show)
season_last, episode_last = thetvdb_missing_plex_last_ep(show)
season_first, episode_first = thetvdb_missing_plex_first_ep(show)
log_debug("#{show} start s#{season_first}e#{episode_first} : last s#{season_last}e#{episode_last}")
if $thetvdb.episodes.has_key?(show)
$thetvdb.episodes[show]['episodes'].keys.each do |season|
next if season == "0"
$thetvdb.episodes[show]['episodes'][season].keys.each do |episode|
first_aired = $thetvdb.episodes[show]['episodes'][season][episode]['first_aired']
show_index = show_index(season, episode)
plex_has = thetvdb_missing_plex_found(show,season,episode)
missing = thetvdb_missing_range(season, season_first, episode, episode_first)
missing = false if plex_has
if first_aired =~ /\w/
date_available = Date.today
date_aired = Date.parse first_aired
if ( date_available > (date_aired + 1) ) and missing
missing_process show, show_index,"aired: #{first_aired}"
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetvdb_missing_plex_found(show,season,episode)\n plex_has = false\n \n # remove shows that we have\n if $plex.episodes.has_key? show \n if $plex.episodes[show].has_key?(season.to_i)\n if $plex.episodes[show][season.to_i].has_key?(episode.to_i)\n plex_has = true \n end\n ... | [
"0.65190876",
"0.6492478",
"0.6420633",
"0.62164086",
"0.5919018",
"0.5781975",
"0.5666205",
"0.5646294",
"0.5546408",
"0.55212903",
"0.55133045",
"0.55097985",
"0.55067444",
"0.54902107",
"0.5479884",
"0.54502773",
"0.53975314",
"0.5380555",
"0.5366146",
"0.5346242",
"0.5327... | 0.59198904 | 4 |
get the missing episodes based on thetvdb | def get
log_debug
$plex.episodes.keys.each do |show|
thetvdb_missing_last_process(show)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetvdb_missing_plex_found(show,season,episode)\n plex_has = false\n \n # remove shows that we have\n if $plex.episodes.has_key? show \n if $plex.episodes[show].has_key?(season.to_i)\n if $plex.episodes[show][season.to_i].has_key?(episode.to_i)\n plex_has = true \n end\n ... | [
"0.68971413",
"0.6663914",
"0.6521342",
"0.62834275",
"0.62667704",
"0.60120064",
"0.6007832",
"0.5991673",
"0.58730125",
"0.5805428",
"0.5799184",
"0.57035935",
"0.5676409",
"0.56607056",
"0.5649644",
"0.56205535",
"0.5614181",
"0.5613577",
"0.5554761",
"0.55046594",
"0.5499... | 0.6176883 | 5 |
Eigenclass Returns a new instance of Vedeu::Editor::Line. | def initialize(collection = nil)
@collection = collection || ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deputy(client = nil)\n Vedeu::DSL::Line.new(self, client)\n end",
"def eigen_vertical_line(size, color)\n {\n type: \"VerticalLine\",\n size: size,\n color: color\n }\n end",
"def create_line(instance_name, class_name, which=0)\n raise StandardError, \"Line object alr... | [
"0.62600344",
"0.61780834",
"0.60357076",
"0.59837794",
"0.59187675",
"0.57833785",
"0.5782081",
"0.57682216",
"0.573901",
"0.5726313",
"0.5709869",
"0.5599225",
"0.5581626",
"0.55598307",
"0.55406785",
"0.5509585",
"0.5509585",
"0.54836595",
"0.54709804",
"0.5400316",
"0.538... | 0.0 | -1 |
Return the character at the given index. | def character(index = nil)
return '' if collection && collection.empty?
return collection[-1] unless index
by_index(index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character(full_string, index)\n full_string[index]\nend",
"def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end",
"def char_at(index)\n self.to_array[index.to_i]\n end",
"def character(index = nil)\n return '' if line && lin... | [
"0.81421363",
"0.8107879",
"0.8053279",
"0.7949277",
"0.78538704",
"0.76641023",
"0.7345691",
"0.73228943",
"0.7106117",
"0.70170766",
"0.700419",
"0.6880574",
"0.6804608",
"0.67518866",
"0.6677644",
"0.664349",
"0.6637772",
"0.65750843",
"0.65320283",
"0.65018886",
"0.648443... | 0.80683035 | 2 |
Delete the character from the line positioned at the given index. | def delete_character(index = nil)
Vedeu::Editor::Line.coerce(Vedeu::Editor::Delete
.from(line, index, size))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_character\n @lines = lines.delete_character(y, x - 1)\n\n left\n\n refresh\n end",
"def delete_at index=@curpos\n return -1 if !@editable \n char = @buffer.slice!(index,1)\n #$log.debug \" delete at #{index}: #{@buffer.length}: #{@buffer}\"\n @modified = t... | [
"0.7387134",
"0.727514",
"0.68795305",
"0.67943084",
"0.67259914",
"0.66502255",
"0.6592625",
"0.65758944",
"0.6533846",
"0.64526546",
"0.63957214",
"0.6304025",
"0.62773126",
"0.6252403",
"0.61952895",
"0.6143449",
"0.6099605",
"0.6082346",
"0.60375226",
"0.5959847",
"0.5958... | 0.88591933 | 1 |
Insert the character on the line positioned at the given index. | def insert_character(character, index = nil)
return self unless character
Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert
.into(collection, character, index, size))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_character(character, index = nil)\n return self unless character\n\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert\n .into(line, character, index, size))\n end",
"def insert_character(character)\n return self if character.is_a?(Symbol)\n\n... | [
"0.81417227",
"0.68893707",
"0.68169624",
"0.6811781",
"0.6556482",
"0.64879465",
"0.6456418",
"0.64364827",
"0.6368418",
"0.627979",
"0.627979",
"0.62780356",
"0.62682813",
"0.6233469",
"0.622108",
"0.6200869",
"0.61653554",
"0.61573774",
"0.61566377",
"0.61483425",
"0.61094... | 0.79030144 | 1 |
You may assume the two numbers do not contain any leading zero, except the number 0 itself. | def add_two_numbers(l1, l2)
curr = try = ListNode.new()
sum = 0
while l1 || l2 || sum > 0
# puts l1.val
if l1
sum += l1.val
l1 = l1.next
end
if l2
sum += l2.val
l2 = l2.next
end
curr.next = ListNode.new(sum % 10)
curr = curr.next
sum /= 10
end
try.next
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_common_digit( a, b )\n\txa = a.divmod( 10 )\n\txb = b.divmod( 10 )\n\n\treturn -1,-1 if xa[ 1 ] == xb[ 1 ] && xa[ 1 ] == 0\n\n\treturn xa[ 1 ],xb[ 1 ] if xa[ 0 ] == xb[ 0 ]\n\treturn xa[ 1 ],xb[ 0 ] if xa[ 0 ] == xb[ 1 ]\n\treturn xa[ 0 ],xb[ 1 ] if xa[ 1 ] == xb[ 0 ]\n\treturn xa[ 0 ],xb[ 0 ] if xa[ 1 ... | [
"0.72131515",
"0.715317",
"0.67107934",
"0.67107934",
"0.6662345",
"0.6639326",
"0.6507969",
"0.64560723",
"0.64537716",
"0.64105594",
"0.63988405",
"0.6396204",
"0.6384871",
"0.6380399",
"0.63803834",
"0.63660574",
"0.63544565",
"0.63032746",
"0.62759125",
"0.6265676",
"0.62... | 0.0 | -1 |
string to integer (atoi) | def my_atoi(s)
new_string = ""
nums = "+-01234567890."
s.each_char do |char|
if !nums.include?(char) && char != " " && new_string == ""
return 0
elsif !nums.include?(char) && char !=" "
break
else nums.include?(char)
new_string << char
end
end
if new_string.to_i < -2**31
return -2**31
elsif new_string.to_i > 2**31 - 1
return 2**31 - 1
else
return new_string.to_i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_integer(string)\n string.to_i\n rescue\n 0\n end",
"def string_to_integer(str)\n str.to_i\nend",
"def string_to_integer(str)\n return str.to_i\nend",
"def string_to_integer(string)\nend",
"def string_to_integer(string)\n digits = string.chars.map { |digit| MATCH[digit] }\... | [
"0.79941136",
"0.78129214",
"0.7729582",
"0.7619611",
"0.7537958",
"0.75151134",
"0.7495805",
"0.7455603",
"0.74422896",
"0.7402852",
"0.7380027",
"0.73634326",
"0.7362075",
"0.73266894",
"0.73225176",
"0.73144335",
"0.7278621",
"0.7278621",
"0.72784317",
"0.72445947",
"0.722... | 0.67212194 | 40 |
container with most water | def max_area(height)
max_area = 0
left = 0
right = height.length - 1
while right > left
min_height = [height[left], height[right]].min
area = find_area(min_height, left, right)
if area > max_area
max_area = area
end
if height[left] >= height[right]
right -= 1
else
left += 1
end
end
max_area
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container\n tube || well\n end",
"def container_with_most_water(height)\n max_area = 0\n left = 0\n right = height.length - 1\n \n until right - left == 0 do \n length = height[left] < height[right] ? height[left] : height[right]\n width = right - left\n ar... | [
"0.6220147",
"0.5935769",
"0.57515",
"0.5582832",
"0.55748445",
"0.5573974",
"0.55023944",
"0.5490273",
"0.54340255",
"0.54275185",
"0.5422245",
"0.538203",
"0.53254056",
"0.53235185",
"0.52970606",
"0.5217733",
"0.5167465",
"0.51440424",
"0.50773543",
"0.50773543",
"0.507711... | 0.0 | -1 |
Given a string containing digits from 29 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. | def letter_combinations(digits)
map = "- - abc def ghi jkl mno pqrs tuv wxyz".split
charsets = digits.chars.map { |d| map[d.to_i].chars }
digits == "" ? [] : [''].product(*charsets).map(&:join)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_combinations(digits)\n dictionary = {\n '1' => [],\n '2' => ['a', 'b', 'c'],\n '3' => ['d', 'e', 'f'],\n '4' => ['g', 'h', 'i'],\n '5' => ['j', 'k', 'l'],\n '6' => ['m', 'n', 'o'],\n '7' => ['p', 'q', 'r', 's'],\n '8' => ['t', 'u', 'v'],\n ... | [
"0.75101686",
"0.70532066",
"0.6991677",
"0.68580794",
"0.6789314",
"0.66761273",
"0.647862",
"0.63912565",
"0.63720846",
"0.63053834",
"0.63027745",
"0.62978005",
"0.6269583",
"0.62526387",
"0.6237471",
"0.62358636",
"0.6178465",
"0.61221075",
"0.6112744",
"0.60967153",
"0.6... | 0.7655314 | 0 |
Given an array nums and a value val, remove all instances of that value inplace and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array inplace with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond the new length. Clarification: Confused why the returned value is an integer but your answer is an array? Note that the input array is passed in by reference, which means a modification to the input array will be known to the caller as well. | def remove_element(nums, val)
nums.each_with_index do |num, i|
if num == val
nums[i] = nil
end
end
nums.compact!
nums.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_element(nums, val)\n nums.delete(val)\n nums.length\nend",
"def remove_element(nums, val)\n return 0 if nums.empty? || (nums.size == 1 && nums[0] == val)\n start = 0\n nums.each_with_index do |num, index|\n if num != val\n nums[start] = num\n start += 1\n ... | [
"0.75248563",
"0.7453051",
"0.7308791",
"0.72617537",
"0.71683663",
"0.7139942",
"0.70382595",
"0.70364654",
"0.69365734",
"0.6657233",
"0.64814603",
"0.6362131",
"0.6325264",
"0.63187855",
"0.63075316",
"0.62714183",
"0.62675685",
"0.6225266",
"0.61950064",
"0.61876684",
"0.... | 0.7503756 | 1 |
Override default date and time formats: | def update_date_formats!
Date::DATE_FORMATS.update(
:db => '%Y-%m-%d %H:%M:%S',
:ui => '%d.%m.%Y',
:yaml => '%Y-%m-%d', # For Dates
:default => '%d.%m.%Y'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0... | [
"0.7721267",
"0.7516863",
"0.7392629",
"0.73883057",
"0.7326643",
"0.7323418",
"0.72808945",
"0.7219632",
"0.6911035",
"0.6894927",
"0.6793609",
"0.67824644",
"0.6645458",
"0.66107035",
"0.6572696",
"0.65455264",
"0.65353334",
"0.6512592",
"0.6497654",
"0.64892036",
"0.646889... | 0.71987396 | 8 |
Rails 2 loads Oracle dates (with timestamps) as DateTime or Time values (before or after 1970) whereas Rails 1.2 treated them as Date objects. Therefore we have a formatting challenge, which we overcome by hiding the time if it's exactly midnight | def update_time_formats!
Time::DATE_FORMATS.update(
:db => '%Y-%m-%d %H:%M:%S',
:ui => '%d.%m.%Y %H:%M',
:yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes
:default => lambda do |time|
non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0
time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')
end
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_date()\n #This is a stub, used for indexing\n end",
"def sql_datetime_second_mask\n case session[:database][:locale]\n when \"de\" then \"DD.MM.YYYY HH24:MI:SS\"\n when \"en\" then \"YYYY-MM-DD HH24:MI:SS\"\n else \"DD.MM.YYYY HH24:MI:SS\" # Deutsche Variante als default\n e... | [
"0.6118587",
"0.6102862",
"0.60548764",
"0.6022073",
"0.5833507",
"0.57795584",
"0.5703911",
"0.5663049",
"0.5656334",
"0.5653293",
"0.56397176",
"0.56332356",
"0.56317246",
"0.5608215",
"0.56046057",
"0.56046057",
"0.56046057",
"0.5591091",
"0.55753785",
"0.5571742",
"0.5570... | 0.5465254 | 32 |
this should be removed so that we can do better with this open | def open()
#note we would want to check for the browser bing open already
#so we don't annoy people
event("Pre")
require 'launchy'
Launchy.open("http://local.general.dev/info.php") #note this should be from setting file
event("Post")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opening; end",
"def opening; end",
"def opening; end",
"def open_for_read\n end",
"def opened\n end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def close() end"... | [
"0.7393204",
"0.7393204",
"0.7393204",
"0.6683487",
"0.6411516",
"0.63841563",
"0.63841563",
"0.63841563",
"0.63841563",
"0.6346746",
"0.63443905",
"0.63443905",
"0.63443905",
"0.63443905",
"0.62442607",
"0.6212402",
"0.617273",
"0.617273",
"0.617273",
"0.61665297",
"0.615644... | 0.0 | -1 |
qvalues http header parser code taken from webrick | def parse_qvalues(value)
tmp = []
if value
parts = value.split(/,\s*/)
parts.each {|part|
if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
val = m[1]
q = (m[2] or 1).to_f
tmp.push([val, q])
end
}
tmp = tmp.sort_by{|val, q| -q}
tmp.collect!{|val, q| val}
end
return tmp
rescue
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cgi_parse_header(line); end",
"def parse_header_contents; end",
"def parseHeaders(request) \n headers = {};\n\n # Loop through headers\n request.lines[1..-1].each do |line|\n # If we are moving to the next line, return what we currently have\n return headers if line == \"\\r\\n\"\n\n # Structur... | [
"0.7338541",
"0.7102848",
"0.69274634",
"0.6925282",
"0.6776426",
"0.670491",
"0.66628206",
"0.6591524",
"0.65734863",
"0.65713435",
"0.65643156",
"0.6558407",
"0.65351754",
"0.65226936",
"0.64157206",
"0.6406783",
"0.6405212",
"0.63786376",
"0.63459855",
"0.6326906",
"0.6274... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_profile
@profile = current_owner.profile
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(:id, :name, :description, :cpf, :services, :mobile, :zipcode, :address, :number, :complement, :neighborhood, :city, :state, :profile)
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 |
When Car.new is called, this method is run Therefore, for this class, you must pass in 2 variables (make and model) when creating a new instance of it | def initialize(make, model)
@make = make
@model = model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(make, model) #these 2 - make, model - are parameters\n @wheels = 4\n @make = make\n @model = model\n end",
"def initialize (make, model, miles, type, color, year, used)\n\t\t@make = make\n\t\t@model = model\n\t\t@miles = miles\n\t\t@type = type\n\t\t@color = color\n\t\t@yea... | [
"0.7462219",
"0.74188995",
"0.7416475",
"0.7096926",
"0.7058828",
"0.699908",
"0.6884808",
"0.68580717",
"0.6783581",
"0.65512407",
"0.6504456",
"0.6503432",
"0.649938",
"0.64527065",
"0.64387816",
"0.64365804",
"0.64203185",
"0.63744015",
"0.6346392",
"0.63099277",
"0.627434... | 0.8067318 | 0 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(resource_or_scope)
user_session_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(reso... | [
"0.81015337",
"0.8007688",
"0.7984609",
"0.7931186",
"0.78991383",
"0.789044",
"0.78749716",
"0.78687364",
"0.78584945",
"0.78447676",
"0.78447676",
"0.78447676",
"0.78447676",
"0.7842587",
"0.7821626",
"0.7789524",
"0.7749104",
"0.77391005",
"0.77310187",
"0.77310187",
"0.77... | 0.7732675 | 18 |
puppet version to use (env var) | def puppet_version
"PUPPET_VERSION=2.7.19"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_puppet_version\n version = nil\n installed = self.is_in_path?('puppet')\n\n if installed\n raw = self.run('puppet --version')\n version = raw.match(/([\\d\\.]*)\\s/) ? $1 : nil\n else\n version = nil\n end\n\n version\n end",
"def puppet_gem_version\n Gem::Version... | [
"0.77366716",
"0.75111145",
"0.7426613",
"0.6920203",
"0.68346065",
"0.68346065",
"0.67788976",
"0.6649844",
"0.66149205",
"0.6544868",
"0.6436166",
"0.64218706",
"0.6409458",
"0.63958323",
"0.6390239",
"0.63891894",
"0.6389179",
"0.6388214",
"0.6361351",
"0.63382107",
"0.632... | 0.7795586 | 0 |
TODO: Don't mark loans as realised if they have futher recoveries. | def realise_loans!
loan_ids = realised_recoveries.map {|recovery| recovery.loan.id }.uniq
Loan.find(loan_ids).each do |loan|
loan.realised_money_date = Date.today
loan.modified_by = creator
loan.update_state!(Loan::Realised, LoanEvent::RealiseMoney, creator)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lost?\n # Fill this in\n end",
"def lost?\n @life <=0\n end",
"def can_recover?\n self.lapsed? and not self.blacklisted\n end",
"def before_recover\n end",
"def after_recover\n end",
"def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @partie... | [
"0.61238754",
"0.586809",
"0.5839576",
"0.57865703",
"0.57289475",
"0.56945395",
"0.56651825",
"0.56275135",
"0.56142366",
"0.5609703",
"0.5602296",
"0.5602296",
"0.5572648",
"0.555517",
"0.55207175",
"0.55205977",
"0.55090857",
"0.54991937",
"0.5486099",
"0.5473138",
"0.5462... | 0.6668867 | 0 |
Get's the `expiration_date` as a Time object | def expiration_time
Time.at(0, expiration_date, :millisecond)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_date_time\n return @expiration_date_time\n end",
"def expiration_date_time\n return @expiration_date_time\n end",
"def expiration_date_time\n return @expiration_date_time\n end",
"def expiration_date_time\n ... | [
"0.81501484",
"0.81501484",
"0.81501484",
"0.81501484",
"0.81501484",
"0.81501484",
"0.7467819",
"0.74556446",
"0.72345227",
"0.72345227",
"0.72345227",
"0.72345227",
"0.72345227",
"0.72345227",
"0.72009885",
"0.7194464",
"0.7037336",
"0.70314133",
"0.6962809",
"0.6937511",
"... | 0.8125416 | 6 |
create a before hook that applies the received validator class to input. will abort request with validation error if invalid | def validate_input(validator_klass, options = {})
unless validator_klass.include?(ActiveModel::Validations)
raise ArgumentError, "validator class should be an ActiveModel::Validator"
end
before lambda { |_rack_env, env|
validator = validator_klass.new(env[:input])
validator.valid? || twirp_validation_error(validator.errors)
}, **options, name: validator_klass.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_validation\n\n end",
"def _before_validation\n end",
"def pre_validation\n\n\n end",
"def valid_before; end",
"def validate(validator, *args); validation_chain.validate(validator, *args); end",
"def before_validation_callback\n end",
"def validate\n errors.clear\n self... | [
"0.66816926",
"0.66270715",
"0.6571829",
"0.6496052",
"0.6409451",
"0.63899034",
"0.6354531",
"0.6337416",
"0.6267571",
"0.62459946",
"0.6219813",
"0.60915405",
"0.60897195",
"0.6066178",
"0.6064134",
"0.6025313",
"0.6014526",
"0.5984107",
"0.5984107",
"0.5984107",
"0.5967430... | 0.7508325 | 0 |
used when constructing service to apply handler's configured service hooks | def configure_hooks(hook_type, service)
unless VALID_HOOKS.include?(hook_type)
raise ArgumentError, "unknown twirp hook type received: #{hook_type}"
end
existing_hooks = instance_variable_get("@#{hook_type}_hooks")
return if existing_hooks.nil?
existing_hooks.values.each do |hook|
service.send(hook_type, &hook)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def around_hooks; end",
"def initialize\n RESTRack::CONFIG[:SERVICE_NAME] = self.class.to_s.split('::')[0].to_sym\n @request_hook = RESTRack::Hooks.new if RESTRack.const_defined?(:Hooks)\n end",
"def setup_handler\n end",
"def InitializeHooks\n end",
"def initialize (service_name, applicatio... | [
"0.6502253",
"0.6396917",
"0.6394521",
"0.6332797",
"0.63215667",
"0.62992376",
"0.6215813",
"0.62039936",
"0.6109727",
"0.60925716",
"0.6084907",
"0.60590404",
"0.60432065",
"0.60090166",
"0.59969884",
"0.5986942",
"0.59840745",
"0.5965312",
"0.5955509",
"0.5950327",
"0.5939... | 0.64143836 | 1 |
creates a wrapped lambda for received hook config and registers it to hooks. method can be a Proc or name of instance or class method on the handler. options :if and :unless are respected here. | def define_hook(hooks, method, options)
hook_name = options[:name] || method
if hook_name.is_a?(Proc)
raise ArgumentError, "name option required when using proc for method"
end
hooks[hook_name] = lambda do |*args|
env = args.find { |arg| arg.is_a?(Hash) && arg.key?(:input) }
return if CallbackHelpers.skip?(env, options)
instance_exec(&CallbackHelpers.make_execute_lambda(method, env[:handler], *args))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hook_before_method(method, hook, opts = {})\n return false if method == hook\n _add_hooked_method(:before, hook, method)\n original = instance_method(method)\n @_defining_hook = true\n define_method(method) do |*args, &block|\n if opts[:send_args] || opts[:send_arg] || opts[:mo... | [
"0.5898352",
"0.58222187",
"0.5811574",
"0.5774951",
"0.5753875",
"0.5734096",
"0.5689229",
"0.5668453",
"0.56216305",
"0.5612948",
"0.5568042",
"0.5564686",
"0.55522984",
"0.5540169",
"0.55165267",
"0.54720986",
"0.5443501",
"0.54318047",
"0.5412243",
"0.5387317",
"0.5386871... | 0.7049262 | 0 |
add a set of item_ids to the matrix | def add_set(set_id, item_ids)
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_item_ids\n [id] + item_ids\n end",
"def add_dimension_to_items\n new_items = Array.new\n items.each do |i|\n Rails.logger.debug(\"i[:product_id] is #{i[:product_id]}\")\n p = CachedProduct.find_by_product_id(i[:product_id])\n i = i.merge({:height=>p.height, :w... | [
"0.7084985",
"0.61166304",
"0.5945865",
"0.58580595",
"0.5762974",
"0.5694951",
"0.56937623",
"0.5691153",
"0.56829137",
"0.5665043",
"0.5558574",
"0.55539",
"0.5519956",
"0.5509171",
"0.55083656",
"0.5493018",
"0.54570323",
"0.5448069",
"0.54439",
"0.54159915",
"0.540044",
... | 0.61113286 | 2 |
add a single item to a set of item_ids to the matrix | def add_single(set_id, item_id, other_item_ids)
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item item\n @items << item\n @@all_items << item\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end",
"def add(item)\n self[... | [
"0.66346425",
"0.660644",
"0.65769356",
"0.6545511",
"0.63007885",
"0.6297965",
"0.62868166",
"0.62660927",
"0.6261452",
"0.62398696",
"0.621355",
"0.616932",
"0.61385965",
"0.612757",
"0.61253935",
"0.60932016",
"0.60859704",
"0.6074837",
"0.60625565",
"0.606239",
"0.6042797... | 0.6693372 | 0 |
calculate the similarity between item1 and item1 (0.01.0) | def similarity(item1, item2)
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similarity_by_euclidean_for_items(item1, item2, list)\n common_users = find_common_users(item1, item2, list)\n \n result = 0.0\n return result if common_users.size < 1\n \n common_users.each do |u|\n result += (u.rating_for(item1.id) - u.rating_for(item2.id))*... | [
"0.80701387",
"0.7937043",
"0.7589208",
"0.75725365",
"0.7359217",
"0.6925787",
"0.6857152",
"0.68302065",
"0.6804935",
"0.67283803",
"0.67250174",
"0.6691393",
"0.6684902",
"0.6674588",
"0.66491437",
"0.66311103",
"0.66295123",
"0.6615349",
"0.66058624",
"0.6531073",
"0.6516... | 0.7576317 | 3 |
calculate all similarities to other items in the matrix for item1 | def similarities_for(item1)
# return => [ ["item23", 0.6], ["item42", 0.23], (...) ]
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similarity_by_euclidean_for_items(item1, item2, list)\n common_users = find_common_users(item1, item2, list)\n \n result = 0.0\n return result if common_users.size < 1\n \n common_users.each do |u|\n result += (u.rating_for(item1.id) - u.rating_for(item2.id))*... | [
"0.71388024",
"0.6949338",
"0.6805654",
"0.6531122",
"0.631466",
"0.6265979",
"0.6025418",
"0.5986484",
"0.5955019",
"0.595329",
"0.5891528",
"0.5864645",
"0.58561486",
"0.58153576",
"0.57817435",
"0.5746806",
"0.5706811",
"0.5704644",
"0.5701195",
"0.5653002",
"0.5647565",
... | 0.73868406 | 0 |
retrieve all item_ids in the matrix | def all_items
# retzrb => [ "item23", "item42", "item17", (...) ]
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_item_ids\n [id] + item_ids\n end",
"def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end",
"def items\n if @items.nil?\n ids = tire_response.results.map { |item| item['id'] }\n items = klass.where(:id => ids).group_by(&:id)\n @items = id... | [
"0.76522875",
"0.7413147",
"0.65557754",
"0.65359426",
"0.62320036",
"0.6201694",
"0.612729",
"0.6087922",
"0.60771424",
"0.60563326",
"0.60553193",
"0.5964694",
"0.5957733",
"0.595444",
"0.5951751",
"0.59078413",
"0.5905141",
"0.5885309",
"0.58731663",
"0.58594424",
"0.58578... | 0.0 | -1 |
delete item_id from the matrix | def delete_item(item_id)
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @@all_items.delete(@id)\n end",
"def delete_item(item)\n @get_items.delete(item)\n end",
"def delete_product(item)\r\n\t\tif item.is_a? Enumerable\r\n\t\t\titem.each { |i| @items.delete i }\r\n\t\telse\r\n\t\t\t@items.delete(item)\r\n\t\tend\r\n\tend",
"def remove_item(item_id)\n @ite... | [
"0.67961454",
"0.6774477",
"0.6673525",
"0.66483307",
"0.66076255",
"0.65512747",
"0.65446544",
"0.6541384",
"0.6528784",
"0.6473194",
"0.6450048",
"0.6429415",
"0.64117146",
"0.635632",
"0.6346991",
"0.6342022",
"0.63412625",
"0.6313359",
"0.63089734",
"0.6305249",
"0.629470... | 0.6479153 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_probe_type
@probe_type = ProbeType.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 |
Only allow a trusted parameter "white list" through. | def probe_type_params
params.require(:probe_type).permit(:name, :description, :communication_channel_id, :value1_type_id, :value2_type_id, :value3_type_id, :value4_type_id, :value5_type_id, :value6_type_id, :value7_type_id, :value8_type_id, :value9_type_id, :value10_type_id, :value11_type_id, :value12_type_id, :value13_type_id, :value14_type_id, :value15_type_id, :value16_type_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Verify if current_user is logged_in | def logged_in?
redirect_to(root_path, notice: 'Unauthorized access!') unless current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in\n current_user != nil\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def log... | [
"0.87036675",
"0.87036675",
"0.8697598",
"0.8667308",
"0.86539376",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
"0.8652277",
... | 0.0 | -1 |
I _should_ be able to use the built in Ruby csv to parse this, but it doesn't work for me :( | def each
parsed_line = ""
@lines.each do |line|
parsed_line += line
if parsed_line.count('"') % 2 == 0
yield create_row(parsed_line)
parsed_line = ""
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some rea... | [
"0.71557415",
"0.70016444",
"0.6993744",
"0.6969925",
"0.69469714",
"0.68631893",
"0.6844068",
"0.67699975",
"0.67562205",
"0.67546135",
"0.6695829",
"0.66855246",
"0.6676476",
"0.6661149",
"0.665229",
"0.66471875",
"0.66189283",
"0.6612319",
"0.6600012",
"0.6539154",
"0.6536... | 0.0 | -1 |
embed gist, accepts: | luikore/737238 gist.github.com/luikore/737238 | def parse_gist
src = content.strip
if src =~ /\A\w+(\-\w+)*\/\d+/
src = "https://gist.github.com/#{src}"
else
src.sub! /\A(?=gist\.github\.com)/, 'https://'
end
src.sub!(/((?<!\.js)|\.git)$/, '.js')
%Q|<script src="#{src}"></script>|
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gist( gist_id )\n\tgist_snippet_url = \"http://gist.github.com/#{gist_id}\"\n\treturn (<<-EOS).chomp\n<div class=\"gist_plugin\"><script src=\"#{gist_snippet_url}.js\"></script>\n<noscript><a href=\"#{gist_snippet_url}\">gist:#{gist_id}</a></noscript></div>\n\tEOS\nend",
"def run_gist\n `open http://gis... | [
"0.7336357",
"0.6581036",
"0.65539694",
"0.6379984",
"0.63251203",
"0.6317538",
"0.6216875",
"0.61995375",
"0.613781",
"0.6091878",
"0.6082169",
"0.60490996",
"0.5932171",
"0.58436644",
"0.5817473",
"0.57898843",
"0.57616067",
"0.57411134",
"0.5689497",
"0.565051",
"0.5636411... | 0.63015604 | 6 |
embed video, calculates embed iframe by urls from various simple formats, but not accept iframe code | def parse_video
# standard
unless /\A\s*(?<width>\d+)x(?<height>\d+)\s+(?<url>.+)\z/ =~ content
env.warn 'can not parse \video content, should be "#{WIDTH}x#{HEIGHT} #{URL}"'
return
end
case url
when /youtu\.?be/
# NOTE merging them into one regexp fails (because longest match?)
unless id = url[/(?<=watch\?v=)\w+/] || url[/(?<=embed\/)\w+/] || url[/(?<=youtu\.be\/)\w+/]
env.warn 'can not parse youtube id'
return
end
%Q|<iframe width="#{width}" height="#{height}" src="https://www.youtube-nocookie.com/embed/#{id}?rel=0" frameborder="0" allowfullscreen></iframe>|
when /vimeo/
unless id = url[/(?<=vimeo\.com\/)\w+/]
env.warn 'can not parse vimeo id, should use link like this "http://vimeo.com/#{DIGITS}"'
return
end
%Q|<iframe width="#{width}" height="#{height}" src="https://player.vimeo.com/video/#{id}" frameborder="0" allowFullScreen></iframe>|
when /sm/
unless id = url[/\bsm\d+/]
env.warn 'can not find "sm#{DIGITS}" from link'
return
end
%Q|<script src="https://ext.nicovideo.jp/thumb_watch/#{id}?w=#{width}&h=#{height}"></script>"|
else
env.warn 'failed to parse video link, currently only youtube, vimeo and niconico are supported'
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_video\r\n\tvid_host = self.video_url.sub(/^https?\\:\\/\\//, '').sub(/^www./,'').split('/')[0]\r\n\tif vid_host == 'youtube.com' or vid_host == 'youtu.be'\r\n\t\tyoutube_embed(self.video_url)\r\n\telsif vid_host == 'player.vimeo.com' or vid_host == 'vimeo.com'\r\n\t\tvimeo_embed(self.video_url)\r\n\tend\... | [
"0.7036487",
"0.68915516",
"0.6817374",
"0.6730852",
"0.67027116",
"0.66616917",
"0.664561",
"0.6611145",
"0.66080594",
"0.65695906",
"0.6552747",
"0.65445626",
"0.64981824",
"0.6455144",
"0.6370712",
"0.6362068",
"0.6353784",
"0.63133764",
"0.6311673",
"0.6299641",
"0.629882... | 0.691994 | 1 |
Define a single reference into _pool_ from _data_ beginning at _start_ | def initialize(pool, data, start, name=nil)
super(name)
@tag = data.u1(start)
@enclosing_pool = pool
@first_index = data.u2(start+1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool; end",
"def pool; end",
"def initialize(pool, data, start, name=nil)\r\n super(pool, data, start, name)\r\n @size = 5\r\n\r\n @second_index = data.u2(start+3)\r\n end",
"def pool\n @pool.dup\n end",
"def pool \n @pool\n end",
"def redis_pool=(_arg0);... | [
"0.65071964",
"0.65071964",
"0.63829106",
"0.63288057",
"0.6131492",
"0.6096813",
"0.59680426",
"0.5910591",
"0.58648056",
"0.58329535",
"0.57922256",
"0.5724876",
"0.56921107",
"0.5683031",
"0.56414473",
"0.5563892",
"0.5551784",
"0.5540265",
"0.55348533",
"0.5520624",
"0.55... | 0.71042734 | 0 |
Return the value, which is the referenced value from the pool. | def first_value
get(@first_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(ref)\r\n @enclosing_pool[ref].to_s\r\n end",
"def value\n mutex.lock\n execute_task_once\n apply_deref_options(@value)\n ensure\n mutex.unlock\n end",
"def [](key)\n @lock.synchronize do\n ref = @references[key]\n value = ref.object if ref\n ... | [
"0.7010257",
"0.66636807",
"0.6399516",
"0.6394772",
"0.63068724",
"0.6253776",
"0.6170082",
"0.6144192",
"0.6141153",
"0.6129286",
"0.6048917",
"0.6029394",
"0.59468925",
"0.5945332",
"0.59435093",
"0.593604",
"0.593604",
"0.5894637",
"0.58885837",
"0.5872364",
"0.58580196",... | 0.0 | -1 |
Return part of debug output. | def dump
super + "##{@first_index};\t// #{to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_debug_string\n s = \"3D Camera: [ #{@x.round(2)}, #{@y.round(2)}, #{@z.round(2)} ]\\n\"\n s += \" T[ #{@tx.round(2)}, #{@ty.round(2)}, #{@tz.round(2)} ]\\n\"\n s += \"Fov: #{@fov.round(2)} View: #{@near.round(2)} -> #{@far.round(2)}\\n\\t\"\n s += \"Gosu::Window FPS (#{Gosu.fps})\\n\\t\"\n ... | [
"0.69366837",
"0.69291043",
"0.69069993",
"0.6879002",
"0.6878159",
"0.6730113",
"0.67059743",
"0.66907835",
"0.66851145",
"0.66389287",
"0.6568203",
"0.65560573",
"0.65443265",
"0.6541664",
"0.65178704",
"0.6486761",
"0.6470802",
"0.6467053",
"0.6449916",
"0.6449916",
"0.644... | 0.0 | -1 |
Get a reference _ref_ from the +enclosing_pool+ | def get(ref)
@enclosing_pool[ref].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool\n @pool.dup\n end",
"def weak_ref_value(o)\n if o && o.weakref_alive?\n o\n end\n end",
"def pool \n @pool\n end",
"def pool\n @pool\n end",
"def ref\n return self if @closed\n ::Libuv::Ext.ref(handle)\n self\n ... | [
"0.6327182",
"0.60461324",
"0.6011201",
"0.5982237",
"0.58152574",
"0.5814085",
"0.5759991",
"0.5725847",
"0.5711285",
"0.56558347",
"0.5642864",
"0.5624329",
"0.5615926",
"0.5596941",
"0.5596941",
"0.5551657",
"0.5545457",
"0.55419296",
"0.55370665",
"0.5534037",
"0.55324346... | 0.77133334 | 0 |
GET /recorridos/1 GET /recorridos/1.json | def show
recorrido = Recorrido.find(params[:id].to_i)
@polylines = []
@stops = []
# @shapes = Shape.all
secuencias = recorrido.get_secuencias_of_the_hour
secuencias.each_with_index do |s, i|
@polylines[i] = []
Shape.where(:code => s.code).first.points.each_with_index do |p, e|
e == 0 ? @polylines[i] << {:strokeColor => '#000000', :icons => [], :lat => p.lat, :lng => p.lng } : @polylines[i] << {:lat => p.lat, :lng => p.lng }
end
s.stops.each do |stop|
@stops << {:title => stop.code,
:lat => stop.lat,
:lng => stop.lng,
:width => 12,
:height => 14,
:picture => "../images/parada_12.png", :type => 'stop',
:type => 'stop',
:ida => i,
:description => render_to_string(:partial => "/recorridos/stop_infowindow", :locals => { :stop => stop})}
end
end
respond_to do |format|
format.js
format.html
format.json { render json: @recorrido }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n @restoras = Restora.all\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
... | [
"0.6985941",
"0.6835628",
"0.6820885",
"0.6757224",
"0.67209727",
"0.65974635",
"0.6552926",
"0.65426266",
"0.6499552",
"0.64912564",
"0.64472693",
"0.6422123",
"0.6418647",
"0.6386169",
"0.6358261",
"0.6343909",
"0.63431144",
"0.6341139",
"0.6286661",
"0.6285019",
"0.6274853... | 0.0 | -1 |
Returns all relationships that are manytoone for this model. Used to find the relationships that require properties in any Repository. Example: class Plur include DataMapper::Resource def self.default_repository_name :plur_db end repository(:plupp_db) do has 1, :plupp end end This resource has a manytoone to the Plupp resource residing in the :plupp_db repository, but the Plur resource needs the plupp_id property no matter what repository itself lives in, ie we need to create that property when we migrate etc. Used in DataMapper::Model.properties_with_subclasses | def many_to_one_relationships
relationships unless @relationships # needs to be initialized!
@relationships.values.collect do |rels| rels.values end.flatten.select do |relationship| relationship.child_model == self end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relationships\n model.relationships(repository.name)\n end",
"def relationships\n @relationships ||= Relationship.from_associations(self, associations)\n end",
"def relationships\n return [] if empty?\n\n map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, \"../#{pivo... | [
"0.7674651",
"0.66676754",
"0.63822305",
"0.63748515",
"0.6187852",
"0.613318",
"0.61046165",
"0.60388786",
"0.58650494",
"0.58530086",
"0.5817168",
"0.577327",
"0.57594293",
"0.57555413",
"0.5707714",
"0.5689091",
"0.5683943",
"0.56767297",
"0.56575596",
"0.56518126",
"0.565... | 0.68165123 | 1 |
A shorthand, clear syntax for defining manytoone resource relationships. | def belongs_to(name, options={})
@_valid_relations = false
if options.key?(:class_name) && !options.key?(:child_key)
warn "The inferred child_key will changing to be prefixed with the relationship name #{name}. " \
"When using :class_name in belongs_to specify the :child_key explicitly to avoid problems." \
"#{caller(0)[1]}"
end
relationship = ManyToOne.setup(name, self, options)
# Please leave this in - I will release contextual serialization soon
# which requires this -- guyvdb
# TODO convert this to a hook in the plugin once hooks work on class
# methods
self.init_belongs_relationship_for_serialization(relationship) if self.respond_to?(:init_belongs_relationship_for_serialization)
relationship
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_relationship(name)\n end",
"def many_to_one(name, opts=OPTS, &block)\n associate(:many_to_one, name, opts, &block)\n end",
"def has_one(*args)\n require \"og/relation/has_one\"\n relations! << Og::HasOne.new(args, :owner_class => self)\n end",
"def one_to_many_relati... | [
"0.67878896",
"0.67640823",
"0.6398748",
"0.6388814",
"0.6350348",
"0.6291635",
"0.62543625",
"0.6250144",
"0.62111217",
"0.61377215",
"0.6119926",
"0.6119926",
"0.6116929",
"0.6024195",
"0.5931825",
"0.58953804",
"0.58782214",
"0.58689624",
"0.5816415",
"0.5794295",
"0.57506... | 0.53172755 | 45 |
for cancancan GET /food_products GET /food_products.json | def index
@food_products = FoodProduct.where(group_id: @groups)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products\n request :public, :get, :products\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def show\n render json: @food_product\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(pross... | [
"0.7486446",
"0.7455785",
"0.73694324",
"0.71438366",
"0.6909205",
"0.6874169",
"0.68394256",
"0.6812788",
"0.6777962",
"0.67466384",
"0.6715071",
"0.671431",
"0.66903335",
"0.66789186",
"0.6673837",
"0.6659579",
"0.6640164",
"0.6638377",
"0.662694",
"0.66268665",
"0.66251516... | 0.0 | -1 |
GET /food_products/1 GET /food_products/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def show\n render json: @food_product\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tp... | [
"0.77522504",
"0.75690866",
"0.723285",
"0.7161735",
"0.70759034",
"0.70320964",
"0.6994874",
"0.6985488",
"0.6953214",
"0.6909264",
"0.6893125",
"0.68811864",
"0.6875878",
"0.6875856",
"0.6868638",
"0.6848525",
"0.68176115",
"0.67991483",
"0.67706245",
"0.67700666",
"0.67599... | 0.0 | -1 |
POST /food_products POST /food_products.json | def create
@food_product = FoodProduct.new(food_product_params)
respond_to do |format|
if @food_product.save
format.html { redirect_to @food_product, notice: 'Food product was successfully created.' }
format.json { render :show, status: :created, location: @food_product }
else
format.html { render :new }
format.json { render json: @food_product.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @food_product = FoodProduct.new(food_product_params)\n\n respond_to do |format|\n if @food_product.save\n format.html { redirect_to @food_product, notice: \"Food product was successfully created.\" }\n format.json { render :show, status: :created, location: @food_product }\n ... | [
"0.7275234",
"0.7096893",
"0.6948125",
"0.6941118",
"0.6929887",
"0.6896571",
"0.68398184",
"0.68259233",
"0.68062246",
"0.6765456",
"0.67191714",
"0.6716081",
"0.6653273",
"0.6620721",
"0.66092646",
"0.6593801",
"0.65681094",
"0.6561806",
"0.6544878",
"0.65330684",
"0.650225... | 0.7284388 | 0 |
PATCH/PUT /food_products/1 PATCH/PUT /food_products/1.json | def update
respond_to do |format|
if @food_product.update(food_product_params)
format.html { redirect_to @food_product, notice: 'Food product was successfully updated.' }
format.json { render :show, status: :ok, location: @food_product }
else
format.html { render :edit }
format.json { render json: @food_product.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @food_product.update(food_product_params)\n end",
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n respond_to do |format|\n ... | [
"0.6999992",
"0.6905472",
"0.68577296",
"0.675926",
"0.6714217",
"0.6700601",
"0.6601842",
"0.659857",
"0.6578815",
"0.65099925",
"0.6509841",
"0.6504303",
"0.64839053",
"0.6473083",
"0.64670897",
"0.64427775",
"0.6439398",
"0.64362687",
"0.64219916",
"0.6421374",
"0.64198744... | 0.6862493 | 2 |
DELETE /food_products/1 DELETE /food_products/1.json | def destroy
@food_product.destroy
respond_to do |format|
format.html { redirect_to food_products_url, notice: 'Food product was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @food_product.destroy\n respond_to do |format|\n format.html { redirect_to food_products_url, notice: \"Food product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
... | [
"0.72047395",
"0.72025514",
"0.71572655",
"0.71572655",
"0.7142773",
"0.71215916",
"0.71050525",
"0.70933443",
"0.7082751",
"0.7052677",
"0.7011949",
"0.70056254",
"0.69896096",
"0.6960052",
"0.69495416",
"0.6920785",
"0.6920785",
"0.6920785",
"0.6913939",
"0.69056326",
"0.68... | 0.7205989 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_food_product
@food_product = FoodProduct.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 food_product_params
params.require(:food_product).permit(:group_id, :name, :first_day_num, :second_day_num, :is_cooking, :start)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
attr_reader :threads2frames Hash[thread_id] > top_frame | def adjust_frame(frame_num, absolute_pos)
frame, frame_num = get_frame(frame_num, absolute_pos)
if frame
@frame = frame
@frame.index = frame_num
prefix = "--> ##{frame_num} "
unless @settings[:traceprint]
msg("#{prefix}%s" %
@frame.describe(:basename => settings[:basename],
:maxwidth => settings[:maxwidth] - prefix.size,
:callstyle => settings[:callstyle]))
end
@line_no = @frame.line
@frame
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frames; end",
"def frame_teardown\n @top_frame = @frame = @current_thread = nil \n @threads2frames = {}\n end",
"def catchupFrames(fromFrameNo, toFrameNo)\r\n #puts \"#{fromFrameNo} --> #{toFrameNo}\"\r\n for i in fromFrameNo..toFrameNo do\r\n #puts \"Catching up frame #{i}:\"... | [
"0.584636",
"0.57474035",
"0.5580766",
"0.55540055",
"0.55254865",
"0.54482716",
"0.5412241",
"0.536749",
"0.53574866",
"0.52836645",
"0.5274136",
"0.518462",
"0.5183925",
"0.5180254",
"0.5170764",
"0.51603466",
"0.5137984",
"0.510208",
"0.5055031",
"0.50243175",
"0.50187874"... | 0.0 | -1 |
Remove access to thread and frame variables | def frame_teardown
@top_frame = @frame = @current_thread = nil
@threads2frames = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_thread_locals; end",
"def clean_thread_locals(thread)\n thread.keys.each do |key|\n next if key == :celluloid_queue\n\n # Ruby seems to lack an API for deleting thread locals. WTF, Ruby?\n thread[key] = nil\n end\n end",
"def clean_thread_locals=(_arg0); ... | [
"0.79764557",
"0.7554669",
"0.7309854",
"0.7042253",
"0.6873595",
"0.6698564",
"0.65046865",
"0.6445234",
"0.64105463",
"0.6400726",
"0.6348991",
"0.63449085",
"0.62832147",
"0.62520415",
"0.6188339",
"0.6188339",
"0.6090207",
"0.6085164",
"0.6055737",
"0.60382485",
"0.602079... | 0.7426193 | 2 |
def image Rails.application.routes.url_helpers.rails_blob_path(object.image, only_path: true) if object.image.attached? end | def initialize(question: nil)
@question = question
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_url\n rails_blob_url(object.image)\n # This helper gets the URL from the file we pass to it\n end",
"def image\n return unless object.image.attached?\n\n # object.image.blob.attributes\n # .slice('filename', 'byte_size')\n # .merge(url: image_url)\n # .tap { |att... | [
"0.84489053",
"0.824382",
"0.8120302",
"0.79041463",
"0.77457637",
"0.76969075",
"0.7611494",
"0.7514989",
"0.7447849",
"0.7389016",
"0.7373772",
"0.7322345",
"0.72447383",
"0.7235509",
"0.7225533",
"0.7209284",
"0.7102403",
"0.70918673",
"0.7075643",
"0.70711476",
"0.705313"... | 0.0 | -1 |
test the validations inside the model | def test_original_source_code_01
original_source_code = OriginalSourceCode.new(:original_file_id => 1,
:line_number => 2,
:line_content => "y1",
:error_line => 45)
assert original_source_code.save
orginal_source_code_copy = OriginalSourceCode.find(original_source_code.id)
assert_equal original_source_code.line_number,orginal_source_code_copy.line_number
assert original_source_code.valid?
assert original_source_code.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_validations\n true\n end",
"def validation; end",
"def validation; end",
"def validate\n \n \n end",
"def validate\r\n\r\n end",
"def validate\n test_case.assert_valid @object\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end"... | [
"0.7818588",
"0.7491052",
"0.7491052",
"0.7379029",
"0.73310715",
"0.7300106",
"0.72885185",
"0.72885185",
"0.72578937",
"0.7235839",
"0.72202706",
"0.7211639",
"0.71838045",
"0.71838045",
"0.71838045",
"0.71838045",
"0.715374",
"0.715374",
"0.715374",
"0.7083311",
"0.7079109... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.