query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
GET /admin/rights/new GET /admin/rights/new.json | def new
@right = Right.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @right }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.h... | [
"0.728867",
"0.6990209",
"0.68578523",
"0.6855714",
"0.67928547",
"0.6774837",
"0.6774837",
"0.6704889",
"0.6704889",
"0.6704889",
"0.6651943",
"0.6631726",
"0.6598057",
"0.6594575",
"0.65912896",
"0.6590574",
"0.6576664",
"0.6569264",
"0.6564156",
"0.655572",
"0.6551336",
... | 0.7044477 | 1 |
PUT /admin/rights/1 PUT /admin/rights/1.json | def update
@right = Right.find(params[:id])
respond_to do |format|
if @right.update_attributes(params[:right])
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def update\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n if @access_right.update_attributes(params[:access_right])\n format.html { redirect_to @access... | [
"0.67360616",
"0.66180056",
"0.6443705",
"0.6359975",
"0.63044715",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.6232228",
"0.6224553",
"0.6091866",
"0.6089308",
"0.60690236",
"0.60633045",
"0.602135",
"0.6013465",
"0.59934676",
"0.5965458",
"0.595... | 0.6751367 | 0 |
DELETE /admin/rights/1 DELETE /admin/rights/1.json | def destroy
@right = Right.find(params[:id])
@right.destroy
respond_to do |format|
format.html { redirect_to admin_rights_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to privileges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @right.destroy\n respond_to do |format|\n format.html { redirect_to rights_url, notice: 'Right was successfully des... | [
"0.6821523",
"0.6796628",
"0.66926265",
"0.6686518",
"0.6645824",
"0.66284394",
"0.6593673",
"0.65813273",
"0.6548169",
"0.6537271",
"0.6532709",
"0.6524623",
"0.65094864",
"0.65058345",
"0.64883137",
"0.64711654",
"0.6463697",
"0.64591",
"0.64466465",
"0.64441735",
"0.643603... | 0.74355155 | 0 |
GET /clasifications or /clasifications.json | def index
@clasifications = Clasification.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n form... | [
"0.73342395",
"0.61597574",
"0.6052229",
"0.6044177",
"0.5962895",
"0.59367573",
"0.5924675",
"0.5913115",
"0.5905584",
"0.58767897",
"0.5853619",
"0.5838951",
"0.5827974",
"0.5788656",
"0.57782507",
"0.5752925",
"0.5745936",
"0.57021964",
"0.5683032",
"0.56769085",
"0.567234... | 0.704686 | 1 |
POST /clasifications or /clasifications.json | def create
@clasification = Clasification.new(clasification_params)
respond_to do |format|
if @clasification.save
format.html { redirect_to @clasification, notice: "Clasification was successfully created." }
format.json { render :show, status: :created, location: @clasification }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classi... | [
"0.69274217",
"0.6877386",
"0.64458674",
"0.63242775",
"0.63035417",
"0.6214275",
"0.62128997",
"0.619138",
"0.61775076",
"0.6161782",
"0.6152889",
"0.6144488",
"0.6135515",
"0.6110071",
"0.6085759",
"0.60156703",
"0.59860504",
"0.5980081",
"0.5960773",
"0.5891116",
"0.586456... | 0.71609735 | 0 |
PATCH/PUT /clasifications/1 or /clasifications/1.json | def update
respond_to do |format|
if @clasification.update(clasification_params)
format.html { redirect_to @clasification, notice: "Clasification was successfully updated." }
format.json { render :show, status: :ok, location: @clasification }
else
format.html { render :edit, stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.67100155",
"0.66281736",
"0.6524881",
"0.6452379",
"0.6452379",
"0.6433005",
"0.64201784",
"0.6417815",
"0.63855267",
"0.6357982",
"0.634495",
"0.633136",
"0.6271337",
"0.6270323",
"0.6196443",
"0.61885625",
"0.6135036",
"0.6129476",
"0.6114893",
"0.61010915",
"0.60980946"... | 0.71494967 | 0 |
DELETE /clasifications/1 or /clasifications/1.json | def destroy
@clasification.destroy
respond_to do |format|
format.html { redirect_to clasifications_url, notice: "Clasification was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @classification... | [
"0.7173859",
"0.7167455",
"0.69788367",
"0.69367486",
"0.6934053",
"0.6852698",
"0.6843896",
"0.684144",
"0.68140477",
"0.6777117",
"0.676174",
"0.675907",
"0.6743268",
"0.67407304",
"0.67407304",
"0.6730304",
"0.6728989",
"0.6725533",
"0.67099106",
"0.6672651",
"0.6659072",
... | 0.74043316 | 0 |
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure. Give up after 30 seconds. | def wait_true max_wait=30, interval=0.5, &block
max_wait = 1 if max_wait <= 0
result = nil
timeout max_wait do
until (result = begin; block.call; rescue; end)
sleep interval
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend",
"def wait_until(timeout=10, &b... | [
"0.6829118",
"0.6670128",
"0.66382533",
"0.6588048",
"0.65865827",
"0.64950585",
"0.64216465",
"0.6327964",
"0.6284875",
"0.6152245",
"0.6101874",
"0.60759",
"0.60516053",
"0.6038432",
"0.5987311",
"0.59793013",
"0.5964858",
"0.5927506",
"0.5926482",
"0.5924625",
"0.5901724",... | 0.67188305 | 1 |
For Sauce Labs reporting. Returns the current session id. | def session_id
@driver.session_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_id\n Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id\n end",
"def session_id\n @session_id || raise(Error::WebDriverError, 'no current session exists')\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanu... | [
"0.71836567",
"0.6971308",
"0.69119895",
"0.6894225",
"0.68413085",
"0.68149835",
"0.68149835",
"0.68149835",
"0.68084663",
"0.6786192",
"0.67266154",
"0.66938823",
"0.6687863",
"0.66735524",
"0.6624103",
"0.65708494",
"0.6556778",
"0.65491825",
"0.6499064",
"0.64797896",
"0.... | 0.7310923 | 0 |
Get the element of type tag_name at matching index. | def ele_index tag_name, index
# XPath index starts at 1.
raise "#{index} is not a valid xpath index. Must be >= 1" if index <= 0
find_element :xpath, "//#{tag_name}[#{index}]"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ele_index(class_name, index)\n raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)\n\n elements = tags(class_name)\n\n if index == 'last()'\n result = elements.last\n else\n # elements array is 0 indexed\n index -= 1\n resu... | [
"0.7250674",
"0.6847777",
"0.67204165",
"0.6672337",
"0.6620418",
"0.66030836",
"0.66030836",
"0.6524591",
"0.65202546",
"0.64483976",
"0.6407453",
"0.6354577",
"0.63328665",
"0.6294993",
"0.6254961",
"0.6175408",
"0.61718357",
"0.61718357",
"0.61328965",
"0.611434",
"0.61015... | 0.747865 | 0 |
Get the first tag by attribute that exactly matches value. | def find_ele_by_attr_include tag, attr, value
@driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_attr?(h, a, v)\n v = v.value if v.instance_of? Nokogiri::XML::Attr\n h.search(\"[#{a}='#{v}']\").one?\n end",
"def find_attribute(name, singleton)\n name = $1 if name =~ /^(.*)=$/\n @attributes.find { |a| a.name == name && a.singleton == singleton }\n end",
"def first_matching(ke... | [
"0.6239441",
"0.6161766",
"0.6061215",
"0.58910185",
"0.5761221",
"0.57191736",
"0.564737",
"0.5631698",
"0.5562108",
"0.55587065",
"0.5415724",
"0.5402241",
"0.53687876",
"0.5368071",
"0.5367492",
"0.53665096",
"0.536548",
"0.53468764",
"0.53362095",
"0.5306197",
"0.52835983... | 0.62143034 | 1 |
Get tags by attribute that include value. | def find_eles_by_attr_include tag, attr, value
@driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_ele_by_attr_include tag, attr, value\n @driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_eles_by_attr_include(class_name, attr, value)\n @driver.find_elements :xpath, string_attr_include(class_name, attr, value)\n end",
"def tags\n attribute... | [
"0.6183723",
"0.60624206",
"0.58803207",
"0.58803207",
"0.5748873",
"0.563602",
"0.56323403",
"0.5598353",
"0.5580782",
"0.5517507",
"0.54761076",
"0.544825",
"0.5442762",
"0.54358375",
"0.54084975",
"0.5379608",
"0.5345656",
"0.5336335",
"0.5329006",
"0.531109",
"0.5296",
... | 0.6645752 | 0 |
Get the tags that include text. | def find_eles_by_text_include tag, text
find_eles_by_attr_include tag, :text, text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end",
"def tags_text\n\t\tself.tags.join(', ') #convertir el arreglo en una cadena de texto separado por ,\n\tend",
"def tag_text()\n return self.tag(tru... | [
"0.657787",
"0.65037596",
"0.6485775",
"0.64538753",
"0.63499254",
"0.6272897",
"0.6272897",
"0.62509525",
"0.6248749",
"0.6226198",
"0.61261743",
"0.6117033",
"0.6094158",
"0.6089709",
"0.60851574",
"0.60851574",
"0.60767037",
"0.6075089",
"0.60611975",
"0.60126996",
"0.6000... | 0.6543037 | 1 |
Get the first tag that matches tag_name | def first_ele tag_name
# XPath index starts at 1
find_element :xpath, "//#{tag_name}[1]"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_e... | [
"0.7768406",
"0.71977824",
"0.70994776",
"0.7052776",
"0.69995296",
"0.6925509",
"0.67837703",
"0.67432266",
"0.67380065",
"0.6656003",
"0.6625299",
"0.66107965",
"0.6591622",
"0.6525326",
"0.6502466",
"0.6499222",
"0.64722955",
"0.6426107",
"0.6353026",
"0.6323054",
"0.63221... | 0.7253185 | 1 |
Get the last tag that matches tag_name | def last_ele tag_name
xpath "//#{tag_name}[last()]"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def latest_tag\n\t\t# Index 0 is HEAD\n\t\t# Index 1 is most recent tag or first commit\n\t\t@list[1]\n\tend",
"def find_tag(tag_name)\n r = scan... | [
"0.6639427",
"0.6415569",
"0.63674664",
"0.6169347",
"0.6125255",
"0.61207145",
"0.6052338",
"0.60280836",
"0.5984895",
"0.59689665",
"0.5957652",
"0.5957652",
"0.59520495",
"0.59480745",
"0.58957404",
"0.5882721",
"0.58379525",
"0.57934237",
"0.57886165",
"0.5781734",
"0.577... | 0.72623575 | 0 |
Returns all elements that exactly match name | def find_names name
find_elements :name, name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def elements_present\n elements_to_check.select { |name| there?(name) }\n end",
"def find_elements(element_name, response)\n ... | [
"0.7094345",
"0.6709751",
"0.64784753",
"0.6439569",
"0.6405609",
"0.6392193",
"0.63236105",
"0.6314487",
"0.6222358",
"0.6199703",
"0.6143943",
"0.6119726",
"0.6106085",
"0.6063704",
"0.605531",
"0.605531",
"0.6045532",
"0.6034813",
"0.602514",
"0.59543884",
"0.5943961",
"... | 0.7539248 | 0 |
Returns all elements matching tag_name | def tags tag_name
find_elements :tag_name, tag_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def retrieve_all_tags(element, tag = :content)\n result = []\n if(element.respond_to? tag)\n result << element.send(tag)\n end\n if element.respond_to? :children\n element.children.each... | [
"0.70586866",
"0.6989633",
"0.6987415",
"0.6901312",
"0.6846613",
"0.6784727",
"0.67800355",
"0.67412317",
"0.67412317",
"0.660534",
"0.65162534",
"0.6489715",
"0.6460763",
"0.63751674",
"0.6366966",
"0.6337809",
"0.63238597",
"0.6221604",
"0.6213733",
"0.6167514",
"0.6079790... | 0.79535556 | 0 |
Converts pixel values to window relative values ```ruby px_to_window_rel x: 50, y: 150 ``` | def px_to_window_rel opts={}
w = $driver.window_size
x = opts.fetch :x, 0
y = opts.fetch :y, 0
OpenStruct.new( x: "#{x.to_f} / #{w.width.to_f}",
y: "#{y.to_f} / #{w.height.to_f}" )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_position_relative_to(px,py,xi,yi,sextx,sexty)\n tx = @wrapped_surface.tile_x\n ty = @wrapped_surface.tile_y\n xoff = offset_from_screen(xi*tx, px, sextx)\n yoff = offset_from_screen(yi*ty, py, sexty)\n [xoff,yoff]\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def rel_... | [
"0.5687661",
"0.5668153",
"0.5668153",
"0.55100274",
"0.54327255",
"0.53369206",
"0.5249425",
"0.523294",
"0.5221263",
"0.5177791",
"0.5175339",
"0.5171482",
"0.51557696",
"0.5134394",
"0.5134394",
"0.5134394",
"0.50939333",
"0.50939333",
"0.50939333",
"0.50924444",
"0.509010... | 0.8150688 | 0 |
Search strings.xml's values for target. | def xml_keys target
lazy_load_strings
@strings_xml.select { |key, value| key.downcase.include? target.downcase }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_values target\n lazy_load_strings\n @strings_xml.select { |key, value| value.downcase.include? target.downcase }\n end",
"def search(target)\n end",
"def string_visible_contains_xpath(class_name, value)\n r_id = resource_id(value, \" or @resource-id='#{value}'\")\n\n if class_name == ... | [
"0.8225673",
"0.5321005",
"0.5236756",
"0.5168079",
"0.49839833",
"0.49510354",
"0.49488974",
"0.49461907",
"0.4926971",
"0.49149278",
"0.48948312",
"0.48937523",
"0.48863024",
"0.48487574",
"0.48290277",
"0.47890753",
"0.47845688",
"0.47787997",
"0.47732252",
"0.47699475",
"... | 0.71313924 | 1 |
Search strings.xml's keys for target. | def xml_values target
lazy_load_strings
@strings_xml.select { |key, value| value.downcase.include? target.downcase }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_keys target\n lazy_load_strings\n @strings_xml.select { |key, value| key.downcase.include? target.downcase }\n end",
"def search(target)\n end",
"def search_in(label, string)\n if !LABELS.include? label.to_sym\n raise ArgumentError, \"Unknown key: #{label}\"\n end\n\n find... | [
"0.8241746",
"0.55252695",
"0.54091",
"0.5388197",
"0.53785586",
"0.5298476",
"0.52643234",
"0.5139001",
"0.5093662",
"0.50899166",
"0.50600827",
"0.50233185",
"0.50185484",
"0.500125",
"0.49780494",
"0.4973376",
"0.49718812",
"0.4944831",
"0.49233717",
"0.49118966",
"0.48931... | 0.753793 | 1 |
Resolve id in strings.xml and return the value. | def resolve_id id
lazy_load_strings
@strings_xml[id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(id)\n # Android auto resolves strings.xml ids\n find_element :id, id\n end",
"def get_localized_string(id)\n $g_localized_strings||=read_xml($g_lang_strings_file)\n if $g_localized_strings[id]==nil\n puts(\"id #{id} string not found\")\n fail(\"id #{id} string not found\")\n ... | [
"0.75345665",
"0.7078667",
"0.62465656",
"0.6110954",
"0.6110954",
"0.606956",
"0.6004073",
"0.5861186",
"0.58279586",
"0.58125645",
"0.5811148",
"0.57958114",
"0.5711793",
"0.5645883",
"0.5628218",
"0.5607832",
"0.5601439",
"0.55797255",
"0.5561076",
"0.55555314",
"0.5552106... | 0.87252325 | 0 |
Used to error when finding a single element fails. | def raise_no_element_error
raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_with_rpc_failed\n rpc_failed('Find failed')\n end",
"def source_find_by_id_fail(source, id, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n source.find_by_id(id)\r\n rescue\r\n return\r\n end\r\n\r\n sleep(1)\r\n... | [
"0.61695534",
"0.60751194",
"0.59798014",
"0.5973216",
"0.5951531",
"0.59398663",
"0.5922384",
"0.59161043",
"0.5862185",
"0.58310926",
"0.5810718",
"0.58033216",
"0.57920426",
"0.57920426",
"0.57920426",
"0.57920426",
"0.5778521",
"0.5764",
"0.5743967",
"0.56888705",
"0.5683... | 0.6482858 | 0 |
make a request to tripsta like: plane("INV", "LON", "211113") | def plane(origin, destination, date)
param_date = date[0,2] + "%2f" + date[2,2] + "%2f20" + date[4,2]
url = "http://www.tripsta.co.uk/airline-tickets/results?dep=#{origin}&arr=#{destination}&passengersAdult=1&passengersChild=0&passengersInfant=0&class=&airlineCode=&directFlightsOnly=0&extendedDates=0&isRoundtrip=0&ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n uri = URI.parse(\"http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty\")\n end",
"def request(method, path, params = nil)\n uri = URI.parse(url_for(path))\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = uri.kind_of?(URI::HTTPS)\n client.verify_mode = OpenSS... | [
"0.573053",
"0.5695246",
"0.56820446",
"0.56767565",
"0.56714404",
"0.56536955",
"0.5620115",
"0.5612157",
"0.5590911",
"0.5588296",
"0.55565244",
"0.5550627",
"0.5412829",
"0.53715193",
"0.53588456",
"0.5340669",
"0.5307712",
"0.5279672",
"0.5279569",
"0.5268617",
"0.5243696... | 0.57402587 | 0 |
Returns a contributor whose quiz is to be taken if available, otherwise will raise an error | def contributor_for_quiz(reviewer, topic)
raise 'Please select a topic.' if topics? && topic.nil?
raise 'This assignment does not have topics.' unless topics? || !topic
# This condition might happen if the reviewer/quiz taker waited too much time in the
# select topic page and other students have alrea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contributor?\n self.contributor\n end",
"def get_contributor(username)\n contributor = @database.get_item(\n table_name: contributors_table_name,\n key: { \"username\" => username },\n consistent_read: true\n )[:item]\n\n contributor\n end",
"def contributor?( id )\n acl... | [
"0.6231927",
"0.6070218",
"0.599577",
"0.5886823",
"0.5781174",
"0.57043993",
"0.56336546",
"0.56161594",
"0.55781585",
"0.5479549",
"0.54765236",
"0.54365355",
"0.54283124",
"0.538915",
"0.53851753",
"0.53477496",
"0.5331976",
"0.52874494",
"0.52767706",
"0.5272094",
"0.5259... | 0.7391718 | 0 |
GET /project_messages/1 GET /project_messages/1.json | def show
@project_message = ProjectMessage.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @project_message }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @project_message = ProjectMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_message }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def show\n @v1_message = V1::Message.find(params[:id])\n\n r... | [
"0.7161965",
"0.7043464",
"0.6896931",
"0.68699974",
"0.6760796",
"0.6629397",
"0.66057634",
"0.65428597",
"0.65428597",
"0.65364516",
"0.65329796",
"0.647289",
"0.6470949",
"0.646479",
"0.64640623",
"0.64599264",
"0.64507496",
"0.64480793",
"0.6445571",
"0.63953716",
"0.6390... | 0.76166475 | 0 |
GET /project_messages/new GET /project_messages/new.json | def new
@project_message = ProjectMessage.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project_message }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.e... | [
"0.79634416",
"0.76264054",
"0.76264054",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.75653803",... | 0.8406446 | 0 |
POST /project_messages POST /project_messages.json | def create
@project_message = ProjectMessage.new(params[:project_message])
respond_to do |format|
if @project_message.save
format.html { redirect_to @project_message, notice: 'Project message was successfully created.' }
format.json { render json: @project_message, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @message = Message.new(params[:message])\n \n @message.project=Project.find(params[:pid])\n @message.project.pem=Pem.find(params[:pemids])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n ... | [
"0.68976545",
"0.6820342",
"0.67595994",
"0.657837",
"0.65494204",
"0.65420383",
"0.64857656",
"0.6466357",
"0.6457209",
"0.643171",
"0.64138055",
"0.63485736",
"0.63360125",
"0.63187516",
"0.62885374",
"0.6288041",
"0.62687224",
"0.6264546",
"0.62539226",
"0.62458557",
"0.62... | 0.7452937 | 0 |
PUT /project_messages/1 PUT /project_messages/1.json | def update
@project_message = ProjectMessage.find(params[:id])
respond_to do |format|
if @project_message.update_attributes(params[:project_message])
format.html { redirect_to @project_message, notice: 'Project message was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n message = Message.find(params[:id])\n message... | [
"0.6938673",
"0.6773656",
"0.67365515",
"0.67293",
"0.6717503",
"0.6665718",
"0.66467106",
"0.66152567",
"0.6483713",
"0.64349705",
"0.6343872",
"0.63343585",
"0.63289434",
"0.62956613",
"0.62865186",
"0.62662524",
"0.6265127",
"0.6246748",
"0.62433255",
"0.62400305",
"0.6239... | 0.7271294 | 0 |
DELETE /project_messages/1 DELETE /project_messages/1.json | def destroy
@project_message = ProjectMessage.find(params[:id])
@project_message.destroy
respond_to do |format|
format.html { redirect_to project_messages_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n # delete a specific message\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific messag... | [
"0.747845",
"0.7337599",
"0.7268884",
"0.726298",
"0.7209047",
"0.7188055",
"0.717306",
"0.71701425",
"0.7153404",
"0.7146793",
"0.71298754",
"0.71000135",
"0.71000135",
"0.70876807",
"0.70876807",
"0.70876807",
"0.70876807",
"0.70823574",
"0.7076121",
"0.7071061",
"0.7050168... | 0.7711854 | 0 |
GET /slideshows/new GET /slideshows/new.json | def new
@slideshow = Slideshow.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @slideshow }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json:... | [
"0.80901617",
"0.7739159",
"0.7739159",
"0.7739159",
"0.77233624",
"0.76675105",
"0.764971",
"0.7520389",
"0.7520389",
"0.7458036",
"0.7436885",
"0.7436885",
"0.73529214",
"0.73529214",
"0.73529214",
"0.71064067",
"0.7106325",
"0.70932066",
"0.7074958",
"0.70222527",
"0.69581... | 0.8400732 | 0 |
POST /slideshows POST /slideshows.json | def create
@slideshow = Slideshow.new(params[:slideshow])
respond_to do |format|
if @slideshow.save
format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }
format.json { render json: @slideshow, status: :created, location: @slideshow }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n form... | [
"0.74267346",
"0.74267346",
"0.74267346",
"0.7147942",
"0.7098196",
"0.7098196",
"0.7049254",
"0.6980505",
"0.689624",
"0.6893306",
"0.6858169",
"0.677515",
"0.6753637",
"0.6713457",
"0.6713457",
"0.6639847",
"0.6608018",
"0.65958506",
"0.65389365",
"0.64928275",
"0.64604634"... | 0.74475336 | 0 |
PUT /slideshows/1 PUT /slideshows/1.json | def update
@slideshow = Slideshow.find(params[:id])
respond_to do |format|
if @slideshow.update_attributes(params[:slideshow])
format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @slideshow = @user.slideshows.find(params[:id])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no... | [
"0.75111306",
"0.74391097",
"0.74391097",
"0.71799284",
"0.71799284",
"0.7068016",
"0.6866891",
"0.6795044",
"0.678487",
"0.675374",
"0.675374",
"0.66529506",
"0.65569437",
"0.652209",
"0.6500816",
"0.6457901",
"0.6457901",
"0.64310133",
"0.64310133",
"0.64310133",
"0.6427564... | 0.75944984 | 0 |
DELETE /slideshows/1 DELETE /slideshows/1.json | def destroy
@slideshow = Slideshow.find(params[:id])
@slideshow.destroy
respond_to do |format|
format.html { redirect_to slideshows_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def destroy\n @slideshow_item = SlideshowItem.find(params[:id])\n @slideshow_item.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshow_items_url }\n format.json { head :ok ... | [
"0.8474956",
"0.7959318",
"0.7947231",
"0.7908333",
"0.7908333",
"0.78684115",
"0.7847883",
"0.7847883",
"0.74992585",
"0.74213576",
"0.74213576",
"0.74213576",
"0.73651767",
"0.73429066",
"0.72759145",
"0.7234686",
"0.714241",
"0.71375084",
"0.71106845",
"0.7081164",
"0.7074... | 0.81346536 | 1 |
Constructs a onetimeuse authorize_endpoint. This method will use a new nonce on each invocation. | def authorize_endpoint_url
uri = URI(openid_config['authorization_endpoint'])
uri.query = URI.encode_www_form(client_id: client_id,
redirect_uri: callback_url,
response_mode: response_mode,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_endpoint(params = nil)\n params = params.reject { |_, v| v.nil? } if params.respond_to? :select\n if params.nil? || params.empty?\n URI::HTTPS.build(host: @host, path: '/' + @tenant + AUTHORIZE_PATH)\n else\n URI::HTTPS.build(host: @host,\n path: '... | [
"0.60011697",
"0.56872374",
"0.56861",
"0.56339306",
"0.56310654",
"0.5540841",
"0.55286527",
"0.55286527",
"0.5516922",
"0.5486267",
"0.5474361",
"0.54203796",
"0.53846484",
"0.53522766",
"0.5316563",
"0.5291127",
"0.5277887",
"0.5272494",
"0.52596784",
"0.52596784",
"0.5259... | 0.5731563 | 1 |
The client id of the calling application. This must be configured where AD is installed as an OmniAuth strategy. | def client_id
return options.client_id if options.client_id
fail StandardError, 'No client_id specified in AzureAD configuration.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id\n return @client_id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n me.client.id\n ... | [
"0.7609361",
"0.75925803",
"0.75925803",
"0.75781375",
"0.74705297",
"0.74705297",
"0.7407728",
"0.73422515",
"0.73301923",
"0.73136103",
"0.7310691",
"0.7308098",
"0.7256761",
"0.72355103",
"0.7170703",
"0.71651953",
"0.7125279",
"0.7030615",
"0.7024217",
"0.694726",
"0.6947... | 0.7838771 | 0 |
The expected id token issuer taken from the discovery endpoint. | def issuer
openid_config['issuer']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issuer\n return @issuer\n end",
"def issuer\n return @issuer\n end",
"def issuer\n @issuer\n end",
"def retrieve_issuer_id\n @saml_issuer_id = @saml_request[/<saml:Issuer\\s?.*>(.*)<\\/saml:Issuer>/, 1]\n return true\n end",
"... | [
"0.7226521",
"0.7226521",
"0.71805733",
"0.717203",
"0.7109209",
"0.7059036",
"0.6930751",
"0.68863004",
"0.6447318",
"0.6447318",
"0.6262485",
"0.6135825",
"0.61190593",
"0.6080033",
"0.6020959",
"0.601819",
"0.6011183",
"0.5950463",
"0.5947751",
"0.5884221",
"0.5879113",
... | 0.76082546 | 0 |
Fetches the current signing keys for Azure AD. Note that there should always two available, and that they have a 6 week rollover. Each key is a hash with the following fields: kty, use, kid, x5t, n, e, x5c | def fetch_signing_keys
response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))
response['keys']
rescue JSON::ParserError
raise StandardError, 'Unable to fetch AzureAD signing keys.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signing_keys\n @signing_keys ||= fetch_signing_keys\n end",
"def list_signing_keys(opts = {})\n data, _status_code, _headers = list_signing_keys_with_http_info(opts)\n data\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def keys\n # Lock for thread ... | [
"0.6876577",
"0.62724376",
"0.6162911",
"0.6088269",
"0.59036756",
"0.58111596",
"0.5808923",
"0.5758461",
"0.57541597",
"0.5753374",
"0.56644094",
"0.56461036",
"0.5613344",
"0.5608864",
"0.55876255",
"0.5552408",
"0.5544535",
"0.5539555",
"0.5527357",
"0.54653937",
"0.54631... | 0.7588368 | 0 |
Fetches the OpenId Connect configuration for the AzureAD tenant. This contains several import values, including: authorization_endpoint token_endpoint token_endpoint_auth_methods_supported jwks_uri response_types_supported response_modes_supported subject_types_supported id_token_signing_alg_values_supported scopes_sup... | def fetch_openid_config
JSON.parse(Net::HTTP.get(URI(openid_config_url)))
rescue JSON::ParserError
raise StandardError, 'Unable to fetch OpenId configuration for ' \
'AzureAD tenant.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def openid_config\n @openid_config ||= fetch_openid_config\n end",
"def azure_options\n options = { tenant_id: tenant_id!,\n subscription_id: subscription_... | [
"0.6742541",
"0.59611785",
"0.59562093",
"0.59076923",
"0.576962",
"0.56634927",
"0.5581978",
"0.5386093",
"0.5324064",
"0.53184986",
"0.5286447",
"0.52467173",
"0.52033466",
"0.51805925",
"0.5164027",
"0.51012015",
"0.50923127",
"0.50414926",
"0.50340885",
"0.50290364",
"0.4... | 0.7441075 | 0 |
A memoized version of fetch_openid_config. | def openid_config
@openid_config ||= fetch_openid_config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_openid_config\n JSON.parse(Net::HTTP.get(URI(openid_config_url)))\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch OpenId configuration for ' \\\n 'AzureAD tenant.'\n end",
"def oidc_configuration\n proxy&.oidc_configuration || OI... | [
"0.6451237",
"0.60046655",
"0.58545274",
"0.5658704",
"0.56156445",
"0.5569909",
"0.5377054",
"0.53276926",
"0.5305248",
"0.53009343",
"0.5270092",
"0.5235436",
"0.52116513",
"0.52051073",
"0.51936686",
"0.514493",
"0.5139281",
"0.5101577",
"0.5092504",
"0.50496596",
"0.50329... | 0.77671504 | 0 |
The location of the OpenID configuration for the tenant. | def openid_config_url
"https://login.windows.net/#{tenant}/.well-known/openid-configuration"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openid_redirect_uri; end",
"def tenant_path\n @tenant_path ||= '/api/v2/tenants/settings'\n end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n ... | [
"0.6150054",
"0.6099612",
"0.6087325",
"0.6046829",
"0.6045363",
"0.5973581",
"0.5944157",
"0.59106547",
"0.5844534",
"0.5842793",
"0.5826858",
"0.5826581",
"0.580979",
"0.580783",
"0.5764733",
"0.5755689",
"0.57336694",
"0.57314724",
"0.5725653",
"0.56615937",
"0.56566256",
... | 0.7745673 | 0 |
The response_type that will be set in the authorization request query parameters. Can be overridden by the client, but it shouldn't need to be. | def response_type
options[:response_type] || DEFAULT_RESPONSE_TYPE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type\n self.class.response_content_type\n end",
"def allowed_types\n config.allowed_response_types\n end",
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n response.content_type\n end",
"def content_type... | [
"0.71298873",
"0.6928073",
"0.6923447",
"0.68637073",
"0.6811482",
"0.67441714",
"0.668171",
"0.66148955",
"0.6610585",
"0.6610585",
"0.6608642",
"0.6582344",
"0.6411907",
"0.63484496",
"0.63484496",
"0.6340048",
"0.6328751",
"0.6318457",
"0.6274402",
"0.62348884",
"0.6215297... | 0.79135305 | 0 |
The response_mode that will be set in the authorization request query parameters. Can be overridden by the client, but it shouldn't need to be. | def response_mode
options[:response_mode] || DEFAULT_RESPONSE_MODE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorization_mode=(mode); end",
"def authorization_mode; end",
"def mode=(mode)\n request.mode = mode\n end",
"def response_type\n options[:response_type] || DEFAULT_RESPONSE_TYPE\n end",
"def mode\n request.mode\n end",
"def mode\n options[:mode]\n en... | [
"0.7058099",
"0.69902515",
"0.63833284",
"0.62261105",
"0.61667675",
"0.5774501",
"0.5742376",
"0.5668136",
"0.5602177",
"0.55582327",
"0.5524251",
"0.55109984",
"0.54894274",
"0.5480112",
"0.543615",
"0.5395262",
"0.5381375",
"0.53771275",
"0.5370629",
"0.5346698",
"0.533679... | 0.80171126 | 0 |
The keys used to sign the id token JWTs. This is just a memoized version of fetch_signing_keys. | def signing_keys
@signing_keys ||= fetch_signing_keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_ids\n @keys.keys\n end",
"def ids\n @keys ||= []\n end",
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def keys\n # Lock for thread safety\n # Only one thread can write to the hash at a time and prevent... | [
"0.73901874",
"0.67432755",
"0.67151344",
"0.6658316",
"0.65744984",
"0.65197563",
"0.6444692",
"0.64068615",
"0.6389506",
"0.638078",
"0.6379534",
"0.636936",
"0.6366043",
"0.6366043",
"0.6356948",
"0.63182974",
"0.631239",
"0.6303397",
"0.6273195",
"0.6273195",
"0.6273195",... | 0.8161365 | 0 |
The location of the public keys of the token signer. This is parsed from the OpenId config response. | def signing_keys_url
return openid_config['jwks_uri'] if openid_config.include? 'jwks_uri'
fail StandardError, 'No jwks_uri in OpenId config response.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_keys\n @public_keys\n end",
"def public_key_data\n @public_key\n end",
"def public_key_params\n params[:public_key]\n end",
"def public_key_params\n params[:public_key]\n end",
"def url\n unless @url\n conf = Grape::Jwt::Authentication.configur... | [
"0.6299287",
"0.5973184",
"0.58965415",
"0.58965415",
"0.58784056",
"0.5847531",
"0.5847531",
"0.5818846",
"0.57765996",
"0.57512957",
"0.57394993",
"0.57181203",
"0.56955385",
"0.56206775",
"0.5607222",
"0.5568036",
"0.55612355",
"0.5544635",
"0.5544635",
"0.5544635",
"0.548... | 0.63673264 | 0 |
The tenant of the calling application. Note that this must be explicitly configured when installing the AzureAD OmniAuth strategy. | def tenant
return options.tenant if options.tenant
fail StandardError, 'No tenant specified in AzureAD configuration.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def tenant_id\n return @tenant_id\n end",
"def ... | [
"0.7369286",
"0.7369286",
"0.7369286",
"0.73279285",
"0.73279285",
"0.73279285",
"0.73279285",
"0.73185754",
"0.72746634",
"0.70236903",
"0.69072735",
"0.67408365",
"0.6450725",
"0.6428446",
"0.64179224",
"0.62244296",
"0.6117843",
"0.5986516",
"0.59557384",
"0.59209865",
"0.... | 0.8110246 | 0 |
traverse from [0,0] to the bottom right, only going either right or down. utilize memoization to keep track of paths return all valid paths as output most likely solved with a buttomup approach start at the bottom right and | def traverse_grid(rows, cols, dead_zones, paths)
paths ||= Array.new(rows) {Array.new(cols)}
#recursive step
return traverse_grid(rows-1, cols) || traverse_grid(rows, cols-1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse_maze(maze)\n def get_path(maze, row, col, current_path)\n return false if row.negative? || row >= maze.length || col.negative? || col >= maze[0].length # out of bounds\n return false if maze[row][col] == 1 # impassable\n\n current_path << Point.new(row, col)\n at_end = row == maze.length ... | [
"0.6807247",
"0.65691304",
"0.65212065",
"0.64520216",
"0.64417267",
"0.6413669",
"0.6358529",
"0.6348295",
"0.6342767",
"0.6327104",
"0.62927175",
"0.62846357",
"0.62400264",
"0.6235159",
"0.6219467",
"0.6213232",
"0.6210251",
"0.62053925",
"0.61970735",
"0.61876786",
"0.615... | 0.66384906 | 1 |
This method takes 2 inputs . one is the hash map of test_file => class name and the other is output of check_marker() i.e using_or is 'true / false' And then builds the file groups that need to run. | def test_file_to_group(test_file_map, using_or)
puts "\nAnalyzing #{@test_files.length} test files... Stand by."
@test_files.each do |tf|
@skip = false
################
test_class = Kernel.const_get(test_file_map[tf])
# Lower cases the group only if each element in the grouping ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_files file_data, output_path, options = {:prefix => \"L\", :suffix => \".fastq.gz\", :exclude_undetermined => true}\n\t\t\t\t# alternatively inherit the parent class and call super???? \n\t\t\t\t# super \n\t\t\t\t# \t\n groups = {}\n file_data.each do |data|\n if data[:barcode... | [
"0.658735",
"0.64436924",
"0.5670412",
"0.5511844",
"0.54880655",
"0.54867905",
"0.5483683",
"0.5472347",
"0.54495555",
"0.5445706",
"0.54409313",
"0.54379886",
"0.543119",
"0.53868425",
"0.53652334",
"0.5347009",
"0.53015405",
"0.528167",
"0.52768904",
"0.52686846",
"0.52602... | 0.80679685 | 0 |
GET /lead_entries GET /lead_entries.json | def index
@lead_entries = LeadEntry.where(:lead_id => params[:lead_id]).paginate(:page => params[:page])
respond_to do |format|
format.html { render action: 'index' }
format.json {
render :json => {
:amount => @lead_entries.length,
:success => true,
:html => (r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n ... | [
"0.66127133",
"0.63569206",
"0.6349944",
"0.6346621",
"0.6329326",
"0.627506",
"0.6217444",
"0.61875",
"0.6157041",
"0.60316324",
"0.60303825",
"0.60194683",
"0.6015344",
"0.5992507",
"0.5970858",
"0.59628105",
"0.5953543",
"0.5945469",
"0.5926073",
"0.5926073",
"0.5912297",
... | 0.7180695 | 0 |
POST /lead_entries POST /lead_entries.json | def create
@lead_entry = LeadEntry.new lead_entry_params
respond_to do |format|
if @lead_entry.save
format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully created.' }
format.json { render :json => {
:success => true,
:html => (render_to_string ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lead_entry_params\n params.require(:lead_entry).permit(:text, :date, :relation, :lead_id)\n end",
"def create_entries(opts = {})\n data, _status_code, _headers = create_entries_with_http_info(opts)\n data\n end",
"def create\n @ledger_entry = LedgerEntry.new(params[:ledger_entry])\n... | [
"0.6288483",
"0.62158364",
"0.6212585",
"0.60418546",
"0.60225666",
"0.5972873",
"0.59220743",
"0.5875825",
"0.58663094",
"0.58401173",
"0.580174",
"0.57681125",
"0.57657146",
"0.5756865",
"0.5749872",
"0.574979",
"0.5740562",
"0.5732084",
"0.57118815",
"0.5709951",
"0.570878... | 0.6596009 | 0 |
PATCH/PUT /lead_entries/1 PATCH/PUT /lead_entries/1.json | def update
respond_to do |format|
if @lead_entry.update(lead_entry_params)
format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @lead_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @lead = Lead.find(params[:id])\n\n respond_to do |format|\n if @lead.update_attributes(params[:lead])\n @lead.lead_notes.create(:notes =>\n \"Lead information changed by user: #{current_user.name} at #{Time.now}.\", \n :user_id => current_user.id, :lead_step_id => @... | [
"0.65401703",
"0.6457846",
"0.64387363",
"0.641881",
"0.64170223",
"0.6315538",
"0.6313723",
"0.62933874",
"0.6258026",
"0.62256646",
"0.6223613",
"0.6210328",
"0.6163048",
"0.6143663",
"0.6134204",
"0.61236674",
"0.6119816",
"0.6065085",
"0.60411793",
"0.6030078",
"0.6029762... | 0.7025225 | 0 |
DELETE /lead_entries/1 DELETE /lead_entries/1.json | def destroy
@lead_entry.destroy
respond_to do |format|
format.html { redirect_to lead_entries_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.h... | [
"0.70858055",
"0.70858055",
"0.705",
"0.7037913",
"0.70199305",
"0.6945926",
"0.6927681",
"0.67897886",
"0.67679244",
"0.67352366",
"0.67352366",
"0.6733046",
"0.6733046",
"0.6733046",
"0.6733046",
"0.6729303",
"0.6729033",
"0.6705907",
"0.669804",
"0.66964895",
"0.66925347",... | 0.7746231 | 0 |
Convert block_size and quantity to a humanreadable disk size. | def blocks_to_bytes(block_size, qty)
size = ( block_size / 1024 ) * qty
if size < 1000
output = "#{size} KB"
elsif size < 1000000
output = "#{size / 1000} MB"
elsif size < 1000000000
output = "#{size / 1000000} GB"
else
output = "#{size / 1000000000} TB"
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_size(block_size,blocks)\n size = block_size * blocks\n if size > SIZE_GB\n return [(size / SIZE_GB).to_i,\"GB\"]\n else\n return [(size / SIZE_MB).to_i,\"MB\"]\n end\n end",
"def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively div... | [
"0.7407986",
"0.6973419",
"0.6972413",
"0.67802286",
"0.6763028",
"0.6645691",
"0.66076714",
"0.6480695",
"0.6436258",
"0.6415762",
"0.6373911",
"0.62670386",
"0.626032",
"0.62537664",
"0.62537664",
"0.6238297",
"0.6229371",
"0.6218393",
"0.62069184",
"0.61644036",
"0.6151029... | 0.75626993 | 0 |
GET /hospital_categories GET /hospital_categories.json | def index
@hospital_categories = HospitalCategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.7240655",
"0.6939212",
"0.69276583",
"0.691725",
"0.6863692",
"0.6838845",
"0.68023413",
"0.66969234",
"0.66304153",
"0.6615906",
"0.65032655",
"0.6496176",
"0.64305794",
"0.64298975",
"0.64056236",
"0.63889074",
"0.6367932",
"0.6365213",
"0.6356687",
"0.63370764",
"0.6328... | 0.76618177 | 0 |
POST /hospital_categories POST /hospital_categories.json | def create
@hospital_category = HospitalCategory.new(hospital_category_params)
respond_to do |format|
if @hospital_category.save
format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully created.' }
format.json { render :show, status: :created, location: @h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def index\n @hospital_catego... | [
"0.69033563",
"0.66519314",
"0.6645564",
"0.6614792",
"0.6398817",
"0.6384493",
"0.6352882",
"0.62959385",
"0.6293843",
"0.62786907",
"0.6250535",
"0.6215882",
"0.6206162",
"0.6178973",
"0.6176571",
"0.61559266",
"0.610285",
"0.61028105",
"0.60753",
"0.605269",
"0.6052371",
... | 0.72510314 | 0 |
PATCH/PUT /hospital_categories/1 PATCH/PUT /hospital_categories/1.json | def update
respond_to do |format|
if @hospital_category.update(hospital_category_params)
format.html { redirect_to @hospital_category, notice: 'hospital_category was successfully updated.' }
format.json { render :show, status: :ok, location: @hospital_category }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_p... | [
"0.68525875",
"0.6836133",
"0.6610611",
"0.6419427",
"0.64112025",
"0.6373052",
"0.6360285",
"0.63505125",
"0.6324173",
"0.631055",
"0.6308039",
"0.6306478",
"0.6298497",
"0.6272521",
"0.62650055",
"0.6255187",
"0.62522435",
"0.6235679",
"0.6223568",
"0.62202203",
"0.62198406... | 0.7140228 | 0 |
DELETE /hospital_categories/1 DELETE /hospital_categories/1.json | def destroy
@hospital_category.destroy
respond_to do |format|
format.html { redirect_to hospital_categories_url, notice: 'hospital_category was successfully deleted.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { he... | [
"0.7554948",
"0.73819655",
"0.7276389",
"0.7198593",
"0.71792185",
"0.7163575",
"0.71228874",
"0.70979595",
"0.7089987",
"0.7089411",
"0.70889765",
"0.7080473",
"0.7075293",
"0.7067855",
"0.7043566",
"0.70379895",
"0.7032809",
"0.7025122",
"0.7014303",
"0.70063204",
"0.700446... | 0.78571284 | 0 |
GET /server_infos/1 GET /server_infos/1.json | def show
@server_info = ServerInfo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @server_info }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n result = []\n Server.all.each do |server|\n result << server.short_result\n end\n\n status_key = makeStatusKey(result)\n render :json => {servers:result}.merge(status_key)\n\n end",
"def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(dat... | [
"0.7632482",
"0.74078155",
"0.7344179",
"0.72670954",
"0.719779",
"0.71064585",
"0.7093832",
"0.7093832",
"0.707999",
"0.706134",
"0.699807",
"0.6989398",
"0.6863124",
"0.6851943",
"0.68321496",
"0.6794796",
"0.6750907",
"0.6720037",
"0.6710388",
"0.67014265",
"0.66739947",
... | 0.7817296 | 0 |
GET /server_infos/new GET /server_infos/new.json | def new
@server_info = ServerInfo.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @server_info }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n... | [
"0.7815124",
"0.7815124",
"0.74888957",
"0.74751145",
"0.74647427",
"0.74019176",
"0.7374422",
"0.736835",
"0.7130959",
"0.6979633",
"0.6953689",
"0.6943579",
"0.68458986",
"0.6766609",
"0.6716958",
"0.67087966",
"0.67079306",
"0.6676945",
"0.6673384",
"0.6650428",
"0.664408"... | 0.8186276 | 0 |
POST /server_infos POST /server_infos.json | def create
@server_info = ServerInfo.new(params[:server_info])
respond_to do |format|
if @server_info.save
format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }
format.json { render json: @server_info, status: :created, location: @server_info }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end",
"def new\n @server = Server.new\n\n @server_options = Server.all.map{|u| [ u.server_name, u.id ] }\n # @server_ips = Server.all.ma... | [
"0.6858404",
"0.6665254",
"0.6520468",
"0.6514328",
"0.6437755",
"0.6425043",
"0.64216435",
"0.6335646",
"0.62769574",
"0.62668175",
"0.6262841",
"0.6225919",
"0.62258923",
"0.6202646",
"0.6202646",
"0.6192489",
"0.6184717",
"0.6174436",
"0.61734205",
"0.6169153",
"0.6150943"... | 0.7411865 | 0 |
PUT /server_infos/1 PUT /server_infos/1.json | def update
@server_info = ServerInfo.find(params[:id])
respond_to do |format|
if @server_info.update_attributes(params[:server_info])
format.html { redirect_to @server_info, notice: 'Server info was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n ... | [
"0.6879228",
"0.6814855",
"0.6721013",
"0.66957366",
"0.6679785",
"0.66616225",
"0.6648926",
"0.6648926",
"0.6648926",
"0.661417",
"0.65991783",
"0.6592893",
"0.659201",
"0.6576404",
"0.6511239",
"0.64895",
"0.64728624",
"0.64665985",
"0.6298507",
"0.62783134",
"0.6250062",
... | 0.72281516 | 0 |
DELETE /server_infos/1 DELETE /server_infos/1.json | def destroy
@server_info = ServerInfo.find(params[:id])
@server_info.destroy
respond_to do |format|
format.html { redirect_to server_infos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @serve... | [
"0.76029724",
"0.74445516",
"0.7376597",
"0.7358587",
"0.73473054",
"0.718371",
"0.71238005",
"0.71072155",
"0.71072155",
"0.71072155",
"0.71072155",
"0.7058676",
"0.7048098",
"0.7021026",
"0.6986391",
"0.69784296",
"0.6972603",
"0.6964402",
"0.6963334",
"0.69252425",
"0.6907... | 0.7829473 | 0 |
Optimize the left operand | def optimize_left
Function.optimize_operand(operation.left)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def optimize\n left\n end",
"def left_optimizable?\n !left.equal?(oper... | [
"0.7122969",
"0.7122969",
"0.7122969",
"0.708683",
"0.708683",
"0.6968616",
"0.6857908",
"0.6715448",
"0.6711576",
"0.66502416",
"0.66389805",
"0.6638019",
"0.6612207",
"0.65555924",
"0.65555924",
"0.65492743",
"0.6429408",
"0.61505395",
"0.61505395",
"0.6094615",
"0.6094615"... | 0.82758355 | 0 |
Optimize the right operand | def optimize_right
Function.optimize_operand(operation.right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize\n right\n end",
"def optimize\n right\n end",
"def optimize\n right\n end",
"def optimize\n right\n end",
"def right_optimizable?\n !right.equal?(operation.right)\n end",
"def optimize... | [
"0.7409947",
"0.7409947",
"0.7399987",
"0.7399987",
"0.72095764",
"0.72021836",
"0.7165248",
"0.7163501",
"0.7056508",
"0.70205927",
"0.6978733",
"0.6874189",
"0.6874189",
"0.6778807",
"0.6682689",
"0.6518567",
"0.6463418",
"0.6437694",
"0.64291227",
"0.64291227",
"0.64291227... | 0.8460492 | 0 |
Test if the left operand is optimizable | def left_optimizable?
!left.equal?(operation.left)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_optimizable?\n !right.equal?(operation.right)\n end",
"def optimize_left\n Function.optimize_operand(operation.left)\n end",
"def optimizable?\n super || !predicate.equal?(operation.predicate)\n end",
"def optimize\n left.ne(right... | [
"0.7488885",
"0.7419305",
"0.7044481",
"0.6612691",
"0.65930456",
"0.65930456",
"0.65930456",
"0.65369546",
"0.65369546",
"0.6535521",
"0.63592416",
"0.63511366",
"0.6291252",
"0.61894643",
"0.6186002",
"0.5990191",
"0.5983856",
"0.5983856",
"0.59837115",
"0.5745654",
"0.5721... | 0.81559587 | 0 |
Test if the right operand is optimizable | def right_optimizable?
!right.equal?(operation.right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize_right\n Function.optimize_operand(operation.right)\n end",
"def left_optimizable?\n !left.equal?(operation.left)\n end",
"def optimizable?\n super || !predicate.equal?(operation.predicate)\n end",
"def optimize(**options)\n if operan... | [
"0.74024963",
"0.71386456",
"0.69105935",
"0.6681015",
"0.6430766",
"0.64075",
"0.6326411",
"0.6232442",
"0.6232442",
"0.621197",
"0.621197",
"0.61888534",
"0.6075977",
"0.5992004",
"0.5937966",
"0.5922706",
"0.5922706",
"0.5915728",
"0.5874312",
"0.57795644",
"0.5689674",
... | 0.835047 | 0 |
Marks inventory units short shipped. Adjusts the order based on the value of the inventory. Sends an email to the customer about what inventory has been short shipped. | def short_ship(inventory_units, whodunnit:nil)
if inventory_units.map(&:order_id).uniq != [@order.id]
raise ArgumentError, "Not all inventory units belong to this order"
end
unit_cancels = []
Spree::OrderMutex.with_lock!(@order) do
Spree::InventoryUnit.transaction do
inventory_unit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end",
"def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end",
"def shipp... | [
"0.67890847",
"0.64178044",
"0.64130884",
"0.63560724",
"0.6340769",
"0.6320822",
"0.6319823",
"0.6302464",
"0.629955",
"0.6294293",
"0.62783396",
"0.6277701",
"0.62108487",
"0.61932886",
"0.6162298",
"0.6084835",
"0.60737103",
"0.6070343",
"0.6069573",
"0.60585403",
"0.60576... | 0.7190293 | 0 |
Marks inventory unit canceled. Optionally allows specifying the reason why and who is performing the action. | def cancel_unit(inventory_unit, reason: Spree::UnitCancel::DEFAULT_REASON, whodunnit:nil)
unit_cancel = nil
Spree::OrderMutex.with_lock!(@order) do
unit_cancel = Spree::UnitCancel.create!(
inventory_unit: inventory_unit,
reason: reason,
created_by: whodunnit
)
invento... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel(reason, info = {})\n @cancelled = true\n @cancelled_by = caller(1, 1)\n @cancelled_reason = reason\n @cancelled_info = info\n cancel_notification\n nil\n end",
"def cancel(*args)\n commit('cancel', *args)\n end",
"def cancel!\n state_guard { modify_c... | [
"0.6363999",
"0.63175195",
"0.62801456",
"0.6270991",
"0.6211374",
"0.6155653",
"0.61353934",
"0.6101082",
"0.60764897",
"0.60443234",
"0.6041007",
"0.6015684",
"0.59909993",
"0.59909993",
"0.5933009",
"0.58915377",
"0.5881165",
"0.58541816",
"0.5844977",
"0.5832736",
"0.5816... | 0.72021127 | 0 |
Reimburses inventory units due to cancellation. | def reimburse_units(inventory_units)
reimbursement = nil
Spree::OrderMutex.with_lock!(@order) do
return_items = inventory_units.map(&:current_or_new_return_item)
reimbursement = Spree::Reimbursement.new(order: @order, return_items: return_items)
reimbursement.return_all
end
reimburse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end",
"def cancel!(e, quantity)\n [e, e.matchee].each do |ex|\n ex.quantity -= quantity\n quantity.times {ex.registrations.pop}\n ex.save\n end\n end",
"def destroy_along_with_units\n sel... | [
"0.65056944",
"0.6341625",
"0.631424",
"0.631424",
"0.61565065",
"0.6146577",
"0.6071971",
"0.60280967",
"0.60010153",
"0.599832",
"0.5982014",
"0.59549403",
"0.5896678",
"0.589055",
"0.58457714",
"0.58274955",
"0.582329",
"0.57932764",
"0.57355887",
"0.5729849",
"0.5717289",... | 0.67158717 | 0 |
GET /reservacions GET /reservacions.json | def index
@reservacions = Reservacion.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: reservations\n end",
"def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end",
"def index\n @vacations = User.find(params[:user_... | [
"0.69865173",
"0.69388676",
"0.6865676",
"0.6819054",
"0.6819054",
"0.679509",
"0.67582035",
"0.668788",
"0.66670537",
"0.66409326",
"0.66224086",
"0.660064",
"0.65913063",
"0.6590446",
"0.6590446",
"0.6590446",
"0.6590446",
"0.6590446",
"0.6590446",
"0.6590446",
"0.6590446",... | 0.7295768 | 0 |
find the maximum sub array in an array | def max_sub_array
(0...self.size).inject([self.first]) do |max_sub,i|
(i...self.size).each do |j|
if max_sub.int_sum < self[i..j].int_sum
max_sub = self[i..j]
end
end
max_sub
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend",
"def maxSubarray(arr)\n [_m... | [
"0.82740986",
"0.82339823",
"0.81471395",
"0.80629534",
"0.7910162",
"0.7902042",
"0.78675115",
"0.7766517",
"0.7761502",
"0.7736341",
"0.7718618",
"0.77082103",
"0.77059853",
"0.76874137",
"0.7681162",
"0.76617724",
"0.7643433",
"0.76412463",
"0.76098824",
"0.7598411",
"0.75... | 0.8459658 | 0 |
GET /messages_comments/1 GET /messages_comments/1.json | def show
@messages_comment = MessagesComment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @messages_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def new\n @messages_comment = MessagesComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messages_comment }\n end\n end",
"def comments\n @article = Article.find(params[:id])\n ... | [
"0.7700898",
"0.69862753",
"0.69298095",
"0.6915482",
"0.6915482",
"0.67945457",
"0.678092",
"0.6692832",
"0.6643637",
"0.6626985",
"0.65854377",
"0.65843046",
"0.65795463",
"0.6535529",
"0.65031946",
"0.64852715",
"0.64826703",
"0.64664644",
"0.6460586",
"0.6449252",
"0.6434... | 0.75209457 | 1 |
GET /messages_comments/new GET /messages_comments/new.json | def new
@messages_comment = MessagesComment.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @messages_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @... | [
"0.78621703",
"0.7730281",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.77216625",
"0.7663547",
"0.7657444",
"0.7657444",
"0.756381",
"0.75368035",
"0.7378663",
"0.... | 0.8366363 | 0 |
POST /messages_comments POST /messages_comments.json | def create
@messages_comment = MessagesComment.new(params[:messages_comment])
respond_to do |format|
if @messages_comment.save
format.html { redirect_to @messages_comment, notice: 'Messages comment was successfully created.' }
format.json { render json: @messages_comment, status: :created... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@comment = Comment.new\n\t\t@comment.comment = params[:message] \n\t\t@comment.user = current_user\n\t\t\n\t\t@comment.save\n\t\trespond_with(@comment)\n end",
"def create_comment\n @user = User.find(params[:user_id])\n @message = Message.find(params[:message_id])\n @comment = @message.... | [
"0.69470954",
"0.6902832",
"0.6787189",
"0.6776868",
"0.67043555",
"0.6638144",
"0.66221327",
"0.661672",
"0.652321",
"0.6503006",
"0.6503006",
"0.6503006",
"0.648112",
"0.64441323",
"0.6440048",
"0.6402352",
"0.63985837",
"0.63964766",
"0.6380872",
"0.6375054",
"0.6375054",
... | 0.7440708 | 0 |
PUT /messages_comments/1 PUT /messages_comments/1.json | def update
@messages_comment = MessagesComment.find(params[:id])
respond_to do |format|
if @messages_comment.update_attributes(params[:messages_comment])
format.html { redirect_to @messages_comment, notice: 'Messages comment was successfully updated.' }
format.json { head :no_content }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comme... | [
"0.70348257",
"0.6787702",
"0.6676065",
"0.6634039",
"0.66048676",
"0.6600948",
"0.65784985",
"0.65628254",
"0.65628254",
"0.6556255",
"0.6528029",
"0.6518304",
"0.6501202",
"0.6499012",
"0.64843047",
"0.64348024",
"0.6432864",
"0.64287406",
"0.6400872",
"0.63966185",
"0.6362... | 0.7263574 | 0 |
DELETE /messages_comments/1 DELETE /messages_comments/1.json | def destroy
@messages_comment = MessagesComment.find(params[:id])
@messages_comment.destroy
respond_to do |format|
format.html { redirect_to messages_comments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end",
"def destroy\n # delete... | [
"0.71931666",
"0.71432465",
"0.71238524",
"0.70616955",
"0.70515424",
"0.7010227",
"0.69748765",
"0.6969526",
"0.6964472",
"0.69637764",
"0.6957433",
"0.69319874",
"0.6931949",
"0.6930181",
"0.69289327",
"0.6913211",
"0.6904451",
"0.6884654",
"0.6884654",
"0.6883664",
"0.6880... | 0.76316255 | 0 |
Summary: Uploads the given file to the bucket, then gives up permissions to the bucket owner Details : intended to allow files to be uploaded to S3, but not allowing the files to be interfered with should the web server get hacked. In truth, S3 permissions aren't adequate and the best we can do is that the file can't b... | def upload_backup(aFileName,aBucketName,aObjectName = nil)
aObjectName ||= File.basename(aFileName)
AWS::S3::S3Object.store(aObjectName, open(aFileName), aBucketName)
bucket_owner = AWS::S3::Bucket.acl(aBucketName).owner
policy = AWS::S3::S3Object.acl(aObjectName,aBucketName)
policy.grants.clear
policy = po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(bucket, file); end",
"def bucket_acl_set_for_owner_id?(\r\n s3_client,\r\n bucket_name,\r\n permission,\r\n owner_id\r\n)\r\n s3_client.put_bucket_acl(\r\n access_control_policy: {\r\n grants: [\r\n {\r\n grantee: {\r\n id: owner_id,\r\n type: 'Canoni... | [
"0.74061835",
"0.7285796",
"0.7169991",
"0.7007247",
"0.69954664",
"0.69686705",
"0.6748115",
"0.67469937",
"0.6663613",
"0.6625622",
"0.662101",
"0.66089386",
"0.65975314",
"0.6584539",
"0.65426373",
"0.65320307",
"0.6520847",
"0.6515147",
"0.6501233",
"0.6493073",
"0.648835... | 0.77392226 | 0 |
check to see if there is already a scheduled job for the listserv id | def duplicate_scheduled_job?(listserv)
scheduled_queue = Sidekiq::ScheduledSet.new
scheduled_queue.any? { |job| check_for_duplicate(listserv, job) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?\n SideJob.redis.sismember 'jobs', id\n end",
"def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend",
"def scheduled?\n status == Status[:scheduled]\n end",
"def valid?\n id && cron_schedule && worker\n end",
"def in_shipped_list?\n MeadSchedulerService.in_ship... | [
"0.67153364",
"0.6387039",
"0.63815665",
"0.63321555",
"0.6285404",
"0.62040794",
"0.6186232",
"0.61440206",
"0.61372703",
"0.61194336",
"0.6050787",
"0.60322905",
"0.5997739",
"0.5981781",
"0.59495723",
"0.5930317",
"0.59269184",
"0.5874908",
"0.5836512",
"0.5805794",
"0.574... | 0.8337974 | 0 |
GET /pagemasters GET /pagemasters.json | def index
@pagemasters = Pagemaster.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end",
"def index\n @pharmaceutical_masters = PharmaceuticalMaster.page(params[:page])\n # @pharmaceutical_masters = PharmaceuticalMaster.all\n end",
"def index\n @sites = current_user.sites.page(params[\"page\"])\n\n... | [
"0.7053716",
"0.667946",
"0.66463715",
"0.65678316",
"0.6535094",
"0.64710444",
"0.6429073",
"0.62397164",
"0.62287617",
"0.6213205",
"0.6213205",
"0.6213205",
"0.6213205",
"0.6213205",
"0.6213205",
"0.6213205",
"0.6211827",
"0.61739004",
"0.615255",
"0.6136375",
"0.61148226"... | 0.72797215 | 0 |
POST /pagemasters POST /pagemasters.json | def create
@pagemaster = Pagemaster.new(pagemaster_params)
respond_to do |format|
if @pagemaster.save
format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' }
format.json { render :show, status: :created, location: @pagemaster }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagemasters = Pagemaster.all\n end",
"def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end",
"def create\n @page = Page.new(p... | [
"0.6266468",
"0.60528743",
"0.5970794",
"0.58868665",
"0.5836367",
"0.5770931",
"0.57577395",
"0.5746898",
"0.569049",
"0.5682702",
"0.56336886",
"0.56322575",
"0.5621664",
"0.55991244",
"0.5586411",
"0.5579931",
"0.55636925",
"0.55626917",
"0.55606896",
"0.55377597",
"0.5529... | 0.7136485 | 0 |
PATCH/PUT /pagemasters/1 PATCH/PUT /pagemasters/1.json | def update
respond_to do |format|
if @pagemaster.update(pagemaster_params)
format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully updated.' }
format.json { render :show, status: :ok, location: @pagemaster }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n for... | [
"0.62844384",
"0.6203034",
"0.6201689",
"0.6175606",
"0.61736435",
"0.615435",
"0.61402535",
"0.60688686",
"0.6041272",
"0.6027496",
"0.6021571",
"0.602073",
"0.59844893",
"0.59844893",
"0.59843415",
"0.59802234",
"0.5979805",
"0.59676296",
"0.5962027",
"0.5962027",
"0.595718... | 0.68065405 | 0 |
DELETE /pagemasters/1 DELETE /pagemasters/1.json | def destroy
@pagemaster.destroy
respond_to do |format|
format.html { redirect_to pagemasters_url, notice: 'Pagemaster was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def dest... | [
"0.71098185",
"0.70382106",
"0.69768494",
"0.6946361",
"0.69462955",
"0.6938194",
"0.6883078",
"0.6880598",
"0.6878404",
"0.6878228",
"0.6860168",
"0.6841834",
"0.68235165",
"0.6822673",
"0.68214947",
"0.6820508",
"0.6813039",
"0.6797299",
"0.67955667",
"0.6789765",
"0.678976... | 0.7490353 | 0 |
Load all words from a text file (one word per line) Keep only words that are 5 ascii letters or more Words all all lower case | def load(file)
words = File.readlines(file)
words = words.collect {|word| Word.new(word.chomp.downcase) }
change_wordlist(words.select {|word| word.word.length >= 5 && word.word =~ /^([a-z])+$/ })
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^... | [
"0.7316448",
"0.7250181",
"0.716863",
"0.7066948",
"0.70191926",
"0.6926973",
"0.679912",
"0.67781585",
"0.6740626",
"0.67250496",
"0.668779",
"0.66851044",
"0.6638561",
"0.6616625",
"0.655909",
"0.6550625",
"0.6515035",
"0.64642227",
"0.6454608",
"0.6449782",
"0.64079714",
... | 0.74152505 | 0 |
Return a new Dictionary with only the words of the given length | def with_only_words_of_size(len)
other = Dictionary.new
@dictionary_per_size[len] ||= @words.select{|word| word.word.length == len }
words = @dictionary_per_size[len]
other.add_words(words)
other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_words_of_length\n\t\t@dictionary.select! { |el| el.length == @word_length + 1 }\n\t\tmake_smart_dictionary\n\tend",
"def narrow_search_by_length\n self.dictionary.select { |word| word.length == self.word_length }\n end",
"def keep_only_words_of_length(len)\n change_wordlist(@words.select{|... | [
"0.84181213",
"0.77309114",
"0.7625024",
"0.7382154",
"0.73415136",
"0.72445273",
"0.72357553",
"0.7179031",
"0.71778965",
"0.714575",
"0.71394193",
"0.70540893",
"0.6883865",
"0.6879563",
"0.68610084",
"0.6850231",
"0.65873605",
"0.6499255",
"0.64796543",
"0.638994",
"0.6372... | 0.85993326 | 0 |
Access each Word individually | def [](index)
@words[index].word
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end",
"def in_a_word\n WORDS[self]\n end",
"def idx_get_word(i)\n @tparses[i][:word]\n end",
"def word\n @word\n end",
"def word\n @w... | [
"0.72010344",
"0.68452895",
"0.68267137",
"0.6762287",
"0.6762287",
"0.6762287",
"0.6741771",
"0.6721848",
"0.6675079",
"0.66309434",
"0.66185355",
"0.6602826",
"0.660076",
"0.6596457",
"0.65897566",
"0.65838426",
"0.65637046",
"0.65538186",
"0.65489805",
"0.6541548",
"0.6541... | 0.6928339 | 1 |
Filter out all words that don't have the given length | def keep_only_words_of_length(len)
change_wordlist(@words.select{|word,letters| word.word.length == len })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_lengths(strings, length = 5)\n words = []\n strings.each do |word|\n if word.length >= length\n words << word\n end\n end\n return words\nend",
"def filter_lengths(strings, length=5)\n big_words = []\n strings.each { |ele| big_words << ele if ele.length >= le... | [
"0.8268905",
"0.82069004",
"0.8036487",
"0.77160835",
"0.7701686",
"0.75003904",
"0.7208516",
"0.71411645",
"0.7057447",
"0.7047899",
"0.6997992",
"0.69461554",
"0.6808017",
"0.6679938",
"0.6667339",
"0.66432947",
"0.66265607",
"0.6538837",
"0.65367144",
"0.6516269",
"0.65061... | 0.86861956 | 0 |
Filter out all words that contain the given letter | def reject_words_that_contain(letter)
change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_words_with_letter array, letter\n array.filter_map{ |value| value if value.include? letter }\nend",
"def words_with_letter (array,letter)\n array.select{|word| word.include? letter}\nend",
"def letter_checker(array, letter_variable)\n# loop over array and return only words that include a given l... | [
"0.8088286",
"0.74130577",
"0.7368156",
"0.7300006",
"0.7235947",
"0.7066958",
"0.66895235",
"0.6686267",
"0.6682136",
"0.6672857",
"0.6629614",
"0.65127003",
"0.6464307",
"0.64636683",
"0.646075",
"0.6435366",
"0.64256155",
"0.64143544",
"0.63935244",
"0.6380838",
"0.6379877... | 0.8102956 | 0 |
Keep only the words that match the partial solution | def keep_only_words_that_match(hangman_pattern)
pattern = Regexp.new('^' + hangman_pattern.gsub(/-/,'.') + '$')
change_wordlist(@words.select { |word,letters| word.word =~ pattern })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_results_of_partial_phrases(results)\n cleaned_results = []\n results.each do |current_result|\n current_result_phrase = current_result[0]\n\n cleaned_results << current_result unless results.any? do |other_result|\n other_result_phrase = other_result[0]\n is_a_partial_string... | [
"0.68372524",
"0.67587155",
"0.66453785",
"0.6633344",
"0.66284317",
"0.6566852",
"0.65604645",
"0.65322715",
"0.6530867",
"0.6521575",
"0.64905804",
"0.6483015",
"0.64492726",
"0.6443264",
"0.64324",
"0.6421518",
"0.6417509",
"0.63569254",
"0.6351105",
"0.6314205",
"0.629324... | 0.68202984 | 1 |
Return the number of words in the dictionary that contain the given letter | def words_that_contain(letter)
letter_count(letter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_count_by_letter(letter)\n\t\tputs \"#{@dictionary_analyzer.word_count_by_letter(letter, @dictionary)} words begin with the letter #{letter}\"\n\tend",
"def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }",
"def letter_counts(word)\n counter = Hash.new(... | [
"0.8189641",
"0.7937864",
"0.7869434",
"0.7787882",
"0.77715236",
"0.7695184",
"0.7650494",
"0.7650218",
"0.7646654",
"0.75720036",
"0.75609696",
"0.7557417",
"0.75205106",
"0.7516355",
"0.75112134",
"0.7421506",
"0.7420873",
"0.74122286",
"0.7393609",
"0.7370991",
"0.7356189... | 0.84663004 | 0 |
Create a HangMan Solver puzzle should be a string of '' as long as the word to guess dictionary is a Dictionary. The solver can find words that are not in the dictionary strategy is an optional parameter to determine the letter choosing strategy a Strategy object should implement one method score_for(letter,dictionary)... | def initialize(puzzle,dictionary,strategy=MostFrequentStrategy.new)
@solution = puzzle.dup
@dictionary = dictionary.with_only_words_of_size(puzzle.length)
@possible_letters = ('a'..'z').to_a
@strategy = strategy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word,... | [
"0.6470329",
"0.6167698",
"0.61333984",
"0.60663444",
"0.60628045",
"0.60478956",
"0.5945501",
"0.5944362",
"0.5918582",
"0.5893982",
"0.58792496",
"0.5876002",
"0.58553874",
"0.5844523",
"0.5811667",
"0.58113146",
"0.5804311",
"0.57754457",
"0.575519",
"0.575519",
"0.575519"... | 0.6951928 | 0 |
Returns the letter that the solver guesses Uses the strategy to determine the letter with the lowest score | def guess
letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]}
letter = letters.min {|letter1,letter2| letter1 <=> letter2 }
letter[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_letter\n\t\t# move the 'a' and 'b' jokers \n\t\tmove_joker_a\n\t\tmove_joker_b\n\n\t\t# get their new positons\n\t\tnew_a = @deck_of_cards.index(Card.new(:joker, 1))\n\t\tnew_b = @deck_of_cards.index(Card.new(:joker, 2))\n\n\t\t# perform a triple split around the positions of the jokers\n\t\ttriple_split(n... | [
"0.6716559",
"0.6707428",
"0.6695332",
"0.6690874",
"0.66757935",
"0.66717863",
"0.66715163",
"0.66393197",
"0.6610986",
"0.65861034",
"0.65775305",
"0.65690815",
"0.65652484",
"0.65220696",
"0.6504551",
"0.647341",
"0.6461107",
"0.6450771",
"0.6450236",
"0.64088917",
"0.6381... | 0.8592044 | 0 |
Tell the solver that the letter does not appear in the solution | def wrong_guess(letter)
@possible_letters.delete(letter)
@dictionary.reject_words_that_contain(letter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end",
"def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end",
"def no_indices(guess)\n @candidate_words.reject! { ... | [
"0.69877553",
"0.69462293",
"0.6907651",
"0.64770323",
"0.64410424",
"0.64104825",
"0.6355883",
"0.63545567",
"0.63487494",
"0.634209",
"0.62722474",
"0.62282974",
"0.62254494",
"0.6211572",
"0.6199264",
"0.6196783",
"0.6166386",
"0.61600214",
"0.6124472",
"0.6095786",
"0.606... | 0.7322945 | 0 |
GET /ramais GET /ramais.json | def index
@ramais = Ramal.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @ramais }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ramal }\n end\n end",
"def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n form... | [
"0.6646255",
"0.6568274",
"0.6403144",
"0.6287112",
"0.6228843",
"0.6134788",
"0.61119664",
"0.6027192",
"0.5993213",
"0.59868544",
"0.59693426",
"0.5902116",
"0.5892363",
"0.58351934",
"0.58291405",
"0.57919765",
"0.57794243",
"0.5742897",
"0.57412696",
"0.57402396",
"0.5735... | 0.7563953 | 0 |
GET /ramais/1 GET /ramais/1.json | def show
@ramal = Ramal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ramal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end",
"def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\... | [
"0.7652828",
"0.67463803",
"0.67453396",
"0.6592756",
"0.6397033",
"0.6381231",
"0.63730806",
"0.6246838",
"0.61505014",
"0.61438894",
"0.6119072",
"0.6096222",
"0.6085872",
"0.6079914",
"0.6038352",
"0.6031311",
"0.60115117",
"0.5999089",
"0.5972969",
"0.59366596",
"0.591651... | 0.7124369 | 1 |
GET /ramais/new GET /ramais/new.json | def new
@ramal = Ramal.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @ramal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end",
"def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end",
"d... | [
"0.7631171",
"0.74667746",
"0.7383068",
"0.72372484",
"0.71745837",
"0.7076995",
"0.70463544",
"0.70446837",
"0.7036847",
"0.7028083",
"0.70137024",
"0.70087147",
"0.70011216",
"0.6983756",
"0.69739485",
"0.6967141",
"0.6957078",
"0.69258124",
"0.6918733",
"0.6918733",
"0.690... | 0.76395696 | 0 |
POST /ramais POST /ramais.json | def create
@ramal = Ramal.new(params[:ramal])
respond_to do |format|
if @ramal.save
format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' }
format.json { render json: @ramal, status: :created, location: @ramal }
else
format.html { render action: "new" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @alram_test = AlramTest.new(alram_test_params)\n\n respond_to do |format|\n if @alram_test.save\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully created.' }\n format.json { render :show, status: :created, location: @alram_test }\n else\n ... | [
"0.62647176",
"0.6159127",
"0.6139747",
"0.5904928",
"0.58909833",
"0.57144237",
"0.5689884",
"0.56723607",
"0.56678516",
"0.56566787",
"0.5625265",
"0.56249714",
"0.5581306",
"0.5573407",
"0.55617315",
"0.55544114",
"0.55317545",
"0.55237716",
"0.55073404",
"0.5501883",
"0.5... | 0.6398049 | 0 |
PUT /ramais/1 PUT /ramais/1.json | def update
@ramal = Ramal.find(params[:id])
respond_to do |format|
if @ramal.update_attributes(params[:ramal])
format.html { redirect_to @ramal, notice: 'Ramal alterado com sucesso!' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.63633907",
"0.62695473",
"0.60082513",
"0.5815193",
"0.5811508",
"0.5806587",
"0.5780349",
"0.575386",
"0.5732287",
"0.56992644",
"0.5680876",
"0.5667151",
"0.56266034",
"0.5614791",
"0.56132",
"0.55970705",
"0.55903393",
"0.55894816",
"0.5581456",
"0.55806786",
"0.5567762... | 0.64180064 | 0 |
DELETE /ramais/1 DELETE /ramais/1.json | def destroy
@ramal = Ramal.find(params[:id])
@ramal.destroy
respond_to do |format|
format.html { redirect_to ramais_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @ram = Ram.find(params[:id])\n @ram.destroy\n\n respond_to do |format|\n format.html { redirect_to rams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomia... | [
"0.6928334",
"0.68618",
"0.6830498",
"0.6805777",
"0.67912847",
"0.6765914",
"0.67633367",
"0.67621964",
"0.6705493",
"0.6700462",
"0.6693336",
"0.6690087",
"0.66743857",
"0.66685414",
"0.6666086",
"0.6650989",
"0.6650645",
"0.6637559",
"0.6612084",
"0.6610384",
"0.6609764",
... | 0.71264106 | 0 |
Roundcurrent_card returns the current card to be answered. | def current_card
@deck.cards[@turns.count]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_card\n deck.cards[@number_correct]\n end",
"def current_card\n @deck.cards[0]\n end",
"def current_card\n @deck.cards[count]\n end",
"def current_value\n @top_card.value\n end",
"def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}... | [
"0.71274006",
"0.684506",
"0.67001146",
"0.6378743",
"0.6365905",
"0.626723",
"0.6143609",
"0.6140993",
"0.6101522",
"0.6064676",
"0.5985079",
"0.59462166",
"0.59124285",
"0.5901385",
"0.58638436",
"0.5729679",
"0.5653972",
"0.56150085",
"0.5512238",
"0.54952383",
"0.5477524"... | 0.6961884 | 1 |
Roundnumber_correct_by_category returns the amount of correct turns for a category. | def number_correct_by_category(category_select)
# Count the cards that are in the selected category and are guessed correct.
@turns.count do |turn|
turn.correct? && turn.card.category == category_select
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_correct_by_category(category)\n correct_count = 0\n @turns.each do |turn|\n if turn.correct? == true && turn.card.category == category\n correct_count = correct_count + 1\n end\n end\n correct_count\n end",
"def number_correct_by_category(card_category)\n ... | [
"0.8018888",
"0.72253853",
"0.7200633",
"0.70389026",
"0.69238466",
"0.6730223",
"0.63557994",
"0.58161545",
"0.5798303",
"0.57859015",
"0.5777151",
"0.5755112",
"0.5684646",
"0.55789167",
"0.51984125",
"0.5192126",
"0.51919246",
"0.51919246",
"0.50753385",
"0.50016093",
"0.4... | 0.7555791 | 1 |
Roundpercent_correct returns the percentage of correct turns. | def percent_correct
# Check for divide by zero. Than calculate the percentage otherwise.
if @turns.size == 0
0.0
else
# Calculate percentage, truncate value to one decimal place.
((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end",
"def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def percent_answered\n percent_answered_int.to_s + \"%\"\n end... | [
"0.77676356",
"0.67909825",
"0.6737275",
"0.6528511",
"0.6500005",
"0.6500005",
"0.64801145",
"0.6464098",
"0.6437641",
"0.6375033",
"0.6352013",
"0.631339",
"0.62854767",
"0.6267044",
"0.6248026",
"0.62446785",
"0.62335867",
"0.62019515",
"0.61555326",
"0.60859907",
"0.60759... | 0.80640006 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.