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
this works up to here, I have all the abundant numbers in the range of 1 to 28123, but not sure how to efficiently test whether or not a number can be written as the sum of two abundant numbers
def is_sum_of_abundants?(n) @sums.include?(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abundant_number?(num)\n num < (1...num).select{|n| num % n == 0}.reduce(:+)\nend", "def isSumOfTwoAbundantNumbers n\n\n # we'll cycle over all abundant numbers less than n / 2\n if n / 2 < @@listOfAbundants.first\n return false\n end\n\n if @@listOfAbundants.last < n / 2\n for i in ((@@listOfAbund...
[ "0.80316055", "0.7990266", "0.7920785", "0.7843548", "0.7801461", "0.7795489", "0.7739949", "0.76290464", "0.7471545", "0.7471545", "0.74108773", "0.74044967", "0.7341604", "0.732063", "0.7242888", "0.7231845", "0.7185026", "0.7136327", "0.70275944", "0.69505507", "0.6944308"...
0.6979998
19
Changes the currently selected campus
def toggle_campus if (params[:campus] == 'tagus') session[:campus] = :tagus session[:center] = APP_CONFIG[:tagus_center] session[:zoom] = APP_CONFIG[:tagus_zoom] else session[:campus] = :alameda session[:center] = APP_CONFIG[:alameda_center] session[:zoom] = APP_CONFIG[:alameda_zoom] end render(:update) do |page| page.replace_html 'campus_placeholder', :partial => '/sounds/campus' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_campus\n @campus = Campus.find(params[:id])\n end", "def set_campus\n @campus = Campus.find(params[:id])\n end", "def set_campus\n @campus = FortyTwo::Campus.find(params[:id])\n end", "def set_camp\n @camp = Camp.find(params[:campid])\n end", "def set_camp\n @camp =...
[ "0.7276875", "0.7276875", "0.7161035", "0.6756827", "0.66113436", "0.66113436", "0.6576283", "0.63581693", "0.6319095", "0.6306829", "0.6298922", "0.6291316", "0.62602043", "0.616409", "0.6157388", "0.61175483", "0.5988594", "0.594539", "0.59240127", "0.5799974", "0.5795036",...
0.6233788
13
% x: String > String % x: (Class,?String) > Class
def x(y) raise "Nope" unless y.kind_of?(Class) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BaseClass(name)\n name == \"string\" ? String : Object\nend", "def BaseClass(name)\n name == \"string\" ? String : Object\nend", "def string_class_name?(class_pair)\n class_pair.children[1].str_type?\n end", "def BaseClass name\n name == \"string\" ? String : Object\nend", "def class...
[ "0.5744788", "0.5744788", "0.5720834", "0.5656511", "0.5408179", "0.5390192", "0.5355971", "0.5286536", "0.509642", "0.5094011", "0.5072209", "0.5069284", "0.50519705", "0.5000633", "0.4993851", "0.49715284", "0.49595487", "0.4958168", "0.4936281", "0.49277273", "0.49085698",...
0.5230175
8
DELETE /product_images/1 DELETE /product_images/1.json
def destroy @workshop_images = WorkshopImage.find(params[:id]) @workshop_images.destroy #back to previouse page with the same parameter redirect_to :back end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n ...
[ "0.75422037", "0.75253284", "0.7512888", "0.74552846", "0.7440323", "0.7438339", "0.7429205", "0.74037325", "0.7365591", "0.7361594", "0.73432827", "0.7330427", "0.7330427", "0.7330427", "0.7330427", "0.7330427", "0.7330427", "0.729567", "0.729567", "0.729567", "0.729567", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def workshop_image_params params.require(:workshop_image).permit(:craft_image, :connector, :display_pic, :workshop_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
e.g. lets us use strip_ads( ht ) attribute reader aliases
def name() title; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_autolink; end", "def strip_attributes(doc)\n attrs = %w[data-tralics-id data-label data-number data-chapter\n role aria-readonly target]\n doc.tap do\n attrs.each do |attr|\n doc.xpath(\"//@#{attr}\").remove\n end\n end\n end", ...
[ "0.57689977", "0.5578861", "0.54974926", "0.54884523", "0.54483515", "0.5414357", "0.5382716", "0.5313235", "0.5313235", "0.5313235", "0.52864313", "0.5271466", "0.5271466", "0.52709186", "0.525366", "0.5242295", "0.5237195", "0.52173865", "0.5215957", "0.5215914", "0.5202449...
0.0
-1
alias for summary also add descr shortcut??
def desc() summary; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary\n # TODO\n end", "def description\n return summary\n end", "def summary\n end", "def summary\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def summary *args\n @summary = args.first if args.size > 0\n end", "def summary\n ...
[ "0.7998052", "0.7950138", "0.7838732", "0.7838732", "0.77272326", "0.77272326", "0.77272326", "0.77272326", "0.7421978", "0.7414017", "0.74064475", "0.73783284", "0.7327787", "0.7302037", "0.7216659", "0.7126676", "0.7118923", "0.7118923", "0.7118923", "0.7118923", "0.7118923...
0.80219734
0
alias (2) for summary also add descr shortcut??
def link() url; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desc() summary; end", "def description\n return summary\n end", "def summary\n # TODO\n end", "def summary\n end", "def summary\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def describe(desc, *additional_desc, &block); end", "def...
[ "0.783032", "0.76221365", "0.75370675", "0.7412426", "0.7412426", "0.7348318", "0.7348318", "0.7348318", "0.7348318", "0.73286444", "0.71845746", "0.69830287", "0.6978565", "0.6978565", "0.6978565", "0.6977788", "0.69525003", "0.69525003", "0.69525003", "0.69525003", "0.69525...
0.0
-1
note: published is basically an alias for created
def updated ## todo/fix: use a new name - do NOT squeeze convenience lookup into existing # db backed attribute read_attribute_w_fallbacks( :updated, :published ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def published?; end", "def published?; end", "def publish\n self.published = true\n end", "def publish\n end", "def publish\n end", "def publish\n end", "def publish!\n self.update_attribute(:published, true)\n end", "def publish!\n self.published = true\n save\n end", "def ...
[ "0.82585144", "0.82585144", "0.791422", "0.749175", "0.749175", "0.749175", "0.7422619", "0.74172765", "0.73913914", "0.73694944", "0.7273529", "0.7256452", "0.7248288", "0.71860087", "0.715729", "0.7140328", "0.71381885", "0.7054662", "0.7054168", "0.7049084", "0.70412326", ...
0.0
-1
flip the booleans in an array according to according
def flip_switches(num) i = num until i >= $switches.length $switches[i] = !$switches[i] i += num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_flop(trueValue, falseValue)\n map! do |truth|\n truth ? trueValue : falseValue\n end\n end", "def bit_flip(arr, n)\n #YOUR WORK HERE\nend", "def boolean_to_binary(array)\nend", "def flip_tile(ind, bool)\n\t\t@tile_Array[ind].flip(bool)\n\tend", "def light_switcher(array, inc)\n count...
[ "0.677943", "0.6636109", "0.66332895", "0.6566851", "0.65651184", "0.6488837", "0.63748276", "0.6365348", "0.6363186", "0.6250546", "0.62411255", "0.62399435", "0.6238359", "0.62007093", "0.6168811", "0.6166687", "0.613707", "0.61345774", "0.6089579", "0.6077613", "0.5985493"...
0.5714899
34
We allow document series to be assigned directly on an edition for speed tagging
def document_series_ids=(ids) raise(StandardError, 'cannot assign document series to an unsaved edition') unless persisted? document.document_series_ids = ids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_series\n @series = Series.find(params[:id])\n @cv = ControlledVocabulary.physical_object_cv('Film')\n @l_cv = ControlledVocabulary.language_cv\n end", "def doc_series=(doc_series)\n if !doc_series.nil? && doc_series.to_s.length > 64\n fail ArgumentError, 'invalid value for \...
[ "0.6066456", "0.59444135", "0.586813", "0.5756031", "0.5699041", "0.56461513", "0.5550231", "0.5543285", "0.55068195", "0.549942", "0.5484264", "0.5462294", "0.5453271", "0.53783274", "0.5371826", "0.5329701", "0.5264035", "0.5261391", "0.52533966", "0.5242429", "0.52258044",...
0.6322694
0
public method for updating twitter status
def update_status( status ) # status = { :message => 'new post on ruby', :url => 'http://www.ruby-lang.com' } message = status[:message] short_url = ::ShortUrl::Client.new.short_url( status[:url] ) if message.nil? or message.empty? posted = shorted unless ( short_url.nil? or short_url.empty? ) else posted = message posted = posted + ': ' + short_url unless ( short_url.nil? or short_url.empty? ) end if posted.nil? { :error => 'Invalid status.'} else call( 'statuses/update', { :status => posted } , :post ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_status\n if current_user.has_twitter_oauth?\n @T_OAUTH = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_KEY,\n :consumer_secret => TWIITER_SECRET,\n :token => current_user.twitter_account.token,\n ...
[ "0.8182144", "0.79290605", "0.7768913", "0.7703261", "0.76670605", "0.76600397", "0.75707644", "0.7537046", "0.73447394", "0.7336132", "0.72876847", "0.72091043", "0.7194297", "0.7086906", "0.7078697", "0.69665325", "0.6768695", "0.6758955", "0.6758955", "0.6758955", "0.67589...
0.72760075
11
public method for getting public timelines
def public_timeline call( 'statuses/public_timeline.json' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_timeline\n Chirpy.public_timeline\n end", "def index\n @time_lines = TimeLine.all\n end", "def timeline\n []\n end", "def parse_timeline\n\nend", "def timeline(action=nil)\n timelines.mine.all(action)\n end", "def list_lines\n RailLine.list_lines\n end", "def inde...
[ "0.7140679", "0.6730209", "0.6504515", "0.6331892", "0.61975807", "0.617406", "0.5916394", "0.58452445", "0.578041", "0.57137537", "0.56786424", "0.5615014", "0.5595368", "0.5590223", "0.5578347", "0.5524757", "0.55179787", "0.55016285", "0.55016285", "0.548186", "0.54776436"...
0.57934517
8
ensure that there are no line items referencing this product
def ensure_not_referenced_by_any_line_item if line_items.empty? return true else errors.add(:base, 'Existe linha de item') return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this product')\n\t\t\t\tthrow :abort\n\t\t\tend\n\t\tend", "def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Pro...
[ "0.87354815", "0.85389805", "0.828825", "0.82455605", "0.82218575", "0.82053775", "0.8205119", "0.8158083", "0.81312025", "0.8103242", "0.81006294", "0.8083884", "0.8075141", "0.8075141", "0.80551374", "0.80364364", "0.80186886", "0.80186886", "0.80186886", "0.80156267", "0.8...
0.0
-1
Return the width of the named style. +style_name+ defaults to the attribute's default_style.
def width(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) from_examination :@original_width else dimensions(style_name).at(0) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(style_name='original')\n geometry(style_name).width.to_i\n end", "def width=(value)\n @style.width = value\n end", "def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n...
[ "0.81040615", "0.6777788", "0.6354896", "0.63064265", "0.6129217", "0.60608274", "0.6014019", "0.5883229", "0.5732189", "0.57186073", "0.56601983", "0.5639279", "0.5637219", "0.56321603", "0.55771065", "0.55676115", "0.5557213", "0.5552883", "0.5549331", "0.55278665", "0.5527...
0.8343923
0
Return the height of the named style. +style_name+ defaults to the attribute's default_style.
def height(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) from_examination :@original_height else dimensions(style_name).at(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(style_name='original')\n geometry(style_name).height.to_i\n end", "def height=(value)\n @style.height = value\n end", "def css_style_height(height = '')\n height = height.to_s.as_css_size\n height.blank? ? '' : \"height:#{height};\"\n end", "def height(name)\n Tk....
[ "0.8258957", "0.6859417", "0.6647148", "0.6227877", "0.5940879", "0.57866794", "0.5767589", "0.5680373", "0.5674596", "0.5670273", "0.5635982", "0.5614297", "0.5612909", "0.55806106", "0.5521675", "0.5512786", "0.5479372", "0.5478817", "0.5478198", "0.5468598", "0.54672617", ...
0.84590805
0
Return the aspect ratio of the named style. +style_name+ defaults to the attribute's default_style.
def aspect_ratio(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) original_width = from_examination(:@original_width) original_height = from_examination(:@original_height) original_width.to_f / original_height else w, h = *dimensions(style_name) w.to_f / h end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end", "def height(style_name=nil)\n style_name ||= reflection.default_s...
[ "0.66587573", "0.6197773", "0.61951274", "0.6068867", "0.60096115", "0.5917236", "0.58478194", "0.5703756", "0.56912726", "0.5612362", "0.5597567", "0.559034", "0.5562877", "0.55475664", "0.5538559", "0.5532147", "0.5456631", "0.5376528", "0.5312218", "0.52979004", "0.5293787...
0.85200244
0
Return the width and height of the named style, as a 2element array.
def dimensions(style_name=nil) style_name ||= reflection.default_style if style_name.equal?(:original) original_width = from_examination(:@original_width) original_height = from_examination(:@original_height) [original_width, original_height] else resize_dimensions(dimensions(:original), reflection.styles[style_name]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dimensions\n case @options[:style]\n when 'horizontal'\n [@colors.size, 1]\n when 'vertical'\n [1, @colors.size]\n end\n end", "def styles\n return @metadata[:styles]\n end", "def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bit...
[ "0.6866974", "0.67288405", "0.6516567", "0.65090215", "0.64856255", "0.6415302", "0.634943", "0.6193142", "0.6119825", "0.6119825", "0.603385", "0.58650863", "0.5858989", "0.58505297", "0.58187747", "0.5804687", "0.57633615", "0.5755147", "0.56933", "0.5682097", "0.56781006",...
0.7086445
0
Return the dimensions, as an array [width, height], that result from resizing +original_dimensions+ for the given +style+.
def resize_dimensions(original_dimensions, style) if style.filled? style.dimensions else original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1] target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1] if original_aspect_ratio > target_aspect_ratio width = style.dimensions[0] height = (width / original_aspect_ratio).round else height = style.dimensions[1] width = (height * original_aspect_ratio).round end [width, height] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n ...
[ "0.82603425", "0.72764045", "0.7099696", "0.6898156", "0.64568", "0.63955665", "0.63532746", "0.63532746", "0.63038194", "0.5962581", "0.5961278", "0.59209335", "0.57798636", "0.57654184", "0.57485104", "0.5705169", "0.57042444", "0.57042444", "0.5652785", "0.56102395", "0.55...
0.82804507
0
ES: Enrichment score for the gene set; that is, the degree to which this gene set is overrepresented at the top or bottom of the ranked list of genes in the expression dataset.
def es @es ||= @fields[3].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness(geneID)\n geneScore = 0\n @genePool[geneID].each_index do |i|\n geneScore += @genePool.get(geneID, i) \n end\n geneScore\n end", "def assign_score; end", "def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(se...
[ "0.58575535", "0.5848474", "0.58468103", "0.57758695", "0.57609564", "0.57583904", "0.57557034", "0.5709519", "0.5691272", "0.5689009", "0.5682961", "0.5674911", "0.56633204", "0.564422", "0.55995435", "0.55988497", "0.55988497", "0.5592646", "0.5588586", "0.5583634", "0.5561...
0.0
-1
NES: Normalized enrichment score; that is, the enrichment score for the gene set after it has been normalized across analyzed gene sets.
def nes @nes ||= @fields[4].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize\n unless @hits.empty? then \n max = highest_score\n min = lowest_score\n all.each do |hit| \n if (max == min) then\n hit.score = 1\n else\n hit.score = (hit.score - min)/(max - min)\n end \n end\n sort\n end\n end", "def sc...
[ "0.6417184", "0.6146193", "0.6104649", "0.6069792", "0.60307115", "0.6013973", "0.6013973", "0.5964663", "0.59250635", "0.5898413", "0.58573526", "0.5797411", "0.578813", "0.5780196", "0.57764196", "0.57284796", "0.5715652", "0.5708575", "0.56797695", "0.5671094", "0.566478",...
0.0
-1
NOM pvalue: Nominal p value; that is, the statistical significance of the enrichment score. The nominal p value is not adjusted for gene set size or multiple hypothesis testing; therefore, it is of limited use in comparing gene sets.
def nominal_p_value @nominal_p_value ||= @fields[5].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend...
[ "0.56107986", "0.55354834", "0.5495203", "0.53964394", "0.53731257", "0.5365285", "0.51771814", "0.50220495", "0.5021046", "0.48743036", "0.48438528", "0.48422042", "0.48233116", "0.48105547", "0.4800551", "0.4794564", "0.47921255", "0.4788358", "0.4784487", "0.47657344", "0....
0.62969375
0
FDR qvalue: False discovery rate; that is, the estimated probability that the normalized enrichment score (NES) represents a false positive finding. For example, an FDR of 25% indicates that the result is likely to be valid 3 out of 4 times.
def fdr_q_value @fdr_q_value ||= @fields[6].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fdr(error_rate = 0.0001)\n sequences = self.dna_hash.values\n if sequences.size == 0\n return {}\n else\n seq_count = self.size\n observed_hash = variant_for_poisson(sequences)\n p_unadjusted = []\n observed_hash.each do |k, v|\n p_value = 1 - `Rscript...
[ "0.6152747", "0.57610196", "0.57374275", "0.5729737", "0.5564448", "0.54393005", "0.54335916", "0.5427187", "0.5425854", "0.5371067", "0.5337704", "0.5335693", "0.5324293", "0.531646", "0.5305478", "0.5281855", "0.52783436", "0.5275544", "0.5264172", "0.5223553", "0.5222835",...
0.6098612
1
FWER pvalue: Familywiseerror rate; that is, a more conservatively estimated probability that the normalized enrichment score represents a false positive finding. Because the goal of GSEA is to generate hypotheses, the GSEA team recommends focusing on the FDR statistic.
def fwer_p_value @fwer_p_value ||= @fields[7].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fare\n return PENALTY_FARE if penalty?\n return MINIMUM_FARE\n end", "def do_rff(fv, sv)\n hf = get_marginal_entropy(fv)\n hs = get_marginal_entropy(sv)\n hfs = get_conditional_entropy(fv, sv)\n \n # symmetrical uncertainty\n 2*(hf-hfs)/(hf+hs)\n end", "def efg\n ...
[ "0.6240372", "0.6228662", "0.6042909", "0.59502393", "0.59360594", "0.5899151", "0.58332646", "0.58183885", "0.580707", "0.56314766", "0.55448127", "0.5517625", "0.5503823", "0.5485083", "0.54778224", "0.54732966", "0.5448831", "0.54374516", "0.54349446", "0.54298985", "0.540...
0.68583584
0
GET /practitioner_roles/1 GET /practitioner_roles/1.json
def show fhir_client = SessionHandler.fhir_client(session.id) fhir_practitionerRole = fhir_client.read(FHIR::PractitionerRole, params[:id]).resource @practitioner_role = PractitionerRole.new(fhir_practitionerRole) unless fhir_practitionerRole.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end", "def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end", "def list_review_roles\n\n @review_roles = Role.get_review_roles\n\n end", "def index\n ...
[ "0.7148923", "0.69656235", "0.69045115", "0.6896062", "0.6893342", "0.68868226", "0.68265414", "0.68049127", "0.67952406", "0.67867637", "0.6741731", "0.66810405", "0.66810405", "0.66810405", "0.66810405", "0.66810405", "0.66810405", "0.66556484", "0.6647469", "0.66472316", "...
0.68669116
6
POST /practitioner_roles POST /practitioner_roles.json
def create @practitioner_role = PractitionerRole.new(practitioner_role_params) respond_to do |format| if @practitioner_role.save format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' } format.json { render :show, status: :created, location: @practitioner_role } else format.html { render :new } format.json { render json: @practitioner_role.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end", "def CreateRole params = {}\n ...
[ "0.70966846", "0.68966454", "0.67919576", "0.66241574", "0.66051143", "0.65650886", "0.653956", "0.64436543", "0.6442777", "0.6413613", "0.63957596", "0.635207", "0.63496995", "0.6345488", "0.63403267", "0.6282266", "0.6282266", "0.6282266", "0.62611324", "0.62566733", "0.625...
0.7032563
1
PATCH/PUT /practitioner_roles/1 PATCH/PUT /practitioner_roles/1.json
def update respond_to do |format| if @practitioner_role.update(practitioner_role_params) format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' } format.json { render :show, status: :ok, location: @practitioner_role } else format.html { render :edit } format.json { render json: @practitioner_role.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @team_role.update(team_role_params)\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was ...
[ "0.7071717", "0.686072", "0.68333566", "0.6822314", "0.68108964", "0.677246", "0.6718536", "0.6697436", "0.66946715", "0.6692879", "0.66622573", "0.666203", "0.66609925", "0.6653987", "0.6629426", "0.6610442", "0.6591068", "0.6565691", "0.654898", "0.6538467", "0.65236104", ...
0.7223109
0
DELETE /practitioner_roles/1 DELETE /practitioner_roles/1.json
def destroy @practitioner_role.destroy respond_to do |format| format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format...
[ "0.7363247", "0.7234942", "0.72219765", "0.71962875", "0.7191758", "0.7175023", "0.7149711", "0.71210355", "0.71153915", "0.71071374", "0.7080056", "0.70769376", "0.7055473", "0.7050793", "0.70415354", "0.7039209", "0.7012131", "0.70101774", "0.7009771", "0.69979894", "0.6991...
0.7533551
0
Use callbacks to share common setup or constraints between actions.
def set_practitioner_role @practitioner_role = PractitionerRole.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 practitioner_role_params params.fetch(:practitioner_role, {}) 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.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
Check to see if we have an HTTP/S Connection
def connected? return false unless @connection return false unless @connection.started? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection?\n begin\n TCPSocket.new 'google.com', 80\n return true\n rescue SocketError\n return false\n end\n end", "def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO...
[ "0.76714796", "0.74807435", "0.7475508", "0.73533094", "0.7268616", "0.72663385", "0.7045703", "0.6984151", "0.6979347", "0.6979347", "0.6940969", "0.68846214", "0.6839425", "0.66899", "0.6687215", "0.664199", "0.66356665", "0.6589685", "0.65874153", "0.65717095", "0.6561397"...
0.0
-1
Connect to the remote system.
def connect! @connection = Net::HTTP.new(@server, 80) if @ssl @connection.use_ssl = true @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE end @connection.start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n...
[ "0.79121536", "0.7757874", "0.7296945", "0.7216767", "0.7166304", "0.70389915", "0.7027099", "0.69598377", "0.6909852", "0.68915206", "0.688377", "0.68424106", "0.6835292", "0.6822853", "0.6748713", "0.6740808", "0.6724437", "0.667054", "0.6647476", "0.66416705", "0.6623895",...
0.0
-1
attr_accessor :pos, :position_in_word store :settings, accessors: [:token, :pos, :position_in_word], coder: JSON
def init (options={}) @position_in_word = options[:position_in_word] @pos = options[:pos] @lemma = options[:lemma] @token = options[:token] @word_id = options[:word_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json(options={})\n\n\t\t\t{\n\t\t\t name: self.class.name,\n\t\t\t data: {\n\t\t\t pos: pos,\n\t\t\t }\n\t\t\t}\n\tend", "def save\n\t\tNg2::HashDb.add(@word, serialize)\n\tend", "def save_pos; end", "def build_pos_hash\n indexer = NokogiriDictionaryIndexer.new @dictionary_path\n ...
[ "0.5702315", "0.55509466", "0.5542875", "0.549929", "0.53328246", "0.52627033", "0.5259892", "0.52473605", "0.5225298", "0.5154828", "0.5153554", "0.5153554", "0.51246536", "0.50434613", "0.4986877", "0.49554968", "0.49519998", "0.49385494", "0.49385494", "0.4929306", "0.4929...
0.55290663
3
TODO open for chrome or machine
def open_url(code) url = URL+code puts url open(url).read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_in_browser\n link = \"http://www.bandsintown.com/cities/pittsburgh-pa\"\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n system \"start #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n system \"open #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n ...
[ "0.63988405", "0.6352659", "0.6340371", "0.62825996", "0.61843264", "0.60961145", "0.5971223", "0.5952971", "0.5949108", "0.5893418", "0.5816647", "0.5808507", "0.5774094", "0.57724684", "0.57445914", "0.5727485", "0.5716825", "0.56944555", "0.56944555", "0.5693313", "0.56534...
0.0
-1
Following method will run the download script, which we have written inside download_ci_data file
def download_actual_signing_credentials() sh($path_to_shell_script_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download\n if File.exist?\"#{Rails.root}/public/MEAN_Angular_#{current_user.email}.sh\"\n @mean_angular_script = \"MEAN_Angular_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/MEAN_AngularJS_#{current_user.email}.sh\"\n @mean_angularjs_script = \"MEAN_AngularJS_#{cu...
[ "0.65607077", "0.64517885", "0.6346552", "0.6110787", "0.60918015", "0.6060614", "0.60550433", "0.60392934", "0.591502", "0.59040844", "0.590213", "0.58433014", "0.5838508", "0.5826378", "0.5802019", "0.5790264", "0.57849675", "0.5777948", "0.5758222", "0.57332295", "0.572497...
0.0
-1
Following method will delete actual credentials and update default signing credentials in signing.properties file (inside SigningConfigs folder)
def restore_default_signing_credentials() system($cmd_to_remove_signing_directory) system($cmd_to_create_new_signing_file) IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset()\n Dir[File.join(@keystore, \"*\")].each { |f| FileUtils.remove_entry_secure f }\n end", "def rotate_credentials!\n clear_all_reviewer_sessions!\n generate_credentials\n save!\n end", "def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end", "def sign_out\n Rai...
[ "0.6000053", "0.57287073", "0.5718047", "0.5712944", "0.5558645", "0.55017227", "0.54360753", "0.5368876", "0.5344141", "0.5324556", "0.5323831", "0.53217494", "0.5254176", "0.5242718", "0.5236519", "0.52344626", "0.52273536", "0.5218138", "0.52134675", "0.51720977", "0.51638...
0.7454791
0
GET /fake_answers GET /fake_answers.json
def index @fake_answers = FakeAnswer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answers\n request('answers')\n end", "def show\n render json: @answer\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def show\n @quiz = params[:quiz_id]\n @fake_answers = Fak...
[ "0.72328824", "0.6914773", "0.6857219", "0.6836569", "0.6794836", "0.6794836", "0.6794836", "0.6794836", "0.6748096", "0.6711686", "0.67115384", "0.6679088", "0.6662031", "0.6576235", "0.6550996", "0.6509215", "0.6509215", "0.6509215", "0.65022916", "0.6499834", "0.6479792", ...
0.76433223
0
GET /fake_answers/1 GET /fake_answers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def index\n @fake_answers = FakeAnswer.all\n end", "def show\n render json: @answer\n end", "def index\n\n @answers = Answer.current\n\n respond_to ...
[ "0.7414684", "0.73231447", "0.6977481", "0.6915329", "0.686733", "0.686733", "0.686733", "0.686733", "0.68053627", "0.68053627", "0.68053627", "0.6765608", "0.6754531", "0.66661406", "0.66281915", "0.6600402", "0.65538317", "0.6550331", "0.6546079", "0.6528259", "0.6525468", ...
0.0
-1
POST /fake_answers POST /fake_answers.json
def create @fake_answer = FakeAnswer.new(fake_answer_params) @fake_answer.question_id = params[:question_id] respond_to do |format| if @fake_answer.save format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' } format.json { render :show, status: :created, location: @fake_answer } else format.html { render :new } format.json { render json: @fake_answer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end", "def index\n @fake_answers = FakeAnswer.all\n end", "def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer...
[ "0.70002824", "0.6714093", "0.66228753", "0.66215265", "0.6574405", "0.65624535", "0.64825547", "0.64625627", "0.6457008", "0.64533365", "0.64462394", "0.6436141", "0.64115065", "0.64115065", "0.6404387", "0.6402076", "0.63927054", "0.6369385", "0.6366281", "0.63653", "0.6358...
0.7353894
0
PATCH/PUT /fake_answers/1 PATCH/PUT /fake_answers/1.json
def update respond_to do |format| if @fake_answer.update(fake_answer_params) format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' } format.json { render :show, status: :ok, location: @fake_answer } else format.html { render :edit } format.json { render json: @fake_answer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @que...
[ "0.68757325", "0.6873886", "0.6738325", "0.6663481", "0.64679563", "0.64679563", "0.6457721", "0.64376235", "0.6424249", "0.64161676", "0.64153993", "0.6397989", "0.6345244", "0.63425946", "0.6326939", "0.6321163", "0.6320706", "0.6319739", "0.63186616", "0.6309624", "0.63096...
0.7129221
0
DELETE /fake_answers/1 DELETE /fake_answers/1.json
def destroy @fake_answer.destroy respond_to do |format| format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n ...
[ "0.75515115", "0.74374837", "0.74374837", "0.74100095", "0.7392629", "0.73762643", "0.73700905", "0.73700905", "0.7281447", "0.7258693", "0.72482276", "0.7225049", "0.7220558", "0.71750474", "0.7172923", "0.7167194", "0.7167163", "0.7167163", "0.7167163", "0.7167163", "0.7167...
0.76496696
0
Use callbacks to share common setup or constraints between actions.
def set_fake_answer @fake_answer = FakeAnswer.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def fake_answer_params params.require(:fake_answer).permit(:answer, :question_id, :quiz_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
This method is invoked whenever Burp Scanner discovers a new, unique issue.
def newScanIssue(issue) event = { 'details' => issue.getIssueDetail, 'vulnerability' => issue.issueName, 'severity' => issue.severity, 'url' => issue.url.to_s, 'port' => issue.port, 'host' => issue.host } send_event(event) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_stale_issues\n handle_newly_stale_issues\n handle_stale_and_unmergable_prs\n end", "def after_create(issue)\n user_agent_detail_service.create\n handle_add_related_issue(issue)\n resolve_discussions_with_issue(issue)\n create_escalation_status(issue)\n\n super\n end...
[ "0.6083699", "0.6028642", "0.58497536", "0.58497536", "0.5809531", "0.5809531", "0.54663014", "0.5306853", "0.52345395", "0.5159733", "0.51464957", "0.5123844", "0.5071489", "0.50656337", "0.50563616", "0.5019229", "0.49901628", "0.49799582", "0.49799582", "0.49753729", "0.49...
0.69553334
0
Override the original to_param so that it returns name, not ID, for constructing URLs. Use Modelfind_by_name() instead of Model.find() in controllers.
def to_param name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_param\n \"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n \"#{self.id}-#{self.name.parameterize.to_s}\"\n end", "def to_param\n \"#{self...
[ "0.7414395", "0.7361364", "0.7361364", "0.7327415", "0.73018503", "0.725298", "0.72435915", "0.72435915", "0.72273415", "0.72061634", "0.7195993", "0.7137509", "0.71234405", "0.71234405", "0.71234405", "0.711025", "0.711025", "0.7089496", "0.7089496", "0.7089496", "0.7089496"...
0.71051437
19
turn a gray entry to white
def turn_to_white(entry) raise "Only a gray entry can be turned to white" unless entry.mode == Entry::MODE_GRAY entry.be_white! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend", "def white\n colorize(37)\n end", "def white!\n self.color = :white\n end", "def cancel_black(entry)\n\t\traise \"Ony a bl...
[ "0.76192683", "0.72442156", "0.68534315", "0.6730867", "0.65915555", "0.65083206", "0.63472074", "0.6335894", "0.62846035", "0.62692386", "0.62544256", "0.61990064", "0.5952079", "0.59362036", "0.5896998", "0.58859175", "0.5861792", "0.583852", "0.5828988", "0.58006966", "0.5...
0.87834173
0
turn a gray entry to black
def turn_to_black(entry) raise "Only a gray entry can be turned to black" unless entry.mode == Entry::MODE_GRAY entry.be_black! decrement!(:entries_num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend", "def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entrie...
[ "0.7797748", "0.75115925", "0.6641252", "0.66394764", "0.65816045", "0.6565367", "0.6558141", "0.6558141", "0.6283044", "0.6276112", "0.6149354", "0.6124538", "0.61047447", "0.60704416", "0.6023583", "0.600836", "0.59670526", "0.5965099", "0.5965099", "0.59643584", "0.5951229...
0.85430205
0
cancel a black entry to gray
def cancel_black(entry) raise "Ony a black entry can be canceled to gray" unless entry.mode == Entry::MODE_BLACK entry.be_gray! increment!(:entries_num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend", "def safe_colorize_deactive\n CLIColorize.off\n end", "def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to ...
[ "0.7253252", "0.6806319", "0.67141515", "0.6550353", "0.6340775", "0.6270994", "0.609823", "0.60920995", "0.60874283", "0.60336524", "0.60202163", "0.6017151", "0.5893231", "0.5872357", "0.581119", "0.57405347", "0.571675", "0.5708805", "0.56946933", "0.5683745", "0.5659697",...
0.8708618
0
Get typographic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text.
def normalize1(text, analyzer = nil) Entry.normalize(text, normalizer1, analyzer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_normalize(text); end", "def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text\n end", ...
[ "0.73205817", "0.6839492", "0.68088114", "0.6375745", "0.6182548", "0.6111364", "0.5863967", "0.5733902", "0.57050794", "0.568171", "0.5676616", "0.5649358", "0.5645117", "0.5638745", "0.5631783", "0.56281304", "0.5623601", "0.56123704", "0.5567301", "0.5564268", "0.55436486"...
0.6819833
2
Get typographic and morphosyntactic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text.
def normalize2(text, analyzer = nil) Entry.normalize(text, normalizer2, analyzer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_normalize(text); end", "def normalize1(text, analyzer = nil)\n\t\tEntry.normalize(text, normalizer1, analyzer)\n\tend", "def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n ...
[ "0.73448277", "0.68200576", "0.65461254", "0.62681997", "0.6033383", "0.59138775", "0.58968383", "0.58936214", "0.5863743", "0.5764376", "0.5729348", "0.56959754", "0.56768626", "0.5668627", "0.5617253", "0.5614357", "0.56085706", "0.56003666", "0.5592124", "0.5585808", "0.54...
0.6842146
1
Accepts parameter objects: parameter :petId, in: :path, type: :integer, required: true Or references: parameter ref: '/parameters/Pet'
def parameter(name, attributes={}) metadata[:parameters] << if name.respond_to?(:has_key?) { '$ref': name.delete(:ref) || name.delete('ref') } else { name: name.to_s }.merge(attributes) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pet_params\n params.require(:pet).permit(:id, :name, :img_url, :about, :user_id)\n end", "def line_pet_params\n params.require(:line_pet).permit(:pet_id)\n end", "def pet_params\n params.require(:pet).permit(:name, :description, :animal_type, :breed, :user_id, :parent_id)\n end", ...
[ "0.6749605", "0.6745692", "0.66847736", "0.6555816", "0.6549656", "0.65386283", "0.65144295", "0.6463791", "0.6449904", "0.64399356", "0.6403879", "0.640252", "0.6399014", "0.6397209", "0.63856494", "0.6378281", "0.63546133", "0.63514096", "0.63483095", "0.6344998", "0.630758...
0.5305223
95
Calculate Krippendorff's alpha (interrater reliability) Assumed input (Matrix) [ [ nil, nil, nil, nil, nil, 3, 4, 1, 2, 1, 1, 3, 3, nil, 3 ], coder 1 [ 1, nil, 2, 1, 3, 3, 4, 3, nil, nil, nil, nil, nil, nil, nil], coder 2 [ nil, nil, 2, 1, 3, 4, 4, nil, 2, 1, 1, 3, 3, nil, 4 ] coder 3 ]
def krippendorff_alpha in_array = self.to_a in_array_flattened = in_array.transpose.flatten unique_values = in_array.flatten.compact.uniq # We need to keep track of the skip indexes separately since we can't send nils via C array of double skip_indexes = [] in_array_flattened.each_with_index do |element, i| skip_indexes << i if element.nil? end # Reformat the in_array to not have nil skip_indexes.each {|i| in_array_flattened[i] = 0 } FFI::MemoryPointer.new(:double, in_array_flattened.size) do |in_array_ptr| FFI::MemoryPointer.new(:double, unique_values.size) do |unique_values_ptr| FFI::MemoryPointer.new(:int, skip_indexes.size) do |skip_indexes_ptr| in_array_ptr.write_array_of_double(in_array_flattened) unique_values_ptr.write_array_of_double(unique_values) skip_indexes_ptr.write_array_of_int(skip_indexes) return _krippendorff_alpha(in_array_ptr, row_count, column_count, skip_indexes_ptr, skip_indexes.size, unique_values_ptr, unique_values.size) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} cat...
[ "0.659812", "0.56843007", "0.54977244", "0.52980226", "0.520264", "0.5083619", "0.5061918", "0.50556916", "0.50504255", "0.5031081", "0.49978867", "0.4965376", "0.49543536", "0.49212122", "0.4915246", "0.4910321", "0.49029636", "0.4896388", "0.48898193", "0.48720384", "0.4861...
0.61531466
1
GET /wishlist_items GET /wishlist_items.xml
def index @wishlist_items = WishlistItem.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @wishlist_items } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # s...
[ "0.7702818", "0.7389687", "0.7069813", "0.70656097", "0.70206", "0.6967141", "0.6891797", "0.68861693", "0.688251", "0.6779779", "0.67751074", "0.6771312", "0.6677934", "0.6667456", "0.64915663", "0.6464108", "0.64375645", "0.6430342", "0.632434", "0.6292687", "0.62863684", ...
0.7948633
0
GET /wishlist_items/1 GET /wishlist_items/1.xml
def show @wishlist_item = WishlistItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @wishlist_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.e...
[ "0.78592396", "0.751913", "0.7107771", "0.70018244", "0.69793105", "0.69069713", "0.68212384", "0.6718996", "0.6705311", "0.6702776", "0.6637464", "0.6612683", "0.6573811", "0.6497558", "0.6494542", "0.64729625", "0.6472366", "0.6445448", "0.6427236", "0.64050853", "0.6292535...
0.7829301
1
GET /wishlist_items/new GET /wishlist_items/new.xml
def new @wishlist_item = WishlistItem.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @wishlist_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end", "def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { rend...
[ "0.80365664", "0.7672576", "0.75745106", "0.75463885", "0.72669226", "0.72669226", "0.71113026", "0.71113026", "0.71113026", "0.71113026", "0.71113026", "0.71113026", "0.71113026", "0.71113026", "0.7104713", "0.7048624", "0.70458513", "0.6994171", "0.69870645", "0.698051", "0...
0.8076632
0
POST /wishlist_items POST /wishlist_items.xml
def create @wishlist = current_wishlist product = Product.find(params[:product_id]) @wishlist_item = @wishlist.wishlist_items.build(:product => product) respond_to do |format| if @wishlist_item.save format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') } format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item } else format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') } format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :cr...
[ "0.70018244", "0.6883698", "0.6872023", "0.6869378", "0.6825226", "0.66802484", "0.66297436", "0.6627193", "0.6569625", "0.654649", "0.65295845", "0.6511484", "0.6486452", "0.6474226", "0.64685917", "0.64427155", "0.64173657", "0.64032847", "0.6381984", "0.636581", "0.6330496...
0.6841335
4
PUT /wishlist_items/1 PUT /wishlist_items/1.xml
def update @wishlist_item = WishlistItem.find(params[:id]) respond_to do |format| if @wishlist_item.update_attributes(params[:wishlist_item]) format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n e...
[ "0.7283253", "0.7260425", "0.7176752", "0.7163197", "0.70719266", "0.706832", "0.70471656", "0.70294124", "0.69872826", "0.6974909", "0.6967413", "0.6899808", "0.68313503", "0.6638728", "0.6629651", "0.6618489", "0.6618489", "0.6618489", "0.6618489", "0.6618489", "0.66137534"...
0.7591988
0
DELETE /wishlist_items/1 DELETE /wishlist_items/1.xml
def destroy @wishlist_item = WishlistItem.find(params[:id]) @wishlist_item.destroy respond_to do |format| format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistite...
[ "0.7499399", "0.72535795", "0.7193845", "0.71509445", "0.7015333", "0.699125", "0.69773203", "0.69632375", "0.69632375", "0.69607407", "0.6893657", "0.68016624", "0.67435944", "0.6742987", "0.6742987", "0.67184496", "0.6668846", "0.6650799", "0.66481614", "0.6621747", "0.6606...
0.7620046
0
Runs the event, calling the block with the given options.
def run(context, options = {}) #@block.call(options) if @options[:defaults] options = @options[:defaults].merge(options) end context.instance_exec(options, &@block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(options)\n act_on_options(options)\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def my_run(options={},&block)\n run_task(Xprobe2::Task.new(options,&block))\n end", "def run\n block.call\n end", "de...
[ "0.7201375", "0.6829764", "0.6766009", "0.67390764", "0.6702059", "0.6691134", "0.6666734", "0.651643", "0.6483024", "0.64294755", "0.6361866", "0.63533163", "0.6306805", "0.627165", "0.626882", "0.626882", "0.6232353", "0.6157915", "0.6152884", "0.6096895", "0.60891706", "...
0.6675411
6
Whether or not this event is a search event.
def search? type == :search end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search?\n self.rel == \"search\"\n end", "def has_simple_search?\n self.search_type.to_s == \"simple\" && !self.is_static?\n end", "def searchable?\n @args[:search].present?\n end", "def event?\n entry_type == :event\n end", "def searching?\n @searching\n end", "de...
[ "0.7050877", "0.68856", "0.68108463", "0.6662095", "0.66348374", "0.6611465", "0.65955347", "0.65955347", "0.6538532", "0.6480304", "0.64727294", "0.64443326", "0.64290655", "0.6394361", "0.6394361", "0.63826466", "0.63657427", "0.6335163", "0.62802213", "0.62311774", "0.6182...
0.77010936
0
Whether or not this event matches another event, to see if it can be ran using this event definition.
def match?(star, event) event.name == name && check_platform_requirement(star) && check_options_requirements(event.options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _events_match(e1, e2)\n e1.source && e2.source && e1.source.title == e2.source.title && e1.start.date_time.to_s == e2.start.date_time.to_s\n end", "def matches?(event_name, *args)\n @event_name == event_name and (any_args? or @args == args)\n end", "def ==(other_event)\n EQUALITY_FIELDS.each...
[ "0.71388555", "0.6930935", "0.6788261", "0.67662555", "0.6697888", "0.666603", "0.66097", "0.6538908", "0.64401734", "0.64012396", "0.64012396", "0.63988507", "0.63870394", "0.63739336", "0.6357546", "0.63529843", "0.63473237", "0.6342563", "0.6340317", "0.63375103", "0.63126...
0.6423733
9
Checks the given runtime options for required options. If no required options exist, returns true. Otherwise, checks the keys of the runtime options to see if they contain all of the required options.
def check_options_requirements(runtime_options) required_options = options[:requires] || options[:require] return true unless required_options ([required_options].flatten - runtime_options.keys).size == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?(options)\n (@required_options - options.keys).size == 0\n end", "def required_by_option?(options)\n req = (options.is_a?(Hash) ? options.stringify_keys[:required] : options)\n !(req.to_s === 'false' || req.nil?)\n end", "def requiredOptionsSet()\n\t\t@@opt.each...
[ "0.74803275", "0.7443251", "0.71763015", "0.69971865", "0.672289", "0.6709709", "0.66750807", "0.66280764", "0.660845", "0.6574304", "0.6508954", "0.6440833", "0.6428106", "0.6428106", "0.64270777", "0.64260393", "0.6373272", "0.6348179", "0.6328891", "0.6257842", "0.6226288"...
0.86579126
0
kill all processes including servers, clients and trema PIDs for server and clients are in PID files
def kill_all_processes puts "KILL : all processes" pid_servers = PID_DIR_PATH + "/" + PID_FILE_PREFIX_SERVER + "*" pid_clients = PID_DIR_PATH + "/" + PID_FILE_PREFIX_CLIENT + "*" # for servers Dir::glob(pid_servers).each do |f| if File::ftype(f) == "file" pid_server = f.split( "." )[1] $pids_s.delete(pid_server) begin File.delete(f) Process.kill('KILL', pid_server.to_i) # puts "KILL : server [" + pid_server + "] was killed" rescue Errno::ESRCH STDERR.puts "KILL : server [" + pid_server + "]: No such process" rescue STDERR.puts "ERROR : Can't kill server process [" + pid_server + "]" end end end # for clients Dir::glob(pid_clients).each do |f| if File::ftype(f) == "file" pid_client = f.split( "." )[1] $pids_c.delete(pid_client) begin File.delete(f) Process.kill('KILL', pid_client.to_i) # puts "KILL : client [" + pid_client + "] was killed" rescue Errno::ESRCH STDERR.puts "KILL : client [" + pid_client + "]: No such process" rescue STDERR.puts "ERROR : Can't kill client process [" + pid_client + "]" end end end # for trema cmd = TREMA + " killall" system(cmd) $pids_c.each{|pid| if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end } $pids_s.each{|pid| if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\...
[ "0.7158874", "0.7088136", "0.70101285", "0.70016754", "0.66099197", "0.65603936", "0.65290403", "0.6455944", "0.644798", "0.6398452", "0.6323112", "0.6299266", "0.62884915", "0.62718755", "0.62341315", "0.6202883", "0.6136912", "0.61367756", "0.6114428", "0.6107549", "0.60939...
0.84458905
0
The default action, redirects to list.
def index list render :action => 'list' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index; redirect_to :action => 'list'; end", "def index\n \n redirect_to ( :action => \"list\")\n end", "def list\n redirect_to action: \"index\"\n end", "def index\n redirect_to :action => :list\n end", "def index\n redirect_to :action => \"list\"\n end", "def index\n redirect_to ...
[ "0.82438374", "0.8202647", "0.82007354", "0.8084862", "0.80248374", "0.80006224", "0.748509", "0.746784", "0.7298787", "0.70332646", "0.70148534", "0.6994208", "0.6994208", "0.69843185", "0.6960732", "0.69471353", "0.69450104", "0.6940921", "0.69229275", "0.6884377", "0.68808...
0.73579246
14
List all the groups.
def list @groups = Group.find(:all, :order => 'name') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_groups\n BrickFTP::API::Group.all\n end", "def list_groups\n BrickFTP::API::Group.all\n end", "def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end", "def groups\n find(:group).map { |g| g.content }\n end", "def hc_group_li...
[ "0.80761874", "0.80761874", "0.7736165", "0.75816", "0.75493896", "0.74877626", "0.74477017", "0.7395149", "0.7394693", "0.7374675", "0.7362523", "0.73018074", "0.72810775", "0.726793", "0.72521836", "0.72483486", "0.7229844", "0.72212493", "0.72163373", "0.7161532", "0.71327...
0.82609266
0
Show a form to enter data for a new group.
def new @group = Group.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end", "def _create_form\n\t\t\tgroup = params[:id].present? ? SystemGroup.find(params[:id]) : SystemGroup.new\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: render_to_string(partial: 'create_form', locals: { grou...
[ "0.73467445", "0.7228242", "0.7150855", "0.7146631", "0.70922065", "0.70922065", "0.70510864", "0.70236397", "0.6992646", "0.6954007", "0.6942587", "0.6939412", "0.6929809", "0.69132423", "0.69097054", "0.69097054", "0.69097054", "0.69097054", "0.69097054", "0.69097054", "0.6...
0.6664574
62
Create a new group using the posted data from the 'new' view.
def create if request.post? @group = Group.new(params[:group]) if @group.save # give the new group permissions to the folders give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false) redirect_to :action => 'list' else render :action => 'new' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end", "def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end", "def create #:nodoc:\n @group = Group.new...
[ "0.803794", "0.7965249", "0.77496606", "0.77134085", "0.7695011", "0.7655155", "0.76291615", "0.76224524", "0.76049924", "0.7597215", "0.7597215", "0.7597215", "0.7597215", "0.7597215", "0.7576202", "0.7559088", "0.75566685", "0.75558984", "0.75460136", "0.7542783", "0.753038...
0.0
-1
Show a form in which the group can be renamed
def rename render end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_name\n group_name\n end", "def show\n @groups = @form.groups\n end", "def show\n @title = \"Grupo \" + @previa_group.name\n end", "def title_for_form(object)\n prefix = object.id != nil ? 'Edit' : 'Create'\n return prefix + ' ' + MyAdmin.prepare_title(object.class.name)\n end",...
[ "0.61118376", "0.60871184", "0.6075993", "0.5976913", "0.5903311", "0.58827555", "0.58050543", "0.5748276", "0.5731455", "0.56554013", "0.562277", "0.56095874", "0.55909455", "0.5554958", "0.55455565", "0.5537276", "0.55365217", "0.5525922", "0.5520117", "0.5514774", "0.55128...
0.5500044
22
Update the group attributes with the posted variables from the 'edit' view.
def update if request.post? if @group.update_attributes(params[:group]) redirect_to :action => 'list' else render :action => 'rename' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :o...
[ "0.7287", "0.7223447", "0.7210886", "0.72051936", "0.71970314", "0.7161159", "0.71265924", "0.7118602", "0.71112645", "0.7110874", "0.7089008", "0.70814675", "0.70614135", "0.70583236", "0.70360976", "0.70271057", "0.70271057", "0.7004795", "0.70030385", "0.7002753", "0.69984...
0.6952359
39
Give the given group either ALL or NO permissions to all the folders
def give_permissions_to_folders(group, permission_to_everything) Folder.find(:all).each do |folder| add_to_group_permissions(group, folder, permission_to_everything) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end", "def add_to_group_permissions(group, folder, permission_to_everything)\n group_permission = GroupPermission.new\n group_permission.folder = folder\n group_permission.group = group\n group_permiss...
[ "0.6821695", "0.67130405", "0.657511", "0.64386684", "0.6430437", "0.6218378", "0.61804175", "0.61694455", "0.61454076", "0.6142309", "0.6113165", "0.60897017", "0.6087991", "0.6047705", "0.6013864", "0.5988046", "0.5961569", "0.593958", "0.592791", "0.59166545", "0.59166545"...
0.72214156
0
Add the given group and folder to GroupPermissions and (dis)allow everything
def add_to_group_permissions(group, folder, permission_to_everything) group_permission = GroupPermission.new group_permission.folder = folder group_permission.group = group group_permission.can_create = permission_to_everything group_permission.can_read = permission_to_everything group_permission.can_update = permission_to_everything group_permission.can_delete = permission_to_everything group_permission.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_group_permission(g)\n\t\t\n\tend", "def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end", "def chg_permission(groups, arg, mode)\n arg = UserGroup.one...
[ "0.7064186", "0.70187306", "0.6718033", "0.66990846", "0.66494733", "0.6522002", "0.6452796", "0.6426728", "0.6351635", "0.6336575", "0.59725577", "0.59701014", "0.5951281", "0.594292", "0.59112537", "0.59099084", "0.5904136", "0.5890368", "0.5828501", "0.5821654", "0.5812975...
0.76209146
0
The group called 'admins' can not be edited or deleted. By calling this method via a before_filter, you makes sure this doesn't happen.
def do_not_rename_or_destroy_admins_group if @group and @group.is_the_administrators_group? redirect_to :action => 'list' and return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prevent_zero_group_admins\n @membership = Membership.find(params[:id])\n @group = @membership.group\n if @group.has_one_admin? && (@membership.user == current_user)\n flash[:danger] = \"You cannot quit unless there are other group admins.\"\n redirect_to @group\n end\n end"...
[ "0.7619519", "0.7419459", "0.73993146", "0.7336209", "0.72050196", "0.716738", "0.71550626", "0.71160245", "0.7100673", "0.707253", "0.6985762", "0.6985762", "0.6983571", "0.6955274", "0.6932021", "0.6932021", "0.6932021", "0.6890417", "0.6867892", "0.68626344", "0.6836359", ...
0.8197735
0
Check if a group exists before executing an action. If it doesn't exist: redirect to 'list' and show an error message
def does_group_exist @group = Group.find(params[:id]) rescue flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.' redirect_to :action => 'list' and return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end", "def require_member_of_group\n if !member_of(current_group)\n # TODO: Add flash alert\n redirect_back fallback_location: home_path\n ...
[ "0.82312167", "0.72790205", "0.6956808", "0.69134754", "0.6887473", "0.6844776", "0.68217444", "0.6724733", "0.6607002", "0.65707684", "0.65427035", "0.6513769", "0.65013766", "0.648523", "0.64541197", "0.6423775", "0.64009565", "0.6399634", "0.63661057", "0.6362678", "0.6353...
0.78789526
1
Given a "square" array of subarrays, find the sum of values from the first value of the first array, the second value of the second array, the third value of the third array, and so on... Example 1: exampleArray = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonalSum(exampleArray) => 4 Example 2: exampleArray = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonalSum(exampleArray) => 5
def diagonalSum(matrix) total = 0 (0...matrix.length).each {|sub| total += matrix[sub][sub]} return total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend", "def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend", "def multi_dimensional_sum(array)...
[ "0.7323168", "0.7081612", "0.70787966", "0.70787966", "0.7062459", "0.7032922", "0.6994547", "0.6981598", "0.69581056", "0.69496137", "0.688263", "0.6870832", "0.68320256", "0.6738789", "0.67178303", "0.67083365", "0.6698856", "0.66214037", "0.6598974", "0.65600705", "0.65573...
0.7112105
1
GET /questions GET /questions.json
def index @questions = current_user.questions.search(params[:search1],params[:search2],params[:search3]) @performance=Performance.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |f...
[ "0.8163266", "0.7624816", "0.75637484", "0.75628823", "0.72408694", "0.7192141", "0.71918124", "0.7082713", "0.7081532", "0.7081532", "0.7081532", "0.70788556", "0.7065757", "0.7030876", "0.70175326", "0.70175326", "0.7002698", "0.6979351", "0.6950402", "0.69497216", "0.69031...
0.0
-1
GET /questions/1 GET /questions/1.json
def show @questions = Question.find(params[:id]) @answers = @question.answers.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender js...
[ "0.7683254", "0.7540626", "0.737101", "0.7303245", "0.7251743", "0.7231343", "0.7230414", "0.7230414", "0.7230414", "0.7194254", "0.7174909", "0.7174909", "0.7168331", "0.7120867", "0.70868975", "0.704648", "0.69566995", "0.693518", "0.6902902", "0.68723387", "0.6862595", "...
0.0
-1
POST /questions POST /questions.json
def create @question = current_user.questions.new(question_params) namedns=@question.dnsname type=@question.recordtype server=@question.server time=@question.timeperiod testing = %x[ dig #{namedns} #{type} | grep "SERVER:" ] c,d=testing.split(": ") e,f=d.split("#") if e != "127.0.0.1" if server=="" value2 = %x[ dig #{namedns} #{type} | grep "SERVER:" ] c,d=value2.split(": ") e,f=d.split("#") query1=%x[dig #{namedns} #{type} | grep "QUERY:"] q1,q2,q3,q4=query1.split(",") q5,q6,q66=q1.split(": ") q7,q8=q2.split(": ") q9,q10=q3.split(": ") q11,q12=q4.split(": ") query2=query1=%x[dig #{namedns} #{type} | grep "version:"] q21,q22=query2.split(",") q23,q24,q25=q21.split(": ") q26,q27,q28=q22.split(": ") else value2 = %x[ dig @#{server} #{namedns} #{type} | grep "SERVER:" ] c,d=value2.split(": ") e,f=d.split("#") query1=%x[dig @#{server} #{namedns} #{type} | grep "QUERY:"] q1,q2,q3,q4=query1.split(",") q5,q6,q66=q1.split(": ") q7,q8=q2.split(": ") q9,q10=q3.split(": ") q11,q12=q4.split(": ") query2=query1=%x[dig @#{server} #{namedns} #{type} | grep "version:"] q21,q22=query2.split(",") q23,q24,q25=q21.split(": ") q26,q27,q28=q22.split(": ") end end server=e if server.blank? @question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27) else @question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27) end @average=Performance.where(question_id: @question.id).average(:responsetime) @highest=Performance.where(question_id: @question.id).maximum(:responsetime) @lowest=Performance.where(question_id: @question.id).minimum(:responsetime) @count=Performance.where(question_id: @question.id).count(:responsetime) @unavailable=Performance.where(responsetime: -1 ) @a=@unavailable.where(question_id: @question.id).count(:responsetime) @availability=0 Search.create(server: @question.dnsname) total=%x[ dig @#{server} #{namedns} #{type} | wc -l ] total1,total2=total.split("\n") a = 1 while a != total1.to_i value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] if value2==";; ANSWER SECTION:\n" a=a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] while value2 !="\n" # b,c,d,e,f,g=value2.split(" ") dnsanswer=b ttl=c typeAnswer=e o=e if g != nil ip=f+" "+g else ip=f end answerType="answer" #answerList=Answer.question.where(:typeAnswer "answer") #answerList.each do |f| #if f.ipadress != ip #Change.create() Answer.create(dnsname: dnsanswer,ttl: c,recordtype: e,ipaddress: ip,question_id: @question.id, typeAnswer: answerType) a=a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] end end if value2==";; AUTHORITY SECTION:\n" a = a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] while value2 != "\n" b,c,d,e,f,g=value2.split(" ") dnsanswer=b ttl=c typeAnswer=e o=e if g != nil ip=f+" "+g else ip=f end answerType="authority" Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType) a = a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] end end if value2==";; ADDITIONAL SECTION:\n" a=a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] while value2 !="\n" b,c,d,e,f,g=value2.split(" ") dnsanswer=b ttl=c typeAnswer=e o=e if g != nil ip=f+" "+g else ip=f end answerType="additional" Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType) a=a+1 value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ] end end a =a+1 end respond_to do |format| if @question.save @question.create_detail(:average => @average ,:maximum => @highest,:minimum => @lowest,:total_query => @count,:total_fail => @a ,:status =>@availability ) format.html { redirect_to @question, notice: 'DNS was successfully Add.' } format.json { render :show, status: :created, location: @question } else format.html { render :new } format.json { render json: @question.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index ...
[ "0.7366109", "0.72979563", "0.7059195", "0.7000753", "0.6956294", "0.68727475", "0.67733675", "0.6729471", "0.67116046", "0.6706642", "0.6705714", "0.6689426", "0.6647686", "0.6635359", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.6...
0.0
-1
PATCH/PUT /questions/1 PATCH/PUT /questions/1.json
def update respond_to do |format| if @question.update(question_params) format.html { redirect_to @question, notice: 'DNS was successfully updated.' } format.json { render :show, status: :ok, location: @question } else format.html { render :edit } format.json { render json: @question.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.71827537", "0.7080452", "0.6957011", "0.69225276", "0.68890774", "0.68794495", "0.6878509", "0.68206614", "0.68206614", "0.68206614", "0.68206614", "0.68206614", "0.68135905", "0.6812396", "0.68111", "0.67370677", "0.6734405", "0.6730357", "0.6722659", "0.66943765", "0.667...
0.0
-1
DELETE /questions/1 DELETE /questions/1.json
def destroy @question.destroy respond_to do |format| format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted questio...
[ "0.7801243", "0.77760345", "0.762556", "0.76092136", "0.76092136", "0.75923663", "0.7591492", "0.7591492", "0.7591492", "0.7591492", "0.7591492", "0.7591492", "0.75907475", "0.7587306", "0.75842667", "0.75842667", "0.75842667", "0.75842667", "0.75842667", "0.75842667", "0.752...
0.7357377
34
Use callbacks to share common setup or constraints between actions.
def set_question @question = Question.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 question_params params.require(:question).permit(:dnsname, :recordtype, :server,:timeperiod) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /test_bookings/1 GET /test_bookings/1.xml
def show @admission = Admission.new @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @test_booking = TestBooking.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @test_booking } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end", "def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml ...
[ "0.6642133", "0.65756303", "0.6536346", "0.6530408", "0.6520359", "0.6508713", "0.63768905", "0.6347579", "0.62398446", "0.6211322", "0.6173901", "0.6169943", "0.61501443", "0.61501443", "0.61501443", "0.61501443", "0.61501443", "0.61501443", "0.61501443", "0.61501443", "0.61...
0.0
-1
GET /test_bookings/new GET /test_bookings/new.xml
def new @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @org_code=@person.org_code @org_location=@person.org_location @test_booking = TestBooking.new @item_master=ChargeMaster.all(:conditions => "org_code = '#{@org_code}'") 10.times{ @test_booking.test_booking_child.build } str="" str1="" @barcode_id="" @tb=TestBooking.last(:conditions =>"org_code='#{@org_code}'") if(@tb) n=(@tb.lab_no.slice!(3..50).to_i+1).to_s @barcode_id=@tb.barcode_id.next str="Lab"+n else n=1.to_s @barcode_id="201208001" str="Lab"+n end @test_booking.lab_no=str receipt_no=Number.new # Create object to number table @test_booking.bill_no=receipt_no.get_number('receipt',@org_code) # Method calling # end @appt_payment = AppointmentPayment.all(:conditions => "appt_date = '#{Date.today}'") @admissions = Admission.all(:conditions => "admn_status = 'admitted'", :order => "id DESC") @registration=Registration.all(:order => "id DESC") respond_to do |format| format.html # new.html.erb format.xml { render :xml => @test_booking } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end", "def new\n @booking = Booking.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n ...
[ "0.7319991", "0.7318187", "0.70825535", "0.6902061", "0.68918467", "0.6891439", "0.6881508", "0.6878061", "0.6878061", "0.6878061", "0.6878061", "0.6878061", "0.6878061", "0.6878061", "0.6878061", "0.68481606", "0.67635816", "0.67561007", "0.6727416", "0.6717058", "0.6686087"...
0.0
-1
POST /test_bookings POST /test_bookings.xml
def create @admission = Admission.new @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @org_code=@person.org_code @org_location=@person.org_location @test_booking = TestBooking.new(params[:test_booking]) @item_master=ChargeMaster.all(:conditions => "org_code = '#{@org_code}'") @admissions = Admission.all(:conditions => "admn_status = 'admitted'", :order => "id DESC") @registration=Registration.all(:order => "id DESC") # code for barcode barcode1= @test_booking.barcode_id path= "public/images/barcodeimages/#{@test_booking.lab_no}.png" barcode = Barby::Code128B.new(barcode1) File.open(path , 'wb'){|f| f.write barcode.to_png(:margin => 3, :xdim => 2, :height => 55) } respond_to do |format| if @test_booking.save @receipt_number=Number.find_by_name_and_org_code('receipt',@person.org_code) @receipt_number.value=@test_booking.bill_no @receipt_number.update_attributes(params[:receipt_number]) format.html { redirect_to("/test_bookings/report/#{@test_booking.id}?print_type=original&format=pdf") } format.xml { render :xml => @test_booking, :status => :created, :location => @test_booking } else @reg=Registration.find_by_mr_no(@test_booking.mr_no) if(@reg) @age=@reg.age end format.html { render :action => "new" } format.xml { render :xml => @test_booking.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking,...
[ "0.58407605", "0.57777464", "0.5776558", "0.56741965", "0.56319493", "0.5569003", "0.55311906", "0.5528845", "0.5528845", "0.5522597", "0.55096954", "0.5507755", "0.54934675", "0.5476046", "0.5465962", "0.5455338", "0.54481065", "0.54252344", "0.5424934", "0.540971", "0.53778...
0.0
-1
PUT /test_bookings/1 PUT /test_bookings/1.xml
def update @test_booking = TestBooking.find(params[:id]) @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @item_master=ChargeMaster.all respond_to do |format| if @test_booking.update_attributes(params[:test_booking]) format.html { redirect_to("/test_bookings/report/#{@test_booking.id}?print_type=original&format=pdf") } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @test_booking.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booking])\n respond_with(@booking)\n end", "def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book ...
[ "0.61841005", "0.6110311", "0.6105933", "0.6101895", "0.6094149", "0.6052914", "0.5976284", "0.5970495", "0.59648174", "0.5959135", "0.5958853", "0.5946206", "0.5942621", "0.591912", "0.5849802", "0.5847772", "0.58415073", "0.58229226", "0.58229226", "0.58229226", "0.5809645"...
0.56950676
35
DELETE /test_bookings/1 DELETE /test_bookings/1.xml
def destroy @test_booking = TestBooking.find(params[:id]) @test_booking.destroy respond_to do |format| format.html { redirect_to(test_bookings_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n...
[ "0.6633766", "0.6633766", "0.65779567", "0.6555827", "0.65358436", "0.6470717", "0.64569455", "0.63899976", "0.63726103", "0.63538194", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6347651", "0.6320892...
0.70728403
0
it to write a function rand5() that generates a random integer from 1 to 5. rand7() returns each integer with equal probability. rand5() must also return each integer with equal probability.
def rand7 rand * 7 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand5()\n rand(1..5)\nend", "def rand5\n rand(1..5)\nend", "def rand5\n rand(0...5)\nend", "def rand_choice \n Random.rand(0...6)\n end", "def generate_random_number\n rand(1..6) + 1\nend", "def random_number \n rand(6) + 1 \nend", "def multiply_by_1_5(n)\n n = n.to_i\n is_one...
[ "0.77966285", "0.7790056", "0.7729562", "0.7040067", "0.67719704", "0.6744785", "0.6587653", "0.6585929", "0.6563516", "0.65153885", "0.6499675", "0.6494788", "0.6481278", "0.6452113", "0.64404243", "0.6400955", "0.63950264", "0.6376528", "0.6375876", "0.63633966", "0.6362167...
0.71795905
3
OVERRIDDEN from BL Get Timeline data if view is Timeline
def index params.delete(:q_ws) (@response, @document_list) = search_results(params, search_params_logic) if params[:view].present? && params[:view].include?('timeline') @timeline_data = timeline_data end respond_to do |format| format.html { store_preferred_view } format.rss { render layout: false } format.atom { render layout: false } format.json do render json: render_search_results_as_json end additional_response_formats(format) document_export_formats(format) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeline\n request('timeline')\n end", "def parse_timeline\n\nend", "def show\n timeline\n end", "def public_timeline\n Chirpy.public_timeline\n end", "def timeline\n twitter.home_timeline\n end", "def timeline(action=nil)\n timelines.mine.all(action)\n end", "def index\...
[ "0.6885383", "0.6741531", "0.6580884", "0.6517158", "0.6444705", "0.64377075", "0.63307446", "0.6317555", "0.62505966", "0.62282896", "0.62251955", "0.621379", "0.621379", "0.619387", "0.619387", "0.6178744", "0.6147121", "0.61245745", "0.6111847", "0.6107795", "0.6059163", ...
0.0
-1
get a single document from the index to add responses for formats other than html or json see _Blacklight::Document::Export_
def show @response, @document = fetch params[:id] @children = @document.children(limit: 100).select { |child| child.published? } # assets ordered by label, excludes preservation only files @assets = @document.assets(ordered: true) @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context) supported_licences @reader_group = governing_reader_group(@document.collection_id) unless @document.collection? if @document.published? Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, "View", @document.id, 1, true) end respond_to do |format| format.html { setup_next_and_previous_documents } format.json do options = {} options[:with_assets] = true if can?(:read, @document) formatter = DRI::Formatters::Json.new(@document, options) render json: formatter.format(func: :as_json) end format.ttl do options = {} options[:with_assets] = true if can?(:read, @document) formatter = DRI::Formatters::Rdf.new(@document, options) render text: formatter.format({format: :ttl}) end format.rdf do options = {} options[:with_assets] = true if can?(:read, @document) formatter = DRI::Formatters::Rdf.new(@document, options) render text: formatter.format({format: :xml}) end format.js { render layout: false } additional_export_formats(@document, format) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_one_document hsh\n response = client.prepare_index(@index, @type).set_source(hsh.to_indexable_json).execute.action_get\n end", "def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end", "def sho...
[ "0.7077039", "0.6881332", "0.6847724", "0.6838684", "0.6776742", "0.6665234", "0.6644046", "0.6640966", "0.6624852", "0.6600099", "0.65971565", "0.65811974", "0.6562634", "0.655483", "0.65388584", "0.65247405", "0.65190923", "0.6511596", "0.65105987", "0.6493588", "0.6475371"...
0.6399905
27
Excludes objects from the collections view or collections from the objects view
def exclude_unwanted_models(solr_parameters, user_parameters) solr_parameters[:fq] ||= [] solr_parameters[:fq] << "-#{ActiveFedora.index_field_mapper.solr_name('has_model', :stored_searchable, type: :symbol)}:\"DRI::GenericFile\"" if user_parameters[:mode] == 'collections' solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('is_collection', :facetable, type: :string)}:true" unless user_parameters[:show_subs] == 'true' solr_parameters[:fq] << "-#{ActiveFedora.index_field_mapper.solr_name('ancestor_id', :facetable, type: :string)}:[* TO *]" end else solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('is_collection', :facetable, type: :string)}:false" if user_parameters[:collection].present? solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('root_collection_id', :facetable, type: :string)}:\"#{user_parameters[:collection]}\"" end end solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('status', :facetable, type: :string)}:published" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_from_model\n []\n end", "def prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end", "def exclude; end", "def complement\n self.class.all.difference(self)\n end", "def exclude?(object)\n !include? object\n end", "def complement\n self.class.all.difference(self)...
[ "0.646626", "0.62107766", "0.61120623", "0.6111222", "0.60607255", "0.60438305", "0.6016812", "0.6001723", "0.58460104", "0.5837656", "0.58049536", "0.57358545", "0.56861496", "0.56078243", "0.5596588", "0.5591361", "0.55899304", "0.55801487", "0.55705786", "0.553814", "0.552...
0.5072063
70
GET /company_types GET /company_types.json
def index @company_types = CompanyType.all render json: @company_types end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @company_type\n end", "def index\n @type_companies = TypeCompany.all\n end", "def type\n fetch('company.type')\n end", "def index\n @admin_company_types = Admin::CompanyType.all\n end", "def byState\n @company_types = CompanyType.where(\"state_id = ?\", co...
[ "0.72950727", "0.7109263", "0.70026845", "0.6909386", "0.66707665", "0.65155303", "0.6488321", "0.6471277", "0.6434962", "0.6343553", "0.6329315", "0.6266198", "0.626582", "0.6236602", "0.61953914", "0.61433315", "0.6132888", "0.6130129", "0.6122113", "0.61215746", "0.6113127...
0.78606737
0
GET /company_types/byState/1 GET /company_types/byState/1.json
def byState @company_types = CompanyType.where("state_id = ?", company_type_params[:state_id]) render json: @company_types end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end", "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def show\n render json: @company_type\n end", "def index\n @type_companies = Ty...
[ "0.7681558", "0.70722884", "0.66862345", "0.657447", "0.650979", "0.6132571", "0.61007315", "0.6017717", "0.5965307", "0.59387076", "0.5898496", "0.58936423", "0.58797354", "0.5841357", "0.5807216", "0.5777385", "0.5771038", "0.57659376", "0.57552516", "0.5754214", "0.5742081...
0.8612504
0
GET /company_types/1 GET /company_types/1.json
def show render json: @company_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def index\n @type_companies = TypeCompany.all\n end", "def type\n fetch('company.type')\n end", "def index\n @admin_company_types = Admin::CompanyType.all\n end", "def set_type_company\n @t...
[ "0.77569324", "0.719821", "0.7186441", "0.6849857", "0.66516054", "0.6590242", "0.6520687", "0.64819556", "0.6416951", "0.6383246", "0.63786995", "0.63211143", "0.62555534", "0.6238684", "0.6238684", "0.6238684", "0.6238684", "0.6237996", "0.6227353", "0.6204575", "0.6188086"...
0.75830656
1
POST /company_types POST /company_types.json
def create @company_type = CompanyType.new(company_type_params) if @company_type.save render json: @company_type, status: :created, location: @company_type else render json: @company_type.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n ...
[ "0.6962814", "0.680279", "0.66868913", "0.66208154", "0.6563562", "0.63400257", "0.6174167", "0.61677396", "0.6143639", "0.611549", "0.6110198", "0.60799456", "0.6071588", "0.6069727", "0.6054", "0.6036068", "0.6017305", "0.5914957", "0.5914957", "0.5900653", "0.5900653", "...
0.74006945
0
PATCH/PUT /company_types/1 PATCH/PUT /company_types/1.json
def update @company_type = CompanyType.find(params[:id]) if @company_type.update(company_type_params) head :no_content else render json: @company_type.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { rend...
[ "0.7487825", "0.72119653", "0.71939164", "0.66199285", "0.6487162", "0.63711363", "0.63375306", "0.6316484", "0.629656", "0.628524", "0.62073284", "0.6207322", "0.6205282", "0.6205282", "0.6192688", "0.61853135", "0.6184857", "0.6184724", "0.61748064", "0.61711967", "0.615462...
0.7569093
0
DELETE /company_types/1 DELETE /company_types/1.json
def destroy @company_type.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.7776477", "0.77046293", "0.75599265", "0.7225775", "0.71949357", "0.7111012", "0.70134944", "0.69842565", "0.6972056", "0.69720095", "0.6943254", "0.691763", "0.691763", "0.691763", "0.687737", "0.6860584", "0.6852094", "0.6852094", "0.6852094", "0.6852094", "0.6852094", ...
0.78043586
0
GET /gltf_models GET /gltf_models.json
def index @gltf_models = GltfModel.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n ...
[ "0.6366516", "0.6159299", "0.6093915", "0.60801965", "0.60612905", "0.6038504", "0.6016536", "0.5965578", "0.5925854", "0.59045404", "0.5847773", "0.58083856", "0.580603", "0.58016175", "0.58016175", "0.57885665", "0.5757472", "0.57548827", "0.5749606", "0.5745169", "0.574000...
0.7086729
0
GET /gltf_models/1 GET /gltf_models/1.json
def show respond_to do |format| format.gltf do send_file EziiOsPath.new(@gltf_model.global_path).file_system_path end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @gltf_models = GltfModel.all\n end", "def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend", "def show\n @model = Model.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model.to_json(\n :only =>[],\n :methods ...
[ "0.68776745", "0.6503903", "0.61830235", "0.6031035", "0.59931195", "0.59612465", "0.59069747", "0.58710486", "0.5855953", "0.58219004", "0.5816734", "0.58076805", "0.58076805", "0.5807638", "0.5797992", "0.57839507", "0.5776893", "0.57406867", "0.5724249", "0.5722585", "0.57...
0.0
-1
POST /gltf_models POST /gltf_models.json
def create @gltf_model = GltfModel.new(gltf_model_params) respond_to do |format| if @gltf_model.save format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' } format.json { render :show, status: :created, location: @gltf_model } else format.html { render :new } format.json { render json: @gltf_model.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/js...
[ "0.6156778", "0.60116416", "0.5969718", "0.5738165", "0.57204694", "0.5691531", "0.56770587", "0.5587047", "0.5572569", "0.55326736", "0.54894453", "0.5426242", "0.54190004", "0.5395249", "0.53938514", "0.5375051", "0.53728", "0.53425467", "0.53425467", "0.5333202", "0.527856...
0.64486474
0
PATCH/PUT /gltf_models/1 PATCH/PUT /gltf_models/1.json
def update respond_to do |format| if @gltf_model.update(gltf_model_params) format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully updated.' } format.json { render :show, status: :ok, location: @gltf_model } else format.html { render :edit } format.json { render json: @gltf_model.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n ...
[ "0.6806672", "0.64017165", "0.63226074", "0.5944277", "0.5939421", "0.5898036", "0.58701813", "0.5865725", "0.5863237", "0.5858418", "0.585234", "0.58366644", "0.58366644", "0.58366644", "0.5831424", "0.58300996", "0.5807789", "0.5746961", "0.5744137", "0.5728008", "0.5712158...
0.6385573
2