query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Extract the definition (sometimes status, sometimes other elements) of the data criteria based on the type | def extract_definition_from_type
if @entry.at_xpath('./cda:grouperCriteria')
@definition ||= 'derived'
return
end
# See if we can find a match for the entry definition value and status.
entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')
handle_entry_type(entry_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_definition_from_type\n # If we have a specific occurrence of a variable, pull attributes from the reference.\n # IDEA set this up to be called from dc_specific_and_source_extract, the number of\n # fields changed by handle_specific_variable_ref may pose an issue.\n extract_informat... | [
"0.70877635",
"0.6724213",
"0.58134764",
"0.57925254",
"0.574444",
"0.574444",
"0.574274",
"0.5699976",
"0.56855583",
"0.5670207",
"0.56222254",
"0.55708593",
"0.5534504",
"0.55274004",
"0.55194914",
"0.55194914",
"0.5469185",
"0.5465795",
"0.5447588",
"0.54367334",
"0.541779... | 0.70942426 | 0 |
Generate the definition and/or status from the entry type in most cases. If the entry type is nil, and the value is a specific occurrence, more parsing may be necessary. | def handle_entry_type(entry_type)
# settings is required to trigger exceptions, which set the definition
HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)
@definition = entry_type
rescue
# if no exact match then try a string match just using entry definition value
cas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_definition_from_entry_type(entry_type)\n case entry_type\n when 'Problem', 'Problems'\n 'diagnosis'\n when 'Encounter', 'Encounters'\n 'encounter'\n when 'LabResults', 'Results'\n 'laboratory_test'\n when 'Procedure', 'Procedures'\n 'procedure'\n ... | [
"0.7135158",
"0.690771",
"0.6828559",
"0.6254563",
"0.6082418",
"0.5800142",
"0.5671633",
"0.56613845",
"0.5569145",
"0.5483706",
"0.5258803",
"0.5194716",
"0.5153253",
"0.51316893",
"0.50979567",
"0.5064813",
"0.5043189",
"0.5036312",
"0.5010712",
"0.500379",
"0.4957756",
... | 0.74991095 | 1 |
is_done depends if subtasks are all done | def is_ready
if self.tasks.empty? and not self.is_done # no tasks assigned for this
false
elsif (self.tasks.find_by is_done: false).nil? # can't find any false => all tasks are done
self.update_attribute(:is_done, true)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_complete\n self.tasks.count == self.tasks.done.count\n end",
"def done?\n self.done\n end",
"def done?\n @done \n end",
"def done?\n @done\n end",
"def done?\n @done\n end",
"def done?\r\n @done\r\n end",
"def has_subtasks?\n\t\ttasks.size > 0\n\tend",
"def is_... | [
"0.73911864",
"0.7034966",
"0.69945025",
"0.69083315",
"0.69083315",
"0.6902642",
"0.69001013",
"0.6850276",
"0.6840231",
"0.6799949",
"0.6798258",
"0.6795368",
"0.6795368",
"0.66567475",
"0.6629424",
"0.66048133",
"0.6597338",
"0.6556361",
"0.6551072",
"0.6518318",
"0.651443... | 0.719278 | 1 |
Part Two: FIXME: Functions Ascii Create a function that returns nothing and which doesn't takes any parameter. It should just be named "TriForce" and print the TriForce symbol (one triangle over two other ones, can be found on internet) with "TRIFORCE" Don't forget to call the function ! | def TriForce
puts(" /\\ ");
puts(" /__\\ ");
puts(" /\\ /\\ ");
puts("/__\\/__\\ ");
puts(" TRIFORCE ");
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_tri(tri)\n\nend",
"def right_tri(tri)\n\nend",
"def triangle(angle1, angle2, angle3)\n sides = [angle1, angle2, angle3]\n return :invalid if invalid_triangle? [angle1, angle2, angle3]\n return :acute if acute? sides\n return :obtuse if obtuse? sides\n return :right if right? sides\nend",
"def t... | [
"0.6289363",
"0.6232166",
"0.6113143",
"0.6080563",
"0.60054225",
"0.59750766",
"0.5930111",
"0.59246683",
"0.5917295",
"0.5812247",
"0.58060527",
"0.57829684",
"0.5774024",
"0.576952",
"0.5767735",
"0.5763407",
"0.5756691",
"0.5724351",
"0.5720728",
"0.57176334",
"0.5716913"... | 0.74860245 | 0 |
FIXME: Functions One parameter Create a function that takes a string as parameter and returns "Hello (value of string) !" | def HelloString(str)
puts "Hello #{ str } !"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hello(name)\n \n str = \"Hello, #{name}\"\n return str \n \nend",
"def my_string\n'Hello World'\nend",
"def hello1(name)\n 'Hello ' + name\nend",
"def hello1(name)\n 'Hello ' + name\nend",
"def hello1(name)\n 'Hello ' + name \nend",
"def hello1 (name)\n 'Hello ' + name\nend",
"de... | [
"0.79108244",
"0.77328014",
"0.7717336",
"0.7717336",
"0.77092487",
"0.77011716",
"0.7632537",
"0.75697106",
"0.7568116",
"0.756538",
"0.7558579",
"0.75428605",
"0.7515395",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829",
"0.7508829"... | 0.83319557 | 0 |
GET /universal_channels GET /universal_channels.json | def index
@universal_channels = UniversalChannel.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels_list\n get \"channels\"\n end",
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) ... | [
"0.7431829",
"0.7186033",
"0.7075986",
"0.7033682",
"0.68589044",
"0.67742974",
"0.6769116",
"0.6765733",
"0.67098844",
"0.6702308",
"0.6682825",
"0.6620975",
"0.6608966",
"0.66063213",
"0.66014725",
"0.65612507",
"0.6547794",
"0.6547794",
"0.6541302",
"0.6519196",
"0.6488669... | 0.7938018 | 0 |
POST /universal_channels POST /universal_channels.json | def create
@universal_channel = UniversalChannel.new(universal_channel_params)
respond_to do |format|
if @universal_channel.save
format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }
format.json { render :show, status: :created, location: @u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def universal_channel_params\n params.require(:universal_channel).permit(:message)\n end",
"def set_universal_channel\n @universal_channel = UniversalChannel.find(params[:id])\n end",
"def create\n @raw_channel = RawChannel.new(params[:raw_channel])\n\n respond_to do |format|\n if @r... | [
"0.6977511",
"0.67895305",
"0.65551823",
"0.6482803",
"0.64813274",
"0.6471311",
"0.63986546",
"0.6300689",
"0.6265254",
"0.6265254",
"0.6215875",
"0.6210978",
"0.61555034",
"0.6142378",
"0.60629135",
"0.60627675",
"0.6013366",
"0.5984147",
"0.5946757",
"0.59364504",
"0.59320... | 0.784523 | 0 |
PATCH/PUT /universal_channels/1 PATCH/PUT /universal_channels/1.json | def update
respond_to do |format|
if @universal_channel.update(universal_channel_params)
format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully updated.' }
format.json { render :show, status: :ok, location: @universal_channel }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @raw_channel = RawChannel.find(params[:id])\n\n respond_to do |format|\n if @raw_channel.update_attributes(params[:raw_channel])\n format.html { redirect_to @raw_channel, notice: 'Raw channel was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.68373525",
"0.6671909",
"0.6671909",
"0.6626084",
"0.6626084",
"0.6622186",
"0.659899",
"0.6564516",
"0.6488672",
"0.64459705",
"0.63554883",
"0.6335833",
"0.63141733",
"0.6249184",
"0.624384",
"0.6233464",
"0.62039804",
"0.6201062",
"0.6187915",
"0.61812866",
"0.6176895",... | 0.7456539 | 0 |
DELETE /universal_channels/1 DELETE /universal_channels/1.json | def destroy
@universal_channel.destroy
respond_to do |format|
format.html { redirect_to universal_channels_url, notice: 'Universal channel was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @raw_channel = RawChannel.find(params[:id])\n @raw_channel.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_channels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @channel.destroy\n respond_to do |format|\n format.html { re... | [
"0.76657176",
"0.74747145",
"0.7427655",
"0.72128695",
"0.72128695",
"0.71607524",
"0.71294",
"0.7106547",
"0.70967203",
"0.7089707",
"0.70837975",
"0.70764405",
"0.70116746",
"0.69967216",
"0.6927834",
"0.6853559",
"0.6845663",
"0.6816634",
"0.6794255",
"0.67911994",
"0.6767... | 0.8001578 | 0 |
Similar to +Locale.available_locales+, except it includes the no_preference locale | def available_locale_preferences
[@no_preference] + available_locales
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_locales; end",
"def available_locales; end",
"def available_locales\n []\n end",
"def available_locales\n evaluate_localization_option!(:available_locales)\n end",
"def available_locales\n locales = Language.sorted_by_abbreviation.pluck(:abbreviation).presence if Language.tab... | [
"0.79535127",
"0.79535127",
"0.78547525",
"0.77139604",
"0.769534",
"0.7651564",
"0.7514421",
"0.75065494",
"0.7488282",
"0.73629487",
"0.73577577",
"0.7303848",
"0.72715896",
"0.72260743",
"0.7214179",
"0.7180138",
"0.7173859",
"0.717171",
"0.7133337",
"0.7122375",
"0.712237... | 0.87317944 | 0 |
def evaluar(objeto_a_evaluarse) resultado = false | def evaluar(objeto_a_evaluarse)
resultado = 'lol'
unless
(patron = @patrones.find do |patron| patron.matchea(objeto_a_evaluarse) end
if (patron != nil)
patron.agregar_bindings(objeto_a_evaluarse)
resultado = patron.ejecutar_bloque(objeto_a_evaluarse)
end)
raise 'Ningun patron match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluable?\n true\n end",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def evaluate\n\n end",
"def passes?(obj)\n method_key = valid_criteria[attribute_name][\"operators\"] rescue nil\n if method_key.nil?\n return false unless DEFAULT_EVAL_M... | [
"0.724005",
"0.6796457",
"0.6796457",
"0.6624278",
"0.6583296",
"0.6278399",
"0.6208673",
"0.6206503",
"0.61344516",
"0.60626197",
"0.6052106",
"0.59913886",
"0.5964731",
"0.5964731",
"0.5964731",
"0.5908226",
"0.58810294",
"0.58533883",
"0.58084935",
"0.5805999",
"0.5785482"... | 0.76326305 | 0 |
Returns 1 if binary bit y is set in self, otherwise 0. | def bit(y)
bit?(y) ? ONE : ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bit\n self\n end",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n ... | [
"0.57821727",
"0.56086886",
"0.55333996",
"0.53367794",
"0.52065706",
"0.5186879",
"0.5110588",
"0.50635517",
"0.49947545",
"0.49814177",
"0.49718133",
"0.49718133",
"0.49640307",
"0.49521697",
"0.49521697",
"0.49521697",
"0.49438486",
"0.49394822",
"0.4900481",
"0.48983788",
... | 0.79530096 | 0 |
Returns the number of bits in the integer part of `self` Note that this is compatible with ruby's Integerbit_length. Libcalc provides a similar function called `highbit` with different semantics. This returns the bit position of the highest bit which is different to the sign bit. If there is no such bit (zero or 1), ze... | def bit_length
(negative? ? -self : self + ONE).log2.ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_i\n @bits.to_i\n end",
"def _nbits(x)\n raise TypeError, \"The argument to _nbits should be nonnegative.\" if x < 0\n # Ruby 2.1 introduced Integer#bit_length\n return x.bit_length if x.respond_to? :bit_length\n if x <= MAXIMUM_SMALLISH_INTEGER\n return 0 if x... | [
"0.6869315",
"0.6850573",
"0.6806951",
"0.64833",
"0.62883097",
"0.6216534",
"0.61321855",
"0.6117682",
"0.6080967",
"0.6041474",
"0.6035189",
"0.6022201",
"0.60200286",
"0.60200286",
"0.5981691",
"0.59709346",
"0.59607476",
"0.59540087",
"0.5917017",
"0.5887551",
"0.58818036... | 0.76164234 | 0 |
Ruby compatible integer division Calls `quo` to get the quotient of integer division, with rounding mode which specifies behaviour compatible with ruby's Numericdiv | def div(y)
quo(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend",
"def rdiv(arg0)\n end",
"def divide(dividend, divisor)\n negative_sign = (dividend < 0 && divisor >= 0) || (dividend >= 0 && divisor < 0)\n\n remaining = dividend.abs\n abs_divisor = ... | [
"0.7406049",
"0.66704065",
"0.6669712",
"0.66377074",
"0.6635215",
"0.66284096",
"0.66207695",
"0.6576546",
"0.65521157",
"0.6549041",
"0.6538429",
"0.65053403",
"0.6444759",
"0.64183134",
"0.64027745",
"0.63975435",
"0.6394772",
"0.63745266",
"0.63437855",
"0.63104105",
"0.6... | 0.67264724 | 1 |
Ruby compatible quotient/modulus Returns an array containing the quotient and modulus by dividing `self` by `y`. Rounding is compatible with the ruby method `Numericdivmod`. Unlike `quomod`, this is not affected by `Calc.config(:quomod)`. | def divmod(y)
quomod(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def div(y)\n quo(y, ZERO)\n end",
"def divmod(other)\n raise TypeError unless other.kind_of?(self.class)\n if other.zero?\n raise ZeroDivisionError; end\n q = @@Zero\n tmp = other\n while self >= tmp\n q = q.next\n tmp += other\n end\n [q, self + ot... | [
"0.6812624",
"0.6215988",
"0.6186637",
"0.61692107",
"0.6134756",
"0.61182576",
"0.59946907",
"0.58908993",
"0.5824408",
"0.57144135",
"0.5709652",
"0.57092154",
"0.5673261",
"0.5504726",
"0.5504726",
"0.5455722",
"0.54439956",
"0.5422434",
"0.5410859",
"0.5409823",
"0.540249... | 0.7700913 | 0 |
Returns an array; [gcd, lcm] This method exists for compatibility with ruby's Integer class, however note that the libcalc version works on rational numbers and the lcm can be negative. You can also pass more than one value. | def gcdlcm(*args)
[gcd(*args), lcm(*args)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcm(*args)\n args.reduce(&:lcm)\nend",
"def lcm(x, y)\n mul(x, div(y, gcd(x, y)))\n end",
"def lcm(p0) end",
"def lcm(*nums)\n nums.reduce(1, :lcm)\nend",
"def my_lcm(*args)\r\n\targs.inject do |memo, num|\r\n\t\tproduct = memo * num\r\n\t\tproduct / my_gcd(memo, num)\r\n\tend\r\nen... | [
"0.74520373",
"0.73320305",
"0.7322869",
"0.72348607",
"0.7212897",
"0.71863705",
"0.7177713",
"0.70611036",
"0.7060098",
"0.7032449",
"0.7012469",
"0.69217134",
"0.6894238",
"0.68760127",
"0.68394935",
"0.6831541",
"0.67759645",
"0.6764885",
"0.6749513",
"0.67486817",
"0.672... | 0.79607904 | 0 |
Returns true if the number is imaginary. Instances of this class always return false. | def imag?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isimag\n ZERO\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_... | [
"0.83465636",
"0.6816838",
"0.6437948",
"0.63883173",
"0.6368428",
"0.6340384",
"0.6213521",
"0.6186674",
"0.6186674",
"0.6185851",
"0.6179606",
"0.6155671",
"0.61504173",
"0.6074933",
"0.6074933",
"0.60740674",
"0.6046662",
"0.60446775",
"0.60390013",
"0.59488386",
"0.592917... | 0.76897883 | 1 |
Returns 1 if the number is imaginary, otherwise returns 0. Instance of this class always return 0. | def isimag
ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imag?\n false\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FLOAT32)\n when CA_CMPLX128\n field(8, CA_FLOAT64)\n when CA_... | [
"0.7147942",
"0.7102622",
"0.66347605",
"0.6596986",
"0.6315472",
"0.6164102",
"0.6120823",
"0.6077887",
"0.60494995",
"0.5986728",
"0.59764105",
"0.59593505",
"0.59090275",
"0.59090275",
"0.58739436",
"0.58184606",
"0.57896084",
"0.57421935",
"0.5732313",
"0.57304925",
"0.57... | 0.82949585 | 0 |
Ruby compatible modulus Returns the modulus of `self` divided by `y`. Rounding is compatible with the ruby method Numericmodulo. Unlike `mod`, this is not affected by `Calc.confg(:mod)`. | def modulo(y)
mod(y, ZERO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remainder(y)\n z = modulo(y)\n if !z.zero? && ((self < 0 && y > 0) || (self > 0 && y < 0))\n z - y\n else\n z\n end\n end",
"def divmod(y)\n quomod(y, ZERO)\n end",
"def mod(x, y)\n raise NotImplementedError\n end",
"def modulo(x, y)\n if y ... | [
"0.7556742",
"0.72860074",
"0.72519183",
"0.6677378",
"0.66708475",
"0.66103697",
"0.6557979",
"0.6556338",
"0.65362805",
"0.6480929",
"0.64806366",
"0.6351008",
"0.6275579",
"0.6263454",
"0.6254176",
"0.6238002",
"0.6181821",
"0.60843366",
"0.60833323",
"0.6072848",
"0.60625... | 0.7883488 | 0 |
Return true if `self` is greater than zero. This method exists for ruby Integer/Rational compatibility | def positive?
self > ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than_zero?\n return false if nil?\n to_i.positive?\n end",
"def nonnegative?\n return self >= 0\n end",
"def negative?\n self < ZERO\n end",
"def negative?\n self < 0\n end",
"def negative?\n self <= 0\n end",
"def nonpositive?\n return self <= 0\n end",
"... | [
"0.7971782",
"0.75748765",
"0.7479741",
"0.7403973",
"0.73154706",
"0.72850955",
"0.7236651",
"0.72205824",
"0.6897486",
"0.67979646",
"0.6579722",
"0.6560223",
"0.6530774",
"0.6525379",
"0.6440879",
"0.64405787",
"0.636887",
"0.63283986",
"0.6317299",
"0.62608963",
"0.624030... | 0.7841954 | 1 |
Probabilistic primacy test Returns 1 if ptest? would have returned true, otherwise 0. | def ptest(*args)
ptest?(*args) ? ONE : ZERO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test?()\n return $testP ;\n end",
"def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n retu... | [
"0.67543375",
"0.62758666",
"0.6239429",
"0.6154191",
"0.6147697",
"0.6068146",
"0.5985209",
"0.5916946",
"0.59145266",
"0.5889934",
"0.58492863",
"0.5785239",
"0.5783308",
"0.57731485",
"0.5751112",
"0.57444394",
"0.57311755",
"0.5721812",
"0.572136",
"0.5713531",
"0.5698445... | 0.7733468 | 0 |
Returns a simpler approximation of the value if the optional argument eps is given (rat|eps| <= result <= rat+|eps|), self otherwise. Note that this method exists for ruby Numeric compatibility. Libcalc has an alternative approximation method with different semantics, see `appr`. | def rationalize(eps = nil)
eps ? Q.new(to_r.rationalize(eps)) : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def round!(prec)\n bounds = [@min, @max].map { |bound| bound.round(prec) }\n initialize(*bounds)\n return self\n ... | [
"0.5490977",
"0.52321494",
"0.5128266",
"0.51264256",
"0.5101784",
"0.5004685",
"0.4975288",
"0.49502382",
"0.4937772",
"0.49344206",
"0.4920785",
"0.49117598",
"0.4890073",
"0.48879734",
"0.48690712",
"0.484556",
"0.4803894",
"0.47588322",
"0.47579437",
"0.47499502",
"0.4731... | 0.6491223 | 0 |
Remainder of `self` divided by `y` This method is provided for compatibility with ruby's `Numericremainder`. Unlike `%` and `mod`, this method behaves the same as the ruby version, unaffected by `Calc.config(:mod). | def remainder(y)
z = modulo(y)
if !z.zero? && ((self < 0 && y > 0) || (self > 0 && y < 0))
z - y
else
z
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divmod(y)\n quomod(y, ZERO)\n end",
"def modulo(y)\n mod(y, ZERO)\n end",
"def mod(x, y)\n raise NotImplementedError\n end",
"def remainder(val); end",
"def div(y)\n quo(y, ZERO)\n end",
"def remainder(v)\n @remainder = v\n end",
"def div!(rhs)\... | [
"0.72549194",
"0.7112831",
"0.6676469",
"0.6441571",
"0.6103782",
"0.60985047",
"0.6089278",
"0.6073645",
"0.5971857",
"0.5930151",
"0.589459",
"0.5836189",
"0.5819464",
"0.5752302",
"0.57501936",
"0.5738224",
"0.561644",
"0.5565591",
"0.55378705",
"0.5531112",
"0.5526351",
... | 0.7910629 | 0 |
work out what the caller meant with their args to step returns an array of [to, by] parameters | def step_args(a1, a2)
if a1.is_a?(Hash)
# fake keywords style
badkeys = a1.keys - %i[to by]
raise ArgumentError, "Unknown keywords: #{ badkeys.join(", ") }" if badkeys.any?
to = a1.fetch(:to, nil)
by = a1.fetch(:by, ONE)
else
# positional style (limit, step)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args() return @args end",
"def steps\n %w[first last]\n end",
"def generator(from, to, step)\n puts from, to, step\n return [] if step <= 0\n return process(from, to, -(step)) if from > to\n process(from, to, step)\nend",
"def args()\n #This is a stub, used for indexing... | [
"0.6166008",
"0.60983247",
"0.59731555",
"0.59246105",
"0.5923346",
"0.59016085",
"0.58542025",
"0.58347696",
"0.5820988",
"0.57743716",
"0.5737893",
"0.5671607",
"0.56616783",
"0.5610003",
"0.56007636",
"0.5597052",
"0.55858856",
"0.55746925",
"0.5565199",
"0.5557948",
"0.55... | 0.66416 | 0 |
Returns a ruby Complex number with self as the real part and zero imaginary part. | def to_c
Complex(int? ? to_i : to_r, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_complex\n C.new(self, 0)\n end",
"def Complex(a, b = 0)\n if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)\n a\n else\n Complex.new( a.real-b.imag, a.imag+b.real )\n end\nend",
"def real\n complexget :real\n end",
"def test_Complex_InstanceMethods_imag\n\t\tasser... | [
"0.80551976",
"0.7079106",
"0.70075077",
"0.66132885",
"0.6588698",
"0.6543675",
"0.65424716",
"0.6463196",
"0.63750255",
"0.63100344",
"0.6223984",
"0.62014705",
"0.6187434",
"0.6140016",
"0.6002022",
"0.59516835",
"0.59392005",
"0.5907457",
"0.58829427",
"0.58146",
"0.57911... | 0.7273271 | 1 |
Returns a Calc::C complex number with self as the real part and zero imaginary part. | def to_complex
C.new(self, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_c\n Complex(int? ? to_i : to_r, 0)\n end",
"def real\n complexget :real\n end",
"def imag\n complexget :imag\n end",
"def imag\n if not @__imag__\n if complex?\n @__imag__ = case data_type\n when CA_CMPLX64\n field(4, CA_FL... | [
"0.7379986",
"0.6883437",
"0.6825969",
"0.67648345",
"0.65718883",
"0.65584326",
"0.6336348",
"0.6285525",
"0.6255356",
"0.60902005",
"0.60478204",
"0.6044318",
"0.599291",
"0.5968815",
"0.5837521",
"0.5813721",
"0.57965666",
"0.57523817",
"0.57047516",
"0.5643007",
"0.561026... | 0.802263 | 0 |
Check is player wants to open cards or some of participants has 3 cards | def game_ended?
@player.reveal? || @player.cards.size == 3 || @dealer.cards.size == 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete?\n @cards.length == 5\n end",
"def turn_end?\n players.all?(&:cant_take_cards?) || players.any?(&:wants_open_cards?)\n end",
"def can_play(player_cnt)\n if @cards.length >= player_cnt * AVERAGE_HAND_SIZE\n return 1\n end\n return nil\n end",
"def six_cards?(playe... | [
"0.70577615",
"0.7042243",
"0.69955117",
"0.6980894",
"0.69498867",
"0.6855534",
"0.6847138",
"0.67779994",
"0.6765362",
"0.6753158",
"0.67362475",
"0.66861534",
"0.6675591",
"0.66635835",
"0.66169006",
"0.6616501",
"0.65807265",
"0.656637",
"0.6534848",
"0.653297",
"0.652811... | 0.73652524 | 0 |
Attempt to log in the AR server user context represented by the Context object. This method returns an array of hashes representing any AR server messages triggered during log in. These method hashes include values for the following keys: +:message+, +:type+, +:number+. If any problems were encountered during login a n... | def login
begin
# Try to log in
@ars_context.login
# If the login was successful, capture any AR messages
@ars_context.get_messages.collect do |message|
{:message => message.get_message, :type => message.get_type, :number => message.get_number}
end
rescue Na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def user_login\n @raw['user']['login']\n end",
"def login_message(connection, nonce)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n ... | [
"0.531786",
"0.5233715",
"0.5204121",
"0.511291",
"0.49858785",
"0.49514577",
"0.49039382",
"0.49013963",
"0.48930195",
"0.48291546",
"0.47894534",
"0.47883496",
"0.47701705",
"0.47543427",
"0.47329432",
"0.4731169",
"0.47297007",
"0.472177",
"0.47044328",
"0.4701299",
"0.469... | 0.6887705 | 0 |
This script is used to check that each _spec.rb file has a relative_require for spec_helper which should live higher up in the ruby/spec repo directory tree. Prints errors to $stderr and returns a nonzero exit code when errors are found. Related to | def check_file(fn)
File.foreach(fn) do |line|
return $1 if line =~ /^\s*require_relative\s*['"](.*spec_helper)['"]/
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_relative_require\n with_fixture 'relativerequire' do\n assert system(\"ruby\", ocra, \"relativerequire.rb\", *DefaultArgs)\n assert File.exist?(\"relativerequire.exe\")\n system(\"relativerequire.exe\")\n assert_equal 160, $?.exitstatus\n end\n end",
"def file_patterns_errors_... | [
"0.6184961",
"0.5948924",
"0.5931932",
"0.57661825",
"0.56595236",
"0.562098",
"0.5578085",
"0.5539679",
"0.5539679",
"0.5539679",
"0.5539679",
"0.55290043",
"0.551305",
"0.55107516",
"0.550379",
"0.54692274",
"0.54537857",
"0.5446131",
"0.5446131",
"0.54361296",
"0.54284894"... | 0.73096734 | 0 |
Compare two strings by comparing the sum of their values (ASCII character code). For comparing treat all letters as UpperCase. NullStrings should be treated as if they are empty strings. If the string contains other characters than letters, treat the whole string as it would be empty. Examples: "AD","BC" > equal "AD","... | def compare_sum_char_code(chars1, chars2)
chars1 = '' unless chars1&.match?(/\A[a-zA-Z]+\z/)
chars2 = '' unless chars2&.match?(/\A[a-zA-Z]+\z/)
num1 = chars1.to_s.upcase.split('').map(&:ord).sum
num2 = chars2.to_s.upcase.split('').map(&:ord).sum
num1 == num2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_strings(string1, string2)\n\n\tcount = 0\n\tstring1.chars.each_index do |i|\n\t\tcount += 1 if string1[i] != string2[i]\n\tend\n\n\treturn count == 1\n\nend",
"def third_ana(str1, str2)\n sorted1 = str1.chars.sort\n sorted2 = str2.chars.sort\n sorted1 == sorted2\nend",
"def anagram_countcompare?... | [
"0.6926953",
"0.6672763",
"0.660678",
"0.6565205",
"0.65318346",
"0.65230954",
"0.6520785",
"0.65007246",
"0.6473744",
"0.646151",
"0.6451957",
"0.6444751",
"0.6440758",
"0.6412896",
"0.63781345",
"0.63506746",
"0.63488305",
"0.6337568",
"0.6335179",
"0.63299006",
"0.6329176"... | 0.7518138 | 0 |
GET /accounting_entries GET /accounting_entries.json | def index
@accounting_entries = AccountingEntry.all
authorize AccountingEntry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end",
"def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\... | [
"0.645624",
"0.63972986",
"0.63329697",
"0.63194007",
"0.6295738",
"0.62791944",
"0.62454814",
"0.6233538",
"0.62263894",
"0.61808765",
"0.6139222",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.6130116",
"0.61248475",
"0.6103203",
"0.60826963",
"0.60826... | 0.70614135 | 0 |
PATCH/PUT /accounting_entries/1 PATCH/PUT /accounting_entries/1.json | def update
authorize AccountingEntry
respond_to do |format|
if @accounting_entry.update(accounting_entry_params)
format.html { redirect_to show_accounting_for_loan_loan_path(@accounting_entry.accounting_book.loan), notice: 'Accounting entry was successfully updated.' }
format.json { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @accounting_entry.update(accounting_entry_params)\n format.html { redirect_to @accounting_entry, notice: 'Se ha actualizado con exito.' }\n format.json { render :show, status: :ok, location: @accounting_entry }\n else\n format.html { render... | [
"0.6911515",
"0.6431857",
"0.63417584",
"0.62840235",
"0.6277344",
"0.6251895",
"0.62371135",
"0.6236573",
"0.6233051",
"0.61779594",
"0.61779594",
"0.61707944",
"0.6156453",
"0.6137227",
"0.61234796",
"0.6109326",
"0.6106697",
"0.6093025",
"0.6088871",
"0.60702246",
"0.60657... | 0.679145 | 1 |
DELETE /accounting_entries/1 DELETE /accounting_entries/1.json | def destroy
@accounting_entry.destroy
authorize AccountingEntry
respond_to do |format|
format.html { redirect_to accounting_entries_url, notice: 'Accounting entry was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @accounting_entry.destroy\n respond_to do |format|\n format.html { redirect_to accounting_entries_url, notice: 'Se ha eliminado con exito!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ledger_entry = LedgerEntry.find(params[:id])\n @ledger_entry.dest... | [
"0.75156885",
"0.6917398",
"0.68716925",
"0.684681",
"0.68115044",
"0.68100715",
"0.6797693",
"0.6797693",
"0.67735714",
"0.67357504",
"0.67338014",
"0.67217165",
"0.6709898",
"0.66971654",
"0.66676116",
"0.6665402",
"0.6649645",
"0.66373533",
"0.6617056",
"0.6605619",
"0.660... | 0.6961732 | 1 |
GET /vendedors GET /vendedors.json | def index
@vendedors = Vendedor.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def managed_venues\n\t\t\t get('venues/managed').venues\n\t\t\tend",
"def index\n... | [
"0.66803765",
"0.6402791",
"0.6380672",
"0.62718785",
"0.6245827",
"0.622651",
"0.62057453",
"0.62057453",
"0.61453766",
"0.61453766",
"0.61453766",
"0.61453766",
"0.6105332",
"0.60998416",
"0.6091319",
"0.608299",
"0.6080477",
"0.60720336",
"0.605281",
"0.59629744",
"0.59548... | 0.77711964 | 0 |
POST /vendedors POST /vendedors.json | def create
@vendedor = Vendedor.new(vendedor_params)
respond_to do |format|
if @vendedor.save
format.html { redirect_to @vendedor, notice: 'Vendedor was successfully created.' }
format.json { render :show, status: :created, location: @vendedor }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vendedor = Vendedor.new(params[:vendedor])\n\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vende... | [
"0.6486787",
"0.6474339",
"0.6441286",
"0.6376677",
"0.6022261",
"0.58787936",
"0.58787936",
"0.58787936",
"0.58787936",
"0.5866251",
"0.5866251",
"0.5838489",
"0.57296216",
"0.57296216",
"0.5705851",
"0.5705851",
"0.5699218",
"0.5665701",
"0.5646923",
"0.5643799",
"0.5638384... | 0.69393945 | 0 |
PATCH/PUT /vendedors/1 PATCH/PUT /vendedors/1.json | def update
respond_to do |format|
if @vendedor.update(vendedor_params)
format.html { redirect_to @vendedor, notice: 'Vendedor was successfully updated.' }
format.json { render :show, status: :ok, location: @vendedor }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @vendedor.update(vendedor_params)\n format.html { redirect_to @vendedor, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @vendedor }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.6662235",
"0.65737545",
"0.65690035",
"0.63109154",
"0.63109154",
"0.6292955",
"0.62829924",
"0.6167377",
"0.61535877",
"0.6143258",
"0.6129436",
"0.6088105",
"0.60683966",
"0.60606617",
"0.6058758",
"0.6048823",
"0.6036588",
"0.60332954",
"0.60332954",
"0.6011929",
"0.600... | 0.68436337 | 0 |
GET /testers/1 GET /testers/1.json | def show
@tester = Tester.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tester }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def show\n @trainer = Trainer.find(params[:id])... | [
"0.7320951",
"0.64492375",
"0.64094263",
"0.6360455",
"0.6325641",
"0.6325641",
"0.62652296",
"0.6210554",
"0.61219674",
"0.610672",
"0.60863084",
"0.6077349",
"0.60522795",
"0.6052208",
"0.60361636",
"0.6035183",
"0.5940203",
"0.5940203",
"0.5939413",
"0.5937062",
"0.5924859... | 0.7289665 | 1 |
PUT /testers/1 PUT /testers/1.json | def update
@tester = Tester.find(params[:id])
respond_to do |format|
if @tester.update_attributes(params[:tester])
format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Tha... | [
"0.61199856",
"0.60428333",
"0.6009719",
"0.599153",
"0.5939015",
"0.5874653",
"0.5859881",
"0.5837808",
"0.5810235",
"0.57881397",
"0.57473135",
"0.5744735",
"0.57092404",
"0.5698415",
"0.56830764",
"0.56617266",
"0.5657657",
"0.5647752",
"0.5647752",
"0.5647752",
"0.5647752... | 0.6563973 | 0 |
DELETE /testers/1 DELETE /testers/1.json | def destroy
@tester = Tester.find(params[:id])
@tester.destroy
respond_to do |format|
format.html { redirect_to testers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n f... | [
"0.7104963",
"0.7082499",
"0.7082499",
"0.7035017",
"0.6881532",
"0.6860707",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68588966",
"0.68576384",
"0.6844915",
"0.6817972",
"0.68159556",
"0.6787012",
"0.67862546",
"0.6777178",
"0.677... | 0.7706601 | 0 |
add a layer that overlays the cell adding a subtle gradient effect | def gradient_layer
@gradient_layer ||= CAGradientLayer.layer.tap do |gradient_layer|
gradient_layer.colors = colors
gradient_layer.locations = [0.0, 0.01, 0.95, 1.0]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_layer(thickness, conductivity, density, specific_heat)\n layer = Layer.new()\n # Make sure all the values are > 0.\n layer.set(thickness, conductivity, density, specific_heat)\n @layers.push(layer)\n end",
"def add_layer\n Layer.create(:name => @new_table_nam... | [
"0.57998306",
"0.55723685",
"0.5535494",
"0.5471663",
"0.53380674",
"0.52575535",
"0.52230936",
"0.5185467",
"0.5103527",
"0.5101402",
"0.50738084",
"0.5012597",
"0.4994323",
"0.49508253",
"0.49211848",
"0.49177206",
"0.48538604",
"0.48359537",
"0.48359025",
"0.48359025",
"0.... | 0.66774964 | 0 |
add a layer that renders a green background when an item is complete | def item_complete_layer
@item_complete_layer ||= CALayer.layer.tap do |item_complete_layer|
item_complete_layer.backgroundColor = UIColor.alloc.initWithRed(0.0, green: 0.6, blue: 0.0, alpha: 1.0).CGColor
item_complete_layer.hidden = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_item_background(index)\n if index == @pending_index\n contents.fill_rect(item_rect(index), pending_color)\n end\n end",
"def draw_item_background(index)\r\n if index == @pending_index\r\n contents.fill_rect(item_rect(index), pending_color)\r\n end\r\n end",
"def draw_advanced(r... | [
"0.61697084",
"0.6160857",
"0.59142566",
"0.585799",
"0.56475645",
"0.56369257",
"0.5487685",
"0.54335743",
"0.53524053",
"0.5327761",
"0.5268604",
"0.5261656",
"0.5240675",
"0.5240675",
"0.52257746",
"0.52257746",
"0.52128273",
"0.5185468",
"0.51841706",
"0.5175293",
"0.5174... | 0.74768335 | 0 |
handles the pan gesture during the begin, changed and ended states | def handle_pan(recognizer)
state_began(recognizer)
state_changed(recognizer)
state_ended(recognizer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_began(recognizer)\n if recognizer.state == UIGestureRecognizerStateBegan\n gesture.original_center = self.center\n end\n end",
"def pan(direction = :left, distance_bp = (self.length_bp.to_f/5).round)\n upstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp < @start_cu... | [
"0.6504828",
"0.6124308",
"0.6041303",
"0.5915514",
"0.5508828",
"0.537555",
"0.5371902",
"0.5219702",
"0.51901394",
"0.51899475",
"0.5164238",
"0.5117866",
"0.500568",
"0.49543175",
"0.49146193",
"0.48829454",
"0.48391688",
"0.48352587",
"0.48334932",
"0.48081478",
"0.476301... | 0.81243837 | 0 |
if the gesture has just started, record the current centre location | def state_began(recognizer)
if recognizer.state == UIGestureRecognizerStateBegan
gesture.original_center = self.center
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_capture_coord\n return true unless @piece_moving and @piece_moving.kind_of?(Pawn)\n if @piece_moving.is_en_passant_capture( from_coord, to_coord - from_coord , @board)\n self[:capture_coord] = (Position.new(to_coord) + [ - Sides[@piece_moving.side].advance_direction, 0]).to_s\n end\n end"... | [
"0.5701011",
"0.56941617",
"0.568051",
"0.5619048",
"0.5619048",
"0.5536186",
"0.5532202",
"0.5503302",
"0.5472782",
"0.5348586",
"0.5341818",
"0.5327314",
"0.5315127",
"0.5301911",
"0.52323896",
"0.52316374",
"0.5228845",
"0.52192813",
"0.5213576",
"0.51983374",
"0.51983374"... | 0.7157968 | 0 |
GET /giro_comercials GET /giro_comercials.json | def index
@giro_comercials = GiroComercial.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @com... | [
"0.6927469",
"0.6632712",
"0.6539626",
"0.64232063",
"0.6396955",
"0.63854396",
"0.63828397",
"0.63697755",
"0.63485634",
"0.63328975",
"0.6316884",
"0.6316884",
"0.63078624",
"0.6275185",
"0.6232466",
"0.6207229",
"0.61989796",
"0.61915636",
"0.61601925",
"0.61516684",
"0.61... | 0.74337226 | 0 |
POST /giro_comercials POST /giro_comercials.json | def create
@giro_comercial = GiroComercial.new(giro_comercial_params)
respond_to do |format|
if @giro_comercial.save
format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente creado.' }
format.json { render :show, status: :created, location: @giro_comercial }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @comida = Comida.new(comida_params)\n\n respond_to do |format|\n if @comida.save\n format.html { redirect_to @comida, notice: 'Comida was successfully created.' }\n format.json { render :show, status: :created, location: @comida }\n else\n format.html { render :new... | [
"0.6510093",
"0.64999366",
"0.6363631",
"0.63544685",
"0.6335549",
"0.6331438",
"0.63287914",
"0.6319697",
"0.6297642",
"0.6278621",
"0.6267741",
"0.62617725",
"0.62151945",
"0.6139281",
"0.6128127",
"0.6121866",
"0.6118009",
"0.6106976",
"0.6049679",
"0.6044875",
"0.60423356... | 0.7064435 | 0 |
PATCH/PUT /giro_comercials/1 PATCH/PUT /giro_comercials/1.json | def update
respond_to do |format|
if @giro_comercial.update(giro_comercial_params)
format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente editado.' }
format.json { render :show, status: :ok, location: @giro_comercial }
else
format.html { render :edit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render... | [
"0.67927885",
"0.6603766",
"0.6526884",
"0.6371026",
"0.6370773",
"0.63246167",
"0.6311864",
"0.62800926",
"0.62597585",
"0.6238562",
"0.6230439",
"0.62255126",
"0.62074095",
"0.6204066",
"0.6201676",
"0.6198815",
"0.61985934",
"0.619811",
"0.6195477",
"0.61880594",
"0.618749... | 0.6842214 | 0 |
DELETE /giro_comercials/1 DELETE /giro_comercials/1.json | def destroy
@giro_comercial.destroy
respond_to do |format|
format.html { redirect_to giro_comercials_url, notice: 'Giro comercial fue exitosamente destruido.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n f... | [
"0.7547217",
"0.7314999",
"0.7104706",
"0.708956",
"0.70444775",
"0.7014775",
"0.70100707",
"0.70060873",
"0.6986531",
"0.6983585",
"0.69822764",
"0.6973104",
"0.69728947",
"0.696977",
"0.6964299",
"0.69351906",
"0.6930172",
"0.69147706",
"0.69073176",
"0.6904887",
"0.6901768... | 0.7406541 | 1 |
POST /add_to_invoice_clients POST /add_to_invoice_clients.json | def create
@add_to_invoice_client = AddToInvoiceClient.new(add_to_invoice_client_params)
respond_to do |format|
if @add_to_invoice_client.save
format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully created.' }
format.json { render :show, status: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @invoice_client = InvoiceClient.new(invoice_client_params)\n\n respond_to do |format|\n if @invoice_client.save\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_... | [
"0.738595",
"0.72208",
"0.7052914",
"0.687583",
"0.68465",
"0.6823549",
"0.6669712",
"0.6669712",
"0.6632753",
"0.66318595",
"0.6628149",
"0.66159445",
"0.6554154",
"0.652998",
"0.6514697",
"0.6431596",
"0.6422484",
"0.6376579",
"0.63599044",
"0.63430625",
"0.63147825",
"0.... | 0.7642035 | 0 |
PATCH/PUT /add_to_invoice_clients/1 PATCH/PUT /add_to_invoice_clients/1.json | def update
respond_to do |format|
if @add_to_invoice_client.update(add_to_invoice_client_params)
format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }
format.json { render :show, status: :ok, location: @add_to_invoice_client }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_add_to_invoice_client\n @add_to_invoice_client = AddToInvoiceClient.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @invoice_client.update(invoice_client_params)\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully updated.' }\n ... | [
"0.7017008",
"0.66069436",
"0.65610534",
"0.6534315",
"0.63927615",
"0.6318801",
"0.627153",
"0.6178868",
"0.6139412",
"0.61034495",
"0.60381085",
"0.6031321",
"0.6025716",
"0.60146654",
"0.6012826",
"0.5957123",
"0.59284973",
"0.59184146",
"0.5883507",
"0.5863886",
"0.586255... | 0.72571063 | 0 |
DELETE /add_to_invoice_clients/1 DELETE /add_to_invoice_clients/1.json | def destroy
@add_to_invoice_client.destroy
respond_to do |format|
format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invoice = Invoice.find(params[:invoice_id])\n @client = @invoice.clients.find(params[:id])\n @client.destroy\n redirect_to invoice_path(@invoice)\n end",
"def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice:... | [
"0.7505724",
"0.74196774",
"0.7063647",
"0.69594336",
"0.6917375",
"0.6893945",
"0.6871842",
"0.68361527",
"0.6819126",
"0.68055856",
"0.68055856",
"0.680429",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.67959785",
"0.6... | 0.7759643 | 0 |
total_cost_eq == 1 => Bonificados => total_cost_eq = 0.0 total_cost_eq == 2 => No Bonificados => total_cost_gt = 0.0 | def setup_cost_types
q = params[:q]
t = q[:total_cost_eq].to_i
if t == TechnicalServicesHelper::COST_TYPE_FREE
q[:total_cost_eq] = '0.0'
elsif t == TechnicalServicesHelper::COST_TYPE_NONFREE
q[:total_cost_gt] = '0.0'
q.delete(:total_cost_eq)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_additional_cost_totals\n pos_cost = 0.0 # init result\n neg_cost = 0.0 # init result\n AppParameterCustomizations.get_receipt_costs().each do |c|\n if c[:value] > 0\n pos_cost += c[:value].to_f / 100.0\n elsif self.price >= 78.19\n neg_cost += c[:v... | [
"0.67882574",
"0.6754116",
"0.66849685",
"0.6670508",
"0.6661727",
"0.6647963",
"0.66120714",
"0.655944",
"0.6557145",
"0.65470785",
"0.65313643",
"0.6482869",
"0.6468283",
"0.64645904",
"0.6463388",
"0.64595664",
"0.64561355",
"0.6446921",
"0.6423496",
"0.6417987",
"0.641350... | 0.6960923 | 0 |
=> true Write a function to generate/print/store the first "n" prime numbers. | def first_n_prime(n)
p Prime.first(n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_prime(n)\n\nend",
"def nthPrime(nth)\n # TODO\nend",
"def nth_prime(n)\n i = 0\n num = 1\n if n == 0\n return nil\n end\n while i < n\n num += 1\n i += 1 if is_prime?(num)\n\n end\n num\nend",
"def nth_prime( n )\n\n prime_number_array = prime_num_gen( n + 1 )\n\n p prime_number_ar... | [
"0.8146801",
"0.7722742",
"0.7685133",
"0.76731205",
"0.76688445",
"0.75499004",
"0.74925137",
"0.7423339",
"0.740077",
"0.7380475",
"0.7372663",
"0.7355696",
"0.7352715",
"0.73397094",
"0.7317421",
"0.72849005",
"0.72551674",
"0.72544885",
"0.7253518",
"0.7252173",
"0.724811... | 0.77612686 | 1 |
Merge the given histogram into this histogram. | def merge! hist
self.frequency.reserve(hist.size) # avoid repeated reallocation if growing
for i in 0...hist.size
freq = hist.frequency[i] # avoid calling swig for zero frequencies
self.accumulate(i, freq) if freq > 0
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(hash)\n hash.each_value { |v| self << v }\n end",
"def combine!(other)\n return self if other == self\n\n @transaction_count += other.transaction_count\n @call_count += other.call_count\n @rows_returned += other.rows_returned\n @call_time += other.call_time\n\n @mi... | [
"0.61433965",
"0.605319",
"0.57309973",
"0.5661068",
"0.5637999",
"0.5637999",
"0.5637999",
"0.5619807",
"0.55658376",
"0.55643374",
"0.5549928",
"0.54926556",
"0.54396224",
"0.54379666",
"0.54119426",
"0.53994644",
"0.5368086",
"0.53612435",
"0.53560203",
"0.5353035",
"0.534... | 0.7447474 | 0 |
Return the smallest observation x s.t. the fraction of all observations less than x is at least q (e.g. q = 0.9 returns the 90% percentile). When q = 0, the minimum observation is returned, and when q = 1, the maximum observation is returned. | def quantile q
cut = (q.to_f * count).ceil
obs = 0
for i in 0...size
obs += self.frequency[i]
return i if obs > 0 && obs >= cut
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = 0.25*sorted_array.length + 1\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n re... | [
"0.691722",
"0.65504193",
"0.61298317",
"0.5901658",
"0.58680826",
"0.581585",
"0.57667637",
"0.56754696",
"0.5652957",
"0.55818236",
"0.55055624",
"0.54592097",
"0.54379207",
"0.5383549",
"0.5317756",
"0.5290622",
"0.5287485",
"0.5260406",
"0.5256884",
"0.52541596",
"0.52493... | 0.6686917 | 1 |
options:: Options hash supplied to windowing system Extra options include :method and :delay. :delay is the number of seconds to wait after page load to open window | def open_window_deprecated(options={})
frame_url = options.has_key?(:iframe) ? url_for(options.delete(:iframe)) : nil
window_url = options.has_key?(:url) ? url_for(options.delete(:url)) : nil
method = options.delete(:method) || 'get'
delay = options.delete(:delay) || 0.5
delay = delay * 1000
url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_open_Speed\n w = Window_Base.new(200, 200, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.openness = 0\n w.open()\n return true\n end",
"def show_window\n end",
"def js_popup(options = {})\n o = {\n :width => 320,\n :height => 240,\n :title => 'Popup',\... | [
"0.5781574",
"0.5773043",
"0.5664081",
"0.5599181",
"0.550609",
"0.5392613",
"0.5392613",
"0.53924924",
"0.5388857",
"0.5388857",
"0.5384871",
"0.5372501",
"0.53707397",
"0.5354655",
"0.53310263",
"0.5314145",
"0.5314145",
"0.528511",
"0.5277514",
"0.52704084",
"0.52665126",
... | 0.7298996 | 0 |
Initializes the 'core' portion of the meterpreter client commands. | def initialize(client)
super(client, 'core')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(client)\n super(\"metaSSH\")\n\t\t# The meterpreter client context\n\t\tself.client = client\n\n\t\t# Queued commands array\n\t\tself.commands = []\n\n\t\t# Point the input/output handles elsewhere\n\t\treset_ui\n\n\t\tenstack_dispatcher(Console::CommandDispatcher::Core)\n enstack_dispatcher(C... | [
"0.70615023",
"0.63104767",
"0.6239149",
"0.61578673",
"0.6103885",
"0.60709906",
"0.5956026",
"0.5944023",
"0.5914806",
"0.5905773",
"0.58586276",
"0.58424705",
"0.5817421",
"0.5811578",
"0.58040535",
"0.5771865",
"0.5771865",
"0.5771865",
"0.5769278",
"0.5753461",
"0.573872... | 0.63120157 | 1 |
Core commands create a named pipe pivot | def create_named_pipe_pivot(opts)
request = Packet.create_request(COMMAND_ID_CORE_PIVOT_ADD)
request.add_tlv(TLV_TYPE_PIVOT_NAMED_PIPE_NAME, opts[:pipe_name])
c = Class.new(::Msf::Payload)
c.include(::Msf::Payload::Stager)
c.include(::Msf::Payload::TransportConfig)
# Include the appropriate r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipe\n @pipe ||= case true\n when System.exists?(pipes[:project]) then pipes[:project]\n when System.exists?(pipes[:local]) then pipes[:local]\n when System.exists?(pipes[:global]) then pipes[:global]\n else\n puts HELP_MASK % pipes.values\n rais... | [
"0.5866526",
"0.5803264",
"0.5790853",
"0.57685846",
"0.5753683",
"0.57192355",
"0.5483181",
"0.5468972",
"0.54675794",
"0.5463583",
"0.5448848",
"0.54214656",
"0.53931195",
"0.5389887",
"0.5302079",
"0.52834606",
"0.52408546",
"0.5240817",
"0.5215224",
"0.51675284",
"0.51435... | 0.77077013 | 0 |
Get a list of loaded commands for the given extension. | def get_loaded_extension_commands(extension_name)
request = Packet.create_request(COMMAND_ID_CORE_ENUMEXTCMD)
start = Rex::Post::Meterpreter::ExtensionMapper.get_extension_id(extension_name)
request.add_tlv(TLV_TYPE_UINT, start)
request.add_tlv(TLV_TYPE_LENGTH, COMMAND_ID_RANGE)
begin
respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_commands\n @commands = Debugger::Command.available_commands.map do |cmd_class|\n cmd_class.new\n end\n @commands.sort!\n end",
"def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end",
"def commands\n l... | [
"0.720783",
"0.697561",
"0.6920565",
"0.68109834",
"0.6795855",
"0.67545563",
"0.67103505",
"0.65463257",
"0.65061176",
"0.63673764",
"0.6238509",
"0.62075585",
"0.62075585",
"0.62075585",
"0.61946",
"0.61946",
"0.6189999",
"0.6182536",
"0.6182536",
"0.6179919",
"0.61708444",... | 0.8047931 | 0 |
Set associated transport timeouts for the currently active transport. | def set_transport_timeouts(opts={})
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SET_TIMEOUTS)
if opts[:session_exp]
request.add_tlv(TLV_TYPE_TRANS_SESSION_EXP, opts[:session_exp])
end
if opts[:comm_timeout]
request.add_tlv(TLV_TYPE_TRANS_COMM_TIMEOUT, opts[:comm_timeout])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout_seconds\n transport_options.timeout_seconds\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeout=(value)\n @conn... | [
"0.6373928",
"0.63639086",
"0.63639086",
"0.63594866",
"0.62544084",
"0.62338036",
"0.6186109",
"0.61295956",
"0.6033906",
"0.59466815",
"0.59001976",
"0.58906406",
"0.58663553",
"0.5806353",
"0.57635057",
"0.5756514",
"0.57232136",
"0.5698027",
"0.5671731",
"0.5662847",
"0.5... | 0.7366192 | 0 |
Loads a library on the remote meterpreter instance. This method supports loading both extension and nonextension libraries and also supports loading libraries from memory or disk depending on the flags that are specified Supported flags: LibraryFilePath The path to the library that is to be loaded LibraryFileImage Bina... | def load_library(opts)
library_path = opts['LibraryFilePath']
library_image = opts['LibraryFileImage']
target_path = opts['TargetFilePath']
load_flags = LOAD_LIBRARY_FLAG_LOCAL
# No library path, no cookie.
if library_path.nil? && library_image.nil?
raise ArgumentError, 'No library fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_library\n name = File.basename @load_path, LIBSUFFIX\n\n NativeMethod.load_extension(@load_path, name)\n end",
"def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end",
"def load_libs; end",
"def load_library\n\t\t#wget some url\n\... | [
"0.69298154",
"0.6646499",
"0.5936667",
"0.59313375",
"0.5924729",
"0.5895161",
"0.5886056",
"0.58538085",
"0.5645993",
"0.5627698",
"0.562669",
"0.55462986",
"0.55115515",
"0.55093086",
"0.55093086",
"0.550486",
"0.54829955",
"0.54494536",
"0.54490674",
"0.54165727",
"0.5328... | 0.81594586 | 0 |
Loads a meterpreter extension on the remote server instance and initializes the clientside extension handlers Module The module that should be loaded LoadFromDisk Indicates that the library should be loaded from disk, not from memory on the remote machine | def use(mod, opts = { })
if mod.nil?
raise RuntimeError, "No modules were specified", caller
end
modnameprovided = mod
suffix = nil
if not client.binary_suffix
suffix = ''
elsif client.binary_suffix.size > 1
client.binary_suffix.each { |s|
if (mod =~ /(.*)\.#{s}/ )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_use(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n\n\t\tmodules = nil\n\n\t\t@@use_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-l\"\n\t\t\t\t\texts = []\n\t\t\t\t\tpath = ::File.join(Msf::Config.install_root, 'data', 'meterpreter')\n\t\t\t\t\t::Dir.entries(p... | [
"0.6424843",
"0.63959235",
"0.60280013",
"0.59327334",
"0.58852553",
"0.58675027",
"0.58646905",
"0.5834242",
"0.5749528",
"0.5728499",
"0.57094085",
"0.5666148",
"0.5636438",
"0.5600541",
"0.55477715",
"0.5533418",
"0.5460047",
"0.54282707",
"0.54270816",
"0.5381664",
"0.537... | 0.6758483 | 0 |
Set the session GUID on the target session. | def set_session_guid(guid)
request = Packet.create_request(COMMAND_ID_CORE_SET_SESSION_GUID)
request.add_tlv(TLV_TYPE_SESSION_GUID, guid)
client.send_request(request)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_uuid\n if session[:session_uuid].blank?\n session[:session_uuid] = SecureRandom.uuid\n end\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def set_session\n @session = session[:user_id]\n end",
"def set_session_unit_id\n session[:unit_id] = @... | [
"0.72196114",
"0.64227295",
"0.63381284",
"0.63174313",
"0.6192695",
"0.6109987",
"0.60882807",
"0.6060033",
"0.6023056",
"0.60060656",
"0.6004382",
"0.599325",
"0.5952643",
"0.5942973",
"0.5873915",
"0.5821326",
"0.58124244",
"0.5767381",
"0.57480234",
"0.57406634",
"0.57321... | 0.79107463 | 0 |
Get the session GUID from the target session. | def get_session_guid(timeout=nil)
request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)
args = [request]
args << timeout if timeout
response = client.send_request(*args)
response.get_tlv_value(TLV_TYPE_SESSION_GUID)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def session_id\n session.transport.algorithms.session_id\n end",
"def sessio... | [
"0.77886343",
"0.69986856",
"0.6970664",
"0.6963137",
"0.6794267",
"0.67941254",
"0.6701585",
"0.6700476",
"0.6700476",
"0.6700476",
"0.66536844",
"0.66276145",
"0.65499",
"0.6527658",
"0.6492617",
"0.64865094",
"0.6470554",
"0.6451022",
"0.6426514",
"0.6426412",
"0.6400185",... | 0.7434208 | 1 |
Get the machine ID from the target session. | def machine_id(timeout=nil)
request = Packet.create_request(COMMAND_ID_CORE_MACHINE_ID)
args = [request]
args << timeout if timeout
response = client.send_request(*args)
mid = response.get_tlv_value(TLV_TYPE_MACHINE_ID)
# Normalise the format of the incoming machine id so that it's consisten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_id\n session.transport.algorithms.session_id\n end",
"def session_id\n @driver.session_id\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes th... | [
"0.6648093",
"0.6515641",
"0.638625",
"0.63716274",
"0.63456905",
"0.6308725",
"0.6267939",
"0.6267939",
"0.6267939",
"0.62231076",
"0.6216795",
"0.6170859",
"0.6158576",
"0.6153442",
"0.61497825",
"0.61282265",
"0.6105966",
"0.60892195",
"0.6080113",
"0.6077868",
"0.6066587"... | 0.69252264 | 0 |
Remove a transport from the session based on the provided options. | def transport_remove(opts={})
request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_REMOVE, opts)
return false unless request
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_transport\n if transport\n unsubscribe_from_transport_events transport\n transport.close_connection\n connection.release_websocket_transport\n end\n end",
"def drop(options = {})\n if key = backend.keys.first\n [key, delete(key)]\n ... | [
"0.5695839",
"0.54179573",
"0.54105264",
"0.52620673",
"0.52366847",
"0.5210973",
"0.519714",
"0.5149722",
"0.5053752",
"0.50304186",
"0.5025868",
"0.5010846",
"0.49807075",
"0.49807075",
"0.49778166",
"0.49778166",
"0.49778166",
"0.49605197",
"0.4955544",
"0.48863292",
"0.48... | 0.6770688 | 0 |
Add a transport to the session based on the provided options. | def transport_add(opts={})
request = transport_prepare_request(COMMAND_ID_CORE_TRANSPORT_ADD, opts)
return false unless request
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(options = {})\n @transport ||= Net::SSH::Transport::Session.new(\n options[:host] || \"localhost\",\n options.merge(kex: \"test\", host_key: \"ssh-rsa\", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))\n )\n end",
"def opt... | [
"0.6336131",
"0.5631498",
"0.53697085",
"0.5368454",
"0.52854973",
"0.5276315",
"0.5276315",
"0.51792395",
"0.51540804",
"0.50504684",
"0.49745977",
"0.49745977",
"0.49745977",
"0.49369544",
"0.4906899",
"0.48927927",
"0.48893186",
"0.48440734",
"0.4838005",
"0.48361906",
"0.... | 0.60187656 | 1 |
Change the active transport to the next one in the transport list. | def transport_next
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_NEXT)
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_transport\n x = transport_list\n x[:transports][0]\n end",
"def advance\n @to = @to.next\n end",
"def next\n update_current(list_index_of(@current))\n end",
"def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end",
"... | [
"0.55481637",
"0.5497913",
"0.53691226",
"0.5345332",
"0.53421706",
"0.53344965",
"0.52844894",
"0.5274306",
"0.5274306",
"0.5274306",
"0.5213262",
"0.52129275",
"0.52129275",
"0.51778936",
"0.5166082",
"0.5127569",
"0.5103578",
"0.5089631",
"0.50820816",
"0.50565475",
"0.502... | 0.6251462 | 0 |
Change the active transport to the previous one in the transport list. | def transport_prev
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_PREV)
client.send_request(request)
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(target, transact = true)\n move_to(target, :swap, transact) \n end",
"def get_current_transport\n x = transport_list\n x[:transports][0]\n end",
"def set_transport\n @transport = Transport.find(params[:id])\n end",
"def set_transport\n @transport = Transport.f... | [
"0.5749374",
"0.5717859",
"0.56225383",
"0.56225383",
"0.56225383",
"0.5431106",
"0.54201126",
"0.53342664",
"0.5324029",
"0.5184787",
"0.5176794",
"0.5144027",
"0.51262647",
"0.5117054",
"0.51132405",
"0.5068399",
"0.5040935",
"0.5033989",
"0.5020549",
"0.5015362",
"0.500009... | 0.61688113 | 0 |
Attempt to get the SSL hash being used for verificaton (if any). | def get_ssl_hash_verify
# Not supported unless we have a socket with SSL enabled
return nil unless self.client.sock.type? == 'tcp-ssl'
request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_GETCERTHASH)
response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_TRANS_CERT_HA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_ssl_hash_verify\n # Not supported unless we have a socket with SSL enabled\n return nil unless self.client.sock.type? == 'tcp-ssl'\n\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SETCERTHASH)\n\n hash = Rex::Text.sha1_raw(self.client.sock.sslctx.cert.to_der)\n request.add_tl... | [
"0.7343069",
"0.6469181",
"0.63263786",
"0.63204813",
"0.6216175",
"0.62072045",
"0.6200956",
"0.6200956",
"0.61360353",
"0.59880763",
"0.59741217",
"0.5971255",
"0.59433615",
"0.59317744",
"0.5891345",
"0.5829062",
"0.5829062",
"0.5805679",
"0.57949144",
"0.5783857",
"0.5740... | 0.77239394 | 0 |
Migrates the meterpreter instance to the process specified by pid. The connection to the server remains established. | def migrate(target_pid, writable_dir = nil, opts = {})
keepalive = client.send_keepalives
client.send_keepalives = false
target_process = nil
current_process = nil
# Load in the stdapi extension if not allready present so we can determine the target pid architecture...
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_migrate(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: migrate pid\\n\\n\" +\n\t\t\t\t\"Migrates the server instance to another process.\\n\" +\n\t\t\t\t\"Note: Any open channels or other dynamic state will be lost.\")\n\t\t\treturn true\n\t\tend\n\n\t\tpid = args[0].to_i\n\t\tif(pi... | [
"0.6637108",
"0.6519998",
"0.64004076",
"0.59887666",
"0.5821757",
"0.58210856",
"0.5727315",
"0.54937464",
"0.5442536",
"0.5442536",
"0.5440639",
"0.5234462",
"0.5125994",
"0.5118183",
"0.5117475",
"0.50919735",
"0.50558233",
"0.4982016",
"0.4977306",
"0.49663824",
"0.496450... | 0.6626714 | 1 |
Indicates if the given transport is a valid transport option. | def valid_transport?(transport)
return false if transport.nil?
VALID_TRANSPORTS.has_key?(transport.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lxd_transport_selected?\r\n instance.transport.is_a? Kitchen::Transport::Lxd\r\n end",
"def requires_transport_security\n to_bool description['RequiresTransportSecurity']\n end",
"def compatible?(opts)\n opts == @options\n end",
"def recipient_required?\n transfer_type?... | [
"0.6418291",
"0.6378669",
"0.60231215",
"0.5906427",
"0.5903978",
"0.58465683",
"0.5818413",
"0.5770901",
"0.57369584",
"0.5731191",
"0.57050544",
"0.57010823",
"0.5671012",
"0.5618755",
"0.5613927",
"0.5547167",
"0.5546207",
"0.5533641",
"0.55271596",
"0.5524442",
"0.5523704... | 0.8292597 | 0 |
Negotiates the use of encryption at the TLV level | def negotiate_tlv_encryption
sym_key = nil
rsa_key = OpenSSL::PKey::RSA.new(2048)
rsa_pub_key = rsa_key.public_key
request = Packet.create_request(COMMAND_ID_CORE_NEGOTIATE_TLV_ENCRYPTION)
request.add_tlv(TLV_TYPE_RSA_PUB_KEY, rsa_pub_key.to_der)
begin
response = client.send_request(req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt; end",
"def encryption_server; end",
"def flag_unencrypted!\n if (!flag_unencrypted?)\n @flags = @flags | TAC_PLUS_UNENCRYPTED_FLAG\n else\n @flags = @flags & (~TAC_PLUS_UNENCRYPTED_FLAG)\n end\n return(nil)\n end",
"def decrypt; end",
"def e... | [
"0.6219268",
"0.6050318",
"0.60302675",
"0.6021541",
"0.5976383",
"0.59305847",
"0.5928",
"0.5901424",
"0.5864061",
"0.5811158",
"0.5778909",
"0.5746842",
"0.5695048",
"0.5692484",
"0.5679981",
"0.5662186",
"0.56545293",
"0.5633376",
"0.56083804",
"0.5597781",
"0.55971",
"0... | 0.71024567 | 0 |
Get a reference to the currently active transport. | def get_current_transport
x = transport_list
x[:transports][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTransport()\n\t\treturn @transport\n\tend",
"def transport\n instance.transport\n end",
"def transport\n @transport ||= definition.transport_class.new(ui, transport_options)\n end",
"def transport\n self.connection.transport\n end",
"def transport_key\n ret... | [
"0.78342223",
"0.7524477",
"0.7294853",
"0.69095546",
"0.64046234",
"0.6343704",
"0.61325413",
"0.6093084",
"0.5908385",
"0.5853454",
"0.58507127",
"0.58507127",
"0.58507127",
"0.5795152",
"0.5795152",
"0.5795152",
"0.5655502",
"0.5622717",
"0.56030846",
"0.55137587",
"0.5483... | 0.8338596 | 0 |
Generate a migrate stub that is specific to the current transport type and the target process. | def generate_migrate_stub(target_process)
stub = nil
if client.platform == 'windows' && [ARCH_X86, ARCH_X64].include?(client.arch)
t = get_current_transport
c = Class.new(::Msf::Payload)
if target_process['arch'] == ARCH_X86
c.include(::Msf::Payload::Windows::BlockApi)
case... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_payload(target_process)\n case client.platform\n when 'windows'\n blob = generate_migrate_windows_payload(target_process)\n else\n raise RuntimeError, \"Unsupported platform '#{client.platform}'\"\n end\n\n blob\n end",
"def generate_migrate(opts={})\n %Q^\n l... | [
"0.652956",
"0.6007505",
"0.5704186",
"0.570251",
"0.56541926",
"0.55902916",
"0.54886645",
"0.5402766",
"0.537883",
"0.53659356",
"0.531144",
"0.5218872",
"0.51872665",
"0.51799184",
"0.5167056",
"0.5117956",
"0.5115455",
"0.51071984",
"0.5082861",
"0.5062394",
"0.49958014",... | 0.81939185 | 0 |
Helper function to prepare a transport request that will be sent to the attached session. | def transport_prepare_request(method, opts={})
unless valid_transport?(opts[:transport]) && opts[:lport]
return nil
end
if opts[:transport].starts_with?('reverse')
return false unless opts[:lhost]
else
# Bind shouldn't have lhost set
opts[:lhost] = nil
end
transport = o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end",
"def prepare_request(params)\n request = process_params(params)\n request.store(:sizes, [extract_size(params.siz... | [
"0.6316247",
"0.6206249",
"0.5979829",
"0.59424824",
"0.59210116",
"0.5753195",
"0.56976604",
"0.56738293",
"0.56536734",
"0.5541747",
"0.55304503",
"0.55268645",
"0.549546",
"0.54951894",
"0.5479809",
"0.54600847",
"0.54554224",
"0.5431667",
"0.5391925",
"0.53846544",
"0.530... | 0.6512627 | 0 |
Create a full Windowsspecific migration payload specific to the target process. | def generate_migrate_windows_payload(target_process)
c = Class.new( ::Msf::Payload )
c.include( ::Msf::Payload::Stager )
# Include the appropriate reflective dll injection module for the target process architecture...
if target_process['arch'] == ARCH_X86
c.include( ::Msf::Payload::Windows::Meter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_payload(target_process)\n case client.platform\n when 'windows'\n blob = generate_migrate_windows_payload(target_process)\n else\n raise RuntimeError, \"Unsupported platform '#{client.platform}'\"\n end\n\n blob\n end",
"def migrate(target_pid, writable_dir = nil, o... | [
"0.6941142",
"0.5674712",
"0.56452084",
"0.54734516",
"0.5110263",
"0.5092422",
"0.50875616",
"0.4919041",
"0.49114454",
"0.48786268",
"0.4847124",
"0.48226452",
"0.4821488",
"0.4809202",
"0.47695208",
"0.47383603",
"0.47161415",
"0.47010955",
"0.4669676",
"0.4655507",
"0.464... | 0.6982177 | 0 |
Create a full migration payload specific to the target process. | def generate_migrate_payload(target_process)
case client.platform
when 'windows'
blob = generate_migrate_windows_payload(target_process)
else
raise RuntimeError, "Unsupported platform '#{client.platform}'"
end
blob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_migrate_windows_payload(target_process)\n c = Class.new( ::Msf::Payload )\n c.include( ::Msf::Payload::Stager )\n\n # Include the appropriate reflective dll injection module for the target process architecture...\n if target_process['arch'] == ARCH_X86\n c.include( ::Msf::Payload::Win... | [
"0.6817791",
"0.6476428",
"0.5920113",
"0.59197146",
"0.5449127",
"0.539093",
"0.53166944",
"0.52585816",
"0.52561843",
"0.52527153",
"0.52227163",
"0.52164346",
"0.5207744",
"0.51957464",
"0.5186737",
"0.51828617",
"0.51788473",
"0.5158144",
"0.51459026",
"0.5143998",
"0.514... | 0.75957185 | 0 |
make a method called make_juice that accepts a parameter (orange, apple, cranberry) | def make_juice(juice)
if @hired == true
puts "you are serving #{juice} juice."
else
puts "you are fired, and you can't serve."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_juice(juice)\n puts \"You want #{juice} juice.\"\n end",
"def meal_choice(arg1 = \"meat\")\n \"#{arg1}\"\nend",
"def meal_choice(meal=\"meat\") #meal is argument, default argument is \"meat\"\n \"#{meal}\" #method returns #{meal}\nend",
"def make_coffee(beans, water, electricity, milk)\n #do ... | [
"0.770687",
"0.6044922",
"0.5963802",
"0.59055734",
"0.5888976",
"0.5680308",
"0.56795436",
"0.5675683",
"0.5662363",
"0.5633928",
"0.56190336",
"0.5613153",
"0.556369",
"0.5559179",
"0.55513203",
"0.5537063",
"0.5506726",
"0.54970896",
"0.5486358",
"0.5473537",
"0.5472743",
... | 0.6512719 | 1 |
make a method called make_eggs that accepts two parameters; the quantity of eggs (1, 2, 3, etc) and the style (overeasy, scrambled, sunnyside up, etc..) | def make_eggs(quantity, style)
if @hired == true
puts "making #{quantity} eggs in #{style}."
else
puts "you are fired, and have to go home."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_eggs(number, type)\n puts \"You want #{number} eggs, #{type}.\"\n end",
"def age!\r\n @hen_age += 1\r\n 4.times do\r\n if @hen_age > 3\r\n @eggs << Egg.new\r\n @number_of_eggs += 1\r\n end\r\n end\r\n end",
"def poach_eggs (egg_stuff)\n (egg_stuff[:number_of_eggs... | [
"0.76865786",
"0.5870603",
"0.5749085",
"0.57410884",
"0.5736469",
"0.57154745",
"0.56976986",
"0.56659997",
"0.5639706",
"0.5607569",
"0.55859685",
"0.5563086",
"0.55582863",
"0.5537529",
"0.5519103",
"0.5513796",
"0.5513483",
"0.55097526",
"0.5509558",
"0.5500617",
"0.54979... | 0.71735626 | 1 |
Returns the driver with the provided id. | def find_driver(id)
return find_by_id(@drivers, id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver(driver_id)\n from_resource(\n :driver,\n connection.get(api_uri(\"drivers/#{driver_id}\"))\n )\n end",
"def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end",
"def find_by(id:)\n storage_adapters.values.find do |storage_adapter|... | [
"0.7822675",
"0.72007877",
"0.65544397",
"0.64229333",
"0.6237874",
"0.61804754",
"0.61804754",
"0.61730224",
"0.61297166",
"0.61247236",
"0.61247236",
"0.61247236",
"0.61247236",
"0.6101296",
"0.6101296",
"0.608054",
"0.60430163",
"0.6004728",
"0.60021347",
"0.599235",
"0.59... | 0.8555056 | 0 |
Returns the passenger with the provided id. | def find_passenger(id)
return find_by_id(@passengers, id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room(id)\n @rooms[id]\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_group_peers.get(\n id,\n deadline: deadline,\n )\n end",
"def retr... | [
"0.62623864",
"0.61780727",
"0.61256754",
"0.61051077",
"0.6099317",
"0.6095565",
"0.60604674",
"0.5997563",
"0.5993956",
"0.5970245",
"0.5950502",
"0.5950502",
"0.5950502",
"0.594577",
"0.59355175",
"0.5920971",
"0.5868865",
"0.58497304",
"0.58494514",
"0.5843002",
"0.583578... | 0.8840033 | 0 |
new_trip_data must be he information needed to create a valid trip. | def make_new_trip(new_trip_data)
trip = Trip.new(new_trip_data)
trip.driver.add_trip(trip)
trip.passenger.add_trip(trip)
return trip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@new_trip = Trip.new\n\tend",
"def create\n @trip = Trip.new(trip_params)\n @trip.user_id = current_user.id\n\n if @trip.roundtrip\n @trip2 = Trip.new()\n @trip2.start_date = @trip.end_date\n @trip2.start_time = @trip2.end_time\n\n @trip2.origin = @trip.destiny\n @t... | [
"0.70455885",
"0.6831871",
"0.68134004",
"0.67461973",
"0.6674544",
"0.66258496",
"0.66080695",
"0.66080695",
"0.6592854",
"0.6562376",
"0.648128",
"0.6473586",
"0.6440386",
"0.6423188",
"0.63966817",
"0.6389584",
"0.63762724",
"0.6374795",
"0.6334971",
"0.63134545",
"0.62982... | 0.78405476 | 0 |
Returns an available driver, with priority going to the driver who has never had trips and then to the driver with the least recent last trip. Returns nil if cannot find an available driver. | def find_available_driver
longest_ago_last_trip = Time.now
longest_ago_last_trip_driver = nil
@drivers.each do |driver|
next if !driver.is_available?
return driver if driver.trips.empty? # driver has never had a trip
last_trip_end_time = get_last_trip_end_time(driver)
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_driver_available\n # Find the first available driver:\n @drivers.each {|driver| return select_driver_available = driver if driver.status == :AVAILABLE }\n end",
"def select_driver_with_earliest_end_of_trip(only_available)\n earliest_end_time = Time.now\n right_driver = nil\n\n ... | [
"0.69621813",
"0.66751736",
"0.6600665",
"0.62989503",
"0.60639536",
"0.58175",
"0.5743223",
"0.56085503",
"0.55751336",
"0.541619",
"0.53816545",
"0.5357466",
"0.5345735",
"0.5341944",
"0.5317126",
"0.5302267",
"0.5302267",
"0.5286998",
"0.5267574",
"0.52250314",
"0.5198091"... | 0.8329913 | 0 |
Returns the most recent end trip time for provided driver. | def get_last_trip_end_time(driver)
last_trip_end_time = Time.parse('1949-04-09') # needed as a placeholder
driver.trips.each do |trip|
last_trip_end_time = trip.end_time if last_trip_end_time < trip.end_time
end
return last_trip_end_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_trip_end_time\n return nil if @driven_trips.empty?\n return @driven_trips.max_by { |item| item.end_time }.end_time\n end",
"def find_available_driver\n longest_ago_last_trip = Time.now\n longest_ago_last_trip_driver = nil\n @drivers.each do |driver|\n next if !driver.i... | [
"0.73836035",
"0.63608193",
"0.63047004",
"0.5927146",
"0.58888227",
"0.58355963",
"0.5762898",
"0.5590426",
"0.5590426",
"0.55876356",
"0.55562884",
"0.55534047",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55508184",
"0.55268764",
... | 0.85894966 | 0 |
GET /clinic_profiles GET /clinic_profiles.json | def index
@clinic_profiles = ClinicProfile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def my_profiles\n @user = User.find(p... | [
"0.67957795",
"0.66158783",
"0.66158783",
"0.65904254",
"0.65620965",
"0.65518934",
"0.6525518",
"0.6477518",
"0.64404804",
"0.63936657",
"0.6384022",
"0.636558",
"0.63554305",
"0.6339656",
"0.63104635",
"0.6293709",
"0.62731755",
"0.6236415",
"0.62272656",
"0.62272656",
"0.6... | 0.764416 | 0 |
POST /clinic_profiles POST /clinic_profiles.json | def create
@clinic_profile = ClinicProfile.new(clinic_profile_params)
respond_to do |format|
if @clinic_profile.save
format.html { redirect_to @clinic_profile, notice: 'Clinic profile was successfully created.' }
format.json { render :show, status: :created, location: @clinic_profile }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n ... | [
"0.6614924",
"0.65718526",
"0.6521124",
"0.6484346",
"0.6463979",
"0.64370984",
"0.64134955",
"0.6338189",
"0.6332701",
"0.62846774",
"0.62773263",
"0.6244513",
"0.62364155",
"0.61822855",
"0.61567503",
"0.61560684",
"0.6149351",
"0.6120731",
"0.6114918",
"0.6114918",
"0.6113... | 0.7533061 | 0 |
PATCH/PUT /clinic_profiles/1 PATCH/PUT /clinic_profiles/1.json | def update
respond_to do |format|
if @clinic_profile.update(clinic_profile_params)
format.html { redirect_to @clinic_profile, notice: 'Clinic profile was successfully updated.' }
format.json { render :show, status: :ok, location: @clinic_profile }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n ... | [
"0.6705261",
"0.6664943",
"0.66492176",
"0.6626116",
"0.6537976",
"0.6451804",
"0.64338285",
"0.6417751",
"0.6395556",
"0.63747644",
"0.6363147",
"0.6353765",
"0.6308682",
"0.6306573",
"0.63018376",
"0.6293812",
"0.6293812",
"0.6293812",
"0.62746686",
"0.62616307",
"0.6257732... | 0.7488682 | 0 |
DELETE /clinic_profiles/1 DELETE /clinic_profiles/1.json | def destroy
@clinic_profile.destroy
respond_to do |format|
format.html { redirect_to clinic_profiles_url, notice: 'Clinic profile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.71567816",
"0.692338",
"0.691823",
"0.683862",
"0.6795145",
"0.67800283",
"0.67747486",
"0.67684346",
"0.67684346",
"0.67684346",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.6746574",
"0.67388755",
"0.67388755",
"0.6733766"... | 0.768103 | 0 |
create method that greets the user by email if no name is given but if a name and a place are given please greet him by name and include a comment about his place of living is really nice | def greet_user email, options={}
if options.empty?
puts "Hello #{email} welcome to my awesome application"
else
puts "Hello #{options[:name]}, how're you?"
puts "I hear that #{options[:place]} is a beautiful place to live!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excited_greet(name)\nend",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_name = message.from.nil? ? '' : ', ' + message.from.first_name\n send_message \"#{greetings.sample.capitalize}#{first_name}!\\n Enter /help for options.\"... | [
"0.668982",
"0.66854846",
"0.6601451",
"0.65042263",
"0.65042263",
"0.6496351",
"0.64630604",
"0.64468086",
"0.6430629",
"0.6409368",
"0.6407438",
"0.63978297",
"0.638867",
"0.63459665",
"0.63282025",
"0.63086766",
"0.6296397",
"0.6255086",
"0.62533736",
"0.62370986",
"0.6192... | 0.6927978 | 0 |
DELETE /unit_planners/1 DELETE /unit_planners/1.xml | def destroy
@unit_planner = UnitPlanner.find(params[:id])
@unit_planner.destroy
respond_to do |format|
format.html { redirect_to(unit_planners_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @test_plan = TestPlan.find(params[:id])\n ... | [
"0.67963845",
"0.67111415",
"0.6697815",
"0.6634309",
"0.6584041",
"0.6575206",
"0.65175664",
"0.64917547",
"0.6479442",
"0.64739686",
"0.6386767",
"0.6383358",
"0.6380345",
"0.6376298",
"0.6348889",
"0.63025683",
"0.62947524",
"0.62651",
"0.6256336",
"0.6254497",
"0.6251666"... | 0.6754743 | 1 |
Register a bidirectional mapping between a type and an implementation | def register_implementation(type, impl_module, _ = nil)
type = type.name if type.is_a?(PAnyType)
impl_module = impl_module.name if impl_module.is_a?(Module)
@type_names_per_implementation[impl_module] = type
@implementations_per_type_name[type] = impl_module
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(mime, klass, orm = ORM_ACTIVERECORD)\n k = @map[mime]\n if k\n k[orm] = klass\n else\n @map[mime] = { orm => klass }\n end\n end",
"def register(type, cls); end",
"def add_mapper_for(type, &block)\n mappers[type] = block\n end",
"def polymorphic_mappings;... | [
"0.6325029",
"0.62472475",
"0.62318534",
"0.61825806",
"0.6108488",
"0.60576564",
"0.59825206",
"0.59825206",
"0.5973936",
"0.59549505",
"0.594782",
"0.5915379",
"0.5912589",
"0.587129",
"0.58648485",
"0.582462",
"0.57784957",
"0.5773743",
"0.5748107",
"0.57462806",
"0.574026... | 0.6547851 | 0 |
Find the name for the module that corresponds to the given type or type name | def module_name_for_type(type)
type = type.name if type.is_a?(PAnyType)
name = @parent.module_name_for_type(type) unless @parent.nil?
name.nil? ? find_mapping(type, @implementations_per_type_name, @type_name_substitutions) : name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_name_with_module(type_name)\n self.name =~ /::/ ? self.name.scan(/(.*)::/).first.first + \"::\" + type_name : type_name\n end",
"def find_module_named name\n @modules_hash[name]\n end",
"def find_module_named(name)\n find_class_or_module(name)\n end",
"def type_from_module( o... | [
"0.7971677",
"0.71911395",
"0.7186292",
"0.7067696",
"0.70116836",
"0.69855064",
"0.69663376",
"0.69314337",
"0.6841188",
"0.6830378",
"0.6829796",
"0.6760382",
"0.67347115",
"0.6685411",
"0.6678516",
"0.6671575",
"0.6668592",
"0.6666118",
"0.66261786",
"0.65867627",
"0.65712... | 0.7550945 | 1 |
check if input is an answer, if so, get the question associated with the answer, else return the question | def get_question(answer)
answer.is_a?(Answer) ? answer.question : answer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_answer_to(question)\n puts question\n answer = gets.chomp\n return answer\nend",
"def get_answer(answer)\n # In case the Chair did not answer this question.\n return 'No response provided.' if answer.nil?\n\n case answer.answer_type\n when 'Multiple Choice' # If multiple choice, show selec... | [
"0.7270826",
"0.72285986",
"0.7184371",
"0.71339965",
"0.7111333",
"0.696897",
"0.6961246",
"0.6945703",
"0.6938034",
"0.6935098",
"0.69102496",
"0.68984836",
"0.6898478",
"0.68383825",
"0.6771324",
"0.6735656",
"0.6703936",
"0.6703318",
"0.6699673",
"0.66973484",
"0.6667297"... | 0.781646 | 0 |
GET /specific_contents GET /specific_contents.json | def index
@specific_contents = SpecificContent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @contents = Content.all\n render json: @contents\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def index\n @contents = Content.all\n\n respond_to ... | [
"0.65488017",
"0.649212",
"0.64590776",
"0.6445844",
"0.6437369",
"0.6384205",
"0.63125163",
"0.6264671",
"0.626106",
"0.6259193",
"0.62191623",
"0.6206697",
"0.6143979",
"0.6128286",
"0.6038655",
"0.60298365",
"0.598193",
"0.59310025",
"0.59176683",
"0.58698034",
"0.58627903... | 0.675044 | 0 |
POST /specific_contents POST /specific_contents.json | def create
@specific_content = SpecificContent.new(specific_content_params)
respond_to do |format|
if @specific_content.save
format.html { redirect_to @specific_content, notice: 'Specific content was successfully created.' }
format.json { render :show, status: :created, location: @specifi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specific_content_params\n params.require(:specific_content).permit(:title, :subtitle, :content, :external_link)\n end",
"def index\n @specific_contents = SpecificContent.all\n end",
"def content_params\n params.require(:content).permit(:content_one)\n end",
"def create(contents, param... | [
"0.5870602",
"0.5670245",
"0.5644242",
"0.5636741",
"0.5628201",
"0.56152403",
"0.55818367",
"0.5501568",
"0.54728043",
"0.5469868",
"0.53832513",
"0.53687227",
"0.5263899",
"0.52289224",
"0.5228776",
"0.52049506",
"0.5202982",
"0.5200085",
"0.5189124",
"0.5178578",
"0.514934... | 0.59360576 | 0 |
PATCH/PUT /specific_contents/1 PATCH/PUT /specific_contents/1.json | def update
respond_to do |format|
if @specific_content.update(specific_content_params)
format.html { redirect_to @specific_content, notice: 'Specific content was successfully updated.' }
format.json { render :show, status: :ok, location: @specific_content }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @o_single.update(content_params)\n format.html { redirect_to contents_url, notice: t(\"general.successfully_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @... | [
"0.65502536",
"0.6412034",
"0.6412034",
"0.62519956",
"0.6236205",
"0.6212608",
"0.61509293",
"0.6125998",
"0.6106785",
"0.6099949",
"0.60364795",
"0.59812576",
"0.5919454",
"0.5911051",
"0.58881444",
"0.58881444",
"0.58881444",
"0.5868378",
"0.58640665",
"0.5860333",
"0.5860... | 0.6428863 | 1 |
DELETE /specific_contents/1 DELETE /specific_contents/1.json | def destroy
@specific_content.destroy
respond_to do |format|
format.html { redirect_to specific_contents_url, notice: 'Specific content was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_... | [
"0.73570955",
"0.70819217",
"0.70819217",
"0.70819217",
"0.7057439",
"0.7057439",
"0.7057439",
"0.7051132",
"0.68632936",
"0.6825476",
"0.6819089",
"0.67937404",
"0.67854166",
"0.6779004",
"0.6764315",
"0.67564523",
"0.67564523",
"0.6724143",
"0.6718644",
"0.66940707",
"0.669... | 0.73604286 | 0 |
This sweeper is going to keep an eye on the IndicatorType model If our sweeper detects that a IndicatorType was created call this | def after_create(indicator_type)
# expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @illness_type = IllnessType.new(illness_type_params)\n if @illness_type.save\n @illness_type = IllnessType.new\n @illness_types = IllnessType.all\n @flag=true \n else\n @flag=false\n end\n end",
"def indicator_state=(indicator_state); end",
"def t... | [
"0.54596263",
"0.5400211",
"0.5343864",
"0.51274395",
"0.5096468",
"0.5071879",
"0.5052985",
"0.50362074",
"0.5020727",
"0.50197613",
"0.50023943",
"0.4998349",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573",
"0.4992573"... | 0.55233943 | 0 |
If our sweeper detects that a IndicatorType was updated call this | def after_update(indicator_type)
expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indicator_state=(indicator_state); end",
"def update?\n update_indicator.eql?('U')\n end",
"def after_update(indicator)\n expire_cache_for(indicator)\n end",
"def update(instance)\n raise NotImplementedError, 'Expected adapter to override `update`'\n end",
"def updat... | [
"0.5575622",
"0.55084574",
"0.5360028",
"0.52903414",
"0.52367",
"0.5220259",
"0.5165592",
"0.51418877",
"0.513922",
"0.51350677",
"0.5107527",
"0.5098657",
"0.50968736",
"0.5094345",
"0.508772",
"0.5068049",
"0.5060769",
"0.50414217",
"0.50373006",
"0.5027641",
"0.500357",
... | 0.6224537 | 0 |
If our sweeper detects that a IndicatorType was deleted call this | def after_destroy(indicator_type)
expire_cache_for(indicator_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deletedaysedit\n end",
"def after_update(indicator_type)\n expire_cache_for(indicator_type)\n end",
"def _delete\n marked_for_destruction?\n end",
"def removed; status[:removed]; end",
"def after_destroy(indicator)\n expire_cache_for(indicator)\n end",
"def after_create(indicator_typ... | [
"0.58384854",
"0.5782335",
"0.5717284",
"0.5703652",
"0.56713504",
"0.5664185",
"0.56124896",
"0.55773056",
"0.5566837",
"0.5562461",
"0.5546288",
"0.5517347",
"0.54835457",
"0.5479567",
"0.54746956",
"0.54684526",
"0.54664713",
"0.5466425",
"0.5430374",
"0.53572714",
"0.5349... | 0.6577595 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.