query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
GET /attribute_layers/1 GET /attribute_layers/1.json | def show
@attribute_layer = AttributeLayer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @attribute_layer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n end",
"def index\n @attribute_layers = @palette.attribute_layers.all\n end",
"def new\n @attribute_layer = AttributeLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js... | [
"0.708815",
"0.6863708",
"0.6739711",
"0.6241973",
"0.6240795",
"0.619612",
"0.6171272",
"0.6137455",
"0.60827386",
"0.5998449",
"0.59869266",
"0.5977867",
"0.5964081",
"0.59019965",
"0.59019965",
"0.59019965",
"0.5881812",
"0.5710326",
"0.5668596",
"0.56614006",
"0.5647556",... | 0.76378375 | 0 |
GET /attribute_layers/new GET /attribute_layers/new.json | def new
@attribute_layer = AttributeLayer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @attribute_layer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @attribute_layer = @palette.attribute_layers.new(attribute_layer_params)\n\n respond_to do |format|\n if @attribute_layer.save\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully created.' }\n format.json { render action: 'show',... | [
"0.74107754",
"0.72874194",
"0.7249065",
"0.6979873",
"0.69274044",
"0.6707557",
"0.66481906",
"0.654877",
"0.65133905",
"0.6489432",
"0.6458325",
"0.6393509",
"0.63915044",
"0.6276942",
"0.62678933",
"0.62502575",
"0.62313426",
"0.6210743",
"0.6210738",
"0.61891913",
"0.6162... | 0.8384585 | 0 |
POST /attribute_layers POST /attribute_layers.json | def create
@attribute_layer = AttributeLayer.new(params[:attribute_layer])
puts "---------------------------------------------"
respond_to do |format|
if @attribute_layer.save
format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully created.' }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @attribute_layer = @palette.attribute_layers.new(attribute_layer_params)\n\n respond_to do |format|\n if @attribute_layer.save\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully created.' }\n format.json { render action: 'show',... | [
"0.7487247",
"0.7067765",
"0.6627036",
"0.6584556",
"0.64409095",
"0.6434468",
"0.6163704",
"0.6119112",
"0.6110361",
"0.6081864",
"0.5999241",
"0.5813739",
"0.5635491",
"0.5634665",
"0.5620239",
"0.55829895",
"0.55353117",
"0.55306417",
"0.53876394",
"0.53647935",
"0.5355117... | 0.7271413 | 1 |
PUT /attribute_layers/1 PUT /attribute_layers/1.json | def update
@attribute_layer = AttributeLayer.find(params[:id])
respond_to do |format|
if @attribute_layer.update_attributes(params[:attribute_layer])
format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n respond_to do |format|\n if @attribute_layer.update(attribute_layer_params)\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully updated.' }\n form... | [
"0.70928246",
"0.61750615",
"0.61469525",
"0.6109116",
"0.6054067",
"0.6015945",
"0.59012794",
"0.5866781",
"0.57476956",
"0.57473683",
"0.5736305",
"0.5688928",
"0.5678348",
"0.56328326",
"0.55455166",
"0.5520123",
"0.5506935",
"0.5453642",
"0.5444925",
"0.5439787",
"0.54197... | 0.73572767 | 0 |
DELETE /attribute_layers/1 DELETE /attribute_layers/1.json | def destroy
@attribute_layer = AttributeLayer.find(params[:id])
@attribute_layer.destroy
respond_to do |format|
format.html { redirect_to attribute_layers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n @attribute_layer.destroy\n respond_to do |format|\n format.html { redirect_to palette_attribute_layers_url(@palette) }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@ru = ... | [
"0.781373",
"0.7112902",
"0.69205403",
"0.69205403",
"0.6852056",
"0.68027055",
"0.6633839",
"0.6602867",
"0.65760803",
"0.65646964",
"0.6536001",
"0.65137297",
"0.65132",
"0.6476078",
"0.647183",
"0.6430505",
"0.63926697",
"0.6387401",
"0.63489807",
"0.634379",
"0.63427657",... | 0.8094902 | 0 |
returns a list with differences between two templates | def difference(rt1, rt2)
return template_tags(rt1) - template_tags(rt2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_difference(rt)\n return marc.all_tags.map{|e| e.tag}.uniq - template_tags(rt).uniq\n end",
"def list\n templates.map{ |t| t.name }.sort_by{ |a|\n i = a.index('@')\n i ? [a[i+1..-1], a] : [a, a]\n }\n end",
"def changes_from_template\n changes_from_docume... | [
"0.7825533",
"0.61621785",
"0.61226743",
"0.6049139",
"0.60303223",
"0.5883453",
"0.58786225",
"0.57578564",
"0.5737683",
"0.5683475",
"0.56676024",
"0.5628493",
"0.5593245",
"0.5575563",
"0.5574201",
"0.55715275",
"0.5569721",
"0.55592567",
"0.5520335",
"0.5504637",
"0.55020... | 0.77025473 | 1 |
return difference between existing tags and tags of the new template | def template_difference(rt)
return marc.all_tags.map{|e| e.tag}.uniq - template_tags(rt).uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference(rt1, rt2)\n return template_tags(rt1) - template_tags(rt2)\n end",
"def diff_list(tag_name_list)\n exist_list = Tag.all.pluck(:name)\n tag_name_list - exist_list\n end",
"def tags_to_add\n current_tags - linked_tags\n end",
"def tags_to_remove\n linked_tags - curr... | [
"0.8013168",
"0.6506995",
"0.63771826",
"0.6185425",
"0.61215717",
"0.61044395",
"0.6034408",
"0.5876528",
"0.58526963",
"0.5808123",
"0.57862246",
"0.577773",
"0.5774749",
"0.5773152",
"0.5652374",
"0.5642741",
"0.56372523",
"0.55819124",
"0.55467564",
"0.55306196",
"0.55277... | 0.797055 | 1 |
Restore a backup tag from 599; probably never used due to template incompatibility | def restore_tags
marc.by_tags("599").each do |t|
new_content = t.fetch_first_by_tag("a").content
if new_content =~ /=[0-9]{3}\s{2}/
tag, content = new_content.split(" ")
marc.parse_marc21(tag[1..4], content)
t.destroy_yourself
end
end
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_tag(tag)\n marc.by_tags(tag).each do |t|\n new_599 = MarcNode.new(Source, \"599\", \"\", \"4#\")\n ip = marc.get_insert_position(\"599\")\n new_599.add(MarcNode.new(Source, \"a\", \"#{t.to_s.strip}\", nil))\n new_599.sort_alphabetically\n marc.root.children.insert(ip, new_599... | [
"0.65160346",
"0.57408595",
"0.56575525",
"0.56227595",
"0.5478151",
"0.5465818",
"0.5405911",
"0.5238993",
"0.509508",
"0.5048554",
"0.50258774",
"0.4970628",
"0.4961201",
"0.49090227",
"0.48997426",
"0.48997426",
"0.48805273",
"0.48805273",
"0.48541296",
"0.48430324",
"0.48... | 0.5893796 | 1 |
Moving tags which are not part of the target template to a holding or to 599 as temp storage | def change_template_to(rt)
template_difference(rt).each do |e|
if e == '852'
create_holding
else
backup_tag(e)
end
end
self.record_type = rt
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_tag(tag)\n marc.by_tags(tag).each do |t|\n new_599 = MarcNode.new(Source, \"599\", \"\", \"4#\")\n ip = marc.get_insert_position(\"599\")\n new_599.add(MarcNode.new(Source, \"a\", \"#{t.to_s.strip}\", nil))\n new_599.sort_alphabetically\n marc.root.children.insert(ip, new_599... | [
"0.59977907",
"0.5498224",
"0.54850596",
"0.54386735",
"0.54386735",
"0.5372725",
"0.53447247",
"0.5339016",
"0.5325439",
"0.5296333",
"0.5286172",
"0.5284614",
"0.52667695",
"0.5232261",
"0.5206687",
"0.5190803",
"0.5152664",
"0.5139368",
"0.5127076",
"0.5112749",
"0.5083071... | 0.59868336 | 1 |
Easy method to calculate the percentage of used tags of a template | def tag_rate
marc.load_source false
((marc.all_tags.map{|e| e.tag}.uniq.size.to_f / (template_tags(record_type).uniq.size.to_f * 100)) * 100).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n tags= Tag.find_all_with_article_counters(20)\n total= tags.inject(0) {|total,tag| total += tag[:article_counter] }\n average = total.to_f / tags.size.to_f\n sizes = tags.inject({}) {|h,tag| h[tag[:name]] = (tag[:article_counter].to_f / average); h} # create a percentage\n # apply a lower ... | [
"0.67622185",
"0.62887716",
"0.6198711",
"0.6170837",
"0.6094978",
"0.60116404",
"0.59656537",
"0.5952613",
"0.5927743",
"0.5912968",
"0.5907246",
"0.58817786",
"0.58460903",
"0.581814",
"0.5813026",
"0.5792468",
"0.57368886",
"0.56930023",
"0.56496304",
"0.56465",
"0.563096"... | 0.74017155 | 0 |
There should be an error with the duration format | def should_be_wrong_on_duration_format(wrong_song = @wrong_song)
validate_column_errors(wrong_song, :duration, false, 'activerecord.errors.models.song.attributes.duration.invalid_format')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_duration\n if ui_duration.present? && ui_duration&.respond_to?(:include?)\n if ui_duration == 'N/A'\n self.duration = nil\n self.ui_duration = ''\n elsif ui_duration.tr('0-9', '').length > 0 # expect there is some delimiter\n delimiter = ui_duration.tr('0-9', '')... | [
"0.76124537",
"0.7040206",
"0.69137615",
"0.6793205",
"0.674298",
"0.6724656",
"0.66388893",
"0.6596238",
"0.6578303",
"0.6570081",
"0.65654135",
"0.65436804",
"0.65317076",
"0.65108883",
"0.65049297",
"0.64295685",
"0.6386839",
"0.6353039",
"0.635273",
"0.63429344",
"0.62616... | 0.72865766 | 1 |
There should be an error if the of song is less or equal than 0 | def should_be_wrong_on_n_album_value(wrong_song = @wrong_song)
validate_column_errors(wrong_song, :n_album, false, 'errors.messages.greater_than', :count=>0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_song_length\n if self.length > 10 then\n self.errors.add(:length, \"is longer than 10 minutes...Calm down Free Bird.\")\n elsif self.length < 1 then\n self.errors.add(:length, \"is shorter than 1 minute...C'MON MAN!\")\n end\n end",
"def test_room_starts_with_no_songs\n assert_eq... | [
"0.66608953",
"0.64055175",
"0.6326705",
"0.61138743",
"0.59263784",
"0.576193",
"0.5731439",
"0.5701372",
"0.56917065",
"0.56506646",
"0.56506646",
"0.56280804",
"0.56267124",
"0.5611954",
"0.5594122",
"0.55793935",
"0.55786854",
"0.5578101",
"0.5564321",
"0.55633056",
"0.55... | 0.69651717 | 0 |
Have the function ABCheck(str) take the str parameter being passed and return the string true if the characters a and b are separated by exactly 3 places anywhere in the string at least once (ie. "lane borrowed" would result in true because there is exactly three characters between a and b). Otherwise return the string... | def ABCheck(str)
str =~ /a...b/ || str =~ /b...a/ ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ABCheck(str)\n str.match?(/a.{3}b/) || str.match?(/b.{3}a/)\nend",
"def ABCheck(str)\n\n return \"true\" if str=~(/a...b/) or str=~(/b...a/)\n return \"false\"\n \nend",
"def abCheck(str)\n\treturn false if(str.include?('a') == false || str.include?('b') == false || str.rindex('b') < str.rindex(... | [
"0.876359",
"0.8190788",
"0.8073621",
"0.7719317",
"0.7494464",
"0.7479125",
"0.7369406",
"0.7226343",
"0.70352924",
"0.6747668",
"0.6585306",
"0.65542865",
"0.65087175",
"0.6494732",
"0.6490071",
"0.64835626",
"0.6453357",
"0.6440847",
"0.64350724",
"0.63982296",
"0.639576",... | 0.82180387 | 1 |
Have the function WordCount(str) take the str string parameter being passed and return the number of words the string contains (ie. "Never eat shredded wheat" would return 4). Words will be separated by single spaces. | def WordCount(str)
str.split(" ").count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WordCount(str)\n\twords = str.split(\" \").count\n\treturn words\nend",
"def wordCounter(inputString)\n inputString.scan(/\\w+/).length\nend",
"def WordCount(string)\n string.scan(/\\w+/).count\nend",
"def word_count(string)\n words = string.split(/\\W+/) #split on any non-word char. Thanks Rubular.co... | [
"0.89500123",
"0.86187196",
"0.8612002",
"0.8525554",
"0.8446864",
"0.844616",
"0.8371299",
"0.8360744",
"0.8358089",
"0.824558",
"0.8227717",
"0.81846863",
"0.81730646",
"0.80608886",
"0.8028142",
"0.8014641",
"0.79968244",
"0.79944557",
"0.7943152",
"0.7879829",
"0.7867023"... | 0.8859508 | 1 |
Have the function ExOh(str) take the str parameter being passed and return the string true if there is an equal number of x's and o's, otherwise return the string false. Only these two letters will be entered in the string, no punctuation or numbers. For example: if str is "xooxxxxooxo" then the output should return fa... | def ExOh(str)
str.scan("x").count == str.scan("o").count ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ExOh(str)\n\n return true if str.scan(/x/).size == str.scan(/o/).size\n return false \n \nend",
"def XO(str)\n exes = str.downcase.count('x')\n ohs = str.downcase.count('o')\n exes == ohs ? true : false\nend",
"def ExesAndOhs(string)\n \n counter_x = string.chars.count { |x| x =... | [
"0.86377835",
"0.82319397",
"0.8230648",
"0.82204753",
"0.8170948",
"0.8158809",
"0.8156606",
"0.80862814",
"0.80744016",
"0.806264",
"0.79746556",
"0.7919636",
"0.79123974",
"0.78828144",
"0.77795196",
"0.775904",
"0.7731061",
"0.73415",
"0.7263471",
"0.7133726",
"0.6729279"... | 0.8597745 | 1 |
Have the function ArrayAdditionI(arr) take the array of numbers stored in arr and return the string true if any combination of numbers in the array can be added up to equal the largest number in the array, otherwise return the string false. For example: if arr contains [4, 6, 23, 10, 1, 3] the output should return true... | def ArrayAdditionI(arr)
largest = arr.sort!.pop
(2..arr.length).each {|i| arr.combination(i).to_a.each {|x| return true if x.inject(:+) == largest}}
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrayAdditionI(arr)\n\tarrSum = 0\n\tlargestNum = arr.sort.pop\n\tarr.each{|x| arrSum += x if(x < largestNum) }\n\tif(arrSum >= largestNum || arr.include?(arrSum - largestNum))\n\t\treturn true\n\telse \n\t\treturn false\n\tend\nend",
"def ArrayAdditionI(arr)\n i = 2\n while i < arr.length\n cs = arr.co... | [
"0.8442841",
"0.8111648",
"0.8106658",
"0.81005573",
"0.78581285",
"0.7114421",
"0.69017124",
"0.6795212",
"0.67081547",
"0.6707958",
"0.669943",
"0.66427624",
"0.65865076",
"0.6571029",
"0.657036",
"0.65678585",
"0.6564673",
"0.65621233",
"0.6552452",
"0.6549897",
"0.6544097... | 0.86289096 | 0 |
Have the function SwapCase(str) take the str parameter and swap the case of each character. For example: if str is "Hello World" the output should be hELLO wORLD. Let numbers and symbols stay the way they are. | def SwapCase(str)
str.swapcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SwapCase(str)\n\tstr.swapcase\nend",
"def SwapCase(str)\n\n return str.swapcase! \n \nend",
"def swap_case(str)\n str.swapcase\nend",
"def swapcase(str)\n swap_chars = str.chars.map do |char|\n if char =~ /[a-z]/\n char.upcase\n elsif char =~ /[A-Z]/\n char.downcase\n else\n... | [
"0.8891396",
"0.87227154",
"0.8602987",
"0.858417",
"0.85441434",
"0.8537297",
"0.8523317",
"0.85113204",
"0.8501437",
"0.850089",
"0.84833854",
"0.84632814",
"0.841235",
"0.83750355",
"0.8373884",
"0.8357406",
"0.83462083",
"0.83456373",
"0.83374435",
"0.8319049",
"0.8311565... | 0.8738551 | 1 |
Have the function OffLineMinimum(strArr) take the strArr parameter being passed which will be an array of integers ranging from 1...n and the letter "E" and return the correct subset based on the following rules. The input will be in the following format: ["I","I","E","I",...,"E",...,"I"] where the I's stand for intege... | def OffLineMinimum(strArr)
batch = []
result = []
strArr.each do |i|
if i == "E"
batch.sort!
result << batch.shift
else
batch << i.to_i
end
end
result.join(",")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off_line_minimum(strArr)\n \nend",
"def offline_min(str_arr)\n mins = []\n \n until not str_arr.include?\"E\"\n \n current = str_arr.slice(0...str_arr.index(\"E\")).map {|a| a.to_i }\n mins << current.min\n str_arr.delete_at(current.index(current.min))\n str_arr.delete_at(str_arr.index(\"E... | [
"0.7238821",
"0.68244624",
"0.56105584",
"0.5452836",
"0.5418985",
"0.53876245",
"0.5359936",
"0.53485805",
"0.534018",
"0.5272546",
"0.5264545",
"0.5226041",
"0.51923174",
"0.51155317",
"0.5110059",
"0.5101615",
"0.5100817",
"0.50999737",
"0.50928885",
"0.5092607",
"0.509019... | 0.80917203 | 0 |
Have the function ChangingSequence(arr) take the array of numbers stored in arr and return the index at which the numbers stop increasing and begin decreasing or stop decreasing and begin increasing. For example: if arr is [1, 2, 4, 6, 4, 3, 1] then your program should return 3 because 6 is the last point in the array ... | def ChangingSequence(arr)
idx = 2
while idx < arr.length
if arr[1] > arr[0] && arr[idx] < arr[idx-1]
return idx - 1
elsif arr[1] < arr[0] && arr[idx] > arr[idx-1]
return idx - 1
end
idx += 1
end
-1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ChangingSequence(arr)\n largest_num = arr.max if arr.max != arr.last\n smallest_num = arr.min if arr.min != arr.first\n indexed_array = arr\n index_for_output = 0\n indexed_array.size.times do |idx|\n if indexed_array[idx] == largest_num\n index_for_output = idx\n elsif indexed_array[idx] == sma... | [
"0.8275342",
"0.79876053",
"0.721506",
"0.66025513",
"0.6590161",
"0.65767485",
"0.6375443",
"0.63282365",
"0.63223684",
"0.62790924",
"0.61951363",
"0.6145416",
"0.6139534",
"0.61037934",
"0.6099242",
"0.6085686",
"0.6009556",
"0.59926707",
"0.5982423",
"0.5978982",
"0.59671... | 0.8406192 | 0 |
Have the function HammingDistance(strArr) take the array of strings stored in strArr, which will only contain two strings of equal length and return the Hamming distance between them. The Hamming distance is the number of positions where the corresponding characters are different. For example: if strArr is ["coder", "c... | def HammingDistance(strArr)
hamming = 0
(0...strArr[0].length).each do |i|
if strArr[0][i] != strArr[1][i]
hamming += 1
end
end
hamming
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HammingDistance(arr)\n first_str = arr[0].chars\n sec_str = arr[1].chars\n hamm_dis_count = []\n (0..first_str.size).each do |index|\n if first_str[index] != sec_str[index]\n hamm_dis_count << first_str[index]\n end\n end\n hamm_dis_count.size\nend",
"def hamming_distance(arr)\n count = 0\n... | [
"0.89302593",
"0.84099627",
"0.8251154",
"0.79598063",
"0.7915821",
"0.75948745",
"0.7204176",
"0.69932574",
"0.6980326",
"0.6947303",
"0.69046456",
"0.68398124",
"0.6803937",
"0.67208457",
"0.67063504",
"0.6693851",
"0.66871095",
"0.66397756",
"0.65906096",
"0.6586478",
"0.6... | 0.90394247 | 0 |
Have the function RectangleArea(strArr) take the array of strings stored in strArr, which will only contain 4 elements and be in the form (x y) where x and y are both integers, and return the area of the rectangle formed by the 4 points on a Cartesian grid. The 4 elements will be in arbitrary order. For example: if str... | def RectangleArea(strArr)
pool = strArr.join.scan(/(-?[0-9]+)/).flatten.map{|i|i.to_i}
rec_l = [pool[1], pool[3], pool[5], pool[7]].sort
rec_w = [pool[0], pool[2], pool[4], pool[6]].sort
length = (rec_l[-1] - rec_l[0]).abs
width = (rec_w[-1] - rec_w[0]).abs
length * width
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectangle_area(str_arr)\n str_arr = str_arr.sort.map do |co_ord|\n co_ord.delete('()').split.map(&:to_i)\n end\n width = str_arr[2][0] - str_arr[0][0]\n height = str_arr[1][1] - str_arr[0][1]\n width * height\nend",
"def RectangleArea(strArr)\n\n # code goes here\n return strArr \n \nend",
... | [
"0.86365765",
"0.7488066",
"0.7114782",
"0.6585374",
"0.6445318",
"0.6435562",
"0.63478214",
"0.6234204",
"0.6205837",
"0.6082435",
"0.60757804",
"0.60726416",
"0.5971879",
"0.5956973",
"0.59361166",
"0.59360874",
"0.5909885",
"0.5895338",
"0.58946514",
"0.5873527",
"0.585749... | 0.86180985 | 1 |
Have the function BitwiseOne(strArr) take the array of strings stored in strArr, which will only contain two strings of equal length that represent binary numbers, and return a final binary string that performed the bitwise OR operation on both strings. A bitwise OR operation places a 0 in the new string where there ar... | def BitwiseOne(strArr)
result = ""
first = strArr[0]
second = strArr[1]
idx = 0
while idx < strArr[0].length
if first[idx] == "0" && second[idx] == "0"
result << "0"
else
result << "1"
end
idx += 1
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BitwiseOne(strArr)\n first = strArr[0]\n second = strArr[1]\n third = \"\"\n \n i = 0 \n while i < first.length\n # When i change this line to first[i] == \"0\" &&\n # second[i] == \"0\"\n # all tests passes. Why????????????????????????\n if first[i] == second[i]\n \t third << \"0... | [
"0.7820862",
"0.77656883",
"0.75368595",
"0.71487653",
"0.7120717",
"0.65298414",
"0.64599407",
"0.6386743",
"0.63338184",
"0.6322576",
"0.6283897",
"0.61651385",
"0.61217976",
"0.60727185",
"0.59535116",
"0.5947428",
"0.5947428",
"0.5934803",
"0.5882967",
"0.5875591",
"0.587... | 0.8900529 | 0 |
Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression. The replacement should always be a string that may include references to the matched data from the rule. | def plural(rule, replacement)
@uncountables.delete(rule) if rule.is_a?(String)
@uncountables.delete(replacement)
@plurals.insert(0, [rule, replacement])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plural(rule, replacement, term: :noun)\n @plurals[term] << [Regexp.new(rule, \"i\"), replacement]\n end",
"def plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.prepend([rule, replacement])\n end",... | [
"0.78080434",
"0.7742466",
"0.7742466",
"0.6821922",
"0.6346475",
"0.60990644",
"0.60030764",
"0.5988815",
"0.5988815",
"0.5988815",
"0.5951694",
"0.5951694",
"0.5802258",
"0.57173264",
"0.5604747",
"0.55871576",
"0.5529318",
"0.55205214",
"0.5496508",
"0.54935265",
"0.549352... | 0.7810321 | 1 |
Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used for strings, not regular expressions. You simply pass the irregular in singular and plural form. Examples: irregular 'octopus', 'octopi' irregular 'person', 'people' | def irregular(singular, plural)
@uncountables.delete(singular)
@uncountables.delete(plural)
if singular[0,1].upcase == plural[0,1].upcase
plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1])
plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def irregular(singular, plural)\n @uncountables.delete(singular)\n @uncountables.delete(plural)\n if singular[0,1].upcase == plural[0,1].upcase\n plural(Regexp.new(\"(#{singular[0,1]})#{singular[1..-1]}$\", \"i\"), '\\1' + plural[1..-1])\n singular(Regexp.new(\"(#{plural[0,1]... | [
"0.7030382",
"0.68373466",
"0.6829547",
"0.6032925",
"0.533286",
"0.53180796",
"0.52982855",
"0.5174435",
"0.5102942",
"0.5102942",
"0.506334",
"0.49950776",
"0.49806598",
"0.4969743",
"0.49688318",
"0.4962685",
"0.49353704",
"0.49353704",
"0.4886441",
"0.4886441",
"0.4886441... | 0.709308 | 1 |
Yields a singleton instance of Inflector::Inflections so you can specify additional inflector rules. Example: ActiveSupport::Inflector.inflections do |inflect| inflect.uncountable "rails" end | def inflections
if block_given?
yield Inflections.instance
else
Inflections.instance
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inflections(&block)\n self.inflector = Dry::Inflector.new(&block)\n end",
"def inflections(locale = :en)\n if block_given?\n yield Inflections.instance(locale)\n else\n Inflections.instance(locale)\n end\n end",
"def inflections(locale = :en)\n if block_given?\n... | [
"0.84448296",
"0.75030327",
"0.75030327",
"0.74915546",
"0.6609839",
"0.6407881",
"0.6310196",
"0.5966587",
"0.5891092",
"0.57575756",
"0.5672936",
"0.5591746",
"0.5591746",
"0.552714",
"0.54611117",
"0.5440463",
"0.5435907",
"0.5389456",
"0.5340996",
"0.5317171",
"0.5317171"... | 0.81235486 | 1 |
Returns the plural form of the word in the string. Examples: "post".pluralize => "posts" "octopus".pluralize => "octopi" "sheep".pluralize => "sheep" "words".pluralize => "words" "CamelOctopus".pluralize => "CamelOctopi" | def pluralize(word)
result = word.to_s.dup
if word.empty? || inflections.uncountables.include?(result.downcase)
result
else
inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralize(word); end",
"def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each do |(rule, replacement)| \n break if result.gsub!(rule, replacement)\n end\n res... | [
"0.7946014",
"0.7911394",
"0.781301",
"0.7726993",
"0.7504775",
"0.7433464",
"0.7432608",
"0.7393196",
"0.73691964",
"0.73340625",
"0.7229642",
"0.72228944",
"0.7188824",
"0.715763",
"0.71571136",
"0.71439284",
"0.71365833",
"0.70461816",
"0.7046087",
"0.7040973",
"0.7017895"... | 0.79619825 | 0 |
Create the name of a table like Rails does for models to table names. This method uses the +pluralize+ method on the last word in the string. Examples "RawScaledScorer".tableize => "raw_scaled_scorers" "egg_and_ham".tableize => "egg_and_hams" "fancyCategory".tableize => "fancy_categories" | def tableize(class_name)
pluralize(underscore(class_name))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tableize(class_name)\n pluralize(underscore(class_name))\n end",
"def tableize\n ActiveSupport::Inflector.tableize(self)\n end",
"def tableize\n MotionSupport::Inflector.tableize(self)\n end",
"def tableize\n # TODO\n # Inflector.demodulize(self)\n end",
"def tableize(cla... | [
"0.77947557",
"0.7709205",
"0.7704614",
"0.7609139",
"0.7597267",
"0.7144776",
"0.7144776",
"0.7026408",
"0.6959079",
"0.67928153",
"0.67635965",
"0.6677879",
"0.6660683",
"0.6626601",
"0.65631896",
"0.65254426",
"0.63863564",
"0.63222194",
"0.6292972",
"0.6196061",
"0.619606... | 0.77983093 | 0 |
sends command to device specified by house and unit string | def send_command(house_and_unit, command)
house_code, unit_code = select_code(house_and_unit)
@marshaller.send(X10_PREFIX + house_code + unit_code + ADDRESS_SUFFIX)
@marshaller.send(X10_PREFIX + house_code + COMMAND_CODE_TABLE[command] +
COMMAND_SUFFIX)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command room, device, state\n # @todo get the device name in here...\n device = device.to_s\n # Command structure is <transaction number>,<Command>|<Action>|<State><cr>\n if room and device and !device.empty? and state\n '666,!' + room['id'] + room['device'][device]['id'] + state + '|Turn ' + ... | [
"0.6718429",
"0.65288377",
"0.616005",
"0.6111367",
"0.6023167",
"0.5968998",
"0.59442085",
"0.5939962",
"0.589631",
"0.5865999",
"0.5840754",
"0.58213866",
"0.581998",
"0.5792267",
"0.576323",
"0.5737349",
"0.5736398",
"0.5719393",
"0.57139874",
"0.5667166",
"0.56522506",
... | 0.7755489 | 0 |
If the node's outputs were a glob, this checks the filesystem to figure out what files were actually generated. If it inherits the outputs of the child tasks, merge them into our own outputs. | def update_outputs!
if @node.inherit_outputs?
@outputs = Files::State.new(self.children_outputs)
else
# After the task has finished, we update the output states:
@outputs.update!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n a... | [
"0.61902183",
"0.60885745",
"0.6060476",
"0.60425824",
"0.6028378",
"0.5927726",
"0.5831355",
"0.5787972",
"0.57427794",
"0.5717381",
"0.5717381",
"0.55824757",
"0.557813",
"0.55356634",
"0.55004394",
"0.54938304",
"0.5447012",
"0.539719",
"0.5375322",
"0.5365952",
"0.5362394... | 0.6842185 | 0 |
this maps the collection of ownership patterns and owners to actual files | def ownerships(opts = {})
log("Calculating ownerships for #{opts.inspect}", opts)
patowns = pattern_owners(codeowners_data(opts), opts)
if opts[:no_git]
files = files_to_own(opts)
ownerships_by_ruby(patowns, files, opts)
else
ownerships_by_gitignore(patowns, opts)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end",
"def raw_git_owner_info(patterns)\n Tempfile.open('codeowner_patterns') do |file|\n file.write(patterns.join(\"\\n\"))\n file.r... | [
"0.6481528",
"0.6344063",
"0.6334546",
"0.6269659",
"0.6266739",
"0.61751676",
"0.5767878",
"0.5761254",
"0.5613436",
"0.558959",
"0.55473715",
"0.5522545",
"0.5511881",
"0.5499399",
"0.5484818",
"0.5464924",
"0.5446044",
"0.5429246",
"0.5364181",
"0.5350322",
"0.5348318",
... | 0.6381984 | 1 |
helper stuff read the github file and spit out a slightly formatted list of patterns and their owners Empty/invalid/commented lines are still included in order to preserve line numbering | def pattern_owners(codeowner_data, opts = {})
patterns = []
codeowner_data.split("\n").each_with_index do |line, i|
stripped_line = line.strip
if stripped_line == "" || stripped_line.start_with?("#")
patterns << ['', ''] # Comment / empty line
elsif stripped_line.start_wit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pattern_owners\n codeowner_path = search_codeowners_file\n patterns = []\n File.read(codeowner_path).split(\"\\n\").each_with_index { |line, i|\n path_owner = line.split(/\\s+@/, 2)\n if line.match(/^\\s*(?:#.*)?$/)\n patterns.push ['', ''] # Comment/empty line\n el... | [
"0.697968",
"0.6659487",
"0.63301414",
"0.6329259",
"0.62027866",
"0.59135514",
"0.5814424",
"0.5770643",
"0.57456535",
"0.57145345",
"0.570866",
"0.5644526",
"0.56380725",
"0.5622957",
"0.5611697",
"0.5600058",
"0.5583383",
"0.5574372",
"0.5556163",
"0.5526969",
"0.5522296",... | 0.73951983 | 0 |
To use a CODEOWNERS file, create a new file called CODEOWNERS in the root, docs/, or .github/ directory of the repository, in the branch where you'd like to add the code owners. if we have access to git, use that to figure out our current repo path and look in there for codeowners if we don't, this function will attemp... | def codeowners_data(opts = {})
if opts[:codeowner_data]
return opts[:codeowner_data]
elsif opts[:codeowner_path]
return File.read(opts[:codeowner_path]) if File.exist?(opts[:codeowner_path])
elsif opts[:no_git]
path = Dir.pwd.split(File::SEPARATOR)
while !path.empty?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applicable_owners_files\n CACHE.cache_block('arb_commit/' + self.sha1 + '/' + 'applicable_owners_files', 0) do\n raise \"not in review repository\" unless exists_in_review_repository?\n\n affected_dirs = changed_files.map { |f| File.dirname(f) }.uniq\n \n owners_files = affected_dirs.\n ... | [
"0.6246969",
"0.62448615",
"0.5823841",
"0.58187634",
"0.58045083",
"0.56965464",
"0.5683067",
"0.56341493",
"0.5535774",
"0.5217722",
"0.51736337",
"0.5172623",
"0.5172623",
"0.50834656",
"0.50177383",
"0.498906",
"0.49500358",
"0.49301404",
"0.4927886",
"0.49202052",
"0.488... | 0.69599557 | 0 |
POST /art_tags POST /art_tags.json | def create
@art_tag = ArtTag.new(art_tag_params)
respond_to do |format|
if @art_tag.save
format.html { redirect_to @art_tag, notice: 'Art tag was successfully created.' }
format.json { render :show, status: :created, location: @art_tag }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'... | [
"0.7240396",
"0.67703766",
"0.6641631",
"0.65967894",
"0.6569093",
"0.6504169",
"0.640354",
"0.63740045",
"0.6372033",
"0.6365447",
"0.6328999",
"0.63249576",
"0.62712634",
"0.6266826",
"0.6252997",
"0.62510777",
"0.6250392",
"0.62453896",
"0.62378365",
"0.6221187",
"0.621952... | 0.68982446 | 1 |
PATCH/PUT /art_tags/1 PATCH/PUT /art_tags/1.json | def update
respond_to do |format|
if @art_tag.update(art_tag_params)
format.html { redirect_to @art_tag, notice: 'Art tag was successfully updated.' }
format.json { render :show, status: :ok, location: @art_tag }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n e... | [
"0.6962989",
"0.67886025",
"0.66820383",
"0.661751",
"0.6571411",
"0.65701026",
"0.65183216",
"0.64894754",
"0.64203614",
"0.6415638",
"0.6406275",
"0.63783765",
"0.63159287",
"0.6301376",
"0.6282384",
"0.6267339",
"0.62638336",
"0.62607497",
"0.62568074",
"0.6243805",
"0.622... | 0.68936586 | 1 |
DELETE /art_tags/1 DELETE /art_tags/1.json | def destroy
@art_tag.destroy
respond_to do |format|
format.html { redirect_to art_tags_url, notice: 'Art tag was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end",
"def delete(tag)\n api_client.tags.multi_delete(resource... | [
"0.7277975",
"0.72362167",
"0.7211264",
"0.7196518",
"0.71165353",
"0.7075563",
"0.70714647",
"0.70547533",
"0.70513666",
"0.7049769",
"0.7034731",
"0.70232165",
"0.70160204",
"0.7001642",
"0.7001642",
"0.7001642",
"0.6985803",
"0.6981432",
"0.6969298",
"0.6961142",
"0.696006... | 0.73651093 | 0 |
POST /contributors POST /contributors.json | def create
@contributor = Contributor.new(contributor_params)
if @contributor.save
render :show, status: :created, location: @contributor
else
render json: @contributor.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_contributors\n @hash[:contributors].each do |json_contrib|\n my_hash = json_contrib.slice('contributor_name', 'contributor_type', 'created_at', 'updated_at', 'award_number')\n @ar_resource.contributors << StashDatacite::Contributor.create(my_hash)\n # btw affiliations for ... | [
"0.6670093",
"0.62659705",
"0.6239934",
"0.6198608",
"0.6186133",
"0.6163758",
"0.6139115",
"0.6017873",
"0.6003645",
"0.5986704",
"0.57870245",
"0.5784634",
"0.57396066",
"0.57388324",
"0.5733809",
"0.57124615",
"0.56854373",
"0.5678733",
"0.5663967",
"0.5663967",
"0.5663967... | 0.7071534 | 0 |
GET /perform_backups GET /perform_backups.json | def index
@perform_backups = PerformBackup.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_backups(site_id, datum = nil)\n current_path = \"/api/v1/sites/#{site_id}/backups\"\n pb = SFRest::Pathbuilder.new\n @conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s\n end",
"def backups\n if args.count == 0\n list_backups\n else\n command = shift_argume... | [
"0.70753354",
"0.69240874",
"0.64683545",
"0.6416198",
"0.6393956",
"0.6385545",
"0.62964517",
"0.61483026",
"0.6101925",
"0.60574675",
"0.59670067",
"0.5956557",
"0.58649534",
"0.5854035",
"0.58430004",
"0.5749153",
"0.5705625",
"0.57033575",
"0.56589913",
"0.56550735",
"0.5... | 0.7071741 | 1 |
This function returns a string that displays the current week range, based on the team's firstdayofweek setting | def get_week_string
team = @user.team
start_of_week = Time.now.beginning_of_week(team.start_of_week_symbol)
end_of_week = Time.now.end_of_week(team.start_of_week_symbol)
start_string = start_of_week.strftime("%d %b %Y")
end_string = end_of_week.strftime("%d %b %Y")
start_string + " - " + end_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beginning_of_week; end",
"def beginning_of_week; end",
"def start_week\n start_date.strftime('%W').to_i\n end",
"def day_of_week\n\tif @current_time.wday == 0 || @current_time.wday == 6\n\t\tweek_period = \"Weekends\"\n\telse\n\t\tweek_period = \"Weekdays\"\n\tend\nend",
"def week_result_string(day... | [
"0.7627012",
"0.7627012",
"0.71351403",
"0.7067318",
"0.70121557",
"0.70016605",
"0.6949517",
"0.69129455",
"0.6893058",
"0.6886711",
"0.6863883",
"0.6742692",
"0.6741516",
"0.67184705",
"0.67115337",
"0.6673561",
"0.666817",
"0.6667355",
"0.66362655",
"0.6635758",
"0.6632768... | 0.84764755 | 0 |
Private: Take the content and process it through Markdown. Cache it. Returns TrueClass. | def cache_markdown_content
self.markdown_content = GitHub::Markdown.render(content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end",
"def markdown\n @markdown ||= process_markdown!\n end",
"def convert_markdown\n # self.content_html = Kramdown::Document.new(content).to_html\n self.content_html = markdown(content)\n end",
... | [
"0.73491484",
"0.7030425",
"0.69360274",
"0.68867725",
"0.68225324",
"0.67839766",
"0.66862494",
"0.6670732",
"0.66018593",
"0.65604454",
"0.6499014",
"0.6451486",
"0.6431196",
"0.6431196",
"0.64131755",
"0.6362703",
"0.6353831",
"0.6353831",
"0.6301316",
"0.62403077",
"0.621... | 0.78009886 | 0 |
true if either of status or description or both are different | def discrepancy?(local, remote)
local.status != remote['status'] ||
local.ad_description != remote['description']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includes_description?\n !long_desc.empty? || !desc.empty?\n end",
"def acceptable?\n status.to_sym.in? [StatusReponded]\n end",
"def not_approved?\n status_map = employee_vacation_responses.map(&:status).uniq\n status_map.size == 1 && status_map.include?(\"not_approved\")\n end",
"def ... | [
"0.62089175",
"0.60525364",
"0.59846336",
"0.5874727",
"0.58463365",
"0.5844662",
"0.5831774",
"0.5824308",
"0.58226645",
"0.58162725",
"0.5809268",
"0.58025837",
"0.58017445",
"0.5786038",
"0.57560974",
"0.575115",
"0.5747735",
"0.57474184",
"0.57425386",
"0.5723443",
"0.571... | 0.7503411 | 0 |
strips the meta data from a field so that it is no longer readable. leaves the metatags property on the object intact however field:: A Symbol corresponding to the field on this object to strip. Defaults to the description field. | def strip_readable_meta ( field = :description )
self[field].scan(LEWTLedger::MATCH_MULTIPLE_META_REGEX).each do |m|
self[field].slice!(m).strip!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_string_fields\n all_fields = self.get_array_of_symbolic_keys\n # stripping\n all_fields.each do |field|\n unless self[field].nil?\n if self[field].class == String\n self[field] = self[field].strip\n end\n end\n end\n end",
"def clean_data( field )\n\tfield.... | [
"0.6209361",
"0.5990455",
"0.58668494",
"0.5821879",
"0.5709197",
"0.56629705",
"0.56134504",
"0.55356014",
"0.54993457",
"0.54423964",
"0.5404814",
"0.53379333",
"0.53002995",
"0.52985454",
"0.5289343",
"0.52876955",
"0.52732843",
"0.5249204",
"0.52403",
"0.5239396",
"0.5231... | 0.78767204 | 0 |
this function extracts all tags/values from a given string. string [String]:: a string to search for meta tags in. | def parse_tags (string)
tags = nil
string.scan(LEWTLedger::MATCH_SINGLE_META_REGEX) { |t|
if tags == nil
tags = Hash.new
end
tag_value = parse_tag_value t[0]
tag_name = parse_tag_name t[0]
tags[tag_name.gsub(/\W/,"_").to_sym] = tag_value
}
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_text_for_meta(text)\r\n # break up the text with some extra newlines to make matching more likely\r\n # and strip out some tags\r\n text.gsub!(/<br/, \"\\n<br\")\r\n text.gsub!(/<p/, \"\\n<p\")\r\n text.gsub!(/<\\/?span(.*?)?>/, '')\r\n text.gsub!(/<\\/?div(.*?)?>/, '')\r\n\r... | [
"0.67412686",
"0.6407475",
"0.64054745",
"0.6187387",
"0.6183463",
"0.6060359",
"0.6004481",
"0.59469825",
"0.5937417",
"0.5888159",
"0.5878244",
"0.58709806",
"0.58258337",
"0.58206016",
"0.57157516",
"0.5715501",
"0.5693958",
"0.5677439",
"0.56761503",
"0.5663385",
"0.56519... | 0.77468455 | 0 |
parses the name of a tag and returns it as a symbol to be used as a hash key tag [string] a string containing the a singular meta tag. | def parse_tag_name( tag )
match_name = /[^=]*/
m = tag.match(match_name)
return m[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tagname_symbol\n @tagname\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def to_sym\n self.tag\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def _tag_name\n @tag_name\n end",
"def tag_name\n return... | [
"0.7576155",
"0.7013119",
"0.6987753",
"0.6986859",
"0.6956297",
"0.68972677",
"0.68659246",
"0.6808434",
"0.6807889",
"0.68038976",
"0.67593277",
"0.670867",
"0.670867",
"0.670867",
"0.6696054",
"0.6580402",
"0.6563046",
"0.6538821",
"0.6517697",
"0.6462939",
"0.6445415",
... | 0.71047175 | 1 |
extracts a mathematical expression from a single tag format: Num +/ Num string:: the string to extract the fraction from | def extract_fraction ( string )
match_fraction = /(\d{1,})([\/\+])(\d{1,})+/
# m = string.match(match_fraction)[0]
m = string.match(match_fraction)
value = nil
if m != nil
value = Rational m[0]
end
return value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_expression(expression)\n if expression.count(\"a-zA-Z\") > 0\n result = \"Incorrect expression or Number\"\n else\n expression = expression.gsub('/', '*1.0/') if expression.include?(\"/\")\n result = eval(expression).round(2)\n end\n result\n end",
"def calculate str\n as... | [
"0.6410246",
"0.62995255",
"0.6243231",
"0.622659",
"0.6140983",
"0.6134576",
"0.61240894",
"0.61015075",
"0.61015075",
"0.6077909",
"0.6067399",
"0.6062985",
"0.6049504",
"0.60353273",
"0.5989603",
"0.5976603",
"0.59293586",
"0.5923835",
"0.5917157",
"0.5911231",
"0.5881463"... | 0.73577005 | 0 |
GET /areas GET /areas.xml | def index
@areas = Area.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @areas }
format.json {render :json => @areas}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @area }\n end\n end",
"def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :x... | [
"0.6694957",
"0.6694957",
"0.668683",
"0.6678448",
"0.6648974",
"0.6624093",
"0.64477986",
"0.6316839",
"0.6204598",
"0.61896354",
"0.6177351",
"0.6122083",
"0.61079425",
"0.60862327",
"0.60821307",
"0.60779876",
"0.60776937",
"0.60476613",
"0.60455006",
"0.6039731",
"0.60294... | 0.72328097 | 0 |
GET /areas/new GET /areas/new.xml | def new
@area = Area.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @area }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end",
"def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render jso... | [
"0.76568425",
"0.7175821",
"0.70477766",
"0.70477766",
"0.70362586",
"0.70019346",
"0.6818052",
"0.67239827",
"0.67076266",
"0.6675978",
"0.66484386",
"0.6646048",
"0.66091365",
"0.65835524",
"0.6563556",
"0.65548724",
"0.65456337",
"0.65450054",
"0.6543472",
"0.653868",
"0.6... | 0.7650926 | 1 |
PUT /areas/1 PUT /areas/1.xml | def update
@area = Area.find(params[:id])
respond_to do |format|
if @area.update_attributes(params[:area])
flash[:notice] = 'Area was successfully updated.'
format.html { redirect_to(@area) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @area = Area.find(params[:id])\n \n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area actualizado correctamente.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :acti... | [
"0.6410856",
"0.6384846",
"0.63053644",
"0.63053644",
"0.63053644",
"0.61739045",
"0.6122322",
"0.6122322",
"0.59582716",
"0.5875499",
"0.5841774",
"0.57423276",
"0.5738485",
"0.5698895",
"0.56285596",
"0.5619221",
"0.5589899",
"0.5578848",
"0.5577936",
"0.55620617",
"0.54647... | 0.6549098 | 0 |
def jasper send_doc_xml(xml, '/records/record', 'directorio', 'Directorio', | def jasper
param=Hash.new {|k, v| k[v] = {:tipo=>"",:valor=>""}}
param["PDIRECCION"]={:tipo=>"String", :valor=>"DIRECCION DE INFORMATICA"}
param["PDEPARTAMENTO"]={:tipo=>"String", :valor=>"DEPARTAMENTO DE BASE DE DATOS"}
send_doc_xml(xml,'/records/record', 'directorio','Directorio',param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_request( xml )\n write( xml )\n read\n end",
"def send_xml(filename, xml)\n send_data xml,\n filename: filename,\n type: 'text/xml; charset=UTF-8;',\n disposition: 'attachment;'\n end",
"def storeRecord\n @doc[:xml_display] = @xml.to_xml\n end",... | [
"0.62114716",
"0.60725754",
"0.5960064",
"0.5960064",
"0.59567064",
"0.59205145",
"0.58485335",
"0.5790174",
"0.5708926",
"0.566242",
"0.56293",
"0.56049407",
"0.55978394",
"0.55817145",
"0.5574788",
"0.556254",
"0.5521902",
"0.55146384",
"0.5438292",
"0.5437214",
"0.5432905"... | 0.75981283 | 0 |
Visualize real time tweet locations to given output dir. | def visualize_real_time_topics(auth, topics, output_dir = "plots")
rserve_setup
@output_dir = output_dir
FileUtils.mkdir_p output_dir
@buffer = Array.new
@client = Twitter::Streaming::Client.new do |config|
config.consumer_key = auth[:consumer_key]
config.consumer_secret = aut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_results(generated_files: true)\n @end_time = Time.now\n tree = if generated_files\n [' ',\n \"Generated files: #{@out_dir}\",\n ' ',\n TTY::Tree.new(@out_dir).render]\n else\n ''\n end\n puts\n ... | [
"0.60087085",
"0.59309494",
"0.5828771",
"0.5811919",
"0.57917863",
"0.56043845",
"0.55675924",
"0.55351996",
"0.5484866",
"0.54670066",
"0.54670066",
"0.54403",
"0.52702457",
"0.5256494",
"0.5229374",
"0.5229109",
"0.5224105",
"0.520672",
"0.5196536",
"0.5191142",
"0.5188054... | 0.6256422 | 0 |
Visualize locations of historical tweets of topic. | def visualize_historical_topics(auth, query, num_results = 100,
output_dir = "plots")
rserve_setup
@output_dir = output_dir
FileUtils.mkdir_p output_dir
@buffer = Array.new
@client = Twitter::REST::Client.new do |config|
config.consumer_key = auth[:cons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n en... | [
"0.66060793",
"0.65736413",
"0.6358143",
"0.6330129",
"0.6183507",
"0.6151924",
"0.61120796",
"0.60805863",
"0.60325646",
"0.60261446",
"0.5902962",
"0.58634603",
"0.58480746",
"0.58227384",
"0.5756547",
"0.5752943",
"0.5735585",
"0.57340425",
"0.56957614",
"0.5679816",
"0.56... | 0.6827585 | 0 |
Connects to rserve and sets it working directory. | def rserve_setup
# Connect to Rserve and verify connection
@rserve = Rserve::Simpler.new
v = @rserve.eval("R.version.string");
puts "Connected to #{v.as_string}"
# Set working directory.
@rserve.eval("setwd('#{Dir.pwd}')")
contents = File.read('plot.R')
@rserve.eval(contents)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def working_directory=(directory)\n @link.WorkingDirectory = directory.tr('/', \"\\\\\")\n end",
"def run\n @active_connections = 0\n @mutex = Mutex.new\n\n logger.info \"Starting server on #{server_configuration.bind}\"\n\n establish_socket_server\n write_pidfile\n setup_si... | [
"0.5622574",
"0.5610432",
"0.56008565",
"0.5549133",
"0.55180097",
"0.5501794",
"0.54801846",
"0.54790545",
"0.5463042",
"0.5452361",
"0.5446953",
"0.5343728",
"0.53413576",
"0.53349644",
"0.53312236",
"0.53299475",
"0.53201616",
"0.5282503",
"0.52662665",
"0.5259591",
"0.525... | 0.6436405 | 0 |
Plots tweet locations. Returns true if plot created, otherwise false. | def plot_tweet_locations(to_time = Time.now)
# Remove old elements from buffer
while !@buffer.empty? and @buffer.first[:ttl] < Time.now do
@buffer.shift
end
return false if @buffer.empty?
data = Hash[:lat, Array.new(0), :long, Array.new(0)]
@buffer.each do |tweet|
data[:lat] << twe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tweet_plot\n tweets = FeedEntry.mark_isolates(self.retweet_ids,self)\n \n Gnuplot.open do |gp|\n Gnuplot::Plot.new(gp) do |plot|\n plot.terminal \"svg\"\n plot.output id.to_s + \".svg\"\n plot.data = []\n r = Hash.new\n s = Hash.new\n i = Hash.new\... | [
"0.6096057",
"0.51900303",
"0.50184697",
"0.5011648",
"0.5001993",
"0.4931558",
"0.49234962",
"0.48768905",
"0.47698054",
"0.47612417",
"0.46937764",
"0.46230945",
"0.46100405",
"0.4591894",
"0.45870614",
"0.45870614",
"0.45781988",
"0.4556874",
"0.4556874",
"0.45514578",
"0.... | 0.7296215 | 0 |
GET /parametrages GET /parametrages.json | def index
@parametrages = Parametrage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(params = {})\n @client.get(\"#{path}/values\", params)\n end",
"def params\n @json['params']\n end",
"def index\n @parametros = Parametro.all\n end",
"def get_all()\n @params\n end",
"def index\n @tp_parameters = TpParameter.all\n\n respond_to do |format|\n ... | [
"0.66662294",
"0.6638993",
"0.6508276",
"0.642957",
"0.641588",
"0.6404685",
"0.6349463",
"0.6323128",
"0.6323128",
"0.62029046",
"0.6192506",
"0.6192359",
"0.61921984",
"0.61859995",
"0.61613876",
"0.61472714",
"0.6138496",
"0.6128719",
"0.60555184",
"0.59976965",
"0.5976248... | 0.6660616 | 1 |
POST /parametrages POST /parametrages.json | def create
@parametrage = Parametrage.new(parametrage_params)
respond_to do |format|
if @parametrage.save
format.html { redirect_to @parametrage, notice: 'Parametrage was successfully created.' }
format.json { render :show, status: :created, location: @parametrage }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prueba_json_params\n params[:prueba_json]\n end",
"def create\n @parametro = Parametro.new(parametro_params)\n @parametro.observacion = @parametro.multiparametro('Ingresa 1', 'Ingresa 2', 'Ingresa 3')\n respond_to do |format|\n if @parametro.save\n format.html { redirect_to @para... | [
"0.62984025",
"0.6262985",
"0.6085754",
"0.604669",
"0.60322213",
"0.5973994",
"0.59584236",
"0.5921536",
"0.591264",
"0.58757645",
"0.5862191",
"0.5828073",
"0.5820941",
"0.5813594",
"0.5805147",
"0.5788846",
"0.57858294",
"0.5779461",
"0.5768407",
"0.57639176",
"0.57525283"... | 0.63578707 | 0 |
PATCH/PUT /parametrages/1 PATCH/PUT /parametrages/1.json | def update
respond_to do |format|
if @parametrage.update(parametrage_params)
format.html { redirect_to @parametrage, notice: 'Parametrage was successfully updated.' }
format.json { render :show, status: :ok, location: @parametrage }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if... | [
"0.6598373",
"0.6313709",
"0.62666947",
"0.61980593",
"0.61980593",
"0.6181181",
"0.61338323",
"0.61323875",
"0.6096609",
"0.6079762",
"0.6059919",
"0.6029709",
"0.6029135",
"0.60154754",
"0.59763885",
"0.59666",
"0.59666",
"0.59512085",
"0.59491557",
"0.59350383",
"0.5925283... | 0.6647301 | 0 |
DELETE /parametrages/1 DELETE /parametrages/1.json | def destroy
@parametrage.destroy
respond_to do |format|
format.html { redirect_to parametrages_url, notice: 'Parametrage was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @parameter = Parameter.find(params[:id])\n @parameter.destroy\n\n respond_to do |format|\n format.html { redirect_to parameters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_status_parametrizacao = Core::StatusParametrizacao.find(params[:id])\... | [
"0.71572995",
"0.71520627",
"0.70152825",
"0.6979409",
"0.69372916",
"0.6863571",
"0.68584454",
"0.685587",
"0.6842345",
"0.6804088",
"0.6782214",
"0.6652317",
"0.6646298",
"0.6625906",
"0.6597523",
"0.65884364",
"0.65848094",
"0.65722555",
"0.65619135",
"0.6560774",
"0.65577... | 0.7324612 | 0 |
This is used internally to process the the question and parameters that sent to the question. | def process_question(question_with_parameters)
parsed_elements = question_with_parameters.scan(GROUP_REGEX)
@question = parsed_elements.first.first
# After the target, question type, question, and answer length has been determined
# look at all the single quoted items to find the list of param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_question\n\t\t#There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n\t\tif @line.start_with? \"how many Credits is \"\n\t\t\tmain_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets gl... | [
"0.6226992",
"0.6220192",
"0.61548465",
"0.6121073",
"0.6084718",
"0.6075611",
"0.60524905",
"0.60308796",
"0.60302967",
"0.6000497",
"0.5998383",
"0.5968966",
"0.5968036",
"0.59661555",
"0.59481835",
"0.5892453",
"0.58848804",
"0.58846444",
"0.58800733",
"0.58441514",
"0.579... | 0.73944557 | 0 |
Flushes all messages to the Kafka brokers. Depending on the value of `required_acks` used when initializing the producer, this call may block until the specified number of replicas have acknowledged the writes. The `timeout` setting places an upper bound on the amount of time the call will block before failing. | def flush
messages_for_broker = {}
@buffered_messages.each do |message|
broker = @broker_pool.get_leader(message.topic, message.partition)
messages_for_broker[broker] ||= []
messages_for_broker[broker] << message
end
messages_for_broker.each do |broker, messages|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def force_flush(timeout: nil)\n writer.force_flush(timeout: timeout) if writer.respond_to? :force_flush\n Export::SUCCESS\n end",
"def flush( queue_name )\n # It can take a long time to flush all of the messages\n # on a server, so we'll set the read timeout to something\n ... | [
"0.57876164",
"0.5282538",
"0.5279535",
"0.5270456",
"0.49578023",
"0.49291092",
"0.48671773",
"0.482185",
"0.47933996",
"0.47818503",
"0.47560918",
"0.47422543",
"0.47337854",
"0.4705692",
"0.46751207",
"0.46090877",
"0.45957473",
"0.45793983",
"0.45344672",
"0.45344484",
"0... | 0.62779224 | 0 |
Declare a set function for a pair of dtypes | def dtypes_set_function dtype_i, dtype_j
str = <<SETFN
static void #{dtypes_function_name(:set, dtype_i, dtype_j)}(size_t n, char* p1, size_t i1, char* p2, size_t i2) {
for (; n > 0; --n) {
#{dtypes_assign(dtype_i, dtype_j)}
p1 += i1; p2 += i2;
}
}
SETFN
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_qualifier_keys( set ); end",
"def FXMAPTYPES(typelo, typehi, func)\n addMapEntry(MKUINT(MINKEY, typelo), MKUINT(MAXKEY, typehi), func)\n end",
"def set(values); end",
"def create_setters\n schema_fields.keys.each do |key|\n self.class.send(:define_method, \"#{key.to_s}=\".to_sym) do |... | [
"0.5259052",
"0.5134491",
"0.5080035",
"0.506463",
"0.50546515",
"0.50309443",
"0.49844247",
"0.49504444",
"0.49197853",
"0.4915668",
"0.49132717",
"0.49034014",
"0.4896863",
"0.48899552",
"0.4842843",
"0.4837773",
"0.4833141",
"0.48084515",
"0.47671697",
"0.47671595",
"0.474... | 0.7226789 | 0 |
Takes a list of declarations and cleans it for insertion in a header file. Removes inline keyword Removes static functions Removes variable names | def process_declarations declarations
declarations.map do |d|
process_declaration d
end.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_declaration declaration\n tokens = declaration.split(' ')\n\n return nil if tokens.include?('static')\n declaration = tokens.delete_if { |t| t == 'inline'}.join(' ')\n\n tokens = declaration.split('(')\n arg_list = tokens.last.split(')').first\n\n # Remove variable names\n... | [
"0.6632059",
"0.5461924",
"0.54266375",
"0.54266375",
"0.54266375",
"0.54266375",
"0.53643423",
"0.5319585",
"0.5277111",
"0.5266107",
"0.5245171",
"0.5243462",
"0.5238946",
"0.5238946",
"0.5228421",
"0.52026165",
"0.52004236",
"0.5199896",
"0.5177197",
"0.5175378",
"0.515389... | 0.6214326 | 1 |
Helper for process_declarations that works on a single function prototype. Removes variable names Removes inline keyword Returns nil if declaration is static, otherwise returns corrected prototype | def process_declaration declaration
tokens = declaration.split(' ')
return nil if tokens.include?('static')
declaration = tokens.delete_if { |t| t == 'inline'}.join(' ')
tokens = declaration.split('(')
arg_list = tokens.last.split(')').first
# Remove variable names
args = ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_function_name(line)\n /(\\s*def\\s*)(\\S[^\\(]*)(\\(.*)/.match(line)\nend",
"def consume_declaration(input = T.unsafe(nil)); end",
"def detect_function(d)\n if d[:body] =~ /[;\\{]/\n d[:type] = :file\n d[:decl] = \"\"\n\n proto = d[:body].split(/[;\\{]/, 2).first.strip\n ... | [
"0.52369106",
"0.52021605",
"0.51711315",
"0.5165953",
"0.51296794",
"0.51277936",
"0.5084219",
"0.5027348",
"0.5021174",
"0.50051385",
"0.4998555",
"0.49187663",
"0.49090204",
"0.49020508",
"0.48797026",
"0.48459277",
"0.4845182",
"0.48037097",
"0.47820604",
"0.4779445",
"0.... | 0.6804525 | 0 |
A list that provides details about the pending maintenance actions for the resource. | def pending_maintenance_action_details
data.pending_maintenance_action_details
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_maintenance(opts = {})\n data, _status_code, _headers = list_maintenance_with_http_info(opts)\n return data\n end",
"def index\n @maintenances = Maintenance.not_expired\n end",
"def action_list\n case\n when no_servers_or_positive_balance? then clear_notifications\n ... | [
"0.69377005",
"0.67883795",
"0.6785492",
"0.648623",
"0.64184266",
"0.6387241",
"0.6299356",
"0.6151939",
"0.61399925",
"0.6052113",
"0.59828323",
"0.59791803",
"0.59536475",
"0.59138256",
"0.5895699",
"0.5895699",
"0.58566976",
"0.5855374",
"0.58221895",
"0.5815838",
"0.5753... | 0.7492023 | 0 |
Override this method to define your query | def query; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n super\n end",
"def initialize\n super(\"query\")\n end",
"def query\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def to_query(_model)\n raise 'subclasses should implement this method.'\n end",
"def query\n @operation = :query\n ... | [
"0.83135086",
"0.77335954",
"0.76337665",
"0.7523034",
"0.73779196",
"0.73275566",
"0.7017944",
"0.7001741",
"0.6972929",
"0.6870267",
"0.6870267",
"0.67949146",
"0.6773889",
"0.6746119",
"0.6713775",
"0.6713775",
"0.6713775",
"0.6713747",
"0.67085385",
"0.6668631",
"0.665981... | 0.7828738 | 1 |
Create the torrent after the site is built | def after_build(builder)
torrent = Torrent.new options.tracker
torrent.defaultdir = options.name
torrent.set_private if options.private
# Move to build_dir so it's not added to the torrent
within_build_path do
app.sitemap.resources.each do |file|
# We decode the path be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end",
"def add_torrent(info)\r\n hash = { \"torrent-file\"=>info[0], \"file-dir\"=>info[1], \"download-dir\"=>info[2] }\r\n @torrents[\"torrent#{@torrents.length}\"] = hash\r\n @file_des... | [
"0.614721",
"0.6045362",
"0.5801728",
"0.5796103",
"0.5751159",
"0.5571135",
"0.5521312",
"0.5498561",
"0.5456376",
"0.5406971",
"0.53939956",
"0.5380164",
"0.5379817",
"0.53789026",
"0.5361563",
"0.5351798",
"0.53282934",
"0.5321348",
"0.531415",
"0.5311328",
"0.53026813",
... | 0.6911082 | 0 |
Move to build dir for the block | def within_build_path(&block)
Dir.chdir app.config.build_dir do
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_build_step(&block)\n\t\t\t@project.post_build_steps << [block, Dir.pwd]\n\t\tend",
"def build_working_dir(&block)\n file_name =\n if block.respond_to?(:source_location)\n block.source_location[0]\n else\n eval(\"__FILE__\", block.binding)\n end\n\n @worki... | [
"0.6473651",
"0.63888645",
"0.6380053",
"0.6232129",
"0.6231429",
"0.6183314",
"0.61091894",
"0.6024885",
"0.58681",
"0.57284164",
"0.57081604",
"0.5706366",
"0.56836075",
"0.5674697",
"0.5668901",
"0.5667944",
"0.55256456",
"0.55207163",
"0.54514784",
"0.5449114",
"0.5441577... | 0.67182255 | 0 |
Returns the 'components' object for a supported/unsupported scanner's report | def build_components_object
info = @scan_report.to_h.fetch(:info)
return [] unless info[:dependencies]
components = []
info[:dependencies].each do |dependency|
components << parse_dependency(dependency)
end
components
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_components\n @available_components ||= {}\n end",
"def components\r\n params = {\r\n method: :get,\r\n url: '/report/components',\r\n params: {\r\n reportUUID: @uuid\r\n }\r\n }\r\n @session.request(params).perform!\r\n end",
"def... | [
"0.6074879",
"0.57135725",
"0.56114036",
"0.56114036",
"0.5501453",
"0.5483188",
"0.54390734",
"0.53063494",
"0.5201584",
"0.5133518",
"0.50706005",
"0.5060667",
"0.5060483",
"0.5024374",
"0.5001388",
"0.49968192",
"0.49118775",
"0.49118775",
"0.49118775",
"0.49118775",
"0.49... | 0.6637152 | 0 |
The gamemode of the HighScore ===== Presentation This is the class' constructor, it only gives the variables their value taken from the parameters. ===== Attributes +idDiff+ The id of the Difficulty of the HighScore +player+ The Player of the HighScore +score+ The score of the HighScore +idMode+ The id of the Gamemode ... | def initialize(idDiff, player, score, idMode)
@id_difficulty_highScores, @player_highScores = idDiff, player
@score_highScores, @id_gamemode_highScores = score, idMode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(id, name)\n @id_gamemode,@name_gamemode = id, name\n end",
"def initialize\n\t\t@mult = 1.1\n @name = 'High Low'\n @min = 1\n @game_money = $player.wallet.amount #game_money\n @game_bet = 0\n\tend",
"def game_score(score)\n end",
"def set_high_score\n @high_score = High... | [
"0.6501723",
"0.6165515",
"0.61601603",
"0.61308026",
"0.61065686",
"0.6096823",
"0.608935",
"0.60407454",
"0.601565",
"0.59946513",
"0.5993365",
"0.59889495",
"0.59747374",
"0.5966681",
"0.5957694",
"0.58965176",
"0.5872978",
"0.58109224",
"0.57563645",
"0.57481015",
"0.5740... | 0.78483534 | 0 |
+api_key+:: your skycore api key (string) +shortcode+:: shortcode you want to send from (string or number) +debug+:: print debug logs to stdout (bool, default is false) | def initialize(api_key, shortcode, debug=false)
@api_key = api_key
@shortcode = shortcode
@debug = debug
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_shortcode(shortcode)\n if request.accept?('application/json') || request.accept?('application/vnd.api+json')\n response.headers['Content-Type'] = 'application/vnd.api+json'\n JSONAPI::Serializer.serialize(shortcode).to_json\n else\n shortcode.name + ' (' + shortcode.destin... | [
"0.6124084",
"0.5868977",
"0.57447684",
"0.57390755",
"0.5711361",
"0.5703179",
"0.56831974",
"0.56508917",
"0.557465",
"0.5522519",
"0.54976374",
"0.54963815",
"0.5449971",
"0.5401922",
"0.5394662",
"0.5352558",
"0.53431267",
"0.5341074",
"0.5309259",
"0.5282919",
"0.5260981... | 0.71520764 | 0 |
send saved MMS on Skycore servers, send it later +to+:: Phone number with leading +1 (String) +mms_id+:: MMS ID (string), can be grabbed from +save_mms+(...)['MMSID'] +fallback_text+:: SMS fallback text content (will be sent if no MMS is available). Required even if provided in +save_mms+ (only skycore knows why) +opti... | def send_saved_mms(to, mms_id, fallback_text, options={})
operator_id = options[:operator_id]
subject = options[:subject]
content = options[:content]
do_request builder.build_send_saved_mms(@shortcode, to, mms_id, fallback_text,
operator_id, subject, content)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_send_saved_mms(from, to, mms_id, fallbacksmstext, operator_id, subject=nil, content=nil)\n x = Builder::XmlMarkup.new\n x.instruct!\n x.REQUEST {\n x.ACTION \"sendSavedMMS\"\n x.API_KEY @api_key\n x.MMSID mms_id\n x.TO to\n x.FALLBACKSMSTEXT fallbacksmste... | [
"0.7504088",
"0.6535704",
"0.65137106",
"0.61389536",
"0.607703",
"0.6050291",
"0.59626323",
"0.5943984",
"0.5939706",
"0.5939093",
"0.588992",
"0.5882967",
"0.5850821",
"0.5822323",
"0.5809111",
"0.5742818",
"0.5717446",
"0.5698843",
"0.5690335",
"0.56792825",
"0.5639355",
... | 0.8444671 | 0 |
This function extract the data from given url to csv file and returns true if success else if the url contains no more data it returns false | def extractDataFromURL(starturl, csv)
#To set SSL certificate
#system('set SSL_CERT_FILE=C:/RailsInstaller/cacert.pem')
outputArr = Array.new
begin
file = open(starturl)
doc = Nokogiri::HTML(file) do
# handle doc
page = Nokogiri::HTML(open(starturl))
dataString = page.css('p').inner_ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_from_url\n debug \"Get CSV from url: '#{@resource[:url]}'\"\n begin\n csv = Net::HTTP.get URI.parse @resource[:url]\n return unless csv\n return if csv.empty?\n csv\n rescue\n nil\n end\n end",
"def get_metadata(csv_url, id)\n begin\n open(csv_url) do |u|\n ... | [
"0.68930197",
"0.6159754",
"0.61181456",
"0.6089054",
"0.60357493",
"0.5955257",
"0.5869278",
"0.5851416",
"0.580596",
"0.5693323",
"0.5652554",
"0.5629089",
"0.5591768",
"0.5553653",
"0.5551898",
"0.5501297",
"0.54916185",
"0.5451879",
"0.5447685",
"0.53867745",
"0.5384309",... | 0.65732294 | 1 |
find sum of squares of array of numbers | def sum_of_squares
inject(0) do |sum, elem|
sum + (elem ** 2)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_squares(array)\n array.each.map{|num total += num*num}.reduce(:+) #is like fold_left. reduce works on array or collection of enumerables\nend",
"def sum_square_array(arr)\n arr.reduce(:+) ** 2\nend",
"def sum_of_squares(numbers)\n numbers.map { |x| x * x }.reduce(0) { |acc, x| acc + x }\nend",
... | [
"0.8258856",
"0.8082352",
"0.79921716",
"0.7902999",
"0.78904045",
"0.78805125",
"0.787128",
"0.78691",
"0.7857537",
"0.7838961",
"0.7793936",
"0.7753166",
"0.77516305",
"0.7738297",
"0.77158284",
"0.7705763",
"0.76667553",
"0.7646278",
"0.7622576",
"0.7600961",
"0.75935155",... | 0.8241846 | 1 |
helper method to initialize every nonstore cup with four stones each | def place_stones
# iterate through array and place 4 stones in all cups, except player stores
@cups.each_with_index do |cup, idx|
unless (idx == 6 || idx == 13)
4.times do
cup << :stone
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_stones\n # helper method to #initialize every non-store cup with four stones each\n #non-store: 0-5, store, 7-13, store\n cups.each_index do |i|\n cups[i] = :stone,:stone,:stone,:stone if i < 6 || i.between?(7,12)\n end\n end",
"def initialize(name1, name2)\n @player_1_name = name... | [
"0.7306267",
"0.6425018",
"0.6195315",
"0.6099121",
"0.6095636",
"0.6053886",
"0.604493",
"0.6035354",
"0.5922095",
"0.5867079",
"0.5810461",
"0.57877344",
"0.5763426",
"0.5752549",
"0.5746629",
"0.5712919",
"0.57026935",
"0.569856",
"0.5691848",
"0.5682647",
"0.5675142",
"... | 0.64710253 | 1 |
return name of winner with most stones in respective cup, :draw otherwise | def winner
count1, count2 = @cups[6].count, @cups[13].count
if count1 > count2
@name1
elsif count2 > count1
@name2
else
:draw
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n $the_win_comb = { flash_straight: flash_straight, for_of_kind: four_of_kind, full_house: full_house,\n flush: flush, straight: straight, three: three, two_pair: two_pair,\n one_pair: one_pair, high_card: high_card }\n puts \"\\n The highest winner combin... | [
"0.69315696",
"0.6544136",
"0.65327466",
"0.6383339",
"0.6350693",
"0.62933767",
"0.62247336",
"0.61688673",
"0.6163639",
"0.61479205",
"0.6112319",
"0.6101422",
"0.60942054",
"0.6091604",
"0.6091074",
"0.6084351",
"0.6077207",
"0.60764015",
"0.6073439",
"0.6059641",
"0.60533... | 0.7892122 | 0 |
Initializer Method params: x,y,w,h: parameters for parent GameObject initializer solid: parameter that determines upon creation whether the character is in solid form or not. Event tiks are set to 0 by default recoil frames by default is 35 frames, e.g. the character recoils for 35 frames. Invincibility frames is set t... | def initialize(x, y, w, h, solid)
super(x, y, w, h)
@event_tiks = 0
@recoil_frames = 35
@recoil_magnitude = 4
@inv_frames = 0
@dying_frames = 20
@solid = solid
@floater = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(animation, pos, health, weapon)\n super(animation, pos)\n @health = health\n @weapon = weapon\n @invincibility = 0\n end",
"def initialize(**args)\n @position = Position.new(args.fetch(:x, 0), args.fetch(:y, 0), args.fetch(:z, 0))\n @velocity = Velocity.new(args.fetch(:vx, 0), a... | [
"0.6326617",
"0.62241375",
"0.6052062",
"0.60055333",
"0.60047036",
"0.5959816",
"0.58974123",
"0.5884391",
"0.58756435",
"0.5874231",
"0.58519",
"0.5793427",
"0.5768155",
"0.5767563",
"0.5766023",
"0.57587063",
"0.57482404",
"0.5741189",
"0.57279825",
"0.571827",
"0.57181233... | 0.72491264 | 0 |
Changes the direction the char is facing. Similar to change_state params: dir: The dir of the new direction. | def change_dir(dir)
@face_dir = dir
@sprite.change_dir(dir)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_direction(dir)\n @direction = dir unless @turned\n @turned = true\n end",
"def turn(dir, val)\n\ti_now = $directions.index($direction)\n\ti_change = dir == \"R\" ? (val / 90 * 1) : (val / 90 * -1)\n\ti_new = (i_now + i_change) % 4\n\t$direction = $directions[i_new]\nend",
"def set_direction(d)\r... | [
"0.75093424",
"0.66219294",
"0.65599877",
"0.65560925",
"0.6474414",
"0.6449539",
"0.6338762",
"0.6326416",
"0.63213956",
"0.62699646",
"0.6260746",
"0.6245424",
"0.61796993",
"0.61643946",
"0.6115455",
"0.60408527",
"0.6032176",
"0.602567",
"0.6016946",
"0.5976615",
"0.59508... | 0.68976337 | 1 |
Defines the behaviour of the character when it is impacted. params: away_from: x,y coordinates that specify the point of origin of the attack. attack_dmg: the damage to be subtracted from the character's remaining health Damage is subtracted from current health. An angle with respect to x,y axis is calculated between t... | def impacted(away_from, attack_dmg)
@current_hp -= attack_dmg
@vect_angle = Gosu.angle(away_from[0], away_from[1], @hb.x, @hb.y)
@vect_v = @recoil_magnitude
change_state(GameStates::States::RECOILING)
@event_tiks = @current_hp > 0 ? @recoil_frames : 18
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20... | [
"0.54997903",
"0.52660763",
"0.5204878",
"0.5204857",
"0.5199827",
"0.5167765",
"0.5163949",
"0.5157595",
"0.5140228",
"0.5104614",
"0.5058402",
"0.50374657",
"0.5016156",
"0.5015596",
"0.49472263",
"0.49467564",
"0.4932828",
"0.48924303",
"0.48895365",
"0.4884655",
"0.486145... | 0.7607196 | 0 |
Overrides parent class update method. This override only implements unclipping functionality. It calls basic move function. Each 4 global frames, the character attepts to unclip from other game objects. This action is not performed if the the char is either dying or attacking, or if it has invincibility frames. It subt... | def update
move
if $WINDOW.global_frame_counter%4 == 0 && !(dying? || attacking?) && @inv_frames <= 0
unclip
end
@event_tiks -=1 unless @event_tiks <= 0
if recoiling? && @vect_v > 0
fraction_event_tiks = @event_tiks.to_f/@recoil_frames.to_f
fraction_bigger_than = 1.00/3.00
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if idle?\n if Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) < 150\n # If distance is 150 or less, behaviour changes to approaching\n change_state(GameStates::States::WALKING)\n @vect_v = 1\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player... | [
"0.67446184",
"0.62284464",
"0.62221855",
"0.6132903",
"0.6115018",
"0.6105459",
"0.60806507",
"0.6061137",
"0.60456353",
"0.6041559",
"0.60351086",
"0.59274536",
"0.5920768",
"0.58887434",
"0.58744407",
"0.5837045",
"0.5804349",
"0.57737523",
"0.5771884",
"0.57691765",
"0.57... | 0.7588233 | 0 |
Main movement method. It uses velocity attributes to determine whether the char can move in both axes. Changes the position of the hitbox in x and y if it can. | def move
if @vect_acc > 0 || @vect_acc < 0
if (@vect_acc > 0 && @vect_v < @max_v) || (@vect_acc < 0 && @vect_v > @max_v)
@vect_v += @vect_acc
else
@vect_v = @max_v
@vect_acc = 0
end
end
vel_x = Gosu.offset_x(@vect_angle, @vect_v)
vel_y = Gosu.offset_y(@vect_angl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevent... | [
"0.6591101",
"0.6453561",
"0.64401066",
"0.6427868",
"0.63903475",
"0.6370232",
"0.63332045",
"0.6321681",
"0.6316446",
"0.62195945",
"0.6170025",
"0.61566436",
"0.61468846",
"0.61147296",
"0.6086998",
"0.60427916",
"0.60236484",
"0.60165644",
"0.5990124",
"0.59567267",
"0.59... | 0.6518357 | 1 |
Schedule a tweet to be sent. | def schedule_tweet(text, datetime)
scheduler = Rufus::Scheduler.new
job = scheduler.schedule datetime do
puts "beep"
send_tweet(text)
end
puts "Job trigger time: #{job.time}\n"
puts "Running Jobs: #{scheduler.running_jobs}\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_tweets\n\n\t\ttweets = TweetQueue.all\n\n\t\ttweets.each do |tweet|\n\n\t\t\ttext \t\t\t= tweet.text\n\n\t\t\ttweet_source \t= {:id => tweet.source}\n\n\t\t\tnew_tweet = reply(text, tweet_source)\n\n\t\t\tunless new_tweet.is_unique?\n\t\t\t\trandom_suffix = random_chars(2)\n\t\t\t\tnew_tweet = reply(text ... | [
"0.6544477",
"0.6528381",
"0.63009185",
"0.6137791",
"0.60728383",
"0.5993537",
"0.59636927",
"0.594522",
"0.58838606",
"0.5879793",
"0.5798995",
"0.57737833",
"0.574672",
"0.574082",
"0.57346183",
"0.5732521",
"0.5711112",
"0.56945837",
"0.56826913",
"0.56745887",
"0.5673837... | 0.7658251 | 0 |
Initiate database maintenance tasks to improve database performance and consistency. A restart will be initiated in order to put the product into maintenance mode while the tasks are run. It will then restart automatically. | def db_maintenance(clean_up = false, compress = false, reindex = false)
return unless compress || clean_up || reindex
parameters = { 'cmd' => 'startMaintenance', 'targetTask' => 'dbMaintenance' }
parameters['cleanup'] = 1 if clean_up
parameters['compress'] = 1 if compress
parameters['rein... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end",
"def activate_maintenance_mode\n return unless maintenance && pending_migrations?\n callback(:activate_maintenance_mode) do\n notify(:activate_maintenance_mode)\n heroku.app... | [
"0.6513386",
"0.61461323",
"0.60578",
"0.6046109",
"0.60122",
"0.59266293",
"0.59058344",
"0.58713937",
"0.57442755",
"0.56489",
"0.56429374",
"0.5546217",
"0.55311877",
"0.55229783",
"0.5510383",
"0.5493323",
"0.54874796",
"0.548211",
"0.54308677",
"0.54237986",
"0.54083395"... | 0.68558705 | 0 |
set Special Feature Opt in value | def set_special_feature_opt_in(id, val)
if id < 1 || id > IABConsentString::GDPRConstantsV2::Core::SPECIAL_FEATURE_OPT_INS_SIZE
raise "Invalid id number", caller
end
@special_feature_opt_in[id - 1] = val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature=(value)\n @feature = value\n end",
"def special=(value)\n @special = value\n end",
"def update_value(name, value)\n feature = features.find_or_create_by!(name: name)\n\n feature.update_attributes(value: value, enabled: true)\n end",
"def ... | [
"0.66683173",
"0.61738145",
"0.59808034",
"0.58793277",
"0.58260924",
"0.5741606",
"0.5729639",
"0.5678882",
"0.5607109",
"0.5598351",
"0.5598351",
"0.5586773",
"0.55488664",
"0.55260205",
"0.55124485",
"0.55065054",
"0.54579073",
"0.5431121",
"0.5430567",
"0.54077566",
"0.53... | 0.74218655 | 0 |
set Purpose Consented value | def set_purposes_consented(id, val)
if id < 1 || id > IABConsentString::GDPRConstantsV2::Core::PURPOSES_CONSENT_SIZE
raise "Invalid id number", caller
end
@purposes_consented[id - 1] = val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_purpose=(value)\n @user_purpose = value\n end",
"def groups_set_purpose(params = {})\n fail ArgumentError, \"Required arguments 'channel' missing\" if params['channel'].nil?\n fail ArgumentError, \"Required arguments 'pupose' missing\" if params['purpos'].nil?\n ... | [
"0.6401911",
"0.6066534",
"0.5668373",
"0.56554306",
"0.5607924",
"0.5594656",
"0.5583838",
"0.55551726",
"0.5509452",
"0.5498592",
"0.5494943",
"0.54699486",
"0.54699486",
"0.54693997",
"0.54591084",
"0.5449131",
"0.54359925",
"0.5431524",
"0.54033935",
"0.539021",
"0.538653... | 0.64696234 | 0 |
init Vendor consent according to range value | def init_vendor_consent(ranged:)
@vendor_consent = VendorSectionBuilder.build(is_ranged_encoding: ranged)
@vendor_consent
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_vendor_legitimate_interest(ranged:)\n @vendor_legitimate_interest = VendorSectionBuilder.build(is_ranged_encoding: ranged)\n @vendor_legitimate_interest\n end",
"def build\n if @consentRecordCreated.nil?\n raise IABConsentString::Error::Vendor... | [
"0.62207997",
"0.61558634",
"0.58162725",
"0.5690112",
"0.5652602",
"0.5549055",
"0.5469205",
"0.5468732",
"0.54210603",
"0.53975964",
"0.5340758",
"0.5329352",
"0.5260276",
"0.5228253",
"0.52104425",
"0.5159229",
"0.515277",
"0.5138129",
"0.50888515",
"0.5086473",
"0.5078575... | 0.7899879 | 0 |
init Vendor legitimate interest according to range value | def init_vendor_legitimate_interest(ranged:)
@vendor_legitimate_interest = VendorSectionBuilder.build(is_ranged_encoding: ranged)
@vendor_legitimate_interest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_setter(min, max)\n price_range = []\n (min..max).step(5) { |x| price_range.push(x) }\n return price_range.sample\nend",
"def initialize(balance, account_holder_name)\n @interest_rate = 1.00001\n @balance = balance\n @account_holder_name = account_holder_name\n end",
"def gain_interest\n ... | [
"0.62678915",
"0.62436646",
"0.60862696",
"0.5999548",
"0.5952319",
"0.59145355",
"0.5897231",
"0.588389",
"0.5871673",
"0.5869507",
"0.5796249",
"0.5785077",
"0.5765298",
"0.5759728",
"0.5718096",
"0.57127565",
"0.56963086",
"0.5674858",
"0.56551707",
"0.56513184",
"0.563327... | 0.69512194 | 0 |
Returns top five tags for a program. First retrives tags, sorts them. Reverses list so goes in decreasing order then returns first five | def tfivetags
tag_array = self.tags
sort_array = tag_array.sort!{|a,b| a.reputation_for(:votes) <=> b.reputation_for(:votes)}
sort_array.reverse!
topfive = sort_array.take(5)
topfive
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_n(n = 10)\n logger.info(\"Top #{n} tags requested\")\n tags = @stream_parser.hash_store.fresh_tags(@config[:tag_ttl])\n HashtagExtractor.extract_tags!(tags, n, @config[:case_sensitive])\n end",
"def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end",... | [
"0.70803016",
"0.6474015",
"0.64369416",
"0.6420536",
"0.62647617",
"0.62500423",
"0.6235832",
"0.6220248",
"0.62010163",
"0.61992556",
"0.61738396",
"0.61587393",
"0.6123773",
"0.6121619",
"0.6097213",
"0.6092094",
"0.60601467",
"0.6058775",
"0.6041148",
"0.6008493",
"0.6008... | 0.7779505 | 0 |
GET /dbconnections GET /dbconnections.json | def index
@dbconnections = Dbconnection.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end",
"def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end",
"def index\... | [
"0.68958914",
"0.68502414",
"0.6650843",
"0.6650843",
"0.66237944",
"0.6618898",
"0.66081554",
"0.6596076",
"0.6533316",
"0.650765",
"0.64756715",
"0.6439214",
"0.64370644",
"0.62797177",
"0.6266524",
"0.62462723",
"0.6208384",
"0.61986357",
"0.61429733",
"0.6122683",
"0.6113... | 0.702668 | 0 |
PATCH/PUT /dbconnections/1 PATCH/PUT /dbconnections/1.json | def update
respond_to do |format|
if @dbconnection.update(dbconnection_params)
format.html { redirect_to @dbconnection, notice: 'Dbconnection was successfully updated.' }
format.json { render :show, status: :ok, location: @dbconnection }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n if @conn.update_attributes(params[:conn])\n format.html { redirect_to @conn, notice: 'Conn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action... | [
"0.6033953",
"0.5773262",
"0.5735879",
"0.56939596",
"0.5654367",
"0.5561882",
"0.54948896",
"0.545159",
"0.5427412",
"0.542106",
"0.54195255",
"0.541788",
"0.5337477",
"0.5295491",
"0.52849114",
"0.52576256",
"0.52550906",
"0.52419597",
"0.5218335",
"0.5184007",
"0.5178461",... | 0.60701644 | 0 |
DELETE /dbconnections/1 DELETE /dbconnections/1.json | def destroy
@dbconnection.destroy
respond_to do |format|
format.html { redirect_to dbconnections_url, notice: 'Dbconnection was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection.destroy\... | [
"0.69439733",
"0.69002515",
"0.6897783",
"0.6878138",
"0.6878138",
"0.687534",
"0.66737294",
"0.664973",
"0.66385597",
"0.6609321",
"0.66073114",
"0.6604616",
"0.6591177",
"0.6538945",
"0.65093905",
"0.65041196",
"0.64475095",
"0.6403054",
"0.63999814",
"0.6395681",
"0.638684... | 0.7241203 | 0 |
Updates all rows that match the filters Fusion tables API allows to update one row (or the full table) per query. | def update(filters, properties, context)
properties_query = properties.map{|k,v| "'#{k}' = '#{v}'"}.join(', ')
row_ids = query_row_ids(filters)
row_ids.each do |row_id|
body = "sql=UPDATE #{@id} SET #{properties_query} WHERE ROWID = '#{row_id}'"
connector.post "https://www.googleapis.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update fields, primaryFilter = nil, orFilter = nil, andFilter = nil, notFilter = nil\n\t\tfields.delete_if {|key, value| !@validFields.include? key}\n\n\t\tif fields.count > 0\n\t\t\tbegin\n\t\t\t\tquery = \"UPDATE #{@table} SET\"\n\t\t\t\tfields.each {|key, value| query += \" #{key}='#{value}',\"}\n\t\t\t\tti... | [
"0.67211056",
"0.63926464",
"0.61972994",
"0.61657256",
"0.61490434",
"0.6070133",
"0.6061933",
"0.6048157",
"0.60130066",
"0.5968238",
"0.5954518",
"0.5895627",
"0.5850135",
"0.58406407",
"0.58406407",
"0.5833867",
"0.58309954",
"0.58128476",
"0.5805329",
"0.57926303",
"0.57... | 0.75811315 | 0 |
Deletes all rows that match the filters Fusion tables API allows to delete one row (or the full table) per query. | def delete(filters, user)
if filters.empty?
body = "sql=DELETE FROM #{@id}"
connector.post "https://www.googleapis.com/fusiontables/v2/query", body
else
row_ids = query_row_ids(filters)
row_ids.each do |row_id|
body = "sql=DELETE FROM #{@id} WHERE ROWID = '#{row_id}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all_rows\n scan.each do |row|\n delete_row(row['key'])\n end\n end",
"def _delete_records\n @ids_to_delete.each do |table, ids|\n delete_from_table(table, ids)\n end\n end",
"def delete_all(table)\n\t\t\t\ttable.clear\n\t\t\tend",
"def flush_records!... | [
"0.68353295",
"0.6697708",
"0.6664171",
"0.65398586",
"0.63981646",
"0.629781",
"0.61911917",
"0.6163794",
"0.616038",
"0.61579424",
"0.6157443",
"0.6136011",
"0.6101532",
"0.6075276",
"0.60449356",
"0.6029529",
"0.6002066",
"0.60008585",
"0.59819615",
"0.59475535",
"0.594197... | 0.79908174 | 0 |
Public Methods Loaders Registers a loader to the registry. | def add_loader(loader)
@loaders << loader
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loader(&block)\n loader_class.class_eval(&block)\n\n self\n end",
"def initialize(loader)\n @loader = loader\n end",
"def initialize(loader)\n @loader = loader\n end",
"def loader; end",
"def add_loader(ext, loader)\n ext = \".#{ext}\" unless ext =~ /^\\./\n @loaders[... | [
"0.67400885",
"0.6655346",
"0.66453356",
"0.66352314",
"0.65428376",
"0.6492528",
"0.64635295",
"0.6419205",
"0.63150716",
"0.62103194",
"0.61982584",
"0.6175811",
"0.6127616",
"0.61166793",
"0.6102317",
"0.602925",
"0.5972352",
"0.58875895",
"0.5853569",
"0.5842131",
"0.5837... | 0.76817465 | 0 |
Unregisters a loader from the registry. | def remove_loader(loader)
@loaders.delete(loader)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unregister\n Registry.unregister_loader(self)\n ExplicitNamespace.unregister_loader(self)\n end",
"def unload(inst)\n # If the reference count drops to zero, remove it from the list of\n # loaded plugins. This will indirectly call the cleanup method on the\n # plugin.\n if (inst.der... | [
"0.79804766",
"0.6385771",
"0.6305873",
"0.6180569",
"0.61622334",
"0.61418617",
"0.6128877",
"0.6099131",
"0.59948003",
"0.59900427",
"0.59773886",
"0.59738815",
"0.59472746",
"0.590709",
"0.583442",
"0.5818676",
"0.58116984",
"0.57818645",
"0.5780053",
"0.5765094",
"0.57387... | 0.7927151 | 1 |
Retrieves a registered loader by name. | def get_loader(name)
@loaders.each do |loader|
return loader if loader.name == name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_loader(type)\n @autoloaders[type.intern]\n end",
"def loader\n @loader ||= self.respond_to?(:load) ? self : instantiate(self.class.get_loader)\n end",
"def define_loader_for(name)\n define_method(\"full_#{name}\") do\n if send(\"has_loaded_#{name}?\")\n i... | [
"0.6491453",
"0.6277739",
"0.62534773",
"0.6160453",
"0.6097052",
"0.60919476",
"0.6048855",
"0.602023",
"0.59505093",
"0.59505093",
"0.5916483",
"0.58296984",
"0.57348585",
"0.5702326",
"0.5702288",
"0.56461203",
"0.5641021",
"0.56112236",
"0.5593635",
"0.55371994",
"0.55341... | 0.89939505 | 0 |
Notifiers Registers a notifier to the registry. | def add_notifier(notifier)
@notifiers << notifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifiers\n @config.notifiers.map do |klass_name, options|\n require \"fyi/notifiers/#{klass_name}\"\n klass = constantize \"Fyi::Notifier::#{klass_name.capitalize}\"\n klass.send :new, options\n end\n end",
"def set_notifier\n @notifier = Notifier.find(params[:id])\n end",
"d... | [
"0.6517459",
"0.57836074",
"0.5659098",
"0.55722415",
"0.5369292",
"0.5369292",
"0.5358543",
"0.5326557",
"0.529803",
"0.52226776",
"0.5163124",
"0.51469606",
"0.51254463",
"0.50604784",
"0.5057388",
"0.50343305",
"0.5029732",
"0.50215644",
"0.4974399",
"0.4966373",
"0.494956... | 0.7425675 | 0 |
Unregisters a notifier from the registry. | def remove_notifier(notifier)
@notifiers.delete(notifier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_notifier(name)\n @notifiers.delete(name) if defined? @notifiers\n end",
"def unsubscribe\n unregister\n end",
"def unregister(path)\n\t\t\t\tpath = path.to_sym\n\t\t\t\tif @@registry[path]\n\t\t\t\t\t@@registry_count[path] -= 1\n\t\t\t\t\tif @@registry_count[path] <= 0\n\t\t\t\t\... | [
"0.6864771",
"0.66803724",
"0.65434325",
"0.63821834",
"0.63774484",
"0.62238204",
"0.616131",
"0.6089258",
"0.60660404",
"0.60162586",
"0.5981106",
"0.59701985",
"0.59491014",
"0.5944469",
"0.58144486",
"0.58073014",
"0.5800538",
"0.5798176",
"0.5797892",
"0.57778096",
"0.57... | 0.72812676 | 0 |
Retrieves a registered notifier by name. | def get_notifier(name)
@notifiers.each do |notifier|
return notifier if notifier.name == name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifier\n @notifier ||= MList::Manager::Notifier.new\n end",
"def notif_for name\n name = name.to_s\n const = \"KAX#{name.camelize}Notification\"\n Kernel.const_defined?(const) ? Kernel.const_get(const) : name\n end",
"def notify_by(name, &block)\n @notifiers << get_class_from_scop... | [
"0.61560583",
"0.61394876",
"0.61320806",
"0.61320806",
"0.61311597",
"0.60392195",
"0.59348094",
"0.5931856",
"0.5877341",
"0.5843106",
"0.575624",
"0.56607133",
"0.5548981",
"0.552931",
"0.5512185",
"0.5496076",
"0.54640543",
"0.5454341",
"0.54377395",
"0.5423276",
"0.53785... | 0.8765794 | 0 |
Test various cases for report_browser_status. | def test_report_browser_status
self.request = TestRequest.new(
:method => :get,
:request_uri => '/foo/bar?var=val'
)
self.session = {}
@session_working = false
@js = false
str = report_browser_status
assert_equal(nil, str)
@session_working = true
@js = false
st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_browser_status\n self.request = TestRequest.new(\n :env => { 'HTTP_USER_AGENT' => NS5 }\n )\n self.params = {}\n self.session = {}\n self.cookies = {}\n\n # Start fresh -- nothing should be working yet.\n browser_status\n assert(session[:_working])\n assert_equal('1', cook... | [
"0.677851",
"0.59251076",
"0.591444",
"0.59052956",
"0.58726656",
"0.57455033",
"0.5734798",
"0.56618977",
"0.56167364",
"0.56065315",
"0.560427",
"0.5589711",
"0.5580433",
"0.5525521",
"0.54906625",
"0.54722005",
"0.5461144",
"0.5443544",
"0.5440786",
"0.54317516",
"0.542651... | 0.7066436 | 0 |
Test various cases for browser_status filter. | def test_browser_status
self.request = TestRequest.new(
:env => { 'HTTP_USER_AGENT' => NS5 }
)
self.params = {}
self.session = {}
self.cookies = {}
# Start fresh -- nothing should be working yet.
browser_status
assert(session[:_working])
assert_equal('1', cookies[:_enabled])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_report_browser_status\n self.request = TestRequest.new(\n :method => :get,\n :request_uri => '/foo/bar?var=val'\n )\n self.session = {}\n\n @session_working = false\n @js = false\n str = report_browser_status\n assert_equal(nil, str)\n\n @session_working = true\n ... | [
"0.6431533",
"0.59971607",
"0.5802718",
"0.5790735",
"0.5675141",
"0.56633186",
"0.5659382",
"0.5593694",
"0.55619895",
"0.5532173",
"0.55248356",
"0.5513145",
"0.55096835",
"0.5471565",
"0.54444563",
"0.5438939",
"0.5371447",
"0.53672355",
"0.5358583",
"0.5354061",
"0.535007... | 0.6721254 | 0 |
_mapping_ must exist as a mapping of a registered id. | def reverse_get mapping
(@map.rassoc(mapping) || (raise "#{mapping} is not a mapping of a registered id"))[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_mapping\n # no additional parameters\n nil\n end",
"def set_mapping\n @mapping = Mapping.find(params[:id])\n end",
"def set_task_mapping\n @project_task_mapping = ProjectTaskMapping.find_by_id(params[:id])\n if @project_task_mapping\n else\n \trender json: ... | [
"0.67337865",
"0.64740795",
"0.62678725",
"0.6216677",
"0.6092073",
"0.60772824",
"0.5884115",
"0.58802444",
"0.58802444",
"0.5810123",
"0.5805825",
"0.57462746",
"0.5706361",
"0.5704102",
"0.5644253",
"0.5635851",
"0.5610589",
"0.56083786",
"0.560725",
"0.55648845",
"0.55639... | 0.67259693 | 1 |
DELETE /courses/1 DELETE /courses/1.json | def destroy
@course.destroy
respond_to do |format|
format.html { redirect_to courses_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n fo... | [
"0.77230847",
"0.76962376",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.7696043",
"0.76494783",
"0.76408905",
"0.7619815",
"0.7609345",
"0.7590714",
"0.75764287",
"0.75692135",
"0.7546291... | 0.77079666 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.