query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Creates a new model with the supplied attributes, and returns an instance of it. | def create(values)
a = new(values)
a.insert
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end",
"def to_model(model)\n model.new(attributes)\n end",
"def create!(attributes = {})\n object = klass.new(attributes)\n object.save!\n obj... | [
"0.8073742",
"0.7589684",
"0.7540807",
"0.7503444",
"0.74855983",
"0.7477606",
"0.74668694",
"0.7401726",
"0.7391709",
"0.73646903",
"0.7350481",
"0.7345779",
"0.7279706",
"0.72267216",
"0.7213535",
"0.71940696",
"0.71762407",
"0.71696806",
"0.7166601",
"0.7166601",
"0.715823... | 0.0 | -1 |
Reads the database row identified by the primary key, and instantiates a model. | def read(id)
sql = "SELECT * FROM #{table_name} WHERE "
sql += Database.quote_identifier(@primary_key.name)
sql += " = "
sql += Database.quote_value(id, @primary_key.type)
sql += " LIMIT 1"
result = Database.execute(sql)
if result.cmd_tuples == 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(model, id)\n key = model.primary_key\n condition = {\"#{key}\" => id}\n data = store.read(condition, table: table_name).first\n fail RecordNotFound.new(condition, table_name) unless data\n\n model.new data\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Conv... | [
"0.709271",
"0.64797884",
"0.64208907",
"0.6381167",
"0.631191",
"0.6300648",
"0.6300648",
"0.6294499",
"0.6215584",
"0.61635655",
"0.6054944",
"0.6054944",
"0.60108215",
"0.5966772",
"0.59343374",
"0.5892587",
"0.58396024",
"0.58112234",
"0.579262",
"0.5781085",
"0.5781085",... | 0.7707149 | 0 |
17 16 15 14 13 18 5 4 3 12 19 6 1 2 11 20 7 8 9 10 21 22 23 24 25. | def highest_number_in_box n
return 1 if n == 1
highest_number_in_box(n - 1) + (8 * (n-1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret_numbers\n\t\t(1..5).to_a \n\tend",
"def five_digit_pattern()\r\n\treturn [\r\n\t\t\t[1, 0, 0, 0, 1],\r\n\t\t\t[0, 1, 0, 0, 1],\r\n\t\t\t[0, 0, 1, 0, 1],\r\n\t\t\t[0, 0, 0, 1, 1]\r\n\t\t ]\r\nend",
"def basic_1\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" }\n puts\nend",
"def ... | [
"0.65800697",
"0.622076",
"0.62006986",
"0.6135584",
"0.6114635",
"0.60855645",
"0.60585016",
"0.6031366",
"0.59941775",
"0.5986862",
"0.59784275",
"0.5964909",
"0.5925945",
"0.59126925",
"0.5905532",
"0.5898033",
"0.5872641",
"0.5868969",
"0.58539927",
"0.58395386",
"0.58354... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_search_result
@search_result = SearchResult.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Once an ActiveJob is queued, ActiveRecord references get serialized into some internal reserved keys, such as _aj_globalid. The problem is, if this job in turn gets queued back into ActiveJob with these magic reserved keys, ActiveJob will throw up and error. We want to capture these and mutate the keys so we can sanely... | def filtered
filtered_context = filter_context(context)
if job_entry = filtered_context.delete(:job)
job_entry.each do |k, v|
filtered_context[k] = v
end
end
# Sidekiq 7.0 started adding `_config` to the context, which is not easily serialisable
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n {\n \"job_class\" => self.class.name,\n \"job_id\" => job_id,\n \"provider_job_id\" => provider_job_id,\n \"queue_name\" => queue_name,\n \"priority\" => priority,\n \"arguments\" => serialize_arguments_if_needed(arguments),\n \"executio... | [
"0.58947706",
"0.5828294",
"0.57302004",
"0.5454285",
"0.5390004",
"0.5358173",
"0.5356987",
"0.5319953",
"0.5292018",
"0.52895796",
"0.5248902",
"0.5200279",
"0.5183062",
"0.5148855",
"0.5131817",
"0.5113438",
"0.5111696",
"0.5107823",
"0.50578725",
"0.5039442",
"0.50294816"... | 0.0 | -1 |
Let's check has been route setted or not. If not returns message, if yes, returns true | def route_check_true
if @route.nil?
puts 'Маршрут не установлен!!!'
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routed?\n\t\t\t@routed\n\t\tend",
"def any_empty_routing?\n self.empty?(self, \"routings\", false)\n end",
"def routing_params?\n routing_params.any?\n end",
"def routing_params?\n routing_params.any?\n end",
"def test? route\n root = nav.root.to_s\n\n ok =... | [
"0.74736327",
"0.7443523",
"0.7139169",
"0.70766824",
"0.6929668",
"0.6840914",
"0.6805472",
"0.6790091",
"0.67105114",
"0.6666659",
"0.65286756",
"0.65054363",
"0.6453923",
"0.63843906",
"0.6341256",
"0.6330037",
"0.63284606",
"0.6322315",
"0.6315162",
"0.6293677",
"0.625602... | 0.8021803 | 0 |
Here we are setting previous station | def previous_station
if @current_station == @route.stations.first
@current_station
else
@current_station = @route.stations[@route.stations.index(@current_station) - 1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev_station\n @route.stations[@current_station - 1] if current_station != @route.stations.first\n end",
"def previous_station\n return @current_station if @current_station == @route.first\n\n @route.stations[@route.stations.index(@current_station) - 1]\n end",
"def previous_station_index\n c... | [
"0.70822495",
"0.64176464",
"0.6334607",
"0.6275901",
"0.6013715",
"0.59938043",
"0.589713",
"0.58878136",
"0.5871042",
"0.5871042",
"0.5871042",
"0.5855394",
"0.5844603",
"0.57988995",
"0.57951057",
"0.5779121",
"0.5779063",
"0.5771511",
"0.57705724",
"0.5770344",
"0.5749049... | 0.6966598 | 1 |
Here we are setting next station | def next_station
if @current_station == @route.stations.last
@current_station
else
@current_station = @route.stations[@route.stations.index(@current_station) + 1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_station\n @route.stations[@current_station_index + 1]\n end",
"def next_station\n @route.stations[@current_station + 1] if current_station != @route.stations.last\n end",
"def go_to_the_next_station!\n gain_speed\n current_station.send_out(self) if current_station\n self.current_stati... | [
"0.7328471",
"0.73209566",
"0.7299116",
"0.7242876",
"0.69680876",
"0.69433516",
"0.68328613",
"0.68276954",
"0.62377095",
"0.6093374",
"0.59642357",
"0.5943769",
"0.58851784",
"0.58729196",
"0.58683044",
"0.5861994",
"0.5834199",
"0.5782227",
"0.577123",
"0.5766058",
"0.5766... | 0.7408667 | 0 |
Moving ahead if route is setted | def ahead
if self.route_check_true
if @current_station != @route.stations.last
@route.stations[@route.stations.index(@current_station)].departure(self)
@current_station = next_station
@route.stations[@route.stations.index(@current_station)].coming(self)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_train_forward_by_route\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train_moved_forward_by_route if train.move_train_... | [
"0.6745677",
"0.663944",
"0.6556773",
"0.6336602",
"0.63132733",
"0.6265691",
"0.6015793",
"0.6005973",
"0.5997385",
"0.5991482",
"0.5960843",
"0.5911454",
"0.5887215",
"0.5868771",
"0.5839687",
"0.58393544",
"0.5761374",
"0.5736659",
"0.572469",
"0.56996596",
"0.56994754",
... | 0.73671085 | 0 |
Moving back if route is setted | def backward
if self.route_check_true
if @current_station != @route.stations.first
@route.stations[@route.stations.index(@current_station)].departure(self)
@current_station = previous_station
@route.stations[@route.stations.index(@current_station)].coming(self)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_route_end\n if @move_route.repeat\n @move_route_index = -1\n elsif @move_route_forcing\n @move_route_forcing = false\n restore_move_route\n end\n end",
"def move_back\n position.depart_train(self)\n @current_station -= 1 if @route.stations[@current_station] != @route.st... | [
"0.70900404",
"0.69054794",
"0.68983006",
"0.67663914",
"0.65012413",
"0.64816165",
"0.64816165",
"0.6478792",
"0.64683366",
"0.63932836",
"0.63932836",
"0.63932836",
"0.6296125",
"0.6201952",
"0.61798555",
"0.6152784",
"0.61120135",
"0.61076283",
"0.60959846",
"0.60878044",
... | 0.7363035 | 0 |
`title`, `description` always needed to potentially populate virtual fields. If not explicitly requested they will not be sent to the user. The same applies to all `_content_ids` in order to be able to expand their corresponding fields without having to request both fields explicitly. popularity is required as a featur... | def fields
search_params.return_fields +
%w[document_type
title
description
organisation_content_ids
topic_content_ids
mainstream_browse_page_content_ids
popularity
format
link
public_timestamp
up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_content_metadata record, tags\n # TODO: Further enrich the structured data by marking up FAQ accordions, Video Carousels, Image Galleries, etc.\n # Also ItemList metadata for the meditations archive\n # See here: https://developers.google.com/search/docs/data-types/article\n []\n e... | [
"0.5191635",
"0.51541626",
"0.5121066",
"0.50926936",
"0.5086957",
"0.5057937",
"0.5033851",
"0.49930477",
"0.49563712",
"0.49399057",
"0.49392873",
"0.49113452",
"0.49095613",
"0.48875514",
"0.48814955",
"0.48615128",
"0.48489136",
"0.48388433",
"0.48373175",
"0.4827042",
"0... | 0.5123369 | 2 |
More like this is a separate function for returning similar documents, but it's included in the main search API. All other parameters are ignored if "similar_to" is present. | def more_like_this_query_hash
docs = content_index_names.reduce([]) do |documents, index_name|
documents << {
_id: search_params.similar_to,
_index: index_name,
}
end
{
more_like_this: {
like: docs,
min_doc_freq: 0, # Revert to the ES 1.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_similar(*args)\n Collection.search_similar(self, *args)\n end",
"def similar\n Enceladus::MovieCollection.new(\"movie/#{id}/similar\", Enceladus::Movie.default_params(only: [:language, :append_to_response]))\n end",
"def similar(options={})\n get(:standard, {:method => \"track... | [
"0.7247079",
"0.6840117",
"0.67053944",
"0.6563447",
"0.65067726",
"0.64968383",
"0.6002752",
"0.59493554",
"0.59490526",
"0.5945947",
"0.58538866",
"0.5832244",
"0.58189553",
"0.5807685",
"0.57748985",
"0.5770922",
"0.5740786",
"0.5740786",
"0.5686561",
"0.5671959",
"0.56456... | 0.68424344 | 1 |
These collection objects are instantiated by ActiveRecord paginating finders; there is no need to do it manually. | def initialize(page, per_page, total = nil)
@current_page = page.to_i
@per_page = per_page.to_i
self.total_entries = total if total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(collection, items_per_page)\n @collection = collection\n @page_size = items_per_page\n end",
"def init_collection\n strong_memoize(:init_collection) do\n filter(finder.execute).reorder(nil)\n end\n end",
"def paginate_collection!\n set_collection get_collection.page... | [
"0.71092314",
"0.7032951",
"0.69668275",
"0.69574404",
"0.6952362",
"0.69484067",
"0.6885874",
"0.6866065",
"0.6776912",
"0.67402655",
"0.6731694",
"0.6668149",
"0.661989",
"0.65634096",
"0.6545726",
"0.6544915",
"0.65181684",
"0.64906496",
"0.6434238",
"0.6430373",
"0.637789... | 0.0 | -1 |
The total number of pages. | def page_count
@total_pages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_pages\n pages.size\n end",
"def total_pages\n total = total_items / page_size\n if total_items % page_size != 0\n total += 1\n end\n total\n end",
"def total_pages\n @total_pages ||= (count.to_f / per_page).ceil\n end",
"def getTotalPageCoun... | [
"0.93122977",
"0.88591504",
"0.8801762",
"0.87218744",
"0.8707143",
"0.8660314",
"0.86223173",
"0.8606631",
"0.8546252",
"0.8525683",
"0.8513195",
"0.85015094",
"0.85014194",
"0.84928614",
"0.8482334",
"0.8479294",
"0.8458429",
"0.8450423",
"0.84464353",
"0.8434497",
"0.84275... | 0.9108889 | 1 |
Current offset of the paginated collection. If we're on the first page, it is always 0. If we're on the 2nd page and there are 30 entries per page, the offset is 30. This property is useful if you want to render ordinals besides your records: simply start with offset + 1. | def offset
(current_page - 1) * per_page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset\n (current_page - 1) * per_page\n end",
"def offset\n (current_page - 1) * per_page\n end",
"def offset\n @options[:offset] || ((current_page - 1) * per_page)\n end",
"def offset\n (page - 1) * PER_PAGE\n end",
"def offset\n if page <= 1\n ... | [
"0.821403",
"0.8170413",
"0.81308544",
"0.79512477",
"0.78992856",
"0.7835301",
"0.716337",
"0.7153614",
"0.70948637",
"0.6984797",
"0.6786981",
"0.6767507",
"0.666944",
"0.6644295",
"0.6634853",
"0.66022843",
"0.65964353",
"0.6571493",
"0.65448016",
"0.6543393",
"0.65171385"... | 0.82175624 | 2 |
current_page 1 or nil if there is no previous page | def previous_page
current_page > 1 ? (current_page - 1) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev_page\n current_page > 1 ? (current_page - 1) : nil\n end",
"def previous_page\n current_page == 1 ? nil : current_page - 1\n end",
"def previous_page\n current_page == 1 ? nil : current_page - 1\n end",
"def previous_page\n @current_page > 1 ? (@current_page - 1) : nil... | [
"0.85539347",
"0.85289717",
"0.84994495",
"0.8465288",
"0.84507585",
"0.84507585",
"0.84430313",
"0.84430313",
"0.8442931",
"0.8266804",
"0.82506204",
"0.8194855",
"0.8174857",
"0.8142886",
"0.80793756",
"0.80562335",
"0.802884",
"0.8006742",
"0.7999713",
"0.7944512",
"0.7925... | 0.84668595 | 5 |
current_page + 1 or nil if there is no next page | def next_page
current_page < page_count ? (current_page + 1) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n @current_page < num_pages ? (@current_page + 1): nil\n end",
"def next_page\n current_page < tot... | [
"0.8988693",
"0.8988693",
"0.89622945",
"0.8938229",
"0.8938229",
"0.8938229",
"0.89377636",
"0.893145",
"0.89027333",
"0.89027333",
"0.88965404",
"0.88965404",
"0.8819468",
"0.86336905",
"0.86122245",
"0.8578722",
"0.8554214",
"0.8514291",
"0.847778",
"0.831255",
"0.8290214"... | 0.9012811 | 0 |
time_taken? Takes a room or instructor, and given the time parameters from the form, check against all times object currently has. Attack this problem like a bounding box collision detection type of problem. If any time is invalid, time is not taken, so return false We work in 24h format, since we are going to use the ... | def time_taken?(model, ss_obj, params)
stime = time_format(params[:stime_h], params[:stime_m], params[:stime_p])
etime = time_format(params[:etime_h], params[:etime_m], params[:etime_p])
# Invalid time, do not care
return false if stime.nil? || etime.nil?
time_wanted = get_range_times(stime, etime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n\t\tif not isEmpty(self.time)\n\t\t\terrors.add(:time, \"is already occupied.\")\n\t\tend\n\t\tif not Schedule.isValidTimeSlot(self.schedule, self.time)\n\t\t\terrors.add(:time, \"is not a valid timeslot.\")\n\t\tend\n\tend",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (se... | [
"0.6997025",
"0.68920404",
"0.6594954",
"0.65910614",
"0.654964",
"0.65390164",
"0.6529259",
"0.65181834",
"0.6491988",
"0.64632446",
"0.64632446",
"0.64607507",
"0.6446129",
"0.6432762",
"0.6430459",
"0.6385948",
"0.63546723",
"0.6351028",
"0.6347887",
"0.6337115",
"0.632814... | 0.7334054 | 0 |
We first check the days and see if we have any match. If not, return false. Then we make another range of times for our obj time | def has_conflict?(ts, days, t_range)
slot_days = ts.days
return false if no_matching_days?(slot_days, days)
# We have matching days, so continue on.
slot_range = get_range_times(ts.start_time, ts.end_time)
collided?(t_range, slot_range)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if... | [
"0.7155521",
"0.7020761",
"0.6879128",
"0.68626213",
"0.68042725",
"0.6765756",
"0.6730301",
"0.6665718",
"0.66335297",
"0.6581897",
"0.6573837",
"0.64552474",
"0.6449317",
"0.6444673",
"0.640365",
"0.63859457",
"0.63738537",
"0.6348823",
"0.6337763",
"0.6336207",
"0.631924",... | 0.65675694 | 11 |
Returns a String that is the humanreadable answer given for the QTS question when the claim was made. | def qts_award_year_answer
year_for_answer = MathsAndPhysics.first_eligible_qts_award_year(claim_academic_year)
year_for_answer -= 1 if awarded_qualified_status_before_cut_off_date?
I18n.t("answers.qts_award_years.#{qts_award_year}", year: year_for_answer.to_s(:long))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str( )\n @question\n end",
"def body\n (answers['transcription'] || answers['1']).to_s\n end",
"def questioning\n return text\n end",
"def questioning\n return text\n end",
"def answer_humanized\n I18n.t(yes_no ? 'answer.yes' : 'answer.no')\n end",
... | [
"0.711646",
"0.6680784",
"0.6388789",
"0.6388789",
"0.62794733",
"0.62230057",
"0.6217939",
"0.61631674",
"0.6107919",
"0.6074666",
"0.6072969",
"0.60662425",
"0.60478324",
"0.60099334",
"0.59902525",
"0.5983696",
"0.59672874",
"0.5963298",
"0.592157",
"0.58965135",
"0.589271... | 0.580014 | 25 |
Returns true only if we can determine that they do not have a qualification in maths or physics. If they are not sure about their ITT specialism, they may still qualify, otherwise we require that they have an ITT in maths or physics or a degree in either maths or physics. | def no_maths_or_physics_qualification?
!itt_specialism_not_sure? &&
!initial_teacher_training_specialised_in_maths_or_physics? &&
(has_uk_maths_or_physics_degree == "no")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qualifies? element\n return false unless the_right_type? element\n return false unless meets_criteria? element\n return true\n end",
"def qualify?\n @qualify\n end",
"def wildcard?\n all_abilities? && all_ages? && !equipment? && !weight?\n end",
"def valid?\n return false i... | [
"0.63923436",
"0.6274544",
"0.6243717",
"0.6241899",
"0.6238356",
"0.6207351",
"0.62064487",
"0.61666316",
"0.6069355",
"0.60588384",
"0.6019762",
"0.60188675",
"0.60167074",
"0.60167074",
"0.60165465",
"0.6016303",
"0.5988884",
"0.5985277",
"0.5930247",
"0.5902969",
"0.58967... | 0.78707397 | 0 |
==== Write a method named greet that invokes the following methods: | def hello
'Hello'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greet\n 'Ahoy Mateys!'\n end",
"def greet(name)\nend",
"def greeter\nend",
"def greet(person)\n puts \"Hello, \" + person\nend",
"def greet(person)\n puts \"Hello, \" + person\nend",
"def greet (n... | [
"0.822727",
"0.81885",
"0.81733346",
"0.8121512",
"0.80159646",
"0.80159646",
"0.8007928",
"0.7980378",
"0.7974731",
"0.7974731",
"0.7974731",
"0.79538536",
"0.7952646",
"0.7939164",
"0.7912923",
"0.782557",
"0.7802795",
"0.7789073",
"0.7769364",
"0.7758564",
"0.7752584",
"... | 0.0 | -1 |
When `greet` is invoked with `puts`, it should output the following: Hello World Make sure you add a space between `"Hello"` and `"World"`, however, you're not allowed to modify hello or world. ANSWER ====== For this problem, our `greet` method will return a string which will be the interpolation of the results of invo... | def greet
"#{hello} #{world}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greet\n hello + \" \" + world # this format allows us to use puts on line 31\nend",
"def greet\n hello + \" \" + world\nend",
"def greet person\n\t'Hello, ' + person + '!'\nend",
"def sayHi\n\t\tputs(greet)\n\tend",
"def greeting\nputs \"HELLO, BONJOUR, HOLA, GUTENTAG, HALLO, HOWDY, NAMASKAR, MERHAB... | [
"0.80951774",
"0.7543268",
"0.75353044",
"0.7439486",
"0.74180096",
"0.7415644",
"0.7378565",
"0.7349181",
"0.7341909",
"0.7320773",
"0.7320773",
"0.7320773",
"0.7295176",
"0.72888756",
"0.7277696",
"0.72672683",
"0.725368",
"0.72372746",
"0.72237426",
"0.72207624",
"0.722076... | 0.77470744 | 1 |
The word list for this document | def words_for(uid)
word_list = get_words(uid)
return word_list if ngrams <= 1
word_list.each_cons(ngrams).map { |a| a.join(' ') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_list\n @word_list\n end",
"def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end",
"def list\n @list ||= Vidibus::Words.words(input)\n end",
"def ... | [
"0.86668843",
"0.7879479",
"0.7663219",
"0.717853",
"0.7163758",
"0.71115804",
"0.6933749",
"0.6820708",
"0.66717154",
"0.6668251",
"0.65920955",
"0.6579599",
"0.6575508",
"0.657305",
"0.6532223",
"0.65176404",
"0.6510765",
"0.64656",
"0.64518654",
"0.6421786",
"0.64207864",
... | 0.59741694 | 63 |
Get the word list for this document, possibly stemmed or lemmatized | def get_words(uid)
doc = Document.find(uid, term_vectors: true)
add_dfs(doc)
# This converts from a hash to an array like:
# [[['word', pos], ['word', pos]], [['other', pos], ...], ...]
word_list = doc.term_vectors.map do |k, v|
k = case stemming
when :s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_list\n @word_list\n end",
"def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end",
"def words_for(uid)\n word_list = if @options[:stemming] == :lemma... | [
"0.8010737",
"0.7895575",
"0.7525483",
"0.7241801",
"0.7189296",
"0.71530294",
"0.7126962",
"0.68489206",
"0.68100816",
"0.66301626",
"0.66235155",
"0.6622687",
"0.6609175",
"0.6531737",
"0.65171415",
"0.6511157",
"0.6495378",
"0.64881974",
"0.6469207",
"0.6462673",
"0.646050... | 0.7377457 | 3 |
Add the DFs to our cache for this document | def add_dfs(doc)
doc.term_vectors.each do |word, hash|
# Oddly enough, you'll get weird bogus values for words that don't
# appear in your document back from Solr. Not sure what's up with
# that.
next if hash[:df] <= 0
key = case stemming
when ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end",
"def initialize_file_based_cache\n Dir.mkdir(\"cache\")\n @document_cache = ActiveSupport::Cache::FileStore.new(\"cache\")\n @file_based_cache = true\n end",
"def add_dfs(doc)\n doc.term_vectors.each do |wor... | [
"0.6581344",
"0.62795997",
"0.6102386",
"0.5696977",
"0.56614053",
"0.557039",
"0.557039",
"0.5549599",
"0.55271053",
"0.55231583",
"0.5499356",
"0.5499356",
"0.5499356",
"0.5499356",
"0.5499356",
"0.5499356",
"0.5499356",
"0.54990196",
"0.5491298",
"0.5453203",
"0.5453203",
... | 0.5863956 | 3 |
GET /arts GET /arts.json | def index
@ability = Ability.new(current_user)
# if params[:search].nil? || params[:search].empty?
@arts = Art.all
# else @arts = Art.basic_search(params[:search])
# render "/arts/index.html"
# end
@filterrific = initialize_filterrific(
Art,
params[:filterrific],
select_options:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @arts = Art.all.all_with_comment_counts.order('updated_at DESC')\n # curl -H \"Accept: application/json\" http://localhost:3000/arts\n respond_to do |format|\n format.html {render}\n format.json {render json: @arts}\n end\n end",
"def index \n artists = Artist.all \n ... | [
"0.6883352",
"0.68268865",
"0.6682478",
"0.6682478",
"0.66728795",
"0.6586924",
"0.6575227",
"0.65612304",
"0.6469494",
"0.64101046",
"0.6402044",
"0.63317144",
"0.63189954",
"0.63090134",
"0.63090134",
"0.63090134",
"0.62965655",
"0.6295717",
"0.6265703",
"0.62483597",
"0.62... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_art
@user = current_user
@art = Art.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
construct_changes_strings sub: model_names series | def construct_changes_strings(model,operation,count=1)
expected=model_names model
case operation
when 'delet' then changed=expected.pop count
when 'add'
changed=series "added#{ 'picture'==model ? '.png' : '-name' }", count
expected=expected.take(count).concat changed
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LetterChanges(str)\n new_string = []\n str = str.split(\" \")\n str.each do |word|\n new_string << word_changes(word)\n end\n new_string.join(\" \")\nend",
"def string_replacements\nend",
"def model_name_strings\n model_names.map(&:to_s)\n end",
"def process_names(total)\n name... | [
"0.53826547",
"0.5262245",
"0.5237979",
"0.514816",
"0.5097242",
"0.50364417",
"0.5025962",
"0.49832758",
"0.4966831",
"0.49332556",
"0.49295694",
"0.49265173",
"0.49141547",
"0.48294786",
"0.4807484",
"0.47992858",
"0.47965524",
"0.47867987",
"0.47813687",
"0.47809175",
"0.4... | 0.6634105 | 0 |
mock_expected Perhaps, change: rename to, 'mock_all_my_models_expected'. Not show. sub: applicationdependent: mock_file_tags mock_directory_pictures mock_unpaired_names | def mock_expected(model,expected)
other='tag'==model ? [] : :all
t,p ='tag'==model ? [expected,other] : [other,expected]
mock_file_tags t
mock_directory_pictures p
mock_unpaired_names []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_model_bad_names(model,expected)\n model.expects(:find_bad_names).returns expected.sort.reverse\n end",
"def mock_model_unpaired_names(model,expected)\n model.expects(:find_unpaired_names).at_least_once.returns(\n expected.sort.reverse)\n end",
"def mock_model_simple(model,expe... | [
"0.7039931",
"0.70026267",
"0.6788308",
"0.6667513",
"0.5790988",
"0.57897186",
"0.57001084",
"0.5672421",
"0.5576436",
"0.55617994",
"0.5555976",
"0.5555391",
"0.55477756",
"0.54282767",
"0.54054815",
"0.53509086",
"0.53300244",
"0.53300244",
"0.5320786",
"0.5293422",
"0.527... | 0.72808075 | 0 |
mock_model (pairs only) Perhaps, change, to use: 'model_pairs' (defined above). Or, pass two models. sub: (none) | def mock_model(model,method,expected)
expected=case
# See ActiveRecord::Base method, '==='. Another way is to use object_id:
when DirectoryPicture==model then Picture
when FileTag ==model then Tag
end.all.map &method if :all==expected
model.expects(:all).at_least_once.returns(expec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_model_simple(model,expected=:all)\n mock_model model, :name, expected\n end",
"def mock_expected(model,expected)\n other='tag'==model ? [] : :all\n t,p ='tag'==model ? [expected,other] : [other,expected]\n mock_file_tags t\n mock_directory_pictures p\n mock_unp... | [
"0.695199",
"0.65086627",
"0.64779544",
"0.63203245",
"0.6020642",
"0.5925159",
"0.5812695",
"0.57525814",
"0.5715558",
"0.5523845",
"0.5523845",
"0.5523845",
"0.5523845",
"0.5502268",
"0.5455358",
"0.54507804",
"0.54354745",
"0.54031795",
"0.53991425",
"0.53991425",
"0.53737... | 0.6619133 | 1 |
mock_model_bad_names Was, 'mock_directory_picture_bad_names', etc. Perhaps, change: instead, parameterize the model, making it: Invoke 'mock_model_bad_names(DirectoryPicture,expected)'. sub: (none) | def mock_model_bad_names(model,expected)
model.expects(:find_bad_names).returns expected.sort.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_expected(model,expected)\n other='tag'==model ? [] : :all\n t,p ='tag'==model ? [expected,other] : [other,expected]\n mock_file_tags t\n mock_directory_pictures p\n mock_unpaired_names []\n end",
"def mock_model_unpaired_names(model,expected)\n model.expects(:f... | [
"0.69967383",
"0.6750377",
"0.67474246",
"0.6537813",
"0.59020865",
"0.5853705",
"0.5665679",
"0.54819155",
"0.5399961",
"0.53483117",
"0.5332768",
"0.5311181",
"0.528539",
"0.5281381",
"0.5268705",
"0.52515095",
"0.5211372",
"0.5183985",
"0.51786685",
"0.51542735",
"0.513313... | 0.7594476 | 0 |
mock_model_simple Was: mock_directory_pictures itself applicationdependent Perhaps, change: instead, parameterize the model, making it: Instead, invoke 'mock_model_simple(DirectoryPicture,expected)'. sub: mock_model | def mock_model_simple(model,expected=:all)
mock_model model, :name, expected
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_model(model,method,expected)\n expected=case\n# See ActiveRecord::Base method, '==='. Another way is to use object_id:\n when DirectoryPicture==model then Picture\n when FileTag ==model then Tag\n end.all.map &method if :all==expected\n model.expects(:all).at_least_once.re... | [
"0.72738034",
"0.66710174",
"0.6504654",
"0.601286",
"0.59301734",
"0.592217",
"0.59122473",
"0.5892242",
"0.5791059",
"0.572523",
"0.5658462",
"0.5557074",
"0.55083257",
"0.54683053",
"0.5406347",
"0.5391892",
"0.5270325",
"0.5258275",
"0.5256822",
"0.51956004",
"0.5175501",... | 0.71057945 | 1 |
mock_model_unpaired_names Was: mock_unpaired_names Perhaps, change: instead, parameterize the model, making it: Instead, invoke 'mock_model_bad_names(DirectoryPicture,expected)'. sub: (none) | def mock_model_unpaired_names(model,expected)
model.expects(:find_unpaired_names).at_least_once.returns(
expected.sort.reverse)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_model_bad_names(model,expected)\n model.expects(:find_bad_names).returns expected.sort.reverse\n end",
"def mock_expected(model,expected)\n other='tag'==model ? [] : :all\n t,p ='tag'==model ? [expected,other] : [other,expected]\n mock_file_tags t\n mock_directory_p... | [
"0.762925",
"0.7301241",
"0.666186",
"0.655314",
"0.5635624",
"0.55567425",
"0.53904843",
"0.5278529",
"0.52091724",
"0.52091724",
"0.5038042",
"0.5025081",
"0.50161994",
"0.50060236",
"0.49704102",
"0.49642965",
"0.49414608",
"0.49374393",
"0.4927018",
"0.49136618",
"0.49030... | 0.7728942 | 0 |
model_names good, as is sub: (none) | def model_names(model)
model.capitalize.constantize.all.map &"#{'file' if 'picture'==model}name".
to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_model_names; end",
"def model_names\n @model_names ||= []\n end",
"def model_name_strings\n model_names.map(&:to_s)\n end",
"def lookup_model_names\n object_name.to_s.scan(/([a-zA-Z_]+)/).flatten.map do |x|\n x.gsub('_attributes', '')\n end\n end... | [
"0.80246437",
"0.7543547",
"0.73957145",
"0.7057089",
"0.6924387",
"0.6827936",
"0.6764266",
"0.6731256",
"0.6731256",
"0.66914105",
"0.6640007",
"0.6640007",
"0.6622652",
"0.66069806",
"0.65134054",
"0.6511991",
"0.6439569",
"0.6408427",
"0.640639",
"0.6360748",
"0.6360298",... | 0.6446592 | 16 |
see_output good, as is Note: required is, 'App.root'. Is this automatic, in Rails? sub: (none) So, in a test, whether controller or view, you can say: see_output or see_output some_string and the generated web page will be copied, complete, into the file, 'out/seeoutput'. | def see_output(s=nil)
a = %w[rendered response].map{|e|(!respond_to? e) ? nil : (send e)}
a.push(a.pop.body) if a.last
(a.unshift s).compact!
assert_present a, 'nothing defined'
f=App.root.join('out/see-output').open 'w'
f.print a.first
f.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output\n options[:output] || 'test'\n end",
"def test_automatically_sets_output_argument\n assert_equal( 'build/docs', @cmd.output )\n end",
"def output\n @location + \"output\"\n end",
"def create_output\n test_case = TestCase.find(params[:id])\n tempDirectory = Rails.c... | [
"0.6792956",
"0.6432059",
"0.62924945",
"0.6276991",
"0.61978304",
"0.61227036",
"0.60794085",
"0.60708666",
"0.60617983",
"0.6011393",
"0.6011393",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"0.60113037",
"... | 0.7161699 | 0 |
series good, as is sub: (none) So you can say: series 'aaa', 3 and it will return %w[aaa aab aac] | def series(start,count=1)
o=object=nil
Array.new(count){o=o.blank? ? start : o.succ}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_series (series_name)\n end",
"def series(*eras); end",
"def series\n []\n end",
"def series(*eras)\n from_eras(*eras, field: :series)\n end",
"def series(*eras)\n from_eras(*eras, field: :series)\n end",
"def series\n return @series\n ... | [
"0.6684154",
"0.6599129",
"0.64742273",
"0.6192226",
"0.6192226",
"0.6048861",
"0.59286964",
"0.589308",
"0.58180517",
"0.5727938",
"0.5689248",
"0.5677052",
"0.5657465",
"0.5532448",
"0.5470959",
"0.5443423",
"0.54433554",
"0.54198176",
"0.5393864",
"0.5388385",
"0.5368259",... | 0.59255576 | 7 |
Perform polling and reportings of metrics | def poll(agent, snmp)
@snmp_manager = snmp
@f5_agent = agent
unless get_names.empty?
get_requests
get_conns_current
get_conns_total
get_packets_in
get_packets_out
get_throughput_in
get_throughput_out
get_cpu_usa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_cycle\n @connection = self.connect\n\n report_metrics\n\n rescue => e\n $stderr.puts \"#{e}: #{e.backtrace.join(\"\\n \")}\"\n ensure\n @connection.finish if @connection\n end",
"def process\n return if self.metrics.nil? # failed reports may have no metrics? be safe.\n ... | [
"0.7296598",
"0.71034336",
"0.6994573",
"0.66980404",
"0.65067023",
"0.64869666",
"0.6409122",
"0.6391134",
"0.638382",
"0.63795406",
"0.63673496",
"0.63433814",
"0.6331976",
"0.6288189",
"0.6288189",
"0.6288189",
"0.6285251",
"0.6261717",
"0.61948526",
"0.61739165",
"0.61570... | 0.5593801 | 67 |
Get the list of Virtual Server names | def get_names(snmp = nil)
snmp = @snmp_manager unless snmp
if snmp
@names.clear
begin
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_NAME]) do |row|
row.each do |vb|
@names.push(vb.value)
end
end
rescue Exception =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vservers\n @vservers=get_endpoint('vservers').keys\n end",
"def name_servers\n Array(@gapi.name_servers)\n end",
"def servers\n servers_by_name.values\n end",
"def name_servers\n response = @client.rest_get(@data['uri'] + '/nameServers')\n response.body\n... | [
"0.73291355",
"0.7090336",
"0.7030569",
"0.7010697",
"0.6967645",
"0.68316984",
"0.68231726",
"0.67357415",
"0.66943413",
"0.6632645",
"0.66016006",
"0.6599797",
"0.6568876",
"0.65632176",
"0.655834",
"0.6490164",
"0.64869297",
"0.64522",
"0.64031726",
"0.6341519",
"0.6328847... | 0.73392725 | 0 |
Gather VS Total Requests | def get_requests(snmp = nil)
@req_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Requests", @names, OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS, snmp)
NewRelic::Platfor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_count; end",
"def request_stats\n @all = current_user.trip_requests.requests.count\n @completed = current_user.trip_requests.completed.requests.count\n @cancelled = current_user.trip_requests.cancelled.requests.count\n @active = current_user.trip_requests.active.requests.count\n @stats... | [
"0.701719",
"0.6795906",
"0.64495337",
"0.6440801",
"0.6408873",
"0.6262847",
"0.62562746",
"0.62414604",
"0.62414604",
"0.624131",
"0.621321",
"0.6212707",
"0.61478424",
"0.6113936",
"0.6088668",
"0.60860497",
"0.6074824",
"0.601673",
"0.59827775",
"0.5958631",
"0.59482235",... | 0.5586001 | 57 |
Gather VS Connection count | def get_conns_current(snmp = nil)
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Current Connections", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_CUR_CONNS, snmp)
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getconnectioncount\n coind.getconnectioncount\n end",
"def connection_count\n request('getconnectioncount')\n end",
"def getconnectioncount\n request :getconnectioncount\n end",
"def getconnectioncount\n @api.request 'getconnectioncount'\n end",
"def connections\n @connections.... | [
"0.75803554",
"0.7555562",
"0.74946404",
"0.72142696",
"0.7012397",
"0.7012397",
"0.7011932",
"0.6875342",
"0.67542756",
"0.67477006",
"0.6716598",
"0.65679127",
"0.6540609",
"0.65334255",
"0.6502505",
"0.6482779",
"0.6453302",
"0.64014304",
"0.638027",
"0.6371518",
"0.634761... | 0.0 | -1 |
Gather VS Connection rate | def get_conns_total(snmp = nil)
@conn_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Connection Rate", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_TOT_CONNS, snmp)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_cycle\n\n puts \"---------------------\"\n puts \"#{host}\"\n puts \"---------------------\"\n data = twemproxy_data()\n\n summary_ejections = 0\n summary_client_connections = 0\n summary_requests = 0\n summary_server_connections = 0\n summary_server_errors = 0... | [
"0.62349904",
"0.61025876",
"0.60585326",
"0.603733",
"0.5949885",
"0.59090155",
"0.5902465",
"0.58971477",
"0.5892775",
"0.5849602",
"0.5799683",
"0.5788706",
"0.57844603",
"0.5768617",
"0.571673",
"0.57093066",
"0.5661062",
"0.5643987",
"0.56391436",
"0.561581",
"0.56046283... | 0.6066994 | 2 |
Gather VS Packets Inbound | def get_packets_in (snmp = nil)
@packet_in_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Packets/In", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_PKTS_IN, snmp)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def packets; end",
"def gather\n\t\t\t@conn.sit\n\t\t\tself\n\t\tend",
"def read\n if !@derived_queue.empty?\n p1 = @derived_queue.shift\n return p1\n else\n\n # This is a blocking call to wait for an actual packet to come over the wire\n packet = super()\n\n agg_pkt_map.select do |... | [
"0.64334464",
"0.62269664",
"0.5991647",
"0.59894264",
"0.5857354",
"0.5761497",
"0.574235",
"0.55965644",
"0.55739605",
"0.5564765",
"0.555025",
"0.5548373",
"0.5541809",
"0.5529697",
"0.5515359",
"0.55055124",
"0.5503554",
"0.54947364",
"0.54922676",
"0.5475522",
"0.5426568... | 0.4992737 | 61 |
Gather VS Packets Outbound | def get_packets_out(snmp = nil)
@packet_out_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Packets/Out", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_PKTS_OUT, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def packets; end",
"def gather\n\t\t\t@conn.sit\n\t\t\tself\n\t\tend",
"def packet(pkt)\n if ((pkt.ip_mf? or pkt.ip_off > 0 ))\n$stderr.puts \"*** Fragmented packet #{@event_collector.pkt_count}\"\n @event_collector.send(:ip_fragmented_packet) do\n { :src_ip => pkt.src, :dst_ip => pkt.dst, :ip_i... | [
"0.6240786",
"0.5889477",
"0.58557004",
"0.5746684",
"0.57166046",
"0.56136554",
"0.55515444",
"0.5547227",
"0.5509212",
"0.54445237",
"0.54291344",
"0.54240006",
"0.5410928",
"0.54081523",
"0.53913224",
"0.53913224",
"0.53913224",
"0.53863907",
"0.5377041",
"0.53764",
"0.534... | 0.5502587 | 9 |
Gather VS Throughput Inbound (returns in bits) | def get_throughput_in(snmp = nil)
@throughput_in_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Throughput/In", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIEN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bits need\n\t\tval = @bit_bucket\n\t\twhile @bit_count < need\n\t\t\tval |= (@input_buffer[@in_pos+=1] << @bit_count)\n\t\t\t@bit_count += 8\n\t\tend\n\t\t\n\t\t@bit_bucket = val >> need\n\t\t@bit_count -= need\n\t\tval & ((1 << need) - 1)\n\tend",
"def get_bits need\n\t\t\tval = @bit_bucket\n\t\t\twhile... | [
"0.59560573",
"0.5860529",
"0.58380926",
"0.5649379",
"0.54184073",
"0.540234",
"0.5388238",
"0.53324383",
"0.53203064",
"0.52905375",
"0.52655625",
"0.5244705",
"0.5213164",
"0.51965094",
"0.51965094",
"0.51957387",
"0.5177943",
"0.51594234",
"0.5157012",
"0.5155425",
"0.514... | 0.0 | -1 |
Gather VS Throughput Outbound (returns in bits) | def get_throughput_out(snmp = nil)
@throughput_out_rate ||= { }
report = { }
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/Throughput/Out", @names, OID_LTM_VIRTUAL_SERV_STAT_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bits need\n\t\tval = @bit_bucket\n\t\twhile @bit_count < need\n\t\t\tval |= (@input_buffer[@in_pos+=1] << @bit_count)\n\t\t\t@bit_count += 8\n\t\tend\n\t\t\n\t\t@bit_bucket = val >> need\n\t\t@bit_count -= need\n\t\tval & ((1 << need) - 1)\n\tend",
"def compute_need_bits; end",
"def get_bits need\n\t\t... | [
"0.5864443",
"0.5765917",
"0.57580876",
"0.57304174",
"0.5463956",
"0.5360302",
"0.5310911",
"0.5275604",
"0.5260796",
"0.5249599",
"0.5226959",
"0.52067924",
"0.5176459",
"0.51581746",
"0.5156064",
"0.5111887",
"0.510625",
"0.51014644",
"0.5093139",
"0.5093139",
"0.5092809",... | 0.4624042 | 98 |
Gather VS Connection rate | def get_cpu_usage_1m(snmp = nil)
snmp = @snmp_manager unless snmp
get_names(snmp) if @names.empty?
res = gather_snmp_metrics_by_name("Virtual Servers/CPU Usage/1m", @names, OID_LTM_VIRTUAL_SERV_STAT_VS_USAGE_RATIO_1M, snmp)
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_cycle\n\n puts \"---------------------\"\n puts \"#{host}\"\n puts \"---------------------\"\n data = twemproxy_data()\n\n summary_ejections = 0\n summary_client_connections = 0\n summary_requests = 0\n summary_server_connections = 0\n summary_server_errors = 0... | [
"0.62349904",
"0.61025876",
"0.6066994",
"0.60585326",
"0.603733",
"0.5949885",
"0.59090155",
"0.5902465",
"0.58971477",
"0.5892775",
"0.5849602",
"0.5799683",
"0.5788706",
"0.57844603",
"0.5768617",
"0.571673",
"0.57093066",
"0.5661062",
"0.5643987",
"0.56391436",
"0.561581"... | 0.0 | -1 |
GET /needs GET /needs.json | def index
@needs = Need.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_needs\n needs_generic_data(request(\"needs/all.xml\", :auth => true))\n end",
"def index\n @needs = current_organization.needs.all\n end",
"def index\n @needs = Need.where(user: current_user).all\n end",
"def hot_needs\n needs_generic_data(request(\"needs/hot.xml\", :auth => true... | [
"0.71158797",
"0.6729052",
"0.6661646",
"0.65301",
"0.60750335",
"0.60182166",
"0.59709525",
"0.5969651",
"0.5955464",
"0.5875391",
"0.58311826",
"0.58276415",
"0.58156675",
"0.5772109",
"0.57206696",
"0.5702678",
"0.5686548",
"0.5660981",
"0.56009",
"0.5564157",
"0.5564157",... | 0.6884134 | 2 |
GET /needs/1 GET /needs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @needs = Need.all\n end",
"def index\n @needs = Need.all\n end",
"def index\n @needs = current_organization.needs.all\n end",
"def show\n @special_needs_type = SpecialNeedsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r... | [
"0.65792966",
"0.65792966",
"0.6350592",
"0.63466847",
"0.62136865",
"0.6191441",
"0.6128907",
"0.6093958",
"0.6007673",
"0.59706724",
"0.5949212",
"0.5923221",
"0.58314705",
"0.57198054",
"0.57165843",
"0.5684483",
"0.5630151",
"0.5630151",
"0.5588373",
"0.55567116",
"0.5554... | 0.0 | -1 |
POST /needs POST /needs.json | def create
@need = Need.new()
@need.firstname = params[:need][:firstname]
@need.lastname = params[:need][:lastname]
@need.color = params[:need][:color]
@need.manufacturer = params[:need][:manufacturer]
# create an instance/object of a BasicCar
myNeed = BasicNeed.new(2000, @need.manufacturer, @need.color)
# add the ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @need = current_organization.needs.build(need_params)\n @need.user = current_user\n\n respond_to do |format|\n if @need.save\n format.html { redirect_to @need, notice: 'Need was successfully created.' }\n format.json { render :show, status: :created, location: @need }\n ... | [
"0.6906965",
"0.6713533",
"0.6622071",
"0.6279867",
"0.62018645",
"0.61313134",
"0.6129514",
"0.6092522",
"0.59810555",
"0.5927406",
"0.59256846",
"0.5826526",
"0.57821417",
"0.5763901",
"0.57485443",
"0.57169074",
"0.5688949",
"0.56509256",
"0.56509256",
"0.5622494",
"0.5606... | 0.4810752 | 87 |
PATCH/PUT /needs/1 PATCH/PUT /needs/1.json | def update
# update the instance variables with the information
# user provided in the form
# retrieve each value from the params hash
@need.firstname = params[:need][:firstname]
@need.lastname = params[:need][:lastname]
@need.color = params[:need][:color]
@need.manufacturer = params[:need][:manufacturer]
# create ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @need = current_user.needs.find(params[:id])\n\n respond_to do |format|\n if @need.update_attributes(params[:need])\n format.html { redirect_to(@need, :notice => 'Need was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action =>... | [
"0.63383543",
"0.62313807",
"0.62243366",
"0.6138861",
"0.6062198",
"0.60533196",
"0.60336417",
"0.5970444",
"0.593772",
"0.5858017",
"0.58559656",
"0.5848304",
"0.5832763",
"0.5831007",
"0.5820357",
"0.581886",
"0.5809435",
"0.57829213",
"0.57786274",
"0.577674",
"0.57540125... | 0.0 | -1 |
DELETE /needs/1 DELETE /needs/1.json | def destroy
@need.destroy
respond_to do |format|
format.html { redirect_to needs_url, notice: 'Need was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @need.destroy\n respond_to do |format|\n format.html { redirect_to needs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @need.destroy\n respond_to do |format|\n format.html { redirect_to needs_url }\n # format.json { head :no_content }\n ... | [
"0.7298693",
"0.71335465",
"0.7052364",
"0.6985004",
"0.6769583",
"0.67661124",
"0.6759707",
"0.67561364",
"0.6728538",
"0.666015",
"0.66379553",
"0.66270906",
"0.6598685",
"0.6598332",
"0.65971625",
"0.6597059",
"0.65948284",
"0.65948284",
"0.6593078",
"0.65670604",
"0.65613... | 0.69625366 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_need
@need = Need.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def need_params
params.require(:need).permit(:firstname, :lastname, :manufacturer, :cost, :description, :color)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
get user info code from jwt | def get_user_info_from_id_token id_token
token_parts = id_token.split(".")
encoded_token = token_parts[1]
leftovers = token_parts[1].length.modulo(4)
if leftovers == 2
encoded_token << "=="
elsif leftovers == 3
encoded_token << "="
end
decoded_token = Base64.urlsafe_decode64(enco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id\n decoded_token.first['user_id']\n end",
"def get_auth_code()\n return @RESPONSE_HASH['AUTH_CODE']\n end",
"def token_user_id\n decoded_token.first['id']\n end",
"def logged_in_user_id\n token = request.headers[\"Authorization\"]\n # something which might raise an exception\n ... | [
"0.7294246",
"0.71752846",
"0.7164257",
"0.71144193",
"0.70039034",
"0.69755834",
"0.6902346",
"0.68620986",
"0.67848986",
"0.67819464",
"0.67818695",
"0.6779823",
"0.6767182",
"0.67619616",
"0.6705088",
"0.6650052",
"0.6634444",
"0.66282195",
"0.6620488",
"0.6607951",
"0.659... | 0.7239054 | 1 |
promote an artifact to a different environment | def promote_artifact
source_key = "#{ @environment_name }/#{ @artifact }/#{ @source_version }.gpg"
target_key = "#{ @target_environment_name }/#{ @artifact }/#{ @version }.gpg"
subsection "Promote artifact from s3://#{ @bucket.name }/#{ source_key } to s3://#{ @bucket.name }/#{ target_key }", c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(env); end",
"def promote\n deprecation_notice!\n downstream = @cisauraus.downstreams(app, 1).first\n verify_downstream! downstream\n print_and_flush(\"Promoting #{app} to #{downstream}...\")\n promotion = @cisauraus.promote(app) { print_and_flush \".\" }\n print_and_flush(\"done, #{... | [
"0.57742226",
"0.5520479",
"0.5509884",
"0.5488365",
"0.5488365",
"0.54172975",
"0.5391735",
"0.52800626",
"0.527978",
"0.5263067",
"0.52494913",
"0.523656",
"0.52302784",
"0.52080756",
"0.51470363",
"0.5118483",
"0.5103446",
"0.50671214",
"0.5057384",
"0.5053558",
"0.5046772... | 0.6654453 | 0 |
For reference for this gem's documentation: | def yml_config
return @yml_config if @yml_config
require 'yaml'
data = File.open(options[:config_path]).read
require 'erb'
data = ERB.new(data).result(binding)
@yml_config ||= YAML.load(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def implementation; end",
"def implementation; end",
"def docs; end",
"def library; end",
"def library; end",
"def usage; end",
"def usage; end",
"def interface; end",
"def interface; end",
"def provider... | [
"0.75861907",
"0.7036684",
"0.7036684",
"0.7036684",
"0.7036684",
"0.7000388",
"0.7000388",
"0.6930235",
"0.6917119",
"0.6917119",
"0.6868262",
"0.6868262",
"0.68599",
"0.68599",
"0.6849639",
"0.66871506",
"0.66871506",
"0.66684306",
"0.66684306",
"0.66684306",
"0.66684306",
... | 0.0 | -1 |
Check the if a feature should be enabled or not Example: >> FlipFlop::get_instance.feature_enabled? :some_feature Arguments: feature_name (Symbol) Returns: boolean | def feature_enabled?(feature_name, actor=nil)
public_send feature_type(feature_name), feature_value(feature_name), actor
rescue
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_enable?(feature)\n @features ||= config.features_enable\n @features[feature] == true\nend",
"def enabled_by_feature?(name = nil)\n if !name\n !!feature\n else\n if feature.class == Array\n feature.each do |f|\n if f == name\n re... | [
"0.84215516",
"0.8101319",
"0.8101319",
"0.7994716",
"0.7951639",
"0.78793776",
"0.77635634",
"0.76836973",
"0.76714927",
"0.76714927",
"0.75647444",
"0.75647444",
"0.7554677",
"0.74011564",
"0.7330996",
"0.73147947",
"0.7284933",
"0.7259637",
"0.72189325",
"0.6942963",
"0.68... | 0.8098823 | 3 |
If no adapter has been configured, use memory, then run the `after_initialize` method defined in the adapter if it's there | def initialize_adapter
# if no adapter has been initialized, use memory adapter
config[:adapter] ||= Adapters::Memory
extend config[:adapter]
after_initialize if respond_to? :after_initialize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_initialize\n # noop\n end",
"def adapter_initialize\n end",
"def after_initialize(&block); end",
"def after_initialize(opts)\n end",
"def do_adapter_specific_setup; end",
"def after_initialize(options={}) ; end",
"def after_initialize(&after_initialize_block)\n after_initi... | [
"0.71979594",
"0.6927583",
"0.6919758",
"0.6697315",
"0.6648439",
"0.66092825",
"0.659728",
"0.6595343",
"0.6595343",
"0.6595343",
"0.6595343",
"0.6590748",
"0.6539549",
"0.6538016",
"0.6507455",
"0.6507455",
"0.6354254",
"0.6353815",
"0.6342028",
"0.6310935",
"0.6265616",
... | 0.8170363 | 0 |
send a direct message | def send(callback, options)
if session[:uid].nil?
redirect_to '/auth/twitter'
return
end
auth # call auth first to make sure we are authenticated
@user = User.find(session[:uid])
@message = params[:message]
@recipient = params[:recipient]
twitter = Twitter::Client.new(:oauth_ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_direct(message)\n\t\t\t\treturned_message = @twitt_client.direct_message_create(@user, message)\n\t\t\tend",
"def send_message!(params = {})\n call_api(\"directmessage/#{secret}/#{token}\",params)\n end",
"def send_message(message); end",
"def send_message(message); end",
"def send(message... | [
"0.78554034",
"0.755414",
"0.74981844",
"0.74981844",
"0.7384741",
"0.73748875",
"0.73620003",
"0.72222865",
"0.7209416",
"0.72034967",
"0.71626437",
"0.7090703",
"0.70572156",
"0.70550865",
"0.7047867",
"0.70030546",
"0.6984032",
"0.6905172",
"0.6899672",
"0.68486476",
"0.68... | 0.0 | -1 |
Returns true if the ticket has "unread" updates | def has_updates?
self['newUpdatesFlag']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_unread_messages?\n received_messages.count > 0\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def unread?\n read_at.nil?\n end",
"def unread?\n (status == UNREAD)\n end",
"def unread?\n self.status == ... | [
"0.7399661",
"0.7331262",
"0.7331262",
"0.7331262",
"0.7308349",
"0.72960436",
"0.7175939",
"0.71577644",
"0.7034658",
"0.69730115",
"0.6894705",
"0.6842263",
"0.678208",
"0.67643833",
"0.66984546",
"0.66959894",
"0.66672367",
"0.6645078",
"0.662683",
"0.66184205",
"0.6610440... | 0.7315883 | 4 |
Returns true if the ticket is a server admin ticket | def server_admin_ticket?
# note that serverAdministrationFlag comes from the server as an Integer (0, or 1)
self['serverAdministrationFlag'] != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tracker_admin?\n self.tracker_admin_role != nil\n end",
"def admin?\r\n infoxml = get_info\r\n return infoxml['isadmin'] == '1'\r\n end",
"def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end",
"def admin_mode?\n\t\tsession[:admin... | [
"0.6808038",
"0.67623675",
"0.6676229",
"0.6658449",
"0.6643785",
"0.6637607",
"0.6628394",
"0.66262054",
"0.65795237",
"0.657916",
"0.65677726",
"0.65554845",
"0.6552887",
"0.6541663",
"0.65395343",
"0.65269166",
"0.6516915",
"0.65137327",
"0.65069956",
"0.6500492",
"0.65001... | 0.8715175 | 0 |
Add an update to this ticket. | def update(body = nil)
self.service.edit(self.softlayer_hash, body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(*args)\n commit(\"update\", *args)\n end",
"def update(*args)\n commit(\"update\", *args)\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update(updates = {})\n @ref.update(updates)\n end",
"def update... | [
"0.5855788",
"0.5785231",
"0.5771334",
"0.5771334",
"0.574158",
"0.5732823",
"0.57216287",
"0.56900287",
"0.5686541",
"0.5666819",
"0.56136984",
"0.5534786",
"0.54804575",
"0.5456957",
"0.5454299",
"0.5410662",
"0.538364",
"0.5354071",
"0.5306822",
"0.5301317",
"0.529952",
... | 0.0 | -1 |
Override of service from ModelBase. Returns the SoftLayer_Ticket service set up to talk to the ticket with my ID. | def service
return softlayer_client[:Ticket].object_with_id(self.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n ... | [
"0.7098825",
"0.6976728",
"0.680232",
"0.680232",
"0.680232",
"0.680232",
"0.680232",
"0.680232",
"0.680232",
"0.680232",
"0.67597634",
"0.6759667",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
"0.67277557",
... | 0.8398268 | 0 |
Override from model base. Requests new details about the ticket from the server. | def softlayer_properties(object_mask = nil)
my_service = self.service
if(object_mask)
my_service = service.object_mask(object_mask)
else
my_service = service.object_mask(self.class.default_object_mask.to_sl_object_mask)
end
my_service.getObject()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def ticket\n end",
"def new\n @ticket = Ticket.new\n end",
"def new\n @ticket = Ticket.new\n end",
"def set_ticket\n @ticket = Ticket.friendly.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:... | [
"0.6733062",
"0.6672172",
"0.6455361",
"0.6455361",
"0.64426214",
"0.639829",
"0.639829",
"0.639829",
"0.639829",
"0.639829",
"0.639829",
"0.639829",
"0.639829",
"0.63668895",
"0.63668895",
"0.63668895",
"0.63668895",
"0.63668895",
"0.63668895",
"0.63668895",
"0.63668895",
... | 0.0 | -1 |
Don't want any skipped message for this step | def log_skip(_entity); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skipped!; end",
"def skipped(message)\n log << \"[SKIPPED] #{message}\"\n false\n end",
"def skipped!\n @skipped = true\n end",
"def skipped; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skip_this_scenario(message ... | [
"0.77096903",
"0.7608891",
"0.75948495",
"0.75709754",
"0.75603175",
"0.75603175",
"0.75603175",
"0.75603175",
"0.73692405",
"0.72832894",
"0.7271534",
"0.7166533",
"0.7149903",
"0.7149903",
"0.71192914",
"0.71192914",
"0.70543855",
"0.69766486",
"0.69766486",
"0.6972814",
"0... | 0.6495546 | 44 |
Use callbacks to share common setup or constraints between actions. | def set_comment
@comment = @post.comments.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def comment_params
params.require(:comment).permit(:content,:user,:post)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
def self.order_by_approval self.order(approval: :desc) end | def update_approval
new_approval = (self.upvotes.length.to_f / self.shows.length.to_f) * 100
self.update(approval: new_approval.to_i)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rev_order\n\t \torder(created_at: :desc)\n\t end",
"def company_order\n {updated_at: :desc}\n end",
"def ordering_query; end",
"def results\n Review.where(:program_id => @program.id).sort_by(&:created_at).reverse\n end",
"def ideas_ordered_by_reminder_created_at\n self.ideas.desc(:remi... | [
"0.6366609",
"0.625485",
"0.6144053",
"0.6142316",
"0.6044618",
"0.60342425",
"0.60267276",
"0.5892173",
"0.5845959",
"0.57595396",
"0.57163465",
"0.5704785",
"0.56737113",
"0.56631637",
"0.5659141",
"0.5659141",
"0.5646324",
"0.563702",
"0.563062",
"0.5628981",
"0.5618466",
... | 0.0 | -1 |
Copy in for stubs | def copy_in(iovec)
tok = []
case return_type
when 'char *'
tok << "#{iovec}.iov_base = #{name};"
tok << "#{iovec}.iov_len = (#{name} == NULL) ? 0 : strlen(#{name}) + 1;"
when /\A[u]int\d+_t\z/, /(unsigned )?(long |int )?(int|long|char)/, 'float', 'double', 'long double',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stubs=(_arg0); end",
"def stubs; end",
"def copy\n \n end",
"def copy_list \n\n\tend",
"def _build_stub( obj )\n index = self.__pack[:stubs].length \n stub = { :class => obj.class.to_s, :id => obj } \n # deal with cached methods\n if obj._embed_me && obj._embed_me.keys &... | [
"0.6985381",
"0.67829263",
"0.63086253",
"0.6077456",
"0.60665023",
"0.59106696",
"0.58077264",
"0.57658666",
"0.5765566",
"0.57631713",
"0.5755338",
"0.5748083",
"0.57413626",
"0.5709519",
"0.5709352",
"0.5703183",
"0.5703183",
"0.5703183",
"0.5694233",
"0.56931674",
"0.5689... | 0.0 | -1 |
Copy out for stubs? | def copy_out(iovec, argsz)
tok = []
if type == 'char **'
tok << "char *tmp_#{name} = malloc(#{argsz});"
tok << "#{iovec}.iov_base = tmp_#{name};"
tok << "#{iovec}.iov_len = #{argsz};"
else
tok << "#{iovec}.iov_base = #{name};"
tok << "#{iovec}.iov_len = sizeof(*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stubs=(_arg0); end",
"def copy\n \n end",
"def stubs; end",
"def cop; end",
"def cop; end",
"def make_copy\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend",
"def copy\n move(:copy)\n end",
"def private; end",
"def original; end",
"def clone; end",
"def clone; end",
"def clone... | [
"0.6795364",
"0.6783975",
"0.66753125",
"0.62914854",
"0.62914854",
"0.6241748",
"0.62150294",
"0.6182075",
"0.6126239",
"0.6091312",
"0.6091312",
"0.6091312",
"0.6085498",
"0.60746473",
"0.60463375",
"0.59840864",
"0.59614295",
"0.591684",
"0.591684",
"0.5849258",
"0.5825988... | 0.0 | -1 |
Convert the name into a legal C identifier | def identifier
name.gsub(/[^A-Za-z0-9_]/, '_')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def c_name_to_ruby(name)\r\n name.to_s.\r\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\r\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\r\n tr('-', '_').\r\n gsub(/\\s/, '_').\r\n gsub(/__+/, '_').\r\n gsub(/^SU_/, \"\").\r\n gsub(/3_D/, \"3d\").\r\n gsub(/2_D/, \"2d\").\r\n downcase\r\nend",
"d... | [
"0.7294953",
"0.7084192",
"0.7039513",
"0.7001688",
"0.6936731",
"0.67557967",
"0.66930354",
"0.6639018",
"0.65742844",
"0.65378183",
"0.651503",
"0.64057493",
"0.64020574",
"0.6387801",
"0.63830274",
"0.6366728",
"0.63547987",
"0.6344505",
"0.6333597",
"0.63010544",
"0.62678... | 0.73845303 | 1 |
Return the macro definition of the stub | def stub_name
prefix = @service.kind_of?(Skeleton) ? 'skeleton' : 'stub'
'ipc_' + prefix + '__' + service.identifier + '__method_' + method_id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def macro; end",
"def macro; end",
"def output_macro_name(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)\n putd \"#define \" + macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)\nend",
"def parse_macro(d)\n if d[:body] =~ /define\\s+... | [
"0.6938147",
"0.6938147",
"0.6497393",
"0.645155",
"0.6387642",
"0.63698065",
"0.6351443",
"0.60539734",
"0.6044521",
"0.60206074",
"0.59634167",
"0.59275573",
"0.5820183",
"0.5815473",
"0.5778991",
"0.574097",
"0.57206047",
"0.57110035",
"0.57091796",
"0.56986773",
"0.563233... | 0.57828355 | 14 |
The "archetype" is a clever name for the declaration of the original method that the IPC mechanism is a wrapper for. | def archetype
tok = []
tok << 'extern int ' + name
tok << '(' + "\n"
tok << [
@returns.map { |ent| "#{ent.type} #{ent.name}" },
@accepts.map { |ent| "#{ent.type} #{ent.name}" },
].flatten.map { |s| "\t" + s }.join(",\n")
tok << "\n);"
tok.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def archetype\n\t\tsuper ? super.archetype : self\n\tend",
"def command(type)\n end",
"def supercommand!() __supercommand__ end",
"def interface; end",
"def interface; end",
"def method_a\n end",
"def protocol; end",
"def protocol; end",
"def protocol; end",
"def protocol; end",
"def acce... | [
"0.6320781",
"0.5720694",
"0.56272745",
"0.5568391",
"0.5568391",
"0.5564155",
"0.5504962",
"0.5504962",
"0.5504962",
"0.5504962",
"0.54387575",
"0.5421846",
"0.54180145",
"0.5392138",
"0.53373945",
"0.53065383",
"0.52771854",
"0.5266619",
"0.5254964",
"0.5251994",
"0.5250725... | 0.0 | -1 |
The arguments to the real function, as defined within the skeleton | def archetype_args
tok = []
@returns.map { |ent| tok << "&#{ent.name}" }
@accepts.map { |ent| tok << ent.name }
tok.join(', ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args\n @function.args\n end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def args(*) end",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments=(_arg0); end",
"def args() return @args end",
"def parameters=(_arg0); end",
"def mc... | [
"0.7746137",
"0.73900545",
"0.73900545",
"0.73900545",
"0.71549404",
"0.7070534",
"0.6966024",
"0.69444185",
"0.690112",
"0.67009765",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"0.66885644",
"... | 0.0 | -1 |
Copy out for stubs? | def copy_out(iovec, response)
tok = []
tok << "struct iovec #{iovec}[#{returns.length}];"
iov_count = 0
@returns.each do |arg|
tok << arg.copy_out("#{iovec}[#{iov_count}]", "#{response}._ipc_argsz[#{iov_count}]")
iov_count += 1
end
tok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stubs=(_arg0); end",
"def copy\n \n end",
"def stubs; end",
"def cop; end",
"def cop; end",
"def make_copy\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend",
"def copy\n move(:copy)\n end",
"def private; end",
"def original; end",
"def clone; end",
"def clone; end",
"def clone... | [
"0.6795364",
"0.6783975",
"0.66753125",
"0.62914854",
"0.62914854",
"0.6241748",
"0.62150294",
"0.6182075",
"0.6126239",
"0.6091312",
"0.6091312",
"0.6091312",
"0.6085498",
"0.60746473",
"0.60463375",
"0.59840864",
"0.59614295",
"0.591684",
"0.591684",
"0.5849258",
"0.5825988... | 0.0 | -1 |
A table to help convert method IDs into method function pointers | def vtable
tok = []
tok << "const struct {"
tok << "\t" + "int vt_id;"
tok << "\t" + "void (*vt_method)(int);"
tok << "} ipc_#{identifier}_vtable[] = {"
tok << @methods.map do |method|
"#{method.method_id}, &#{method.stub_name},\n"
end.join("\n")
tok << '};'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit_methods_arrays\n @symbol_table.map do |cname, chash|\n if chash.has_key? :functions_def\n id2fun_records = chash[:functions_def].map do |fname,farray|\n fdef = farray.first\n args_number = fdef[2].rest.length\n if fdef[0] == :stdlib_defn\n # Method defi... | [
"0.6760602",
"0.60246724",
"0.5969292",
"0.595397",
"0.58491015",
"0.58031964",
"0.5784513",
"0.57593024",
"0.5756852",
"0.5755147",
"0.56283385",
"0.562748",
"0.5570159",
"0.5570159",
"0.5564576",
"0.5561624",
"0.54938245",
"0.54873866",
"0.5479557",
"0.5474705",
"0.54697216... | 0.53727627 | 25 |
Convert the name into a legal C identifier | def identifier
name.gsub(/[^A-Za-z0-9_]/, '_')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def c_name_to_ruby(name)\r\n name.to_s.\r\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\r\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\r\n tr('-', '_').\r\n gsub(/\\s/, '_').\r\n gsub(/__+/, '_').\r\n gsub(/^SU_/, \"\").\r\n gsub(/3_D/, \"3d\").\r\n gsub(/2_D/, \"2d\").\r\n downcase\r\nend",
"d... | [
"0.7294953",
"0.7084192",
"0.7039513",
"0.7001688",
"0.6936731",
"0.67557967",
"0.66930354",
"0.6639018",
"0.65742844",
"0.65378183",
"0.651503",
"0.64057493",
"0.64020574",
"0.6387801",
"0.63830274",
"0.6366728",
"0.63547987",
"0.6344505",
"0.6333597",
"0.63010544",
"0.62678... | 0.73845303 | 0 |
list = [ 0, 3, 5, 4, 5, 10, 1, 90 ] p my_min(list) p my_min2(list) | def largest_contiguous_subsum(list) # O(n^2)
array = []
list.each_with_index do |ele1, i1| # O(n^2)
(i1...list.length).each do |i2|
array << list[i1..i2]
end
end
max_sum = array.first.sum
array[1..-1].each do |subarr| # O(n^2)
sum = subarr.sum
if sum > max_sum
max_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n ... | [
"0.87104166",
"0.8673322",
"0.8621691",
"0.85942405",
"0.8582091",
"0.8437624",
"0.8430881",
"0.8413794",
"0.8404373",
"0.8399387",
"0.8392067",
"0.8383349",
"0.83655506",
"0.83611727",
"0.836033",
"0.8353243",
"0.83334947",
"0.8255523",
"0.82168937",
"0.8197756",
"0.8185718"... | 0.0 | -1 |
functions needed to perform matrix operations | def isSquare()
truth = (@rowSize == @colSize) ? true : false
truth
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix\n end",
"def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_... | [
"0.7336496",
"0.71872735",
"0.7045794",
"0.69439465",
"0.6924844",
"0.6906902",
"0.68769646",
"0.6837039",
"0.68067056",
"0.67882985",
"0.67727315",
"0.67726004",
"0.67647207",
"0.67251205",
"0.671213",
"0.6693849",
"0.6676083",
"0.665774",
"0.66498286",
"0.65986365",
"0.6594... | 0.0 | -1 |
overloaded operators ( [], + ) | def [](index)
@rowSize = (index >= @rowSize) ? index + 1 : @rowSize
@matrix[index] = [] if (@matrix[index] == nil)
@matrix[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def +(other); end",
"def +(other); end",
"def +(other); end",
"def +(*values); end",
"def +(x); end",
"def +(arr)\n raise 'Not Implemented'\n end",
"def +(other)\n end",
"def + other\n #This is a stub, used for indexing\n end",
"def +(arg0)\n end",
"def +(arg0)\n end",
"d... | [
"0.74259716",
"0.74259716",
"0.74259716",
"0.734951",
"0.73002255",
"0.72793895",
"0.7182434",
"0.7148683",
"0.7047608",
"0.7047608",
"0.7016016",
"0.6938886",
"0.6889298",
"0.6827723",
"0.6765185",
"0.6765185",
"0.6765185",
"0.6765185",
"0.67648906",
"0.6756614",
"0.6649505"... | 0.0 | -1 |
initialize this student: s1 = Student.new(name, dob, gender, gpa, major) | def initialize(n, d, g, gpa, m)
@name = n
@dob = d
@gender = g
@gpa = gpa
@major = m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name, major, year)\n \n @stud_name = name #instance variable for name\n @stud_major = major #instance variable for major\n @stud_year = year #instance variable for year\n end",
"def initialize (name, major, grade)\n\t\t@name = name\n\t\t@major = major\n\t\t@grade = \"\"\n\ten... | [
"0.782593",
"0.77920556",
"0.74802357",
"0.7469905",
"0.73475456",
"0.73072255",
"0.7290502",
"0.72888184",
"0.7271314",
"0.72548896",
"0.7143887",
"0.71012515",
"0.70737624",
"0.7066892",
"0.7047318",
"0.7002941",
"0.70024705",
"0.6991023",
"0.6984741",
"0.6950534",
"0.69483... | 0.7682781 | 2 |
GET /item_acompanhamentos GET /item_acompanhamentos.json | def index
@item_acompanhamentos = ItemAcompanhamento.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"def index\n @comprobantes = Compr... | [
"0.6716451",
"0.6686165",
"0.65713805",
"0.65018785",
"0.6493009",
"0.6487748",
"0.6454126",
"0.64063543",
"0.639307",
"0.6343739",
"0.6343739",
"0.6343739",
"0.6343739",
"0.63394314",
"0.6286478",
"0.62860996",
"0.62755024",
"0.62695587",
"0.62693286",
"0.62683415",
"0.62640... | 0.7442426 | 0 |
GET /item_acompanhamentos/1 GET /item_acompanhamentos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @item_acompanhamentos = ItemAcompanhamento.all\n end",
"def show\n @carrito_item = CarritoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carrito_item }\n end\n end",
"def set_item_acompanhamento\n @item_acom... | [
"0.730619",
"0.66827744",
"0.65968543",
"0.6567867",
"0.65518373",
"0.65000606",
"0.64909905",
"0.64402246",
"0.6428797",
"0.6390692",
"0.6344734",
"0.63443893",
"0.6326513",
"0.6311889",
"0.6304243",
"0.62597066",
"0.6244772",
"0.6238263",
"0.6228296",
"0.6223743",
"0.621400... | 0.0 | -1 |
POST /item_acompanhamentos POST /item_acompanhamentos.json | def create
@item_acompanhamento = ItemAcompanhamento.new(item_acompanhamento_params)
respond_to do |format|
if @item_acompanhamento.save
format.html { redirect_to @item_acompanhamento, notice: 'Item acompanhamento was successfully created.' }
format.json { render :show, status: :created, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_acompanhamento_params\n params.require(:item_acompanhamento).permit(:preco_item_acompanhamento, :item_pedido_id, :acompanhamento_id)\n end",
"def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n ... | [
"0.7233666",
"0.6780672",
"0.6631099",
"0.65765214",
"0.64956754",
"0.6471206",
"0.64460504",
"0.64452505",
"0.6394423",
"0.6342313",
"0.63158554",
"0.6247045",
"0.6246251",
"0.6205341",
"0.619351",
"0.6178496",
"0.6154338",
"0.61443126",
"0.61299056",
"0.61195344",
"0.611110... | 0.7623118 | 0 |
PATCH/PUT /item_acompanhamentos/1 PATCH/PUT /item_acompanhamentos/1.json | def update
respond_to do |format|
if @item_acompanhamento.update(item_acompanhamento_params)
format.html { redirect_to @item_acompanhamento, notice: 'Item acompanhamento was successfully updated.' }
format.json { render :show, status: :ok, location: @item_acompanhamento }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end",
"def set_item_acompanhamento\n @item_acompanhamento = ItemAcompanhamento.find(params[:id]... | [
"0.66684",
"0.65293264",
"0.65013355",
"0.6451758",
"0.64279824",
"0.6425471",
"0.63790727",
"0.6368526",
"0.63505185",
"0.6321748",
"0.6306696",
"0.625674",
"0.62321734",
"0.62164396",
"0.6214507",
"0.61959434",
"0.61855435",
"0.6174187",
"0.61712307",
"0.6171",
"0.6161551",... | 0.7275357 | 0 |
DELETE /item_acompanhamentos/1 DELETE /item_acompanhamentos/1.json | def destroy
@item_acompanhamento.destroy
respond_to do |format|
format.html { redirect_to item_acompanhamentos_url, notice: 'Item acompanhamento was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @itemtipo.destroy\n\n head :no_content\n end",
"def destroy\n @item_cardapio = ItemCardapio.find(params[:id])\n @item_cardapio.destroy\n\n respond_to do |format|\n format.htm... | [
"0.74470866",
"0.74209845",
"0.73854786",
"0.73688346",
"0.73281676",
"0.7318799",
"0.73080605",
"0.7298385",
"0.72608",
"0.7259516",
"0.7259298",
"0.72189844",
"0.7173762",
"0.71608245",
"0.71606445",
"0.71257055",
"0.7117938",
"0.71100545",
"0.7109683",
"0.7079467",
"0.7077... | 0.7865899 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_item_acompanhamento
@item_acompanhamento = ItemAcompanhamento.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def item_acompanhamento_params
params.require(:item_acompanhamento).permit(:preco_item_acompanhamento, :item_pedido_id, :acompanhamento_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
output_key = nil
name_hash.each do |key, value|
if value<11
output_key = key
end
end
output_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
GET /administradors GET /administradors.json | def index
@administradors = Administrador.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @administradors }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @administradors = Administrador.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @administrators = Administrator.all\n end",
"def index\n @admins = Admin.all\n\n render json: @admins\... | [
"0.69064206",
"0.6850715",
"0.6850715",
"0.6850715",
"0.6826825",
"0.66985464",
"0.6651742",
"0.66373485",
"0.66004825",
"0.65936816",
"0.65583766",
"0.6534841",
"0.65172267",
"0.6509711",
"0.6489389",
"0.648763",
"0.64653116",
"0.6457521",
"0.64417917",
"0.6415516",
"0.64029... | 0.71433336 | 0 |
GET /administradors/1 GET /administradors/1.json | def show
@administrador = Administrador.find(session[:usuario_id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @administrador }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @administradors = Administrador.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administradors }\n end\n end",
"def index\n @administradors = Administrador.all\n end",
"def index\n @admins = Admin.all\n\n render json: @admins... | [
"0.70439345",
"0.67724186",
"0.67423326",
"0.6718781",
"0.6718781",
"0.6718781",
"0.6714474",
"0.66843134",
"0.66607314",
"0.66318524",
"0.6617617",
"0.661671",
"0.6614336",
"0.661355",
"0.65949607",
"0.6583922",
"0.658277",
"0.65796417",
"0.65615696",
"0.6553316",
"0.654882"... | 0.66280943 | 10 |
GET /administradors/new GET /administradors/new.json | def new
@administrador = Administrador.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @administrador }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @new = true\n @administrativo = Administrativo.new\n @administrativo.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administrativo }\n end\n end",
"def new\n @admin = Admin.new\n\n respond_to do |format|\n ... | [
"0.75539976",
"0.71310693",
"0.71189654",
"0.70120203",
"0.70120203",
"0.69671136",
"0.6919188",
"0.68969434",
"0.68853146",
"0.6870866",
"0.6870866",
"0.6870866",
"0.68566084",
"0.6842882",
"0.68423074",
"0.6841532",
"0.6838997",
"0.6833204",
"0.6829218",
"0.6813363",
"0.680... | 0.7336023 | 1 |
POST /administradors POST /administradors.json | def create
@administrador = Administrador.new(params[:administrador])
respond_to do |format|
if @administrador.save
format.html { redirect_to "/dados_admin", notice: 'O novo administrador foi adicionado com sucesso.' }
format.json { render json: @administrador, status: :created, location:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @adminstrator = Administrator.new(adminstrator_params)\n\n respond_to do |format|\n if @adminstrator.save\n format.html { redirect_to adminstrators_url, notice: 'Administrator #{adminstrator.name} successfully created.' }\n format.json { render :show, status: :created, locatio... | [
"0.6239362",
"0.621279",
"0.6115297",
"0.6079989",
"0.6025594",
"0.6023984",
"0.60118777",
"0.5937293",
"0.5924575",
"0.5866831",
"0.5863669",
"0.58597326",
"0.58374554",
"0.5834332",
"0.5794229",
"0.5788659",
"0.57827616",
"0.57576966",
"0.57373846",
"0.5717677",
"0.56957674... | 0.6046816 | 4 |
PUT /administradors/1 PUT /administradors/1.json | def update
@administrador = Administrador.find(params[:id])
respond_to do |format|
if @administrador.update_attributes(params[:administrador])
format.html { redirect_to "/dados_admin", notice: 'Seus dados foram atualizados com sucesso.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # binding.pry;''\n @occasion.administrators << User.find(params[:adminstrator]) if params[:adminstrator]\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to @occasion, notice: 'Occasion was successfully updated.' }\n format.json { ren... | [
"0.70385903",
"0.6407113",
"0.6229806",
"0.6143909",
"0.6141202",
"0.61068016",
"0.6105609",
"0.6093314",
"0.60772955",
"0.6073477",
"0.60623",
"0.6032806",
"0.60036975",
"0.59688437",
"0.5951785",
"0.5937507",
"0.5929541",
"0.59214836",
"0.5899067",
"0.58926785",
"0.58723176... | 0.6122698 | 5 |
DELETE /administradors/1 DELETE /administradors/1.json | def destroy
@administrador = Administrador.find(params[:id])
@administrador.destroy
respond_to do |format|
format.html { redirect_to administradors_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @admin = Admin.find(params[... | [
"0.73033935",
"0.72625434",
"0.72406805",
"0.71112823",
"0.70978796",
"0.7057876",
"0.7052484",
"0.70485866",
"0.7042852",
"0.70061505",
"0.69985",
"0.6975464",
"0.6972309",
"0.69638515",
"0.6960356",
"0.6951541",
"0.6939727",
"0.69287884",
"0.6919866",
"0.6905594",
"0.689723... | 0.71833074 | 3 |
GET /usages GET /usages.json | def index
@usages = Usage.all
# byebug
# redirect_to usage_path(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def get_usage(opts = {})\n data, _status_code, _headers = get_usage_with_http_info(opts)\n data\n end",
"def usage(opts)\n url = '/... | [
"0.78998053",
"0.78054106",
"0.7538731",
"0.7272538",
"0.70218045",
"0.6846835",
"0.674168",
"0.6717483",
"0.6691863",
"0.6640947",
"0.66375786",
"0.65302515",
"0.6523126",
"0.64793277",
"0.6462036",
"0.64337176",
"0.6412392",
"0.6377321",
"0.6377321",
"0.63666296",
"0.634538... | 0.61931115 | 25 |
GET /usages/1 GET /usages/1.json | def show
@shoppings = Shopping.all.where(:usage_id => params[:id])
@price = 0
@shoppings.each do |s|
@price = @price + s.tag.item.price.tr('۰۱۲۳۴۵۶۷۸۹','0123456789').to_i
# .tr!()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def get_usage(opts = {})\n data, _status_code, _headers = get_usage_with_http_info(opts)\n data\n end",
"def show\n @usage = Usage.f... | [
"0.7757404",
"0.7624409",
"0.7336756",
"0.7286233",
"0.7228713",
"0.7091778",
"0.68509716",
"0.6824678",
"0.6795394",
"0.6789404",
"0.6700131",
"0.65995395",
"0.65707904",
"0.6489745",
"0.6469132",
"0.64466184",
"0.63603044",
"0.63564473",
"0.63205934",
"0.63108087",
"0.62797... | 0.0 | -1 |
POST /usages POST /usages.json | def create
# @usage = Usage.new
# @usage.user_id = params[:user_id]
# @usage.cart_id = params[:cart_id]
# byebug
@user = User.find(params[:usage][:user_id].to_i)
@cart = Cart.find(params[:usage][:cart_id].to_i)
@usage = @user.usages.new()
@usage.cart_id = params[:usage][:cart_id].to_i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @usage = Usage.new(usage_params)\n\n respond_to do |format|\n if @usage.save\n format.html { redirect_to @usage, notice: 'Usage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @usage }\n else\n format.html { render ac... | [
"0.70373714",
"0.67928064",
"0.655445",
"0.6486958",
"0.63437533",
"0.6336536",
"0.6307743",
"0.6269324",
"0.62565863",
"0.62298244",
"0.6132824",
"0.6123847",
"0.6121037",
"0.6065091",
"0.59790194",
"0.597437",
"0.5934319",
"0.5930338",
"0.59013367",
"0.5897502",
"0.5889671"... | 0.61934614 | 10 |
PATCH/PUT /usages/1 PATCH/PUT /usages/1.json | def update
respond_to do |format|
if @usage.update(usage_params)
format.html { redirect_to @usage, notice: 'Usage was successfully updated.' }
format.json { render :show, status: :ok, location: @usage }
else
format.html { render :edit }
format.json { render json: @usage.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @usage.update(usage_params)\n format.html { redirect_to @usage, notice: 'Usage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @usage.errors,... | [
"0.7188801",
"0.7090191",
"0.68381405",
"0.63989174",
"0.6380645",
"0.6115758",
"0.6113047",
"0.6113047",
"0.6113047",
"0.6113047",
"0.60989314",
"0.60698444",
"0.60658216",
"0.60572964",
"0.6046614",
"0.60455567",
"0.6044492",
"0.60269135",
"0.6017712",
"0.5982072",
"0.59810... | 0.71583724 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.