query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
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
Returns the first element that matches the provided xpath.
def xpath xpath_str find_element :xpath, xpath_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_first(xpath, nslist = nil)\n find(xpath, nslist).first\n end", "def at(xpath)\n self.find_first(xpath)\n end", "def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risul...
[ "0.80378413", "0.78829056", "0.7852283", "0.77787846", "0.7372876", "0.7305197", "0.73033327", "0.72525275", "0.70989764", "0.69839895", "0.6973274", "0.68902415", "0.6749206", "0.6738103", "0.67280716", "0.6648252", "0.65136373", "0.650805", "0.6507062", "0.6436845", "0.6435...
0.6973612
10
Returns all elements that match the provided xpath.
def xpaths xpath_str find_elements :xpath, xpath_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_elements(xpath); end", "def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end", "def elements_by_xpath(va...
[ "0.8026308", "0.79066217", "0.7849657", "0.7764967", "0.76488084", "0.7128325", "0.6960413", "0.6940631", "0.69363225", "0.69363225", "0.68294674", "0.6809298", "0.67731315", "0.67249256", "0.6685712", "0.66830206", "0.662625", "0.6622509", "0.6568911", "0.6520585", "0.635649...
0.739641
5
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 all elements exactly matching tag name
def find_eles tag_name @driver.find_elements :tag_name, tag_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags tag_name\n find_elements :tag_name, tag_name\n end", "def elements\n find_by_tag('*')\n end", "def find_names name\n find_elements :name, name\n end", "def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end", "def find_tag(tag_name)\n r = scan(/\\<#{tag...
[ "0.74248403", "0.72330594", "0.6930145", "0.6638875", "0.6634128", "0.6606429", "0.652169", "0.6507143", "0.6420594", "0.63818467", "0.63674474", "0.6315953", "0.6300778", "0.62992346", "0.62921494", "0.62465906", "0.61173344", "0.61173344", "0.60858923", "0.60636365", "0.602...
0.69878024
2
Get the first tag that exactly matches tag and text.
def find_ele_by_text tag, text @driver.find_element :xpath, %Q(#{tag}[@text='#{text}']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\...
[ "0.6744437", "0.66811275", "0.6511489", "0.64343023", "0.63833266", "0.61991805", "0.61058146", "0.6062507", "0.6032106", "0.59776616", "0.5930785", "0.59261745", "0.59043604", "0.57742965", "0.57216215", "0.57214665", "0.57209814", "0.57197744", "0.56756485", "0.55984247", "...
0.5528779
21
Get all tags that exactly match tag and text.
def find_eles_by_text tag, text @driver.find_elements :xpath, %Q(#{tag}[@text='#{text}']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end", "def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end", "def search_tag(tag)\n search_text(tag.name)\n end", "def tagged_with(_tags)\n _tags = convert_string_tags_to_array(...
[ "0.6266885", "0.62010944", "0.6119152", "0.6067555", "0.5957864", "0.59182805", "0.5871871", "0.58593357", "0.58072025", "0.57537794", "0.5740311", "0.5739751", "0.5702388", "0.5700148", "0.5626286", "0.56000686", "0.5578781", "0.55428416", "0.55252373", "0.55178005", "0.5515...
0.54013413
33
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 first tag that includes text.
def find_ele_by_text_include tag, text find_ele_by_attr_include tag, :text, text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end", "def first_text\n first_ele static_text_class\n end", "def tag_text()\n return self.tag(true)\n end", "def first_ele(class_name)\n tag(class_name)\n end", "def first_t...
[ "0.72211885", "0.71445173", "0.6932663", "0.6825029", "0.6687706", "0.65747035", "0.65155643", "0.64259815", "0.6397045", "0.63311565", "0.62765795", "0.6225", "0.61543924", "0.6124014", "0.60766304", "0.60634404", "0.59838337", "0.59777766", "0.59717375", "0.5862769", "0.585...
0.5918439
19
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
Prints a JSON view of the current page
def source ap get_source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @page\n end", "def pretty_print_page\n pp @page\n end", "def show_json\n end", "def get_page\n render_page_sections_json\n end", "def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @v...
[ "0.7077802", "0.67606837", "0.66862035", "0.6647434", "0.6570376", "0.65508354", "0.6508218", "0.64921397", "0.6373055", "0.6324023", "0.6319101", "0.6262443", "0.62582093", "0.6225372", "0.6145214", "0.6145214", "0.6145214", "0.6145214", "0.6145214", "0.6145214", "0.6145214"...
0.0
-1
Gets a JSON view of the current page
def get_source # must set max nesting. default limit of 20 is too low for selendroid JSON.parse @driver.page_source, max_nesting: 9999 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @page\n end", "def get_page\n render_page_sections_json\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @versi...
[ "0.7623492", "0.7428901", "0.68959826", "0.6860339", "0.6842646", "0.6653308", "0.6650702", "0.6482096", "0.6471876", "0.64305514", "0.64063644", "0.64063644", "0.64063644", "0.64063644", "0.64063644", "0.64063644", "0.64063644", "0.637942", "0.63757366", "0.63757366", "0.637...
0.0
-1
Returns the first element that exactly matches name
def find_name name find_element :name, name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end", "def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end", "def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end", "def find_first(name)\n find_all(na...
[ "0.7612365", "0.74789006", "0.74676776", "0.74570316", "0.7410159", "0.71146005", "0.7097981", "0.6937381", "0.6862355", "0.67928755", "0.6738946", "0.67318225", "0.67318225", "0.66656816", "0.6592674", "0.6563946", "0.6512656", "0.6490407", "0.64891005", "0.6485149", "0.6468...
0.72028893
5
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 the first element matching tag_name
def tag tag_name find_element :tag_name, tag_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end", "def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end", "def first_ele(class_name)\n tag(class_name)\n end", "def first_matching_...
[ "0.78427315", "0.7539798", "0.7000159", "0.6976029", "0.67870736", "0.6770968", "0.67693603", "0.66739005", "0.66687083", "0.66429824", "0.6640506", "0.66028047", "0.65569204", "0.65496385", "0.6487704", "0.64416623", "0.6368279", "0.6334703", "0.6310857", "0.62873346", "0.62...
0.70563114
2
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
GET /themes or /themes.json def index
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @themes = Theme.all\n json_response(@themes)\n end", "def index\n @themes = Theme.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end", "def index\n @themes = TemplateTheme.all\n\n re...
[ "0.8407449", "0.7707325", "0.7674515", "0.76456285", "0.7311576", "0.72925186", "0.727758", "0.7160831", "0.7026856", "0.70230657", "0.7011665", "0.7011665", "0.6967266", "0.68615", "0.66917175", "0.66674376", "0.66038984", "0.65290767", "0.6514228", "0.65027976", "0.6481354"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_theme # @theme = Theme.find(params[:id]) @theme = Theme.current_theme end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def theme_params params.require(:theme).permit(Theme::DEFAULTS.keys + [:logo, :hero_image, :favicon_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Restrict theme access to admins
def ensure_admin! authorize! :read, :admin_dashboard end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_requ...
[ "0.7951221", "0.7790804", "0.7790804", "0.7790804", "0.7678672", "0.76469594", "0.7607186", "0.75529754", "0.7526073", "0.7519597", "0.7501832", "0.7499353", "0.74862844", "0.7432273", "0.7419374", "0.7417087", "0.7401012", "0.7400061", "0.7380491", "0.7340216", "0.7334123", ...
0.69950503
70
I worked on this challenge [by myself!]. Your Solution Below
def array_concat(array_1, array_2) array_2.each do |a2_element| array_1.push(a2_element) end return array_1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def challenge; end", "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx]...
[ "0.63846064", "0.6255908", "0.6084379", "0.5993604", "0.5934277", "0.59197694", "0.5915114", "0.5862419", "0.58391076", "0.5819009", "0.58101237", "0.5791203", "0.57860905", "0.5777768", "0.5764495", "0.57605153", "0.57548004", "0.5754786", "0.575139", "0.5749838", "0.5749597...
0.0
-1
make a request to national rail like: train("INV", "ABD", "211113")
def train(origin, destination, date) url = "http://ojp.nationalrail.co.uk/service/timesandfares/#{origin}/#{destination}/#{date}/0900/dep" xml = Nokogiri::HTML(open(url).read) #get prices price_string = xml.css('.opsingle').inner_html price_string.gsub!(/\s+/, "") prices = price_string.scan(/£\d*.\d*/) #get durations duration_string = xml.css('.dur').inner_html duration_string.gsub!(/\s+/, "") duration_string.gsub!(/<abbrtitle="hours">h<\/abbr>/, ":") duration_string.gsub!(/<abbrtitle="minutes">m<\/abbr>/, ",") duration_string.gsub!(/^.*>/, "") duration_string = duration_string.split(',') durations = Array.new duration_string.each do |d| hours = d[0, d.index(':')] mins = d[d.index(':')+1, d.length] if mins[0,1] == "0" mins = mins[1,1] end durations.push(Integer(hours)*60 + Integer(mins)) end results = Array.new prices.count().times do |count| pair = [prices[count][1,prices[count].length], durations[count]] #rather messy way of taking out the £ at the last minute! results.push(pair) end return results, url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(query:)\n Trainer.train(query: query)\n end", "def train_params\n params.require(:train).permit(:train_line, :route_name, :run_number, :operator_id)\n end", "def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_requ...
[ "0.6190405", "0.5961827", "0.58726203", "0.5859995", "0.57776934", "0.5648438", "0.5646053", "0.56196856", "0.5581352", "0.55779755", "0.5525539", "0.55188817", "0.5481776", "0.54337704", "0.54244375", "0.53712434", "0.53677875", "0.53632045", "0.53405464", "0.5299907", "0.52...
0.0
-1
make a request to megabus like: bus("49", "56", "211113")
def bus(origin, destination, date) param_date = date[0,2] + "%2f" + date[2,2] + "%2f20" + date[4,2] #megabus uses odd date formats url = "https://uk.megabus.com/JourneyResults.aspx?originCode=#{origin}&destinationCode=#{destination}&outboundDepartureDate=#{param_date}&passengerCount=1&transportType=-1" xml = Nokogiri::HTML(open(url).read) #get prices price_string = xml.css('ul.standard>li.five>p').to_s price_string.gsub!(/\s+/, "") price_string.gsub!(/[<p>\/]/, '') prices = price_string.split('£') prices.delete_at(0) #get durations dur_string = xml.css('ul.standard>li.three>p').to_s dur_string.gsub!(/\s+/, "") dur_string.gsub!(/></, ',') dur_string.gsub!(/[<p>\/]/, '') dur_string.gsub!('hrs', ':') dur_string.gsub!('mins', '') duration_string = dur_string.split(',') durations = Array.new duration_string.each do |d| hours = d[0, d.index(':')] mins = d[d.index(':')+1, d.length] if mins[0,1] == "0" mins = mins[1,1] end durations.push(Integer(hours)*60 + Integer(mins)) end #prepare results results = Array.new prices.count().times do |count| pair = [prices[count], durations[count]] results.push(pair) end return results, url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(params=Hash.new, &result_cbk)\n\n cmd = params.delete :cmd\n prefix = params.delete :prefix\n cont = params.delete :cont\n offset = params.delete :offset\n len = params.delete :len\n\n if cont.is_a? String\n cont=request_string(cont)\n elsif cont.i...
[ "0.5711192", "0.5678817", "0.5639555", "0.5566896", "0.54750746", "0.54276973", "0.5391307", "0.5325581", "0.5277402", "0.52635443", "0.5261373", "0.52587235", "0.5229412", "0.5215006", "0.52139646", "0.52070856", "0.51984966", "0.51947206", "0.51614445", "0.5154057", "0.5133...
0.5088457
25
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&obDate=#{param_date}&obTime=&ibDate=&ibTime=" xml= Nokogiri::HTML(open(url).read) #get prices price_string = xml.css("span.amount").to_s price_string.gsub!(/\s+/, "") price_string.gsub!(/[<\/spancl=""moutright>]/, "") #I'm sure there's a better way but... prices = price_string.split('£') prices.delete_at(0) #get durations duration_string = xml.css('td.duration>span:first-child').inner_html duration_string.gsub!(/\s+/, "") duration_string = duration_string.scan(/\d*h\d*min/) durations = Array.new duration_string.each do |d| dur = d.gsub('h', ':') dur = dur.gsub!('min', '') hours = dur[0, dur.index(':')] mins = dur[dur.index(':')+1, dur.length] if mins[0,1] == "0" mins = mins[1,1] end durations.push(Integer(hours)*60 + Integer(mins)) end #prepare results results = Array.new prices.count().times do |count| pair = [prices[count], durations[count]] results.push(pair) end return results, url end
{ "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
names = str.split string = "" until names.empty? string << names.pop + " " end puts string end
def name_shuffler(str) p str.split.reverse.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def liststrs(strs)\n return \"\" if strs.empty?\n if (strs.count == 1)\n strs[0]\n else\n last = strs.pop\n [strs.join(', '), last].join(' and ')\n end\nend", "def get_name_initials(names)\n output = []\n names.each do |name|\n first, last = name.split(\" \")\n output << [first[0], last[0]]...
[ "0.64150476", "0.63771516", "0.63720644", "0.63210225", "0.6252859", "0.6249087", "0.62449706", "0.62322867", "0.6216454", "0.6216454", "0.6112335", "0.6075554", "0.606516", "0.6041707", "0.5981446", "0.596406", "0.5961802", "0.59560454", "0.5922974", "0.5915404", "0.590735",...
0.59536684
18
Create the filename to save the image locally as
def image_url_to_default_filename (image_url = @todays_image_url) matches = image_url.scan(/\S+\/(\S+.jpg)/) # returns an array if (matches.length != 1) return nil end return matches[0].to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filename(name)\n $file = \"images/\" << Time.now.strftime('%Y-%m-%d-%H-%M-%S-') << \"#{name}.jpg\"\nend", "def filename\n \"mp-#{make_stamp}-1024.jpg\" if original_filename\n end", "def image_filename\n File.join Img_Store, \"#{id}.#{extension}\"\n end", "def filename\n #\"#{original_fil...
[ "0.75576806", "0.73158324", "0.7294669", "0.7190004", "0.71491385", "0.7109095", "0.7057079", "0.7028486", "0.7028486", "0.6976257", "0.69451445", "0.69408506", "0.6932692", "0.69046056", "0.6902102", "0.68485284", "0.6847525", "0.6842672", "0.6841337", "0.6839679", "0.681849...
0.0
-1
redcloth loves to put caps in 'spancaps', it's lame
def start_span attrs if attrs['class'] == 'caps' @nospan = true else @output << "%" @output << add_attributes(attrs) if add_attributes(attrs) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_caps(text)\n # $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match\n text.gsub(%r{\n (<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values\n (\\s|&nbsp;|^|'|\"|>|) ...
[ "0.72289354", "0.6885218", "0.6827235", "0.6801748", "0.6444477", "0.6337838", "0.6331051", "0.62902665", "0.6267668", "0.6243935", "0.6182852", "0.6175215", "0.6115733", "0.6082101", "0.60139275", "0.59841365", "0.5969673", "0.5966692", "0.5953061", "0.59528863", "0.59500206...
0.6034458
14
def update songs=User.find(session[:user_id]).mediafiles.where(:id => params[:selected_songs],:mediatype => params[:mediatype]) devices=User.find(session[:user_id]).devices.where(:id => params[:selected_devices]) songs.each do |song| devices.each do |device| song.devices << device unless song.devices.include?(device) end end redirect_to '/media?mediatype='+params[:mediatype], success: 'The playlist has been updated!' end
def songs <<<<<<< HEAD file="#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}" if File.exists?(file) send_file( file, filename: "#{params[:file_name]}", type: "application/mp3" ) else render nothing: true end ======= send_file( "#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}", filename: "#{params[:file_name]}", type: "application/mp3" ) >>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params[:song][:song_type] = params[:song][:songs].content_type.chomp\n params[:song][:song_in] = params[:song][:songs].read\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, :flash => {:success => 'Song was successfully updated.'} }...
[ "0.6968963", "0.6918466", "0.6864413", "0.67567044", "0.6695875", "0.6656355", "0.6644359", "0.6636006", "0.6626034", "0.66091925", "0.65767044", "0.65570587", "0.65552163", "0.6513207", "0.64864624", "0.6485873", "0.64698684", "0.64669", "0.64482707", "0.6446513", "0.6426641...
0.0
-1
Expand include_path to actual path with recursive_include If recursive_include is true, files in subdir would be included.
def load_file_path! @files = FilepathScanner.call( include_paths, exclude_path_regexps, recursive_scan: recursive_include ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include\n File.join(@root, 'include')\n end", "def add_include(path)\n @includes << path\n end", "def add_include(path)\n @includes << path\n end", "def add_include include\n add_to @includes, include\n\n include\n end", "def include_path\n @include_paths.map { |p| \"-I#{ p }\" ...
[ "0.6387776", "0.6252814", "0.6252814", "0.5995808", "0.58833057", "0.58222693", "0.5713803", "0.57063824", "0.55212444", "0.5461311", "0.54587555", "0.5425509", "0.534797", "0.53277665", "0.5291778", "0.52727497", "0.52727497", "0.5233622", "0.5159083", "0.51562554", "0.50692...
0.5449057
11
Update the tower state. Called once per frame.
def update event @image.fill :white enemy_in_range? attack! unless @target.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n update_flow\n update_sprites\n update_weather\n update_timer\n update_viewports\n @brightness -= 15 if @brightness > 0\n end", "def update_state\r\n case @state\r\n when STATE_PICK\r\n @ip1.copy! @ip\r\n Sketchup::set_status_text \"[WALL] Click for end of wall\...
[ "0.63458997", "0.60826844", "0.60565686", "0.6054759", "0.59838015", "0.5922708", "0.59080523", "0.5905839", "0.59017", "0.58204085", "0.5783788", "0.57798034", "0.5777637", "0.577515", "0.57426196", "0.5660861", "0.5659293", "0.56495744", "0.56351167", "0.5631331", "0.560822...
0.0
-1
! ! ! ! ! ! ! !
def to_s channel = (self.h % :channel) channel.children.each_with_index do |e,i| if e.class == Hpricot::Elem && e.name == "item" channel.children[i] = Hpricot::XML("") end end @items.each do |item| channel.children << item.to_h end self.h.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def terpene; end", "def probers; end", "def star; end", "def suivre; end", "def villian; end", "def nn\n end", "def nebula; end", "def king_richard_iii; end", "def sk! ; k! ; s! ; end", "def hiddens; end", "def gounod; end", "def celebration; end", "def berlioz; end"...
[ "0.62127715", "0.61551666", "0.61286193", "0.61057", "0.6098053", "0.60567224", "0.60322005", "0.6004552", "0.5983333", "0.5961636", "0.592969", "0.58922714", "0.5861197", "0.5849029", "0.58401144", "0.5838243", "0.58128154", "0.5779364", "0.5756141", "0.5756141", "0.5756141"...
0.0
-1
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 already selected this topic. # Another scenario is someone that deliberately modifies the view. if topic raise 'Too many quizzes have been taken for this topic; please select another one.' unless candidate_topics_for_quiz.include?(topic) end contributor_set = Array.new(contributors) work = topic.nil? ? 'assignment' : 'topic' # 1) Only consider contributors that worked on this topic; 2) remove reviewer/quiz taker as contributor # 3) remove contributors that have not submitted work yet contributor_set.reject! do |contributor| (signed_up_topic(contributor) != topic) || # both will be nil for assignments with no signup sheet contributor.includes?(reviewer) # ##or !contributor.has_quiz? end raise "There are no more submissions to take quiz on for this #{work}." if contributor_set.empty? # Reviewer/quiz taker can take quiz for each submission only once contributor_set.reject! { |contributor| quiz_taken_by?(contributor, reviewer) } # raise "You have already taken the quiz for all submissions for this #{work}." if contributor_set.empty? # Choose a contributor at random (.sample) from the remaining contributors. # Actually, we SHOULD pick the contributor who was least recently picked. But sample # is much simpler, and probably almost as good, given that even if the contributors are # picked in round-robin fashion, the reviews will not be submitted in the same order that # they were picked. contributor_set.sample end
{ "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, location: @project_message } else format.html { render action: "new" } format.json { render json: @project_message.errors, status: :unprocessable_entity } end end end
{ "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 } else format.html { render action: "edit" } format.json { render json: @project_message.errors, status: :unprocessable_entity } end end end
{ "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
Use callbacks to share common setup or constraints between actions.
def set_forum_thread @forum_thread = ForumThread.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def forum_thread_params params.fetch(:forum_thread, {}) params.inspect params.require(:forum_thread).permit(:title, :user_id, :body, :unread_posts, :total_posts, :post_time, :anonymous) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
destroys import on remote module and then destroys self
def rollback if self.failed? && !self.rollbacked? response = RestClient.delete resource_uri, app_key: Contacts::API_KEY if response.code == 200 self.update_attribute(:status, 'rollbacked') else return false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_local\n super\n end", "def desist\n self.class.delete self\n end", "def destroy\n run_callbacks :destroy do\n rpc_execute('unlink', [id], context)\n @destroyed = true\n freeze \n end\n end", "def reset\n @instance = nil\n @local_e...
[ "0.6391121", "0.6148912", "0.6148435", "0.6027159", "0.6027159", "0.6019726", "0.5977239", "0.5918988", "0.59025776", "0.5877782", "0.58320504", "0.58259004", "0.581805", "0.58129156", "0.58129025", "0.57984436", "0.5797054", "0.5766546", "0.5766546", "0.57536966", "0.574283"...
0.0
-1
ContactImportModule (ContactImporter) is always ready
def ready? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import\n if request.post?\n login = params[:email].to_s\n password = params[:password].to_s\n begin\n case params[:lib]\n when \"gmail.com\"\n @contacts = Contacts::Gmail.new(login, password)\n when \"yahoo.com\"\n @contacts = Contacts::Yahoo.new(login, ...
[ "0.61401707", "0.5984866", "0.5954104", "0.59204066", "0.58920145", "0.58590335", "0.5825482", "0.5816464", "0.5816464", "0.5816464", "0.5816464", "0.57686454", "0.5670945", "0.5597657", "0.55604506", "0.54979175", "0.54939264", "0.5463692", "0.546064", "0.54560035", "0.54493...
0.0
-1
The view for making a new post.
def new @post = Post.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @post = Post.new\n render :new\n end", "def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end", "def new\r\n @post = Post.new\r\n end", "def new\n @post = Post.new\n end", "def new\n # Display a form to create a new post\n ...
[ "0.8107586", "0.8079042", "0.80599034", "0.8051818", "0.80067784", "0.7966639", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", "0.79664767", ...
0.7911565
54
Actually make the post
def create @post = Post.new(post_params) @post.user_id = current_user.id # current_user is given to us from devise if @post.save # Redirect to the show page for Post. And pass along this cool (useless...) notice redirect_to @post, notice: 'Your post was created successfully' else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\r\n end", "def post; end", "def post\n end", "def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end", "def POST; end", "def post(*args)\n execute(:post, *args)\n end", "def post\n Rentlinx.client.post(self)\n end", "def post(data = \...
[ "0.8352422", "0.82043755", "0.81769395", "0.7831789", "0.76249915", "0.7567621", "0.7523996", "0.7409122", "0.73441756", "0.7314405", "0.72897834", "0.7287683", "0.72528833", "0.7247261", "0.72376204", "0.7107416", "0.70709574", "0.7053492", "0.7044218", "0.7034199", "0.69918...
0.0
-1
This is called in a before action at the top of this file
def set_post @post = Post.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_run; end", "def before_setup; end", "def before_bootstrap; end", "def before\n end", "def before\n end", "def before() ; end", "def before_bootstrap\n end", "def on_before_load\n end", "def before; end", "def before\n\t\t\ttrue\n\t\tend", "def before_setup\n ...
[ "0.78709", "0.7815782", "0.74950093", "0.7378815", "0.73123467", "0.7301313", "0.730084", "0.72632384", "0.7230923", "0.71606666", "0.71034265", "0.71029437", "0.70081866", "0.70067257", "0.7005263", "0.6983161", "0.6934832", "0.6934832", "0.6849517", "0.6825912", "0.6794129"...
0.0
-1
GET /slideshows/1 GET /slideshows/1.json
def show @slideshow = Slideshow.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @slideshow } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end", "def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\...
[ "0.82744855", "0.7762472", "0.77482057", "0.77462846", "0.7373935", "0.7373935", "0.71811527", "0.71302176", "0.71240145", "0.71027374", "0.7046371", "0.7046371", "0.7046371", "0.6972977", "0.6972977", "0.69592965", "0.6883599", "0.68524235", "0.6838921", "0.6777041", "0.6735...
0.8133371
2
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 format.html { render action: "new" } format.json { render json: @slideshow.errors, status: :unprocessable_entity } end end end
{ "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 action: "edit" } format.json { render json: @slideshow.errors, status: :unprocessable_entity } end end end
{ "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
Show Method Method used by API to return a teacher from database GET /api/v1/teachers/[id]
def show teacher = Teacher.find(params[:id]) render json: {status: 'SUCCESS', message: 'Loaded teacher', data: teacher}, include:'school', status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @teacher = Teacher.find(params[:id])\n \n end", "def show\n id = params[:id]\n\n raise \"must specify id parameter\" unless !id.nil?\n \n @teacher = Teacher.find(id)\n respond_with(@teacher)\n end", "def show\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\...
[ "0.821759", "0.81778306", "0.79979455", "0.79771054", "0.7966516", "0.7945637", "0.76841635", "0.76648563", "0.76648563", "0.76648563", "0.76648563", "0.76648563", "0.7475807", "0.7475807", "0.7475807", "0.73484814", "0.72715", "0.72134", "0.72031844", "0.718469", "0.718469",...
0.7349782
15
Create Method Method used by API to create new teacher into database POST /api/v1/teachers
def create teacher = Teacher.new(teacher_params) if teacher.save render json: {status: 'SUCCESS', message: 'Teacher has been saved.', data: teacher}, include:'school', status: :ok else render json: {status: 'ERROR', message: 'Teacher has not been saved.', data: teacher.errors}, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @teacher = Teacher.new(teacher_params)\n \n respond_to do |format|\n if @teacher.save\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.htm...
[ "0.80228996", "0.8002134", "0.8002134", "0.79118246", "0.79118246", "0.7903219", "0.7809076", "0.77314436", "0.76530373", "0.7637161", "0.758569", "0.753495", "0.74805236", "0.734051", "0.7319702", "0.72887254", "0.72540617", "0.72211564", "0.7204599", "0.7194", "0.7148154", ...
0.749344
12
Update Method Method used by API to update a teacher into database PUT /api/v1/teachers/[id]
def update teacher = Teacher.find(params[:id]) if teacher.update_attributes(teacher_params) render json: {status: 'SUCCESS', message: 'Teacher has been updated.', data: teacher}, include:'school', status: :ok else render json: {status: 'ERROR', message: 'Teacher has not been updated.', data: teacher.errors}, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n flash[:notice] = 'Teacher was successfully updated.'\n format.html { redirect_to(teachers_path) }\n format.xml { head :ok }\n else\n format.h...
[ "0.8052105", "0.79975593", "0.79975593", "0.7967521", "0.7896907", "0.7771634", "0.7763963", "0.7763963", "0.7763963", "0.7763963", "0.7753108", "0.768382", "0.76357996", "0.7602473", "0.75106627", "0.7416016", "0.7408979", "0.738581", "0.7376093", "0.73698795", "0.7350446", ...
0.7512325
14
Destroy Method Method used by API to delete a teacher from database DELETE /api/v1/teachers/[id]
def destroy teacher = Teacher.find(params[:id]) teacher.destroy render json: {status: 'SUCCESS', message: 'Teacher has been deleted.', data: teacher}, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_teachers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n teacher.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.8410002", "0.8358778", "0.83311886", "0.83311886", "0.82799214", "0.82793546", "0.82793546", "0.82793546", "0.82093024", "0.8155484", "0.81123024", "0.81035995", "0.81035995", "0.81035995", "0.81035995", "0.81035995", "0.80392414", "0.78662366", "0.782562", "0.7764053", "0...
0.8289337
4
Method teacher_params Private params for Teacher
def teacher_params params.permit(:name, :email, :phone, :subject, :school_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teacher_params\n # Steven Royster: Changed the teacher_params. Got rid of a lot of them in an attempt to fix login.\n params.require(:teacher).permit(:user_name, :teacher_password)\n end", "def teacher_params\n params.require( :teacher).permit( :user_name, :full_name, :email, :admin,\n ...
[ "0.81150186", "0.7974617", "0.794482", "0.79345787", "0.7888767", "0.788833", "0.7874398", "0.78552693", "0.78465366", "0.7768704", "0.7749777", "0.77125067", "0.7705771", "0.76323205", "0.7623158", "0.7614509", "0.7603085", "0.7501094", "0.7472192", "0.7470412", "0.7441826",...
0.74345434
21
Overridden method from OmniAuth::Strategy. This is the first step in the authentication process.
def request_phase redirect authorize_endpoint_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_once_state\n super\n end", "def authentication_method\n super\n end", "def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n #...
[ "0.6917292", "0.67753625", "0.6543912", "0.64825565", "0.64818954", "0.647117", "0.6447113", "0.63365775", "0.6275532", "0.6257608", "0.6257608", "0.6255135", "0.6234224", "0.6232851", "0.62021816", "0.6195844", "0.6194512", "0.61902326", "0.61775994", "0.6119965", "0.6112656...
0.0
-1
Overridden method from OmniAuth::Strategy. This is the second step in the authentication process. It is called after the user enters credentials at the authorization endpoint.
def callback_phase error = request.params['error_reason'] || request.params['error'] fail(OAuthError, error) if error @session_state = request.params['session_state'] @id_token = request.params['id_token'] @code = request.params['code'] @claims, @header = validate_and_parse_id_token(@id_token) # validate_chash(@code, @claims, @header) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_custom_authentication; end", "def after_custom_authentication\n\n end", "def after_token_authentication\n end", "def after_token_authentication\n end", "def after_hash_token_authentication\n end", "def after_crowd_authentication\n end", "def successful_authentication(us...
[ "0.7168384", "0.7061061", "0.673652", "0.673652", "0.66804063", "0.6413441", "0.6320074", "0.6299635", "0.6280201", "0.62683916", "0.6208505", "0.62056977", "0.61840904", "0.618167", "0.61622494", "0.6151446", "0.611958", "0.61117077", "0.61112285", "0.60952693", "0.605659", ...
0.55153674
74
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, response_type: response_type, nonce: new_nonce) uri.to_s end
{ "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_supported issuer claims_supported microsoft_multi_refresh_token check_session_iframe end_session_endpoint userinfo_endpoint
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
Generates a new nonce for one time use. Stores it in the session so multiple users don't share nonces. All nonces should be generated by this method.
def new_nonce session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n rand(1_500_000_000)\n end", "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def...
[ "0.7854984", "0.7854984", "0.7837371", "0.7607155", "0.7529376", "0.7508704", "0.75055224", "0.7451894", "0.7424053", "0.7258386", "0.7133276", "0.70351195", "0.70284104", "0.6833875", "0.66902983", "0.6578251", "0.6471142", "0.64180654", "0.64180654", "0.6402287", "0.6366716...
0.7126692
11
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
Returns the most recent nonce for the session and deletes it from the session.
def read_nonce session.delete('omniauth-azure-activedirectory.nonce') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def delete(nonce)\n _resetCount()\n runMbxTransa...
[ "0.6613439", "0.6550846", "0.6550846", "0.6425401", "0.62723625", "0.6130543", "0.61277896", "0.6019787", "0.59970516", "0.59182733", "0.59108347", "0.5898751", "0.58649296", "0.5835891", "0.57578737", "0.5681017", "0.5672286", "0.5630954", "0.5592462", "0.55843985", "0.55401...
0.60645604
7
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
Verifies the signature of the id token as well as the exp, nbf, iat, iss, and aud fields. See OpenId Connect Core 3.1.3.7 and 3.2.2.11.
def validate_and_parse_id_token(id_token) # The second parameter is the public key to verify the signature. # However, that key is overridden by the value of the executed block # if one is present. # # If you're thinking that this looks ugly with the raw nil and boolean, # see https://github.com/jwt/ruby-jwt/issues/59. jwt_claims, jwt_header = JWT.decode(id_token, nil, false, verify_options) do |header| # There should always be one key from the discovery endpoint that # matches the id in the JWT header. x5c = (signing_keys.find do |key| key['kid'] == header['kid'] end || {})['x5c'] if x5c.nil? || x5c.empty? fail JWT::VerificationError, 'No keys from key endpoint match the id token' end # The key also contains other fields, such as n and e, that are # redundant. x5c is sufficient to verify the id token. OpenSSL::X509::Certificate.new(JWT.base64url_decode(x5c.first)).public_key end return jwt_claims, jwt_header if jwt_claims['nonce'] == read_nonce fail JWT::DecodeError, 'Returned nonce did not match.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_iat; end", "def verify_iat; end", "def verify_signature\n @req.verify(public_key)\n end", "def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end", "def v...
[ "0.6876629", "0.6876629", "0.6694493", "0.6682686", "0.6584846", "0.6544076", "0.6523213", "0.64918154", "0.64861506", "0.6350312", "0.6340107", "0.6310668", "0.62649673", "0.6262085", "0.6227141", "0.62072355", "0.6177997", "0.6177997", "0.61510044", "0.6143952", "0.61392754...
0.6661562
4
GET /posts or /posts.json
def index @posts = Post.all.order("RANDOM()") @categories = Category.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_...
[ "0.6997458", "0.6996869", "0.6862507", "0.68329054", "0.68329054", "0.68329054", "0.6823404", "0.6819618", "0.6786192", "0.6767177", "0.66757053", "0.6654793", "0.6605684", "0.6579752", "0.6572869", "0.65616906", "0.65600824", "0.655784", "0.65495145", "0.65482247", "0.654278...
0.0
-1
GET /posts/1 or /posts/1.json
def show @categories = Category.all @users = User.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def get(options = {})\n response= handle...
[ "0.6976226", "0.6745518", "0.6723887", "0.6702761", "0.66672957", "0.66672957", "0.66672957", "0.66596746", "0.66551304", "0.66492945", "0.66199887", "0.6607758", "0.660037", "0.658429", "0.65815914", "0.6576847", "0.65718734", "0.65713036", "0.6565387", "0.65360427", "0.6533...
0.0
-1
POST /posts or /posts.json
def create @post = Post.new(post_params) respond_to do |format| if @post.save format.html { redirect_to @post, notice: "Post was successfully created." } format.json { render :show, status: :created, location: @post } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @post.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(*args)\n request :post, *args\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def post(*args)\n request(:post, *args)\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def post(path, **args); end", ...
[ "0.7122229", "0.70707834", "0.69825006", "0.6970939", "0.68835485", "0.68292725", "0.6817987", "0.68095577", "0.6733894", "0.6622669", "0.66085804", "0.659331", "0.658407", "0.65816855", "0.6573764", "0.6571573", "0.6557903", "0.6529084", "0.6528547", "0.65230095", "0.6500116...
0.0
-1
PATCH/PUT /posts/1 or /posts/1.json
def update respond_to do |format| if @post.update(post_params) format.html { redirect_to @post, notice: "Post was successfully updated." } format.json { render :show, status: :ok, location: @post } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @post.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n @post = Post.find(params[:id])\n ...
[ "0.7244233", "0.71808875", "0.692856", "0.6877579", "0.68152857", "0.67375803", "0.67343867", "0.6674573", "0.6666083", "0.6659683", "0.6607322", "0.65937084", "0.6586463", "0.65829575", "0.65725297", "0.65613693", "0.6560171", "0.6554742", "0.6554742", "0.6539801", "0.653380...
0.0
-1
DELETE /posts/1 or /posts/1.json
def destroy @post.destroy respond_to do |format| format.html { redirect_to dashboard_index_path, notice: "Post was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json {...
[ "0.77866316", "0.7472207", "0.73706627", "0.7365725", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364187", "0.7364081", "0.73526657", "0.7321882", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Only allow a list of trusted parameters through.
def post_params params.require(:post).permit(:title, :image, :description, :category, :ingredients, :method, :prep, :cook, :difficult) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69485277", "0.6813547", "0.6799911", "0.6796169", "0.6745757", "0.6741778", "0.6527065", "0.65204644", "0.64925444", "0.64314413", "0.64314413", "0.64314413", "0.6398711", "0.6355623", "0.6355327", "0.6345812", "0.6343951", "0.6338371", "0.6327366", "0.6327366", "0.6327366...
0.0
-1
Dump back string parseable form
def dump str = if @page "page=#{@page}" else s = "by=#{@by}" s += ",from=#{@from}" if @from s end str += ",items=#{items}" if @items str += ',total_count=true' if @total_count str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @parser ||= WikitextParser.new\n @parsed ||= @parser.parse(@string).to_s\n end", "def dumpAsString\n\t\tmarkup = \"\"\n\t\t@Value.each do |line|\n\t\t\tmarkup += \"#{line}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend", "def to_s\r\n dump\r\n end", "def prettify(str); end", ...
[ "0.6329071", "0.6087414", "0.6063648", "0.60239905", "0.5857265", "0.5807426", "0.5720491", "0.5706091", "0.5643747", "0.56033844", "0.56007695", "0.55980957", "0.55793864", "0.5559918", "0.5559918", "0.5559918", "0.5559918", "0.5559918", "0.55581546", "0.55429876", "0.554298...
0.0
-1
TODO: currently only works when firewall is enabled
def rule_exists? Chef::Log.info("#{new_resource.name} rule_exists?") # To Action From # -- ------ ---- # 22 ALLOW Anywhere # 192.168.0.1 25/tcp DENY 10.0.0.0/8 # 22 ALLOW Anywhere # 3309 on eth9 ALLOW Anywhere # Anywhere ALLOW Anywhere # 80 ALLOW Anywhere (log) # 8080 DENY 192.168.1.0/24 # 1.2.3.5 5469/udp ALLOW 1.2.3.4 5469/udp # 3308 ALLOW OUT Anywhere on eth8 to = rule_exists_to? # col 1 action = rule_exists_action? # col 2 from = rule_exists_from? # col 3 # full regex from columns regex = rule_exists_regex?(to, action, from) match = shell_out!('ufw', 'status').stdout.lines.find do |line| # TODO: support IPv6 return false if line =~ /\(v6\)$/ line =~ regex end match end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_firewall\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 389 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 389 -j ACCEPT`\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 636 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m ud...
[ "0.6778904", "0.6127051", "0.59988374", "0.5844392", "0.583598", "0.57881355", "0.5787114", "0.577674", "0.577674", "0.5773263", "0.5759785", "0.57573324", "0.57412744", "0.5726957", "0.57204473", "0.571064", "0.56808496", "0.56776303", "0.56776303", "0.56745845", "0.56556255...
0.0
-1
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
pass a commaseparated list of groups in a single string for execution
def initialize(target_groups, target_priority, options = {}) init_start_time = Time.now # this is the directory we'll recursively index for candidate tests @dir_to_index = File.expand_path(File.dirname(__FILE__) + '/../../tests/' + $test_module_path) @groups_not_to_run = ["deprecated"] @framework_utils = FrameworkUtils.new # check markers. @groups = target_groups.split(/[,\+]/).collect { |group| group.downcase.strip } # and initialize some other containers we'll be using to store various values during indexing init_containers(target_priority) # now find all of the test files in specified directory test_file_map = create_test_file_map() # build a hash of test files => groups (don't include the tests which are restricted from the current environment) test_file_to_group(test_file_map, false) # display associated tcid at the end of each test script file display_test_ids() # get expected test count @expected_test_count = @framework_utils.get_test_count(@files_to_run) init_end_time = Time.now puts "Time taken for analysis by test runner: #{(init_end_time - init_start_time)*1000}" if ! @duplicate_class_files.empty? and $find_duplicate_classes == "true" puts "These files has the duplicate class in the repository", @duplicate_class_files @duplicate_class_files.each do |f| if @files_to_run.include? f raise " ******** Terminating the execution since file: #{f} has the duplicate class ***************" end end end unless options[:dry_run] == 'true' MultiThreadedTestRunner.new($max_concurrent_tests, @files_to_run, $results_dir, :xml) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group _args\n \"group _args;\" \n end", "def discover_groups_string\n discover_groups.join(', ')\n end", "def groups(*groups); end", "def groups(*groups); end", "def groupID _args\n \"groupID _args;\" \n end", "def discover_groups_string=(groups)\n self.discover_gro...
[ "0.71024776", "0.69310397", "0.67895716", "0.67895716", "0.6497885", "0.64975536", "0.6366717", "0.6274625", "0.62680227", "0.62539524", "0.622766", "0.61533713", "0.61265945", "0.6117943", "0.60436445", "0.60068107", "0.59884447", "0.5883977", "0.58780754", "0.5871837", "0.5...
0.0
-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 array is a string. # Note: The check is there to work around cases like below. # @properties[:grouping] = [CAD, CONNECT_AWLI, CONNECT], JOBS, JOBS_GRP5 test_class.properties[:grouping].map!{|g| g.downcase if g.kind_of?(String)} ## Check if the test has any group that we need not run. @skip = false test_class.properties[:grouping].each do |g| if @groups_not_to_run.include?(g) @skip = true end end ## check if tcid is present in the file. if not then skip the file next if (test_class.properties[:tcid].nil? || test_class.properties[:tcid].length < 1) # If tcid is present, then ensure that they are numbers only! @skip_tcid = false test_class.properties[:tcid].each do |tc| @skip_tcid = true if !is_a_number?(tc) end # Check for priority if test_class.properties[:priority].nil? # If not defined or if not as per argument 'priority' then skip this test class puts "PRIORITY property not defined. Skipping file: #{tf}" if $debug_mode == "true" next end # If @priority_to_run is equal to MASTER PRIORITY then do not check if priority to run exists in the test class. # If @priority_to_run is not equal to MASTER PRIORITY then check if priority to run matches @priority_to_run in # the test class; skip test if it does not match. # puts "@priority_to_run = #{@priority_to_run}" @check_priority = (@priority_to_run.eql?("") or @priority_to_run.eql?(MASTER_PRIORITY.downcase)) if @check_priority == false @target_priority_present = test_class.properties[:priority].include?(@priority_to_run) if @target_priority_present == false next end end ########################## # Get the grouping and service property from the file and add it to the @file_group hash # Basically file_groups is a hash with file name as key and an array of all groups # present in the file as the value @file_groups[tf] = [] if test_class.properties[:grouping].length > 0 test_class.properties[:grouping].each { |group| @file_groups[tf] << group } ########################## # Get the tcid property from the file and add it to the @file_tcids hash # Basically @file_tcids is a hash with file name as key and an array of all tcid # present in the file as the value tcids = test_class.properties[:tcid] @file_tcids[tf] = tcids unless tcids.empty? end # "and" operator is default # for each file, compare the intersection of groups vs groups to run. # if the intersection exactly matches groups to run, lets see about running it. @file_groups.each_pair { |f, g| @files_to_run << f if (@groups_to_run & g) == @groups_to_run and !(@groups_not_to_run & g).any? } if @priority_to_run.eql?("") puts "\nFound #{@files_to_run.length} tests grouped for execution. Priority was not defined, so taking as ALL." else puts "\nFound #{@files_to_run.length} tests grouped for execution which have the desired priority = #{@priority_to_run} to run:" end end
{ "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
This method finds all the files with the mentioned groups and services
def grep_files_by_properties # I - filter on @properties[:grouping] keywords. property_filter = "@properties[:grouping]" # @services_to_run ||= [] @groups_to_run ||= [] # groups to run may contain something like ["g1,g2,g3","g4,g5,g6"] groups_to_run_filter = @groups_to_run.map {|g| g.split(',')}.flatten.uniq # adding services and groups to filter group_filter = groups_to_run_filter.join('|') # grep -rw '@properties[:grouping]|@properties[:services] ../tests' grep_cmd1 = "grep -rw '#{property_filter.shellescape}' #{@dir_to_index} " # grep -rw 'service1|service2|group1|group2' grep_cmd2 = "grep -iw \"#{group_filter.shellescape}\"" # Command to apply both the grep filters # = grep_cmd1 | grep_cmd2 grep_cmd = "#{grep_cmd1}|#{grep_cmd2}" cmd_result = %x[ #{grep_cmd} ] grep_result_list = cmd_result.nil? ? [] : cmd_result.split("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_services(params, serviceDir)\n service_files = []\n if ((services = params[:services]) != nil)\n services.each do |name|\n s = {}\n s[:name] = name\n s[:require] = \"omf-aggmgr/ogs_#{name}/#{name}\"\n s[:config] = \"#{name}.yaml\"\n service_files << s\n end\n else\n MO...
[ "0.6939348", "0.6546415", "0.630141", "0.62237555", "0.61721474", "0.6061502", "0.6047479", "0.6020904", "0.5992923", "0.59679884", "0.59679884", "0.59627223", "0.5959475", "0.5917015", "0.5891461", "0.58693886", "0.58693886", "0.5856694", "0.58457494", "0.58281225", "0.58099...
0.6285783
3
Method to test if a given string is a number
def is_a_number?(s) s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number? string\n true if Float(string) rescue false\n end", "def is_number?(string)\n true if Integer(string) && Integer(string) >= 0 rescue false\n end", "def number?(string)\n string.to_i.to_s == string\n end", "def is_number? string\n true if Float(string) rescue false\n ...
[ "0.86003387", "0.8599222", "0.8599198", "0.85716003", "0.8518382", "0.8518382", "0.84963095", "0.8489259", "0.84880173", "0.84496814", "0.84259415", "0.83837295", "0.8361107", "0.8277064", "0.8276294", "0.8238891", "0.8238891", "0.82079613", "0.8188625", "0.8137609", "0.81222...
0.8405007
12
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 => (render_to_string partial: 'list.html.haml') } } end end
{ "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
GET /lead_entries/1 GET /lead_entries/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lead_entries = LeadEntry.where(:lead_id => params[:lead_id]).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json {\n render :json => {\n :amount => @lead_entries.length,\n :success => true,\n ...
[ "0.6975558", "0.6437789", "0.628868", "0.6252577", "0.6233732", "0.61927164", "0.61784846", "0.6030111", "0.60056496", "0.59966236", "0.5975805", "0.5946085", "0.5945465", "0.5922962", "0.5909163", "0.58990026", "0.5894583", "0.5894583", "0.58519703", "0.5847465", "0.5846977"...
0.0
-1
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 partial: 'list_item.html.haml', :lead_entry => @lead_entry) } } else format.html { render action: 'new' } format.json { render json: @lead_entry.errors, status: :unprocessable_entity } end end end
{ "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_entry.errors, status: :unprocessable_entity } end end end
{ "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
Use callbacks to share common setup or constraints between actions.
def set_lead_entry @lead_entry = LeadEntry.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def lead_entry_params params.require(:lead_entry).permit(:text, :date, :relation, :lead_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1