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 |
|---|---|---|---|---|---|---|
Current HTTP version being used | def http_version
env['HTTP_VERSION'] || env['SERVER_PROTOCOL'] || 'HTTP/1.0'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_version\n \"%d.%d\" % [self[:http_major], self[:http_minor]]\n end",
"def http_major; end",
"def http_version\n @http_version ||= [\n 'HTTP_VERSION',\n 'SERVER_PROTOCOL',\n ].map{ |x| rack_environment[x] }.find.first.to_s.split('/').last\n end",
"def http... | [
"0.8405215",
"0.8299775",
"0.8205051",
"0.81734085",
"0.77577025",
"0.77308536",
"0.7553819",
"0.7392847",
"0.7335722",
"0.7270772",
"0.7229353",
"0.7158619",
"0.7156052",
"0.71510655",
"0.7043084",
"0.7007428",
"0.7007428",
"0.69650334",
"0.69134796",
"0.69065917",
"0.689932... | 0.8340931 | 1 |
Find resources at depth requested | def find_resources(with_current_resource=true)
ary = nil
case depth
when 0
ary = []
when 1
ary = resource.children
else
ary = resource.descendants
end
with_current_resource ? [resource] + ary : ary
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_resources(&block)\n found = Varnisher::Urls.new\n\n self.class.resources.each do |resource|\n found += find_resource(resource, &block)\n end\n\n Varnisher.log.debug ''\n Varnisher.log.info \"#{found.length} total resources found.\\n\"\n\n found\n end",
"def get_ne... | [
"0.63941234",
"0.62719256",
"0.60623515",
"0.5973748",
"0.59615445",
"0.59117174",
"0.58521956",
"0.5828594",
"0.579396",
"0.5792961",
"0.57477987",
"0.5738571",
"0.5738571",
"0.5696544",
"0.56964",
"0.56911016",
"0.5687111",
"0.5673948",
"0.56731796",
"0.5667999",
"0.5630555... | 0.6748965 | 0 |
Namespace being used within XML document TODO: Make this better | def ns(wanted_uri="DAV:")
_ns = ''
if(request_document && request_document.root && request_document.root.namespace_definitions.size > 0)
_ns = request_document.root.namespace_definitions.collect{|__ns| __ns if __ns.href == wanted_uri}.compact
if _ns.empty?
_ns = request_document.ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace\n @namespace ||= metadata.xpath('//Schema').first.attributes['Namespace'].value\n end",
"def xml_ns\r\n { \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\r\n \"rss\" => \"http://purl.org/rss/1.0/\",\r\n \"prism\"=>\"http://prismstandard.org/namespaces/1.2/basi... | [
"0.75043947",
"0.7454409",
"0.72440684",
"0.72440684",
"0.724375",
"0.72128826",
"0.72128826",
"0.71671575",
"0.71671575",
"0.71671575",
"0.71671575",
"0.71358615",
"0.7127436",
"0.7121924",
"0.7121924",
"0.7121924",
"0.7121924",
"0.7121924",
"0.7121924",
"0.7121924",
"0.7121... | 0.6541867 | 51 |
root_type:: Root tag name Render XML and set Rack::Responsebody= to final XML | def render_xml(root_type)
raise ArgumentError.new 'Expecting block' unless block_given?
doc = Nokogiri::XML::Builder.new do |xml_base|
xml_base.send(root_type.to_s, {'xmlns:D' => 'DAV:'}.merge(resource.root_xml_attributes)) do
xml_base.parent.namespace = xml_base.parent.namespace_definitio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_xml\n content = Nokogiri::XML::Builder.new(:encoding => \"UTF-8\") do |xml|\n yield xml\n end.to_xml\n response.body = [content]\n response[\"Content-Type\"] = 'text/xml; charset=utf-8'\n response[\"Content-Length\"] = content.to_s.bytesize.to_s\n end",
... | [
"0.65819895",
"0.6500937",
"0.64024055",
"0.6322608",
"0.62814236",
"0.61676896",
"0.61609167",
"0.61255765",
"0.59961957",
"0.59897774",
"0.59711856",
"0.5970843",
"0.59650373",
"0.59386784",
"0.59081537",
"0.58934885",
"0.587389",
"0.5872442",
"0.5849049",
"0.5840008",
"0.5... | 0.7606093 | 0 |
block:: block Creates a multistatus response using render_xml and returns the correct status | def multistatus(&block)
render_xml(:multistatus, &block)
MultiStatus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_xml_output(status)\n builder do |xml|\n xml.instruct!\n xml.response do\n xml.status status\n end\n end\nend",
"def render_health_xml\n render :xml => @results.values, :status => health_response_code\n end",
"def render_check\n values = get_health_status(*subsystems... | [
"0.7438203",
"0.674326",
"0.6682214",
"0.65124726",
"0.6449937",
"0.6420527",
"0.63254905",
"0.6317321",
"0.6265582",
"0.6265582",
"0.62324363",
"0.62308836",
"0.62078524",
"0.61614853",
"0.61450946",
"0.6136487",
"0.6090238",
"0.6066992",
"0.6055416",
"0.60370874",
"0.603568... | 0.7553277 | 0 |
xml:: Nokogiri::XML::Builder errors:: Array of errors Crafts responses for errors | def response_errors(xml, errors)
for path, status in errors
xml.response do
xml.href "#{scheme}://#{host}:#{port}#{URI.escape(path)}"
xml.status "#{http_version} #{status.status_line}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pagseguro_error(xml)\n messages = []\n xml.css(\"errors > error\").each do |error|\n messages << error_message(error.css(\"code\").text, error.css(\"message\").text)\n end\n {}.tap do |data|\n data[:errors] = messages\n end\n end",
"def error_xml(code, msg)\n xm... | [
"0.6910148",
"0.64565",
"0.6349886",
"0.61964315",
"0.6111043",
"0.6033974",
"0.5990165",
"0.5849135",
"0.5849135",
"0.5849135",
"0.5849135",
"0.5842488",
"0.58032995",
"0.576143",
"0.5734711",
"0.5717954",
"0.57119846",
"0.56928927",
"0.56832445",
"0.5635758",
"0.56340134",
... | 0.7453926 | 0 |
resource:: Resource elements:: Property hashes (name, ns_href, children) Returns array of property values for given names | def get_properties(resource, elements)
stats = Hash.new { |h, k| h[k] = [] }
for element in elements
begin
val = resource.get_property(element)
stats[OK] << [element, val]
rescue Unauthorized => u
raise u
rescue Status
stats[$!.class] << elemen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def properties_for_children(path, property_names)\n result = {}\n properties_for_path(path, property_names, 1).each_with_index do |row, k|\n # Skipping the parent path\n next if k == 0\n\n ... | [
"0.6245897",
"0.62456685",
"0.59955937",
"0.5978939",
"0.5974708",
"0.5780851",
"0.5721063",
"0.56750095",
"0.56750095",
"0.56303716",
"0.5620414",
"0.5617229",
"0.56143534",
"0.55596834",
"0.5555235",
"0.5534525",
"0.55003196",
"0.54952246",
"0.54945236",
"0.54888916",
"0.54... | 0.599151 | 3 |
resource:: Resource elements:: Property hashes (name, namespace, children) Removes the given properties from a resource | def rm_properties(resource, elements)
for element, value in elements
resource.remove_property(element)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def remove(resource)\n resource.... | [
"0.68099976",
"0.66810554",
"0.6454848",
"0.63553953",
"0.61565363",
"0.60434157",
"0.59351194",
"0.5909683",
"0.5871106",
"0.584533",
"0.58319026",
"0.57933843",
"0.5768058",
"0.5739592",
"0.56950843",
"0.56944895",
"0.56661916",
"0.5655734",
"0.56450725",
"0.5629004",
"0.56... | 0.75552493 | 0 |
resource:: Resource elements:: Property hashes (name, namespace, children) Sets the given properties | def set_properties(resource, elements)
stats = Hash.new { |h, k| h[k] = [] }
for element, value in elements
begin
stats[OK] << [element, resource.set_property(element, value)]
rescue Unauthorized => u
raise u
rescue Status
stats[$!.class] << element
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_resource(kind, results, name, resource)\n if results[kind][name]\n results[kind][name][:properties] += resource[:properties]\n results[kind][name][:properties].uniq!\n results[kind][name][:diffs] += resource[:diffs]\n results[kind][name][:diffs].uniq!\n els... | [
"0.6258034",
"0.6221625",
"0.62100786",
"0.6162497",
"0.61446595",
"0.6096834",
"0.60803294",
"0.6039067",
"0.5976889",
"0.59711903",
"0.5964617",
"0.59482354",
"0.58941716",
"0.583369",
"0.583369",
"0.583369",
"0.583369",
"0.583369",
"0.583369",
"0.5741892",
"0.5670563",
"... | 0.6428934 | 0 |
xml:: Nokogiri::XML::Builder stats:: Array of stats Build propstats response | def propstats(xml, stats)
return if stats.empty?
for status, props in stats
xml.propstat do
xml.prop do
for element, value in props
defn = xml.doc.root.namespace_definitions.find{|ns_def| ns_def.href == element[:ns_href]}
if defn.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propstats(response, stats)\n return if stats.empty?\n stats.each do |status, props|\n propstat = Ox::Element.new(D_PROPSTAT)\n prop = Ox::Element.new(D_PROP)\n\n props.each do |element, value|\n\n name = element[:name]\n if prefix = prefix_for(element[:ns_href])... | [
"0.71866554",
"0.5823723",
"0.56020784",
"0.5357169",
"0.53424895",
"0.5268972",
"0.5218381",
"0.5179636",
"0.5170124",
"0.5125023",
"0.5120829",
"0.51142234",
"0.509245",
"0.508812",
"0.50847214",
"0.5051115",
"0.50470334",
"0.5044878",
"0.4991613",
"0.4987611",
"0.49854085"... | 0.7514266 | 0 |
xml:: Nokogiri::XML::Builder element:: Nokogiri::XML::Element Converts element into proper text | def xml_convert(xml, element)
xml.doc.root.add_child(element)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_xml\n child.to_s\n end",
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def element_xml(xpath)\n if NOKOGIRI\n... | [
"0.64755714",
"0.64057165",
"0.64057165",
"0.6397218",
"0.6287493",
"0.620764",
"0.6206383",
"0.61539817",
"0.61249065",
"0.61090505",
"0.5978911",
"0.5919262",
"0.5886151",
"0.5771524",
"0.57654524",
"0.5746725",
"0.5724643",
"0.57134956",
"0.5694688",
"0.56909686",
"0.56896... | 0.614918 | 8 |
Provides the next sequence identification number which is used to keep track of DNS messages. | def next_id!
# Using sequential numbers for the query ID is generally a bad thing because over UDP they can be spoofed. 16-bits isn't hard to guess either, but over UDP we also use a random port, so this makes effectively 32-bits of entropy to guess per request.
SecureRandom.random_number(2**16)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_sequence_id\n last_sequence_id + 1\n end",
"def next_sequence_number\n last_sequence_number ? last_sequence_number.next : 0\n end",
"def nextSeqNum()\n $sequence_num = ($sequence_num + 1) % 256\n return $sequence_num\nend",
"def get_next_id\n id = java.lang.System.nanoTime.t... | [
"0.7951623",
"0.7508619",
"0.7295687",
"0.7260555",
"0.72290295",
"0.7174504",
"0.71742743",
"0.7168441",
"0.7154891",
"0.7090378",
"0.7079726",
"0.70305145",
"0.70205104",
"0.7012666",
"0.70016146",
"0.6994702",
"0.69648993",
"0.6948657",
"0.69343984",
"0.6905943",
"0.689483... | 0.68635744 | 21 |
Look up a named resource of the given resource_class. | def query(name, resource_class = Resolv::DNS::Resource::IN::A, &block)
message = Resolv::DNS::Message.new(next_id!)
message.rd = 1
message.add_question name, resource_class
send_message(message, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def find_resource\n set_resource_ivar class_name.find(params[:id])\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]... | [
"0.75850433",
"0.7463482",
"0.7216812",
"0.7178611",
"0.70050114",
"0.69757086",
"0.692395",
"0.69237524",
"0.69142586",
"0.68979186",
"0.6884255",
"0.6884255",
"0.6884255",
"0.6874534",
"0.6872319",
"0.6856621",
"0.6855239",
"0.6853542",
"0.68403953",
"0.68291885",
"0.682227... | 0.0 | -1 |
Yields a list of `Resolv::IPv4` and `Resolv::IPv6` addresses for the given `name` and `resource_class`. | def addresses_for(name, resource_class = Resolv::DNS::Resource::IN::A, &block)
query(name, resource_class) do |response|
# Resolv::DNS::Name doesn't retain the trailing dot.
name = name.sub(/\.$/, '')
case response
when Message
yield response.answer.select{|record| record[0].to_s == name}.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ips_for(name)\n resolvers.each do |r|\n ips = r.getaddresses(name)\n\n return ips unless ips.nil? || ips.empty?\n end\n\n []\n end",
"def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end",
"def each_address(na... | [
"0.5914191",
"0.57804143",
"0.5607171",
"0.5581977",
"0.54183024",
"0.53322",
"0.5282946",
"0.527871",
"0.5204884",
"0.52017903",
"0.51704544",
"0.5163592",
"0.51397765",
"0.51394504",
"0.5025684",
"0.50224376",
"0.5020894",
"0.5018779",
"0.5008364",
"0.49550745",
"0.49495664... | 0.7585573 | 0 |
Once either an exception or message is received, we update the status of this request. | def process_response!(response)
finish_request!
if Exception === response
@logger.warn "[#{@message.id}] Failure while processing response #{response}!" if @logger
RubyDNS.log_exception(@logger, response) if @logger
try_next_server!
elsif response.tc != 0
@logger.warn "[#{@mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status\n @request_group.request.change_status_to_accepted\n end",
"def in_progress!\r\n return if [:in_progress].include? self.status\r\n raise \"Invalid state: message must be new or retry to in_progress!\" unless [:new, :retry].include? self.status\r\n\r\n self.status = :in_progress\r\n... | [
"0.6900053",
"0.6592417",
"0.6504436",
"0.64087933",
"0.64087933",
"0.62943465",
"0.628589",
"0.6239021",
"0.6211554",
"0.6198693",
"0.6181462",
"0.61762744",
"0.6151462",
"0.61337876",
"0.61024666",
"0.60835546",
"0.60133994",
"0.60103416",
"0.60016227",
"0.5998907",
"0.5996... | 0.0 | -1 |
Closes any connections and cancels any timeout. | def finish_request!
cancel_timeout
# Cancel an existing request if it is in flight:
if @request
@request.close_connection
@request = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end",
"def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. T... | [
"0.76570344",
"0.7582031",
"0.7582031",
"0.73100674",
"0.72592527",
"0.7194528",
"0.71737784",
"0.71737784",
"0.70911026",
"0.70672035",
"0.70335466",
"0.70162547",
"0.6946205",
"0.6909968",
"0.69023275",
"0.6884804",
"0.6804849",
"0.67917377",
"0.6788654",
"0.6782516",
"0.67... | 0.0 | -1 |
function to print board into console | def print_game_board(game_board)
puts game_board[0].join(" | ")
puts "-------------------------"
puts game_board[1].join(" | ")
puts "-------------------------"
puts game_board[2].join(" | ")
puts "-------------------------"
puts game_board[3].join(" | ")
puts "-------------------------"
puts game_boa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end",
"def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end",
"def print_board\r\n\t\t@board... | [
"0.8743268",
"0.8675284",
"0.8543048",
"0.84873897",
"0.84865487",
"0.84785724",
"0.8475877",
"0.8470219",
"0.84438175",
"0.8441099",
"0.8441099",
"0.84278244",
"0.8414824",
"0.83702534",
"0.83662516",
"0.83601797",
"0.8356183",
"0.8356183",
"0.83516335",
"0.83457536",
"0.834... | 0.0 | -1 |
function to evaluate game | def evaluate_game(game_board)
game_finished = false
for i in 0..5
if game_finished == true
break
end
#Vertical and Horizontal evaluation to see if 4 are connected
for j in 0..3
if (game_board[i+1][j] == game_board[i+1][j+1]) && (game_board[i+1][j]==game... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gameflow\n \n end",
"def evaluate\r\n score = 0\r\n # Evaluate score for each wining combination\r\n WIN_COMBINATIONS.each do |combo|\r\n score += evaluate_combo(combo)\r\n end\r\n\r\n score\r\n end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
... | [
"0.7325198",
"0.7202363",
"0.71964127",
"0.71964127",
"0.71964127",
"0.71964127",
"0.71964127",
"0.71953714",
"0.71953714",
"0.7075663",
"0.70147115",
"0.7012946",
"0.6983784",
"0.6921724",
"0.6898894",
"0.6890449",
"0.68431354",
"0.6824709",
"0.68060076",
"0.67991257",
"0.67... | 0.68918586 | 15 |
=begin Problem: Write a method that determines the mean (average) of the three scores passed to it, and returns the letter value associated with that grade. Tested values are all between 0 and 100. There is no need to check for negative values or values greater than 100. Rephrase: Examples/tests: Numerical Score Letter... | def get_grade(score1, score2, score3)
avg = [score1, score2, score3].sum / 3
case avg
when (90..100) then 'A'
when (80...90) then 'B'
when (70...80) then 'C'
when (60...70) then 'D'
when (0...60) then 'F'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grade(sc1, sc2, sc3)\n # get average of scores\n avg = (sc1 + sc2 + sc3) / 3\n\n # assign letter grade\n # return letter grade\n case avg\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n else 'F'\n end\nend",
"def get_grade(scores)\n score_total =... | [
"0.8460023",
"0.8439594",
"0.83987385",
"0.83649534",
"0.832841",
"0.81696564",
"0.8108768",
"0.8089203",
"0.8054955",
"0.8028801",
"0.80115336",
"0.7987023",
"0.7983605",
"0.7925289",
"0.78911394",
"0.7871538",
"0.7868469",
"0.784992",
"0.7839805",
"0.78367746",
"0.78288555"... | 0.83549935 | 4 |
Gets all contacts for the specified Team. NOTE: Does not return contacts which have not been assigned to an agent, ie. contacts that are still in the queue, or which have been missed. | def get_team_contacts(team_name, start_date, end_date)
get_agent_contacts(service_group_id: -1,
service_id: -1,
team_name: team_name,
agent_id: -1,
start_date: start_date,
end_date: end_date,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_contacts(opts = {})\n get_all_contacts_with_http_info(opts)\n nil\n end",
"def get_contacts(opts = {})\n data, _status_code, _headers = get_contacts_with_http_info(opts)\n data\n end",
"def all_contacts\n Contact.all\n end",
"def get_agent_contacts(params)\n m... | [
"0.66416454",
"0.6462136",
"0.6319289",
"0.63140035",
"0.62160444",
"0.6206298",
"0.6202135",
"0.61985075",
"0.60878307",
"0.602462",
"0.599677",
"0.5976107",
"0.59599143",
"0.5952498",
"0.593874",
"0.59386694",
"0.5938085",
"0.5920204",
"0.58473545",
"0.5832088",
"0.5825212"... | 0.6836388 | 0 |
Gets all contacts for the specified service, including those that are still in the queue or which have been missed. | def get_service_contacts(service_id, start_date, end_date)
get_agent_contacts(service_group_id: -1,
service_id: service_id,
team_name: '',
agent_id: -1,
start_date: start_date,
end_date: end_date,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_contacts\n @contacts.where(contact_type: 'PBX', direction: 'I', forwarded_to_agent: nil, call_ended: nil).where.not(service_id: 120)\n end",
"def missed_contacts\n @contacts.where(contact_type: 'PBX', answered: nil, after_call_ended: nil, direction: 'I').where.not(call_ended: nil, service_id: 12... | [
"0.7124967",
"0.59890044",
"0.5927926",
"0.5860782",
"0.58547986",
"0.5852891",
"0.5838836",
"0.5832661",
"0.5805078",
"0.5797388",
"0.5797358",
"0.5795982",
"0.57743764",
"0.57196015",
"0.5627763",
"0.5623213",
"0.56159323",
"0.5615548",
"0.56100345",
"0.56035584",
"0.559646... | 0.7068839 | 1 |
Method for getting agent contacts | def get_agent_contacts(params)
message = {
serviceGroupID: params[:service_group_id],
serviceID: params[:service_id],
teamID: params[:team_name],
agentID: params[:agent_id],
startDate: params[:start_date],
endDate: params[:end_date],
contactTypes: params[:contact_type],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts\n contact_client.contacts\n end",
"def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end",
"def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end",
"def contacts\n parser.contacts\n end",
"def contacts\n @contacts ||= @ab... | [
"0.77587485",
"0.7671927",
"0.72062355",
"0.71771854",
"0.71414",
"0.71160746",
"0.7078058",
"0.7019259",
"0.70176184",
"0.7003471",
"0.69273764",
"0.6924886",
"0.69054955",
"0.6892203",
"0.6860299",
"0.6839295",
"0.683727",
"0.6826749",
"0.68198186",
"0.677601",
"0.67721546"... | 0.79166013 | 0 |
Gets all Agents registered in OC | def get_agents
reply = @client.call(:get_agents)
data = reply.body.dig(:get_agents_response,
:get_agents_result,
:array_of_string)
data = check_if_data_exists(data)
data.map do |attrs|
{
agent_id: Integer(attrs[:string][0], 10),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agents\n return @agents unless @agents.nil?\n agents_array = []\n agents = @doc.xpath('//mets:agent')\n agents.each do |agent|\n type = agent.attr('TYPE')\n role = agent.attr('ROLE')\n id = agent.attr('ID')\n if agent.element_children.first.name == 'name'\n name = agent.e... | [
"0.67948514",
"0.63935006",
"0.6264116",
"0.620879",
"0.6122343",
"0.6111229",
"0.6095078",
"0.59922796",
"0.5991462",
"0.596868",
"0.5961634",
"0.593668",
"0.59228444",
"0.5897611",
"0.58959216",
"0.5813223",
"0.57866275",
"0.57601047",
"0.5716977",
"0.5693392",
"0.56861705"... | 0.6172364 | 4 |
Gets all Services registered in OC | def get_services
reply = @client.call(:get_services)
data = reply.body.dig(:get_services_response,
:get_services_result,
:array_of_string)
data = check_if_data_exists(data)
data.map do |attrs|
{
id: Integer(attrs[:string][0], 10),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_services\n @services\n end",
"def services\n @services ||= []\n end",
"def services\n\t\tService.find(:all)\n\tend",
"def services\n return @services\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response... | [
"0.8240226",
"0.79366714",
"0.79132426",
"0.77629167",
"0.7647431",
"0.76406854",
"0.7603967",
"0.7583144",
"0.75645655",
"0.75395924",
"0.75199366",
"0.75156003",
"0.7513447",
"0.74600387",
"0.7376056",
"0.7339032",
"0.72140986",
"0.7201887",
"0.7197502",
"0.71949697",
"0.71... | 0.6964235 | 27 |
Gets the current status of all logged in agents | def get_agent_online_state
reply = @client.call(:get_agent_online_state)
data = reply.body.dig(:get_agent_online_state_response,
:get_agent_online_state_result,
:array_of_string)
data = check_if_data_exists(data)
data.map do |attrs|
{
ag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n self.agent.status\n end",
"def agents_index\n @agents = User.agents\n end",
"def list_all_agents\n url_string=\"http://#{@server_address}:#{@server_port}/agents\"\n url=URI(url_string)\n req = Net::HTTP::Get.new(url)\n res=Net::HTTP.start(url.hostname,url.port) do |http... | [
"0.71438146",
"0.6909027",
"0.67281365",
"0.6718666",
"0.6520585",
"0.64365906",
"0.6285969",
"0.6248997",
"0.6234862",
"0.60731316",
"0.60362434",
"0.6032918",
"0.60003376",
"0.59511167",
"0.58294415",
"0.5766836",
"0.57647467",
"0.57500875",
"0.57420236",
"0.5723162",
"0.57... | 0.5916477 | 14 |
Returns the current state of the queue for all services (and hence all teams) | def get_general_queue
reply = @client.call(:get_general_queue)
data = reply.body.dig(:get_general_queue_response,
:get_general_queue_result,
:array_of_string)
data = check_if_data_exists(data)
data.map do |attrs|
{
service_id: attrs[:str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def states\n peek_state\n if !@state_queue.empty?\n @current_state = @state_queue.last\n @state_queue,old = [],@state_queue\n old\n else\n []\n end\n end",
"def all\n [ACTIVE, PENDING]\n end",
"de... | [
"0.6354742",
"0.6133464",
"0.610641",
"0.6056403",
"0.6044018",
"0.59763527",
"0.5918376",
"0.59110415",
"0.58185345",
"0.5767871",
"0.57615715",
"0.57574135",
"0.5752888",
"0.57279557",
"0.57279557",
"0.57279557",
"0.57279557",
"0.57279557",
"0.5723155",
"0.5719346",
"0.5718... | 0.53754073 | 55 |
Gets all teams currently registered in OC. | def get_teams
reply = @client.call(:get_teams)
data = reply.body.dig(:get_teams_response,
:get_teams_result,
:string)
check_if_data_exists(data)
rescue Savon::HTTPError => error
logger.debug error.http.code
return []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teams\n @teams ||= @api.client.orgs.teams.list(org: @org)\n end",
"def teams(org)\n get \"/orgs/#{org}/teams\"\n end",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def org_teams(org)\n Hardmode.get(\"/orgs/#{org}/teams\", :headers... | [
"0.84055823",
"0.76519996",
"0.76239854",
"0.76217157",
"0.74964625",
"0.73846453",
"0.7324248",
"0.7319956",
"0.7294294",
"0.7183712",
"0.7164756",
"0.70427924",
"0.70201904",
"0.6987938",
"0.69852585",
"0.69771814",
"0.6951672",
"0.69449013",
"0.69130707",
"0.68994856",
"0.... | 0.6843236 | 23 |
finally! a random pair generator written in ruby! | def generate_pairs
students.shuffle.each_slice(2).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_key_pair\n\tg = 2\n\tp = generate_safe_prime(g)\n\td = rand(p)\n\te2 = ModMath.pow(g, d, p)\n\n\tpublic_key = [p, g, e2]\n\tprivate_key = [p, g, d]\n\n\treturn public_key, private_key\nend",
"def random_pairs()\r\n\r\n\tpair_ups = []\r\n\r\n\tnamelist = [\"Allen\", \"Brian\", \"Cummie\", \"Dover\", ... | [
"0.6950033",
"0.69028395",
"0.6739397",
"0.6579195",
"0.65500265",
"0.65286213",
"0.64878696",
"0.6359431",
"0.6237286",
"0.6145161",
"0.61224526",
"0.61219895",
"0.6117232",
"0.61013126",
"0.6063279",
"0.60476923",
"0.6042679",
"0.6028886",
"0.6023866",
"0.6010788",
"0.59944... | 0.7018774 | 0 |
tx_reference identifier payment_reference amount datetime payment_method phone_number | def callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payment_instruction\n end",
"def payment_type\n self.transcation_payment_type\n end",
"def transaction_date\n credit_card_transaction? ? transaction_hash[:transaction_date] : transaction_hash[:date]\n end",
"def payment_sequence\n nil\n end",
"def transaction_id\r\n para... | [
"0.60703063",
"0.6067569",
"0.6052102",
"0.60451424",
"0.6032871",
"0.593614",
"0.5924022",
"0.5916105",
"0.5896675",
"0.5855602",
"0.5778478",
"0.5751851",
"0.57043093",
"0.569314",
"0.56740004",
"0.564912",
"0.56348175",
"0.56348175",
"0.5622235",
"0.5613689",
"0.5613618",
... | 0.0 | -1 |
Valida que la instancia prolog este activa ( que el archivo se haya abierto ) true: si esta activa false: si no esta activa | def validaInstancia
if @prolog == nil then
@textArea.setText("El archivo main debe abrirse\n")
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready_to_create?\n valid? && processed? && import_level_ok?\n end",
"def load_enabled\n DataManager.save_file_exists?\n end",
"def valid_import?\n true\n end",
"def require_activation?\n !self.enabled? and !self.activation_code.blank?\n end",
"def activer\n DBC.require( !acti... | [
"0.63763493",
"0.6240806",
"0.61954564",
"0.6194527",
"0.61803",
"0.61520725",
"0.60942113",
"0.6023018",
"0.5987584",
"0.5961421",
"0.59565806",
"0.59492546",
"0.5947552",
"0.592532",
"0.5914477",
"0.5914477",
"0.5914477",
"0.5914477",
"0.5914284",
"0.59028256",
"0.5883727",... | 0.6914653 | 0 |
Attempt to detect the vcs for specified directory and add mapping as appropriate | def detect_vcs(directory)
if File.exist?("#{directory}/.git")
add_git(directory)
elsif File.exist?("#{directory}/.svn")
add_svn(directory)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_vcr_cassette_in dir\n return if build_cache_link_present_already_expanded?\n\n pid = fork do\n # Remove existing data\n FileUtils.rm_rf Dir.glob(dir.join(\"*\").to_s)\n\n app_route_map = {}\n vcr = YAML.load_file @response_file\n vcr[\"http_interactions\"].e... | [
"0.5368529",
"0.5344487",
"0.520936",
"0.512312",
"0.5006163",
"0.49981543",
"0.49840397",
"0.49426585",
"0.4933042",
"0.4914513",
"0.4913194",
"0.4884551",
"0.48696265",
"0.48613915",
"0.48456973",
"0.48454547",
"0.48451844",
"0.4842376",
"0.4841417",
"0.4828926",
"0.482789"... | 0.61966586 | 0 |
GET /friends or /friends.json | def index
@friends = Friend.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end",
"def friends(options={})\n perform_get(\"statuses/friend... | [
"0.8408616",
"0.778203",
"0.7763323",
"0.7360096",
"0.73198587",
"0.7272554",
"0.72419846",
"0.7235086",
"0.7089949",
"0.70721203",
"0.70650333",
"0.70635736",
"0.6955405",
"0.6935549",
"0.69112444",
"0.688604",
"0.68803215",
"0.6825887",
"0.6804269",
"0.6777998",
"0.6773289"... | 0.60187334 | 98 |
GET /friends/1 or /friends/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_ge... | [
"0.78883326",
"0.7543937",
"0.7474942",
"0.7249145",
"0.72088504",
"0.7143882",
"0.71297807",
"0.7068458",
"0.7065336",
"0.70462793",
"0.7045598",
"0.7010766",
"0.7008273",
"0.6956795",
"0.688041",
"0.6865299",
"0.6859973",
"0.67927325",
"0.67706937",
"0.67576915",
"0.6754076... | 0.0 | -1 |
POST /friends or /friends.json | def create
#@friend = Friend.new(friend_params)
@friend = current_user.friends.build(friend_params)
respond_to do |format|
if @friend.save
format.html { redirect_to @friend, notice: "Friend was successfully created." }
format.json { render :show, status: :created, location: @friend }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2])... | [
"0.69640195",
"0.6908395",
"0.6708779",
"0.6706744",
"0.66924226",
"0.66683054",
"0.6653443",
"0.66467404",
"0.66056013",
"0.6602584",
"0.6577616",
"0.65341544",
"0.65245163",
"0.6522975",
"0.6521179",
"0.65166366",
"0.6514117",
"0.6514117",
"0.6511053",
"0.64773375",
"0.6462... | 0.65071595 | 19 |
PATCH/PUT /friends/1 or /friends/1.json | def update
respond_to do |format|
if @friend.update(friend_params)
format.html { redirect_to @friend, notice: "Friend was successfully updated." }
format.json { render :show, status: :ok, location: @friend }
else
format.html { render :edit, status: :unprocessable_entity }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @friend = Friend.find(params[:id])\n @friend.update_attributes(params[:friend])\n respond_with(@friend)\n end",
"def update\n respond_to do |format|\n if @friends1.update(friends1_params)\n format.html { redirect_to @friends1, notice: \"Friend was successfully updated.\" }\n... | [
"0.7128157",
"0.70867634",
"0.70422626",
"0.7009649",
"0.69825983",
"0.69771075",
"0.69445425",
"0.69445425",
"0.69445425",
"0.69445425",
"0.69445425",
"0.68314767",
"0.6807866",
"0.6721241",
"0.6715154",
"0.67114085",
"0.6699271",
"0.6686838",
"0.66603094",
"0.66603094",
"0.... | 0.69168746 | 12 |
DELETE /friends/1 or /friends/1.json | def destroy
@friend.destroy
respond_to do |format|
format.html { redirect_to friends_url, notice: "Friend was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_friend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \tif @user.friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} deleted!\"\n format.json{render :json => {:message => message, :status => \"200\"... | [
"0.7626809",
"0.75598186",
"0.7505639",
"0.74936897",
"0.7452101",
"0.74432087",
"0.7427582",
"0.74077207",
"0.73825777",
"0.73147696",
"0.7314011",
"0.73099005",
"0.7278816",
"0.7264738",
"0.7258197",
"0.7243976",
"0.7243976",
"0.7240689",
"0.7240689",
"0.72394174",
"0.72084... | 0.72427666 | 18 |
Use callbacks to share common setup or constraints between actions. | def set_friend
@friend = Friend.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 list of trusted parameters through. | def friend_params
params.require(:friend).permit(:first_name, :last_name, :email, :phone, :twitter,:user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
def displayNetwork network_controller = NetworkController.new network_controller.profile = profile self.navigationController.pushViewController(network_controller, animated: true) end | def displayWalletActions
manage_wallet_controller = ManageWalletController.new
manage_wallet_controller.profile = profile
self.navigationController.pushViewController(manage_wallet_controller, animated: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@network = Network.new(user)\n end",
"def create\n @network = Network.new(params[:network])\n @network.owner = current_user.person\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: \"#{t('network')} was successfully created.\" }\n ... | [
"0.68592",
"0.65990275",
"0.6597393",
"0.64395916",
"0.63984007",
"0.6364932",
"0.6337776",
"0.6330778",
"0.6280363",
"0.6274298",
"0.6274298",
"0.6274298",
"0.6274298",
"0.6274298",
"0.62146074",
"0.614245",
"0.6080215",
"0.60665697",
"0.6014611",
"0.6010754",
"0.6004605",
... | 0.7600472 | 0 |
Delegate to the middleware chain of Shelf. | def middleware
Yeah.application.server.middleware
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middleware(&block); end",
"def middleware; end",
"def middleware(&block)\n @@middleware << block\n end",
"def middlewares; end",
"def middleware(&block)\n if block_given?\n self._middleware = block\n end\n end",
"def method_missing(method, *args, &block)\n ... | [
"0.7028663",
"0.68571913",
"0.6564231",
"0.6460875",
"0.6459307",
"0.6447927",
"0.64238334",
"0.6368068",
"0.62268883",
"0.60275835",
"0.5952989",
"0.59166074",
"0.58772177",
"0.58741415",
"0.5825985",
"0.5782037",
"0.5780347",
"0.57415193",
"0.5730275",
"0.5717092",
"0.56773... | 0.5771582 | 17 |
def get_average_age_for_season(data, season) bachelortv.each do |season_number, contestant_data| if season == season_number contestant_data.each do |contestant| age_value = contestant["age"] age_value.to_f total_age_value = age_value.sum total_age_value/(contestant.length) end end end end | def get_average_age_for_season(bachelortv, season)
bachelortv.each do |season_number, contestant_data|
if season == season_number
contestant_data.each do |contestant|
contestant["age"].reduce(0) do |sum|
sum += age
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_age_for_season(data, season)\n age = 0\n count = 0\n data[season].each do |contestant_data|\n age += (contestant_data[\"age\"]).to_f\n count += 1\n end\n (age / count).round\nend",
"def get_average_age_for_season(data, season)\n age_total = 0\n num_of_contestants = 0\n data[season].... | [
"0.94390225",
"0.93227434",
"0.93088037",
"0.9261427",
"0.9184221",
"0.9178375",
"0.91316926",
"0.90815073",
"0.7378176",
"0.70357704",
"0.6776425",
"0.67593986",
"0.6757428",
"0.66097575",
"0.6575671",
"0.64866793",
"0.6482009",
"0.6471215",
"0.6462096",
"0.64605635",
"0.643... | 0.9251566 | 4 |
GET /furdos GET /furdos.json | def index
@furdos = Furdo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n render json: @fiestas\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def index\n @fretes = Fre... | [
"0.65143275",
"0.651118",
"0.63597065",
"0.62866545",
"0.6118117",
"0.6052938",
"0.60382354",
"0.6019527",
"0.5980408",
"0.59477293",
"0.5923789",
"0.59192646",
"0.58965707",
"0.58702683",
"0.586941",
"0.586896",
"0.5858266",
"0.5853503",
"0.5850849",
"0.58441705",
"0.5807354... | 0.65118426 | 1 |
GET /furdos/1 GET /furdos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @furdos = Furdo.all\n end",
"def index\n render json: @fiestas\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: ... | [
"0.6547426",
"0.64493996",
"0.64151925",
"0.63686407",
"0.6251275",
"0.61792",
"0.61609447",
"0.6147692",
"0.6102057",
"0.6043597",
"0.60354483",
"0.60281914",
"0.60241085",
"0.6020129",
"0.6015027",
"0.6005329",
"0.5991784",
"0.5987926",
"0.5974777",
"0.5971916",
"0.5962197"... | 0.0 | -1 |
POST /furdos POST /furdos.json | def create
@furdo = Furdo.new(furdo_params)
respond_to do |format|
if @furdo.save
format.html { redirect_to @furdo, notice: 'Furdo was successfully created.' }
format.json { render :show, status: :created, location: @furdo }
else
format.html { render :new }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def furdo_params\n params.require(:furdo).permit(:client_name, :location)\n end",
"def create\n @fondo = Fondo.new(fondo_params)\n\n respond_to do |format|\n if @fondo.save\n format.html { redirect_to @fondo, notice: 'Fondo was successfully created.' }\n format.json { render :sho... | [
"0.60723686",
"0.60065275",
"0.5797509",
"0.5756666",
"0.56911963",
"0.56581354",
"0.56455123",
"0.5615596",
"0.5600533",
"0.56003404",
"0.5589482",
"0.5552152",
"0.5542789",
"0.5538462",
"0.5533971",
"0.5533371",
"0.5527451",
"0.5527451",
"0.55157954",
"0.551213",
"0.5498501... | 0.68480706 | 0 |
PATCH/PUT /furdos/1 PATCH/PUT /furdos/1.json | def update
respond_to do |format|
if @furdo.update(furdo_params)
format.html { redirect_to @furdo, notice: 'Furdo was successfully updated.' }
format.json { render :show, status: :ok, location: @furdo }
else
format.html { render :edit }
format.json { render json: @furdo.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {}... | [
"0.64685196",
"0.6438949",
"0.64013994",
"0.62037224",
"0.618731",
"0.6183726",
"0.6124882",
"0.611433",
"0.6106233",
"0.60750914",
"0.6049469",
"0.6048176",
"0.6035838",
"0.6019764",
"0.5998167",
"0.5962208",
"0.5961366",
"0.595754",
"0.59338766",
"0.5925923",
"0.5920558",
... | 0.6261096 | 3 |
DELETE /furdos/1 DELETE /furdos/1.json | def destroy
@furdo.destroy
respond_to do |format|
format.html { redirect_to furdos_url, notice: 'Furdo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n re... | [
"0.7045308",
"0.693834",
"0.687411",
"0.6834995",
"0.6774423",
"0.6717474",
"0.67125297",
"0.6683436",
"0.66771847",
"0.6643236",
"0.66361105",
"0.661471",
"0.661471",
"0.661471",
"0.661471",
"0.6614459",
"0.6612219",
"0.6610599",
"0.65962553",
"0.65913606",
"0.6588702",
"0... | 0.685572 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_furdo
@furdo = Furdo.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 furdo_params
params.require(:furdo).permit(:client_name, :location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Convert it to [a1, b1, c1, a2, b2, c2, ..., aN, bN, cN] Returns the index of where the element should actually be placed. i = current_index n = number of elements each series (a1..aN).length | def get_new_idx(i, n)
# I use the number 4 here but it correlates to the number of series.
# For example, I only have "a", "b", "c", and "d" series so I use 4.
(i % 4) * n + (i / 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend... | [
"0.56440276",
"0.5485164",
"0.54579765",
"0.5403344",
"0.53842926",
"0.52981627",
"0.5240184",
"0.51738775",
"0.51677805",
"0.5166791",
"0.5160809",
"0.5159293",
"0.5153996",
"0.51430523",
"0.51089936",
"0.5085676",
"0.5065387",
"0.5060678",
"0.5053362",
"0.50419724",
"0.5019... | 0.5915827 | 0 |
GET /apuntes/1 GET /apuntes/1.json def show end GET /apuntes/new def new | def create
@leccion = Leccion.find(params[:leccion_id])
@apunte = @leccion.apuntes.create(apunte_params)
@apunte.user_id = current_user.id
if @apunte.save
redirect_to @leccion
else
flash.now[:danger] = "error"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @apunte = Apunte.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apunte }\n end\n end",
"def new\n @apuesta_detail = ApuestaDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apue... | [
"0.7471015",
"0.73875517",
"0.73480725",
"0.72779965",
"0.7112024",
"0.71031505",
"0.7101361",
"0.70959014",
"0.7071433",
"0.7071433",
"0.70695525",
"0.7050694",
"0.7022678",
"0.70205283",
"0.70115864",
"0.70085716",
"0.700563",
"0.70013356",
"0.6986566",
"0.6965169",
"0.6953... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_apunte
@apunte = Apunte.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 apunte_params
params.require(:apunte).permit(:content, :leccion_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Returns true if there are no more jobs queued and there is just one working job in the queue (which is this job) | def all_jobs_hve_been_processed?(queue)
(job_count(queue) == 0) && (working_job_count(queue) <= 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_work?\n get_queue_message_count(:job_requests) > 0\n end",
"def completed?\n !self.shift_jobs.empty?\n end",
"def eop?\n @jobs.empty?\n end",
"def has_job_progress?\n !job_progress_queue.empty?\n end",
"def busy?\n\n @queue.size > 0\n end",
"... | [
"0.7885282",
"0.77535725",
"0.7681815",
"0.7664034",
"0.76550174",
"0.76491904",
"0.7647446",
"0.7583457",
"0.7515779",
"0.7457014",
"0.7416263",
"0.7401085",
"0.73865646",
"0.7386508",
"0.72961015",
"0.72883165",
"0.7283126",
"0.72817665",
"0.7279658",
"0.72751695",
"0.72668... | 0.83299166 | 0 |
ITEM GETTER & SETTER | def get_item_value(key)
@attributes[key] = get_item_record(key) unless @attributes.has_key?(key)
@attributes[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item; @item; end",
"def item; @item; end",
"def item=(item)\n @item = item\n end",
"def item;\n @item;\n end",
"def item; end",
"def item; end",
"def item; end",
"def item; end",
"def item; end",
"def item=(i)\n\t\t@item = i\n\tend",
"def item\n self.properties\n end",
"def se... | [
"0.7612347",
"0.7612347",
"0.7471119",
"0.7378371",
"0.7340473",
"0.7340473",
"0.73403883",
"0.73403883",
"0.73403883",
"0.68511397",
"0.67757314",
"0.6734398",
"0.6618111",
"0.649852",
"0.6401422",
"0.63905776",
"0.6341111",
"0.6320159",
"0.6309969",
"0.6309969",
"0.62928885... | 0.0 | -1 |
redefine your position_taken? method here, so that you can use it in the valid_move? method above. | def position_taken?(board, index)
if (board[index] == "" || board[index] == nil || board[index] == " " )
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def position_taken?\nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n # re-define your #position_taken? method here, so that you can use it in the #v... | [
"0.8409533",
"0.8161412",
"0.80915326",
"0.802741",
"0.80150443",
"0.78980684",
"0.7893883",
"0.7886275",
"0.78447807",
"0.7843449",
"0.7831682",
"0.78148174",
"0.7813732",
"0.7810363",
"0.78020334",
"0.7801113",
"0.7800951",
"0.7789361",
"0.7782831",
"0.777421",
"0.7774137",... | 0.0 | -1 |
GET / The default dashboard | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n\n end",
"def dashboard\n\n end",
"def dashboard\r\n end",
"def dashboard\n self.root\n self.follow('dtime:dashboard')\n self.get\n self\n ... | [
"0.7898819",
"0.7898819",
"0.7898819",
"0.7898819",
"0.7898819",
"0.7838187",
"0.7838187",
"0.78127605",
"0.7721168",
"0.7721037",
"0.7570319",
"0.74804115",
"0.7442911",
"0.7339518",
"0.72607857",
"0.7235975",
"0.7224238",
"0.71758556",
"0.71447587",
"0.7139428",
"0.711789",... | 0.0 | -1 |
Limit should reset every 30 days, starting on day of account creation | def set_upload_limit_reset_date
now = DateTime.now
reset_date = now + 30
self.upload_limit_resets_at = reset_date
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_limit_reset_for(account)\n @task_manager.in '1d' do\n account.reset_limit\n end\n end",
"def expiration\n @expiration ||= 60 * 60 * 24 * 30 # 30 days\n end",
"def usage_reset_day\n self.upload_limit_resets_at.strftime(\"%A, %B %e, %Y\")\n end",
"def reset_password_period_valid?; ... | [
"0.69325906",
"0.6266623",
"0.60932314",
"0.5986049",
"0.59350866",
"0.589723",
"0.58769196",
"0.58769196",
"0.58445275",
"0.57878584",
"0.5752404",
"0.5741317",
"0.5731356",
"0.56837934",
"0.5682006",
"0.5677127",
"0.5670475",
"0.5655345",
"0.5619526",
"0.56165904",
"0.56102... | 0.7157258 | 0 |
Called when user uploads new files so we can keep track of limits | def record_new_upload_size(bytes)
self.upload_size_this_month = self.upload_size_this_month + bytes
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_limit_reached?\n self.uploads.sum(:file_file_size) > UPLOAD_LIMIT\n end",
"def max_files; end",
"def check_file_size\n if document && document.file && document.file.size.to_f > self.class::UPLOAD_LIMIT\n errors.add(:document, \"You cannot upload a document greater than #{Filesize.from(se... | [
"0.6529262",
"0.6316389",
"0.6228271",
"0.6125129",
"0.61197495",
"0.60798836",
"0.6046864",
"0.6026274",
"0.6026151",
"0.59993607",
"0.5946067",
"0.59435344",
"0.59005105",
"0.5881561",
"0.58800554",
"0.58473235",
"0.58238405",
"0.58238405",
"0.58117867",
"0.5794328",
"0.578... | 0.57308036 | 22 |
Called to check if user exceeds monthly upload limit, with option to pass in an extra byte count | def exceeds_upload_limit?(attempted_bytes=0)
self.upload_size_this_month + attempted_bytes >= Rails.application.secrets.monthly_upload_byte_limit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_limit_reached?\n self.uploads.sum(:file_file_size) > UPLOAD_LIMIT\n end",
"def check_file_size\n if document && document.file && document.file.size.to_f > self.class::UPLOAD_LIMIT\n errors.add(:document, \"You cannot upload a document greater than #{Filesize.from(self.class::UPLOAD_LIMIT.t... | [
"0.6861171",
"0.6589997",
"0.6435688",
"0.6404441",
"0.63645816",
"0.6237182",
"0.61882204",
"0.6158263",
"0.61435735",
"0.6113538",
"0.61006725",
"0.6073173",
"0.59894156",
"0.59825677",
"0.5965628",
"0.5961257",
"0.5959034",
"0.5935221",
"0.59234625",
"0.5910143",
"0.590878... | 0.8022083 | 0 |
May be better in a helper | def upload_usage_percent
((self.upload_size_this_month.to_f / Rails.application.secrets.monthly_upload_byte_limit.to_f)*100).to_i.to_s + "%"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def private; end",
"def formation; end",
"def suivre; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def who_we_are\r\n end",
"def common\n \n end",
"def probers; end"... | [
"0.646308",
"0.646308",
"0.646308",
"0.63261336",
"0.5923771",
"0.58875406",
"0.58305293",
"0.58305293",
"0.58305293",
"0.58305293",
"0.57295644",
"0.5674205",
"0.56367505",
"0.56207824",
"0.5574143",
"0.5574143",
"0.54803544",
"0.5392741",
"0.5392741",
"0.5381656",
"0.535430... | 0.0 | -1 |
May be better in a helper | def upload_usage_fraction
# Show in megabytes
used = (self.upload_size_this_month.to_f / 1024.0 / 1024.0).round(2).to_s
limit = (Rails.application.secrets.monthly_upload_byte_limit / 1024 / 1024).to_s
"#{used} MB / #{limit} <span title='megabytes'>MB</span>".html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def private; end",
"def formation; end",
"def suivre; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def who_we_are\r\n end",
"def common\n \n end",
"def probers; end"... | [
"0.646308",
"0.646308",
"0.646308",
"0.63261336",
"0.5923771",
"0.58875406",
"0.58305293",
"0.58305293",
"0.58305293",
"0.58305293",
"0.57295644",
"0.5674205",
"0.56367505",
"0.56207824",
"0.5574143",
"0.5574143",
"0.54803544",
"0.5392741",
"0.5392741",
"0.5381656",
"0.535430... | 0.0 | -1 |
May be better in a helper | def usage_reset_day
self.upload_limit_resets_at.strftime("%A, %B %e, %Y")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def private; end",
"def formation; end",
"def suivre; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def who_we_are\r\n end",
"def common\n \n end",
"def probers; end"... | [
"0.646308",
"0.646308",
"0.646308",
"0.63261336",
"0.5923771",
"0.58875406",
"0.58305293",
"0.58305293",
"0.58305293",
"0.58305293",
"0.57295644",
"0.5674205",
"0.56367505",
"0.56207824",
"0.5574143",
"0.5574143",
"0.54803544",
"0.5392741",
"0.5392741",
"0.5381656",
"0.535430... | 0.0 | -1 |
if it's just one article, the url is the same except it's not html otherwise we use the permalink template with some placeholder | def url
@url ||= if single_post?
single_post.url.gsub(/\.html$/, ".#{@format}")
else
URL.new({
template: @config['bundle_permalink'],
placeholders: url_placeholders,
permalink: nil }).to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permalink(item)\n url = url_for(item)\n url.gsub!(/\\.html$/, '') #if url[0].chr == \"/\"\n \n return url\n end",
"def url\n return permalink if permalink\n\n @url ||= (ext == '.html') ? template.gsub(':name', basename) : \"/#{name}\"\n end",
"def url_template\n @url_template... | [
"0.74871373",
"0.7201123",
"0.69816685",
"0.6801292",
"0.6801292",
"0.67576283",
"0.6713992",
"0.6636252",
"0.6635807",
"0.65819377",
"0.6580197",
"0.6527159",
"0.6525259",
"0.6508501",
"0.6472811",
"0.6364523",
"0.6332674",
"0.6316517",
"0.6298476",
"0.6277338",
"0.62651813"... | 0.6837431 | 3 |
adds post metadata as yaml metadata | def yaml_metadata
if single_post?
# if we were to merge config to data, the default options would
# take precedence
data = Jekyll::Utils.deep_merge_hashes @config, single_post.data
single_post.merge_data! data
# we extract the excerpt because it serializes as an object a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_post(path, metadata, content = nil)\n File.open(path, 'w') do |f|\n f.puts metadata.to_yaml\n f.puts '---'\n f.puts content\n end\nend",
"def read_post(path)\n chunks = IO.read(path).split(/^---\\s*$/)\n\n metadata = YAML.load(\"---\\n\" + chunks[1])\n\n [metadata, chunks[2]]\nend",
"de... | [
"0.69047254",
"0.63895494",
"0.63852304",
"0.61554176",
"0.6061501",
"0.6042871",
"0.59315777",
"0.5920667",
"0.59092623",
"0.58972067",
"0.5886295",
"0.5851221",
"0.5844354",
"0.5809172",
"0.5807171",
"0.58071315",
"0.57975376",
"0.57729805",
"0.5730915",
"0.57281935",
"0.57... | 0.7306084 | 0 |
Returns a cover, without checking if it exists It assumes covers are in PNG format | def cover
cover_path = [ @site.config['source'] ]
if single_post? && single_post.data['cover']
cover_path << single_post.data['cover']
elsif site_lang?
cover_path << @config['covers_dir']
cover_path << site_lang
cover_path << "#{@slug}.png"
else
cover_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover\n pictures.find_by_cover(true) or pictures.first\n end",
"def extract_cover(replace_cover=true)\n if cover && !replace_cover\n return false\n end\n return false if tracks.empty?\n if full_path = tracks.first.extract_cover\n self.cover = File.basename(full_path)\n self.thu... | [
"0.75566274",
"0.74880016",
"0.7052893",
"0.7027194",
"0.7000398",
"0.6911632",
"0.6898967",
"0.6751232",
"0.6713361",
"0.66899604",
"0.6645905",
"0.6567836",
"0.65412146",
"0.65127265",
"0.6441794",
"0.64123344",
"0.639",
"0.632951",
"0.62568873",
"0.6236026",
"0.61852175",
... | 0.6342474 | 17 |
Returns a PDF cover | def pdf_cover
cover.gsub(/\.[^\.]+\Z/, '.pdf')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf_cover(quality, resolution)\n options = { quality: quality, resolution: resolution }.compact\n converted_file = PdfCover::Converter.new(file, options).converted_file\n FileUtils.cp(converted_file, current_path)\n end",
"def show\n @cover = Cover.find(params[:id])\n\n respond_to do |format|... | [
"0.74308294",
"0.71295017",
"0.6957025",
"0.6734812",
"0.65965784",
"0.6566639",
"0.6326594",
"0.6127201",
"0.6062171",
"0.60566336",
"0.6037465",
"0.60330147",
"0.60254854",
"0.6021871",
"0.59991074",
"0.59840876",
"0.597942",
"0.5960578",
"0.59238255",
"0.59016335",
"0.5900... | 0.78067267 | 0 |
These formats are binary files and must use the o flag | def binary?
%w[pdf epub epub3 odt docx].include? @format
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n ... | [
"0.66478467",
"0.632754",
"0.6116023",
"0.6074161",
"0.59323543",
"0.5932142",
"0.58592176",
"0.5819981",
"0.5819981",
"0.57726264",
"0.5753859",
"0.5748334",
"0.57409",
"0.5689189",
"0.5657215",
"0.56374854",
"0.56374854",
"0.56374854",
"0.5598275",
"0.55929065",
"0.5586914"... | 0.6096248 | 3 |
Finds the source files for this pandoc file | def sources
return @sources if @sources
@sources = ['_config.yml']
@sources << flags.split(' ').map do |flag|
file = File.join(@site.config['source'], flag.split('=').last)
file if File.exist? file
end
@sources << posts.map(&:path)
@sources = @sources.flatten.compa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scann... | [
"0.69425446",
"0.6777647",
"0.6666688",
"0.653539",
"0.6523546",
"0.6470788",
"0.64462245",
"0.64388686",
"0.6289013",
"0.6235276",
"0.61841136",
"0.6139673",
"0.6130313",
"0.6107942",
"0.60787535",
"0.60578096",
"0.60511345",
"0.6034605",
"0.6022242",
"0.5987509",
"0.5987509... | 0.0 | -1 |
=begin Returns the class_hierachy To fetch all Vertices: class_hieararchy(base_class: 'V').flatten To fetch all Edges: class_hierarchy(base_class: 'E').flatten notice: To retrieve the class hierarchy from Objects avoid calling `ORD.classname (obj)`, because it depends on class_hierarchy. =end | def class_hierarchy base_class: '', system_classes: nil
# @actual_class_hash = get_classes('name', 'superClass') #if requery || @all_classes.blank?
fv = ->( s ) { @actual_class_hash.find_all{|x| x['superClass']== s}.map{|v| v['name']} }
fx = ->( v ) { fv[v.strip].map{|x| ar = fx[x]; ar.empty? ? x : [x, ar]} }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_hierarchy\n @class_hierarchy ||= process_ontology_hierarchy\n end",
"def flatten_hierarchy c=self\n result = [c]\n c.subclasses.each do |s|\n result += flatten_hierarchy(s)\n end\n result\n end",
"def ancestors_of klass\n ancestors = []\n un... | [
"0.6222121",
"0.60980654",
"0.5816095",
"0.580237",
"0.5794296",
"0.5750706",
"0.57228744",
"0.5680325",
"0.5652331",
"0.56362385",
"0.56158084",
"0.5593891",
"0.55863553",
"0.5563853",
"0.55599767",
"0.5534007",
"0.5502293",
"0.54945135",
"0.54876524",
"0.54377663",
"0.54343... | 0.64417315 | 0 |
=begin Returns an array with all names of the classes of the database. | def database_classes system_classes: nil
@actual_class_hash = get_classes('name', 'superClass')
all_classes = get_classes('name').map(&:values).sort.flatten
all_user_classes = all_classes - system_classes()
all_user_classes.each{|x| ActiveOrient.database_classes[x] = "unset" unless ActiveOrient.databas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_names\n classes.map &:name\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes\n end",
"def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end",
"def sc_all_classes()\n... | [
"0.7286335",
"0.7169682",
"0.7169682",
"0.7144781",
"0.7097559",
"0.7072676",
"0.69682246",
"0.6965823",
"0.6919112",
"0.6890828",
"0.68309605",
"0.6785022",
"0.66797686",
"0.6657727",
"0.6588744",
"0.657951",
"0.6551428",
"0.6538149",
"0.6530138",
"0.6512214",
"0.6469566",
... | 0.78648216 | 0 |
=begin ServiceMethod for ModelOrientdbClass =end | def get_db_superclass name #:nodoc:
# @actual_class_hash = get_classes( 'name', 'superClass') if @actual_class_hash.nil?
z= @actual_class_hash.find{|x,y| x['name'] == name.to_s }
z['superClass'] unless z.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def couchrest_model\n ## TODO - deprecate this method\n return if self.term.nil? || instance_database.nil? || self.vocabulary.nil?\n \n write_attribute(:instance_class_name, self.term.singularize.camelize)\n\n if Object.const_defined?(self.instance_class_name.intern)\n klass = Object.const_get(... | [
"0.67955863",
"0.67378235",
"0.66239756",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.66164225",
"0.64804953",
"0.6409669",
"0.6404233",
"0.6395648",
"0.6395648",
"0.6228718",
"0.6228718",
"0... | 0.0 | -1 |
GET /planpagos/1 GET /planpagos/1.xml | def show
@planpago = Planpago.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @planpago }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @planodepagamento = Planodepagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @planodepagamento }\n end\n end",
"def index\n @pagos = Pago.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.69061327",
"0.686524",
"0.6841246",
"0.6824158",
"0.6723234",
"0.6601867",
"0.6561451",
"0.6523934",
"0.65037495",
"0.64760154",
"0.647016",
"0.64526486",
"0.64350384",
"0.63845664",
"0.63661283",
"0.63557994",
"0.6333862",
"0.63334453",
"0.63279873",
"0.63195074",
"0.6298... | 0.7104167 | 0 |
GET /planpagos/new GET /planpagos/new.xml | def new
@planpago = Planpago.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @planpago }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @planodepagamento = Planodepagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @planodepagamento }\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { r... | [
"0.7551637",
"0.7426723",
"0.74121726",
"0.74070626",
"0.73885703",
"0.73692626",
"0.73665625",
"0.7329699",
"0.732326",
"0.7305991",
"0.72938204",
"0.7261735",
"0.7253636",
"0.7248411",
"0.7220658",
"0.7216388",
"0.72087616",
"0.7208291",
"0.72071946",
"0.72071946",
"0.72071... | 0.7741638 | 0 |
POST /planpagos POST /planpagos.xml | def create
@planpago = Planpago.new(params[:planpago])
respond_to do |format|
if @planpago.save
flash[:notice] = 'Planpago was successfully created.'
format.html { redirect_to(@planpago) }
format.xml { render :xml => @planpago, :status => :created, :location => @planpago }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @planodepagamento = Planodepagamento.new(params[:planodepagamento])\n\n respond_to do |format|\n if @planodepagamento.save\n flash[:notice] = 'Planodepagamento was successfully created.'\n format.html { redirect_to(@planodepagamento) }\n format.xml { render :xml => @pl... | [
"0.6544568",
"0.64280564",
"0.5963985",
"0.5905185",
"0.58469707",
"0.5846334",
"0.58371216",
"0.5750205",
"0.5711397",
"0.5692895",
"0.56789595",
"0.5673142",
"0.5670084",
"0.5650371",
"0.563941",
"0.56312335",
"0.556018",
"0.5552053",
"0.55486715",
"0.55468196",
"0.55458474... | 0.65261364 | 1 |
PUT /planpagos/1 PUT /planpagos/1.xml | def update
@planpago = Planpago.find(params[:id])
respond_to do |format|
if @planpago.update_attributes(params[:planpago])
flash[:notice] = 'Planpago was successfully updated.'
format.html { redirect_to(@planpago) }
format.xml { head :ok }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @planodepagamento = Planodepagamento.find(params[:id])\n\n respond_to do |format|\n if @planodepagamento.update_attributes(params[:planodepagamento])\n ... | [
"0.64344496",
"0.61416817",
"0.59411573",
"0.5939971",
"0.5920311",
"0.5916663",
"0.5901735",
"0.5846386",
"0.58287805",
"0.5774",
"0.5663379",
"0.56310385",
"0.5630369",
"0.5628431",
"0.56251156",
"0.560684",
"0.56031287",
"0.55885017",
"0.5584187",
"0.5558762",
"0.5557944",... | 0.63547194 | 1 |
DELETE /planpagos/1 DELETE /planpagos/1.xml | def destroy
@planpago = Planpago.find(params[:id])
@planpago.destroy
respond_to do |format|
format.html { redirect_to(planpagos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @planodepagamento = Planodepagamento.find(params[:id])\n @planodepagamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(planosdepagamento_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n ... | [
"0.6984507",
"0.6848798",
"0.68191427",
"0.6795317",
"0.67889565",
"0.6786699",
"0.6773207",
"0.6743974",
"0.67377806",
"0.67239845",
"0.671033",
"0.6709161",
"0.6701239",
"0.6689097",
"0.667217",
"0.66616976",
"0.66428804",
"0.6635305",
"0.6620682",
"0.6616394",
"0.660033",
... | 0.7098147 | 0 |
Initialize a new Client object | def initialize(attrs={})
attrs = FCS.options.merge(attrs)
Config::VALID_OPTIONS_KEYS.each do |key|
instance_variable_set("@#{key}".to_sym, attrs[key])
end
connect if @auto_connect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t self.client=client\n end",
"def initialize(client)\n self.client=client\n\n\tend",
"def init_client; end",
"def initialize(client)\n @client = client\n ... | [
"0.8160659",
"0.8160659",
"0.811145",
"0.8038365",
"0.80216956",
"0.79558086",
"0.7929323",
"0.7844545",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
"0.782658",
... | 0.0 | -1 |
Delgate api call to Request | def method_missing(method, *args, &block)
klass = class_for_api_command(method)
return klass.new(@socket).send(method, *args, &block) if klass
super(method, *args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend",
"def deleteRequest\n\n end",
"def APICall params = {}\n \n path = params[:path]\n method = params[:method] || 'GET'\n payload = params... | [
"0.6840533",
"0.67026514",
"0.65985495",
"0.6516424",
"0.6402",
"0.638067",
"0.63140976",
"0.63083345",
"0.6300281",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62286335",
"0.62... | 0.0 | -1 |
Step 1: Working with Arrays and Hashes Copy your solution from conditional_teddit.rb. | def greeting
puts "Welcome to teedit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_flash(n)\nhash = Hash[\n'&','name: Set Intersection---Returns a new array\ncontaining elements common to the two arrays, with no duplicates.\n\n [ 1, 1, 3, 5 ] _____ [ 1, 2, 3 ] #=> [ 1, 3 ]' ,\n'*','name: Repetition---With a String argument, equivalent to\nself.join(str). Otherwise, returns a new arra... | [
"0.568844",
"0.563214",
"0.5607857",
"0.54557663",
"0.54066986",
"0.53942376",
"0.5345433",
"0.53453714",
"0.53156406",
"0.529669",
"0.5282175",
"0.5265526",
"0.52612454",
"0.5237712",
"0.5198244",
"0.5171596",
"0.51424336",
"0.5131333",
"0.51292825",
"0.5126655",
"0.51208824... | 0.0 | -1 |
Users enter the story as they do now, but it gets put in a hash instead. | def story_hash(story, upvotes, category) # Defines a method called "story_hash" with the value of "names"
hash = { story: story, upvotes: upvotes, category: category }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def story\n\t @story_hash = {\n\t\t\t\"start\" => \"You are in a junk store in South America, when you stumble upon the journal of Sir Reginald Higginbotham, the famous explorer, who disappeared many years ago, searching for the lost treasure of Z. Sir Reginald was last seen in this very town, and what happened ... | [
"0.6367694",
"0.63074976",
"0.6030929",
"0.592734",
"0.5811965",
"0.57778966",
"0.5776396",
"0.5730304",
"0.5685083",
"0.5668375",
"0.5641388",
"0.5638074",
"0.55993223",
"0.5599104",
"0.5591796",
"0.5580256",
"0.55537295",
"0.55310357",
"0.5525973",
"0.5519409",
"0.551472",
... | 0.5572365 | 16 |
GET /items GET /items.json | def index
@item = current_owner.items.new
@items = current_owner.items.by_name
@departments = current_owner.departments.by_name
@order_item = OrderItem.new
@items_by_concern = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def index\n @items =... | [
"0.79562956",
"0.7546286",
"0.74375594",
"0.7434485",
"0.73975587",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7357372",
"0.7313286",
"0.73129123",
"0.7311041",
"0.7306297",
"0.7281173",
"0.7273615",
"0.72629416",
"0.72484964",
"0.72301924",
"0.71767205",
"0.71181... | 0.0 | -1 |
POST /items POST /items.json | def create
@item = current_owner.items.new(item_params)
respond_to do |format|
if @item.save
format.html { redirect_to items_path, notice: 'Item was created successfully' }
format.json { render :show, status: :created, location: items_path }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { ... | [
"0.7971939",
"0.7285761",
"0.7231758",
"0.721958",
"0.71792215",
"0.71131957",
"0.7062943",
"0.7053179",
"0.6988855",
"0.69712186",
"0.6903009",
"0.6871792",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6839645",
"0.68317765",
... | 0.68806237 | 11 |
PATCH/PUT /items/1 PATCH/PUT /items/1.json | def update
respond_to do |format|
if @item.update(item_params)
format.html { redirect_to items_path, notice: 'Item was updated successfully' }
format.json { render :show, status: :ok, location: items_path }
else
format.html { render :edit }
format.json { render json: @ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n\n #update the item of request_item\n if (par... | [
"0.7442021",
"0.71437544",
"0.7139624",
"0.70251447",
"0.70026696",
"0.69958323",
"0.6980672",
"0.69373846",
"0.69218457",
"0.68723136",
"0.6832834",
"0.68177253",
"0.6805765",
"0.6805765",
"0.6794939",
"0.67887527",
"0.67887527",
"0.67887527",
"0.67887527",
"0.67887527",
"0.... | 0.66516906 | 49 |
DELETE /items/1 DELETE /items/1.json | def destroy
@item.destroy
respond_to do |format|
format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @item = Item.find(params[:id... | [
"0.7906849",
"0.76885504",
"0.7604411",
"0.7585917",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.7547388",
"0.7539847",
"0.7528851",
... | 0.7227808 | 51 |
Use callbacks to share common setup or constraints between actions. | def set_item
@item = current_owner.items.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 item_params
params.require(:item).permit(:name, :department_id, order_item_ids: [], assembly_item_ids: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /egc_server_types GET /egc_server_types.json | def index
@egc_server_types = EgcServerType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_types\n get_info :service_types\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def types\n @types ||= Types.new(@client)\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n ... | [
"0.6545588",
"0.64829814",
"0.63688517",
"0.63336205",
"0.6254579",
"0.6183304",
"0.6180425",
"0.615308",
"0.6144544",
"0.6131827",
"0.61118346",
"0.60942185",
"0.60716957",
"0.6069542",
"0.6069044",
"0.60477555",
"0.6003519",
"0.6003519",
"0.59930104",
"0.59787726",
"0.59494... | 0.7684167 | 0 |
GET /egc_server_types/1 GET /egc_server_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @egc_server_types = EgcServerType.all\n end",
"def server_type\n super\n end",
"def set_egc_server_type\n @egc_server_type = EgcServerType.find(params[:id])\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/... | [
"0.7430905",
"0.6572559",
"0.6270081",
"0.6129012",
"0.60991657",
"0.60632086",
"0.6054511",
"0.6033808",
"0.6013487",
"0.6004919",
"0.599579",
"0.59803843",
"0.59502",
"0.59502",
"0.5945225",
"0.5936051",
"0.5935833",
"0.593575",
"0.5917485",
"0.5917485",
"0.58887124",
"0.... | 0.0 | -1 |
POST /egc_server_types POST /egc_server_types.json | def create
@egc_server_type = EgcServerType.new(egc_server_type_params)
respond_to do |format|
if @egc_server_type.save
format.html { redirect_to @egc_server_type, notice: 'Egc server type was successfully created.' }
format.json { render :show, status: :created, location: @egc_server_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @egc_server_types = EgcServerType.all\n end",
"def egc_server_type_params\n params.require(:egc_server_type).permit(:name, :description, :quote_request_item_server_id)\n end",
"def set_server_type(opts)\n opts = check_params(opts,[:types])\n super(opts)\n end",
"def serve... | [
"0.65649927",
"0.6543661",
"0.6199694",
"0.6173643",
"0.61040616",
"0.60501796",
"0.5927063",
"0.5927063",
"0.5837045",
"0.5837045",
"0.575639",
"0.56877315",
"0.5597711",
"0.55889696",
"0.55859315",
"0.5573422",
"0.55727977",
"0.55670655",
"0.556248",
"0.5561061",
"0.5520676... | 0.6800004 | 0 |
PATCH/PUT /egc_server_types/1 PATCH/PUT /egc_server_types/1.json | def update
respond_to do |format|
if @egc_server_type.update(egc_server_type_params)
format.html { redirect_to @egc_server_type, notice: 'Egc server type was successfully updated.' }
format.json { render :show, status: :ok, location: @egc_server_type }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n if @server.update_attributes(params[:server])\n @server.send_update\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json... | [
"0.6285604",
"0.62635005",
"0.62394196",
"0.6230344",
"0.6168445",
"0.61035126",
"0.60589653",
"0.6023042",
"0.60131377",
"0.60131377",
"0.60131377",
"0.59834266",
"0.5981812",
"0.59638494",
"0.5933165",
"0.59233576",
"0.592097",
"0.5900005",
"0.5881862",
"0.586644",
"0.58316... | 0.73111284 | 0 |
DELETE /egc_server_types/1 DELETE /egc_server_types/1.json | def destroy
@egc_server_type.destroy
respond_to do |format|
format.html { redirect_to egc_server_types_url, notice: 'Egc server type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n ... | [
"0.70647615",
"0.68979204",
"0.67224586",
"0.66942126",
"0.66687435",
"0.6602642",
"0.65488017",
"0.6532904",
"0.6522239",
"0.65204483",
"0.6519448",
"0.6514071",
"0.6505486",
"0.6495781",
"0.6488555",
"0.6469825",
"0.6465594",
"0.64508927",
"0.64465827",
"0.64305687",
"0.643... | 0.76963115 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_egc_server_type
@egc_server_type = EgcServerType.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 egc_server_type_params
params.require(:egc_server_type).permit(:name, :description, :quote_request_item_server_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Completes SCA authentication successfully | def complete_stripe_sca
find_sca_frame do
click_on "Complete authentication"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authentication_succeed(oidresp)\n end",
"def ssl_handshake_completed\n auth_data = {\n api_key: client.api_key,\n instance: client.instance_name,\n 'user-agent' => \"syncano-ruby-#{Syncano::VERSION}\"\n }\n\n auth_data[:auth_key] = client.auth_key if client.auth_key.prese... | [
"0.59770536",
"0.5842772",
"0.5779581",
"0.5760293",
"0.55724984",
"0.5568296",
"0.55601585",
"0.5546243",
"0.5512192",
"0.5444879",
"0.54412127",
"0.54189426",
"0.53937",
"0.5352663",
"0.5294474",
"0.5290371",
"0.52842313",
"0.5272148",
"0.5236213",
"0.52332246",
"0.5199287"... | 0.61981213 | 0 |
Generic helper for finding an iframe | def find_frame(selector, &block)
using_wait_time(7) do
frame = find(selector)
within_frame(frame) do
block.call
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_iframeid\r\n storeHtmlSource = @driver.page_source\r\n storeHtmlSource2 = storeHtmlSource.gsub(/frameborder=\"0\" /, '')\r\n index = storeHtmlSource2.to_s.match(/iframe id=\"[a-z]+[0-9]+\"/)\r\n @iframe = index[0].match(/[a-z]+[0-9]+/)\r\n end",
"def iframe(name, iframe_class, *find_args)... | [
"0.74124044",
"0.7146924",
"0.70413995",
"0.6734063",
"0.6628261",
"0.6603752",
"0.6543734",
"0.6408439",
"0.63655734",
"0.6311965",
"0.6311965",
"0.629203",
"0.61783063",
"0.6049078",
"0.5851745",
"0.57582855",
"0.57534605",
"0.56812835",
"0.56649727",
"0.56534296",
"0.56426... | 0.5716828 | 17 |
Creates a function that takes 1 argument then returns the values of the functions variables | def secret_formula(started)
jelly_beans = started * 500
jars = jelly_beans / 1000
crates = jars / 100
return jelly_beans, jars, crates
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def function(*args)\n Function.new(self, *args)\n end",
"def function(*args)\n Function.new(self, *args)\n end",
"def function(*code)\n Function.new(*code)\nend",
"def process_defn(exp)\n make_function exp\n end",
"def visitFunction func,args=nil\n type=func.type.accept(se... | [
"0.6432033",
"0.6432033",
"0.6294791",
"0.6120237",
"0.60454476",
"0.59691",
"0.59305626",
"0.5926404",
"0.5838245",
"0.5819412",
"0.5808625",
"0.5800562",
"0.57812655",
"0.5770028",
"0.5750522",
"0.5748865",
"0.57309186",
"0.568808",
"0.5674965",
"0.564104",
"0.56274104",
... | 0.0 | -1 |
Closes all client connections, both ingress and egress. | def close_connections
@connections.values.each(&:close)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_client_connections\n @pending_data.each_key(&:close)\n @pending_data.clear\n end",
"def close\n @clients.each { |c| c.reset(); c.close() } if @clients\n end",
"def close_all\n @connections.close_all\n end",
"def close\n\t\t\t@clients.map(... | [
"0.7616962",
"0.7571399",
"0.7377835",
"0.7156395",
"0.6887004",
"0.68066734",
"0.68066734",
"0.6526977",
"0.65186125",
"0.6509758",
"0.64442503",
"0.64268124",
"0.6392329",
"0.63833654",
"0.6378604",
"0.6342428",
"0.6336807",
"0.6336807",
"0.6333852",
"0.6333852",
"0.6193483... | 0.69963014 | 4 |
Retrieve ARV pill count for patient on a given visit NOTE: The visit object seems to always have pill count not set although the actual pill counts are available as observations. | def number_of_arvs_given(patient_id, visit_date)
obs = EmastercardDb.find_all_observations_by_encounter(patient_id,
Emastercard::Concepts::ARVS_DISPENSED,
Emastercard::Encounters::... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patient_last_drugs_pill_count(patient, ref_date, program_id: nil)\n program = Program.find(program_id) if program_id\n concept_name = ConceptName.find_by_name('Number of tablets brought to clinic')\n optimize_concept = ConceptName.find_by_name('Appointment type')\n return [] if program.blank?\n\n ... | [
"0.5844951",
"0.5609924",
"0.5421505",
"0.52287763",
"0.52107555",
"0.5199946",
"0.5199946",
"0.5137201",
"0.5124828",
"0.5044812",
"0.49954394",
"0.4989211",
"0.49787453",
"0.49716204",
"0.49651957",
"0.49528745",
"0.4857892",
"0.48415136",
"0.48343724",
"0.48147577",
"0.480... | 0.59259677 | 0 |
Calculates the expected remaining number of ARVs prescribed on initial_visit as of current_visit. | def expected_remaining_arvs(drug_daily_dose, arvs_given_on_initial_visit,
previous_visit_date, current_visit_date)
number_of_days_elapsed = days_between(previous_visit_date, current_visit_date)
arvs_given_on_initial_visit - (drug_daily_dose * number_of_days_elapse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_iterations\n (remaining_points.to_f / estimated_velocity.to_f).ceil\n end",
"def accepted_points\n total_points - remaining_points\n end",
"def expected\n\t\t\tBigDecimal(@count) * ((@sides + 1.0) / 2.0)\n\t\tend",
"def calculate_views_count\n self.visits.count.to_i\n ... | [
"0.6275304",
"0.54179406",
"0.54077494",
"0.5389412",
"0.5369933",
"0.5369459",
"0.5359909",
"0.53425074",
"0.5322097",
"0.5311248",
"0.5308556",
"0.53031456",
"0.5295394",
"0.5293847",
"0.528458",
"0.52417856",
"0.5233182",
"0.51992863",
"0.51891017",
"0.5188871",
"0.5156644... | 0.7382953 | 0 |
Returns total number of `regimen` pills to be taken everyday by patient of given weight. | def find_arvs_daily_dose(drug_id, weight)
dose = Treatment.find_arv_dose(drug_id, weight)
unless dose
LOGGER.warn("Could find dose for drug ##{drug_id}")
return 0
end
dose[:am] + dose[:pm]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_person\n (total_bill / @party_size).ceil.to_i\n end",
"def count_total()\n self.regulatory_elements.count\n end",
"def weight_watchers(hash)\n calories_count = 0\n hash.each do |k, v|\n calories_count = v * CALORIES[k] + calories_count\n end\n return calories_count\nend",
"def total_... | [
"0.58897454",
"0.58035815",
"0.57242286",
"0.5638169",
"0.5637968",
"0.5621485",
"0.56108356",
"0.5543745",
"0.54855496",
"0.5468826",
"0.5467477",
"0.5456386",
"0.54418653",
"0.5421616",
"0.5418392",
"0.5361789",
"0.5336725",
"0.5329203",
"0.53166974",
"0.53071976",
"0.53016... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.