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 |
|---|---|---|---|---|---|---|
Remove repo hooks repo String hook_id Integer | def remove_hooks(repo, hook_id)
api.remove_hook(repo, hook_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_hook!\n client.remove_hook(full_name, github_hook_id)\n\n self.github_hook_id = nil\n end",
"def delete_hook(id)\n delete(\"/hooks/#{id}\")\n end",
"def delete(user_name, repo_name, hook_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_pa... | [
"0.7973188",
"0.7442817",
"0.7292757",
"0.6857257",
"0.6805585",
"0.6790555",
"0.6790454",
"0.6635315",
"0.6573217",
"0.64184344",
"0.6323295",
"0.63057613",
"0.629042",
"0.6259226",
"0.62513006",
"0.62237173",
"0.62119156",
"0.61896896",
"0.61869967",
"0.6150687",
"0.6077260... | 0.8837115 | 0 |
All repos for access_token Returns Array of Hash | def repos
api.repos.map(&:to_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end",
"def get_all_user_repos\n user = Us... | [
"0.72552896",
"0.7195828",
"0.7124684",
"0.71223515",
"0.7069559",
"0.700496",
"0.69649553",
"0.6962621",
"0.6920793",
"0.6894719",
"0.6890018",
"0.68424547",
"0.683883",
"0.68136215",
"0.6794929",
"0.67660946",
"0.6756994",
"0.67404073",
"0.670515",
"0.6693565",
"0.659786",
... | 0.7971248 | 0 |
Returns organizations where user is admin | def own_organizations
api.org_memberships.select { |org| org[:role] == "admin"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organizations_by_user(user)\n @organizations.values.select { |org| org.is_member?(user) }\n end",
"def active_organizations\n admin? ? Organization.all : organizations.map(&organization_mapper).flatten\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def all_organizations\n ... | [
"0.73870474",
"0.7298261",
"0.72521496",
"0.7235908",
"0.72211736",
"0.71670115",
"0.71518266",
"0.70152676",
"0.69716513",
"0.69662064",
"0.69344085",
"0.6912834",
"0.68772995",
"0.6868512",
"0.68435663",
"0.67940855",
"0.6750358",
"0.6749135",
"0.6709109",
"0.66911966",
"0.... | 0.7852174 | 0 |
Computes the total value of all Bitcoin inputs | def total_input
@inputs.inject(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_coin_total\n @coins.map(&:value).reduce { |sum, num| sum += num }\n end",
"def compute_total_value\n @value= @net_price * @count\n end",
"def total_in\n @total_in ||= self.in.inject(0){ |m, input|\n m + (input.coinbase? ? total_out : (input.get_prev_out.try(:value) || 0))\n ... | [
"0.7600391",
"0.7212935",
"0.7142149",
"0.7000208",
"0.697509",
"0.68985397",
"0.6883535",
"0.68800914",
"0.6854406",
"0.6835453",
"0.67933196",
"0.6783961",
"0.67829865",
"0.67808646",
"0.6757314",
"0.67529774",
"0.67269516",
"0.6686949",
"0.66571903",
"0.6654099",
"0.664368... | 0.7518649 | 1 |
Computes the total value of all Bitcoin outputs | def total_output
@outputs.inject(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_coin_total\n @coins.map(&:value).reduce { |sum, num| sum += num }\n end",
"def compute_total_value\n @value= @net_price * @count\n end",
"def total_coins_value\n json_response({:total_coins_value => @total_coins_val, :status => true, :message => 'calculated'})\n end",
"def get_T... | [
"0.75860184",
"0.7155013",
"0.7079803",
"0.6996463",
"0.6787966",
"0.6787147",
"0.67832524",
"0.6652126",
"0.66318303",
"0.66152173",
"0.6614591",
"0.66003776",
"0.65509325",
"0.65509325",
"0.65394974",
"0.6536221",
"0.65268594",
"0.65208703",
"0.6513868",
"0.647227",
"0.6468... | 0.7608338 | 0 |
Computes the fees paid for the transaction | def fees
total_input - total_output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def fees\n @fees ||= {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap { |fees| fees[\"drivy_fee\"] = commission - fees.values.inject(:+) }\n ... | [
"0.7749463",
"0.74608964",
"0.7358724",
"0.7254256",
"0.7245168",
"0.7217393",
"0.7161691",
"0.7154761",
"0.70849466",
"0.70822394",
"0.7076584",
"0.7061791",
"0.7057174",
"0.696606",
"0.6962604",
"0.69495636",
"0.6942314",
"0.6904392",
"0.68831974",
"0.6873501",
"0.6846851",... | 0.78017414 | 0 |
rubocop: enable MethodLength, UnderscorePrefixedVariableName Public: Checks whether one word or phrase is an anagram of another. === Parameter(s) +phrase_one+ +String+: A word or phrase. +phrase_two+ +String+: A word or phrase that may be an anagram of +phrase_one+. === Return Value +Boolean+: True if one phrase is an ... | def anagram?(phrase_one, phrase_two)
phrase_one.split('').sort == phrase_two.split('').sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anagram word1, word2\n \tpermute = permute_word(word1)\n \tpermute.each do |w|\n \t puts w.join\n \t if w.join.eql?(word2)\n \t \treturn true\n \t end\n \tend\n \treturn false\n end",
"def are_anagrams?(word1, word2)\n #si las palabras son anagramas regresa true de lo contrario regresa false... | [
"0.7999213",
"0.77452654",
"0.7714912",
"0.7682446",
"0.75966746",
"0.7537825",
"0.7522081",
"0.7510409",
"0.75014913",
"0.7491602",
"0.74911195",
"0.74911195",
"0.74685204",
"0.7464296",
"0.7457432",
"0.7457432",
"0.7457432",
"0.74527305",
"0.744779",
"0.74465615",
"0.744632... | 0.8612305 | 0 |
Public: Performs frequency analysis on the provided text. === Parameter(s) +text+ +String+: The text to analyze. === Return Value +Hash+: A hash representing the letter frequencies. | def frequency(text)
text = text.downcase.gsub(/\s*/, '')
chars = text.split('')
freqs = Hash[('a'..'z').to_a.zip([0] * 26)]
chars.each { |c| freqs[c] += 1 }
freqs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend",
"def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n freque... | [
"0.731779",
"0.72305524",
"0.7139432",
"0.70138705",
"0.688126",
"0.68060577",
"0.67000073",
"0.66217005",
"0.64838266",
"0.64221245",
"0.63893574",
"0.63296264",
"0.62854445",
"0.62699956",
"0.62413496",
"0.61716616",
"0.61622936",
"0.61328524",
"0.61181974",
"0.6044382",
"0... | 0.81292146 | 0 |
Public: Calculates the percentage of text composed of vowels. (Y is not included as a vowel.) === Parameter(s) +text+ +String+: The text to analyze. === Return Value +Float+: The percentage comprising vowels. | def vowels(text)
vowels = %w(A E I O U)
chars = text.upcase.split('')
vowel_count = 0
chars.each { |c| vowel_count += 1 if vowels.include? c }
vowel_count.to_f / text.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vowels(text)\n percent = text.vowels.length / text.length.to_f\n percent * @emphasis[:vowels]\n end",
"def score_text(txt)\n txt_length = txt.length.to_f\n total_score = 0\n\n e_ratio = txt.count('e') / txt_length\n t_ratio = txt.count('t') / txt_length\n a_ratio = txt.count('a') / txt_leng... | [
"0.7840416",
"0.6168757",
"0.5833714",
"0.5800462",
"0.579222",
"0.5754188",
"0.5731221",
"0.5709409",
"0.5648014",
"0.5631721",
"0.561774",
"0.5579635",
"0.54964375",
"0.54412633",
"0.54007244",
"0.5396063",
"0.5382628",
"0.5380566",
"0.53674144",
"0.5347461",
"0.53446966",
... | 0.71767694 | 1 |
The inline worker to migrate the data report | def report_worker
@report_worker ||= DataReportWorker.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n\t\tbegin\n\t\t\tnext_run_at = Time.now + 30.minutes\n\t\t\tDataImporterWorker.perform_at(next_run_at)\n\t\t\tqds = QueryDataSource.find_all_by_enabled(true)\n\t\t\tqds.each do |q|\n\t\t\t\tQueryDataSourceWorker.perform_async(q.id)\n\t\t\tend\n\n\t\t\t#spree data source importer\n\t\t \tspree_data_sou... | [
"0.5945893",
"0.57572097",
"0.5681698",
"0.5650164",
"0.5566229",
"0.556445",
"0.5547763",
"0.55165744",
"0.54743725",
"0.5434695",
"0.541954",
"0.5393376",
"0.5349002",
"0.5316676",
"0.530394",
"0.527761",
"0.52651745",
"0.5207843",
"0.5198338",
"0.5193809",
"0.51920885",
... | 0.61501044 | 0 |
Offset Polygon Functions Get the orientation of a polygon Pick "bottom left" corner vertex (and adjacent oes) determine orientation matrix of this subpolygon (which is guaranteed to be convex) | def orientation
p1, p2, p3 = *convex_sub_polygon
det = (p2[0]-p1[0])*(p3[1]-p1[1]) - (p3[0]-p1[0])*(p2[1]-p1[1])
@orientation ||= (det < 0)? 1 : -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mill_polygon(mill, cent_x, cent_y, diam, \r\n no_sides, depth=nil, cutter_comp=false)\r\n#############################################\r\n if cutter_comp == true\r\n diam -= mill.bit_radius\r\n end #if\r\n #mill.retract()\r\n side_count = 0\r\n curr_angle = 0.0\r\n radius = diam / 2\r\n degre... | [
"0.5706218",
"0.5680307",
"0.55774313",
"0.5497918",
"0.5491631",
"0.54648197",
"0.5400046",
"0.53660953",
"0.53585744",
"0.53214765",
"0.53126967",
"0.528629",
"0.52474815",
"0.52182263",
"0.5201485",
"0.5201322",
"0.5177382",
"0.5163872",
"0.5160315",
"0.5154005",
"0.513752... | 0.73073494 | 0 |
Returns a set of 3 points along a convex subsection of the polygon | def convex_sub_polygon
subsets = []
vertices.each_cons(3) do |p1, p2, p3|
subsets << [p2, [p1, p2, p3]]
end
subsets.sort.first.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygon_vertices(sides, size)\n return [CP::Vec2.new(-size, size), CP::Vec2.new(size, size), CP::Vec2.new(size, -size), CP::Vec2.new(-size, -size)]\n end",
"def sample_polygon\n polygon(200, [[10.0, 10.0], [180.0, 20.0], [160.0, 150.0], [100.0, 50.0], [20.0,180.0]])\nend",
"def get_3d_polygon()\n ... | [
"0.66696864",
"0.6127653",
"0.59551084",
"0.5934988",
"0.58613807",
"0.58403933",
"0.5786485",
"0.5786485",
"0.5766312",
"0.57596177",
"0.5756885",
"0.5746187",
"0.573527",
"0.57215947",
"0.56538755",
"0.5618196",
"0.5618196",
"0.5618196",
"0.56045294",
"0.5539671",
"0.552242... | 0.8318579 | 0 |
cost is stored in cents | def cost_in_dollars
self.cost / 100.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cents; end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend",
"def total_cost\n # quantity * unit_cost_price\n unit_cost_price\n end",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def cost\n 1.99\n ... | [
"0.78827745",
"0.7859967",
"0.780307",
"0.7697984",
"0.76807725",
"0.76602143",
"0.76178896",
"0.7613016",
"0.760285",
"0.7590271",
"0.7590271",
"0.75808454",
"0.7573254",
"0.7571516",
"0.75292516",
"0.7527297",
"0.7527297",
"0.75215244",
"0.7510472",
"0.7501266",
"0.7489259"... | 0.79597855 | 0 |
GET /reunion_participantes GET /reunion_participantes.json | def index
@reunion_participantes = ReunionParticipante.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @participantes = Participante.all\n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end... | [
"0.65341324",
"0.6456688",
"0.6336768",
"0.6336768",
"0.6336768",
"0.6336768",
"0.6336768",
"0.6336768",
"0.6333179",
"0.60533345",
"0.60379845",
"0.6029556",
"0.59963757",
"0.5980109",
"0.59759647",
"0.59687454",
"0.5934961",
"0.59127",
"0.5909372",
"0.5897896",
"0.5856482",... | 0.77123106 | 0 |
DELETE /reunion_participantes/1 DELETE /reunion_participantes/1.json | def destroy
@reunion_participante.destroy
respond_to do |format|
format.html { redirect_to reunion_participantes_url, notice: 'Reunion participante was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json... | [
"0.7235546",
"0.7235546",
"0.72209346",
"0.72061276",
"0.72061276",
"0.7182637",
"0.7098842",
"0.70149934",
"0.6988022",
"0.6969382",
"0.6969382",
"0.6969382",
"0.6956189",
"0.6956189",
"0.6919971",
"0.69035554",
"0.6841168",
"0.68308055",
"0.6802261",
"0.67692906",
"0.676680... | 0.73164445 | 0 |
Notifies everyone who has commented on the video as well as the video owner that someone has commented on that video | def notify_all_users_in_the_conversation(current_user, video, video_owner)
# send e-mail to the video owner unless the person commented on their own video
# or their notification settings say not to
unless (video.user_id == self.user_id)
# for whatever reason, delayed_job won't send the email unless y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_watchers(comment_id)\n comment = Comment.find comment_id\n\n article_id = comment.article_id\n favs = Favorite.where(favorable_id: article_id)\n uid = comment.user_id\n ids = []\n favs.each do |f|\n i = f.user_id\n next if uid == i or i == 0\n ids << i\n f.updated_a... | [
"0.6341719",
"0.61025774",
"0.60463345",
"0.60395116",
"0.5946618",
"0.58695436",
"0.5813978",
"0.57936853",
"0.57907104",
"0.5777171",
"0.5762344",
"0.57525826",
"0.5684363",
"0.5681352",
"0.56734",
"0.56484014",
"0.5639869",
"0.56309175",
"0.55900097",
"0.5585",
"0.5575286"... | 0.6805111 | 0 |
p sum_of_range([1, 4]) => 10 p sum_of_range([4, 1]) => 10 | def sum_of_range(arr)
arr[0] < arr[1] ? (arr[0]..arr[1]).reduce(:+) : arr[0].downto(arr[1]).reduce(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_range(range)\n range.sort! # easiest way to max sure it's in min max order\n # range = [range[1], range[0]] if range[1] < range[0] # longer way to check min/max order\n (range[0]..range[1]).reduce(:+)\nend",
"def get_sum(a,b)\n\trange = b..a\n\trange = a..b if b > a\n\trange.inject(&:+)\nend",
"d... | [
"0.8308774",
"0.78453916",
"0.77965695",
"0.7785309",
"0.7745558",
"0.76876223",
"0.7679498",
"0.76598024",
"0.7606298",
"0.75951713",
"0.7544433",
"0.74849266",
"0.7481171",
"0.7476813",
"0.74693817",
"0.73276687",
"0.7308638",
"0.72997403",
"0.72878706",
"0.7277177",
"0.724... | 0.8161494 | 1 |
if ( str.length() ==0 ) puts s; return end ch = str[0,1] ros = str[1,str.length()1] print_Subsequence(ros,s) print_Subsequence(ros,s+ch) end print_Subsequence("abc","") | def print_Subsequence(str)
if(str.length() == 0 )
base = [];
base.push(".")
return base;
end
ch = str[0,1];
ros = str[1,str.length()-1]
recResult = print_Subsequence(ros)
res=[]
for i in (0..recResult.length-1)
res.push(recResult[i])
end
for i in (0..r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_subs(str)\n result = []\n str.chars.each_index do |current_idx|\n (str.size - current_idx).times do |inner_idx|\n result << str[current_idx..(current_idx + inner_idx)]\n end\n end\n p result\nend",
"def find_subs(string)\n result = []\n arr = string.chars\n arr.each_index do |outer_idx... | [
"0.6843673",
"0.66567266",
"0.66509813",
"0.66106296",
"0.65680367",
"0.65555406",
"0.6536475",
"0.6367481",
"0.6352542",
"0.6348208",
"0.63473046",
"0.63333005",
"0.62908465",
"0.6268469",
"0.625752",
"0.62387353",
"0.6237308",
"0.6235232",
"0.62308496",
"0.6228356",
"0.6198... | 0.81107867 | 0 |
create new status change record on status change | def check_status_change
if self.status_id != @current_status
sc = StatusChange.new
sc.submission_id = self.id
sc.status_id = self.status_id
sc.changed_at = @current_time
sc.comments = status_comments
sc.save
#give sub a global id if approved
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end",
"def handle_status_change\n return nil unless self.new_status.present?\n self.status = self.new_status\n if self.new_status == 'active'\n # the user wants to make the ad active now so push out the inac... | [
"0.66669685",
"0.6452245",
"0.6452151",
"0.63089436",
"0.61982274",
"0.61640203",
"0.61028206",
"0.60521525",
"0.60329837",
"0.5996082",
"0.59941417",
"0.5970475",
"0.5970475",
"0.5955967",
"0.59524834",
"0.5933079",
"0.5919985",
"0.5896049",
"0.5881074",
"0.587314",
"0.58672... | 0.70357925 | 0 |
mainmenu(companyname,user,client_hash) Returns option selected by user | def main_menu(companyname="Unknown",username="Unknown",client_hash)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
input = ""
while input != "Exit"
system('clear')
Debug.show "Debug ON\ninput: #{input} | company_name: #{companyname} | username: #{username}"
menuoptions = ["Add new ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def booth_main_menu\n prompt.select(\"Welcome Booth Operator, what would you like to do today?\" ) do |menu|\n menu.choice \"View Merchandise\", -> {self.user.check_merchandise}\n menu.choice \"Update Inventory\", -> {self.user.add_to_inventory}\n menu.choice \"List of Custo... | [
"0.6683829",
"0.6619521",
"0.6475951",
"0.6423823",
"0.6411169",
"0.6322222",
"0.62314653",
"0.6187118",
"0.61712605",
"0.61637294",
"0.61376595",
"0.61367303",
"0.6131876",
"0.6098732",
"0.60840327",
"0.6078142",
"0.60523623",
"0.60432315",
"0.6037656",
"0.6008937",
"0.60054... | 0.6884344 | 0 |
add_new_client(client_hash) prompts for new client information, adds to client_hash, then returns the updated hash. Also updates the clients.json file | def add_new_client(client_hash)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
totalclients = client_hash[:clients].length
system('clear')
Debug.show("Debug ON")
puts "Create new client: \n\n\n"
name = prompt.ask("Name:") do |q|
q.validate(/^[\w ]+$/)
q.messages[:valid?] = "Inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_client(new_client)\n output_strings = []\n if @clients[new_client.name.to_sym].nil?\n @clients[new_client.name.to_sym] = new_client\n output_strings << \"New client #{new_client.name} added.\"\n else\n output_strings << \"That client already exists. Not adding again.\"\n end\n e... | [
"0.69799507",
"0.65547836",
"0.65053415",
"0.6395103",
"0.6298468",
"0.62344766",
"0.6218407",
"0.6095143",
"0.5967004",
"0.58639014",
"0.5789714",
"0.5739492",
"0.5694084",
"0.5548911",
"0.55179197",
"0.5503776",
"0.5503776",
"0.550269",
"0.5466857",
"0.5460222",
"0.54471946... | 0.7650266 | 0 |
searches the client hash to match a string input from the user, then goes to clientselect menu | def clientsearch(client_hash,username)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
input = ""
while input != "Exit"
system('clear')
Debug.show("Debug ON")
input = prompt.select("Client lookup\n\n\n",["Fulltext search","ID search","Exit"])
string = nil
if input ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu(companyname=\"Unknown\",username=\"Unknown\",client_hash)\n prompt = TTY::Prompt.new(symbols: {marker: \">\"})\n input = \"\"\n while input != \"Exit\"\n system('clear')\n Debug.show \"Debug ON\\ninput: #{input} | company_name: #{companyname} | username: #{username}\"\n ... | [
"0.6759327",
"0.6324657",
"0.5992985",
"0.59792423",
"0.597182",
"0.59325135",
"0.59264416",
"0.59149677",
"0.58898187",
"0.58865523",
"0.58832717",
"0.58218354",
"0.5807176",
"0.57887733",
"0.57650787",
"0.57365936",
"0.57117605",
"0.5711046",
"0.56862634",
"0.5668969",
"0.5... | 0.6830015 | 0 |
Construct an XML fragment representing the assertion id request | def to_xml(xml=Builder::XmlMarkup.new)
xml.tag!('samlp:AssertionIDRequest') {
assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml }
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n a... | [
"0.61706084",
"0.61599076",
"0.6087966",
"0.6059848",
"0.5905357",
"0.5904865",
"0.5864847",
"0.58290994",
"0.5776716",
"0.56429183",
"0.5626103",
"0.5585975",
"0.55723405",
"0.5566708",
"0.5516159",
"0.54650563",
"0.5462001",
"0.5462001",
"0.5454173",
"0.544742",
"0.54470307... | 0.7901732 | 0 |
symbols_for() returns an array of symbols, one for each name in a group returns an array of the input symbol if not a group | def symbols_for( symbol )
return @group_members.member?(symbol.name) ? @group_members[symbol.name] : [symbol]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbols\n each_symbol.to_a\n end",
"def to_sym_arr\n @by_symbol.keys\n end",
"def symbols() @symbols end",
"def each() @symbols.each {|s| yield s if block_given? } end",
"def get_symbols\n\t\treturn @symbols\n\tend",
"def symbols\n @symbol_set.symbols\n end",
"de... | [
"0.65819234",
"0.62139195",
"0.62100434",
"0.6100269",
"0.606925",
"0.5971053",
"0.591074",
"0.5895718",
"0.57150704",
"0.5707035",
"0.56902176",
"0.5631679",
"0.5603679",
"0.5585194",
"0.55822146",
"0.5581193",
"0.55746925",
"0.5570102",
"0.55147666",
"0.54776484",
"0.546128... | 0.8255681 | 0 |
syntactic_determinants_for() given a syntactic production name, returns a list of token symbols that can start it | def syntactic_determinants_for( symbols, into = nil, trail_marker = nil )
if symbols.is_an?(Array) then
trail_marker = Util::TrailMarker.new() if trail_marker.nil?
determinants = into.nil? ? {} : into
symbols.each do |symbol|
syntactic_determinant... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lexical_determinants_for( symbols, visited = {} )\n if symbols.is_an?(Array) then\n determinants = CharacterRange.new()\n symbols.each do |symbol|\n determinants.add( lexical_determinants_for(symbol) )\n end\n return determinants\n \n... | [
"0.6983176",
"0.52609754",
"0.51561874",
"0.50732535",
"0.5068226",
"0.5001423",
"0.49060056",
"0.4905483",
"0.48939398",
"0.48845258",
"0.48724672",
"0.48724097",
"0.48724097",
"0.48143458",
"0.47996315",
"0.47958252",
"0.47951737",
"0.478103",
"0.47741196",
"0.47638944",
"0... | 0.6365912 | 1 |
lexical_determinants_for() given a lexical production name, returns a CharacterRange of codes that can start it | def lexical_determinants_for( symbols, visited = {} )
if symbols.is_an?(Array) then
determinants = CharacterRange.new()
symbols.each do |symbol|
determinants.add( lexical_determinants_for(symbol) )
end
return determinants
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_lowercase_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[2].token.lexeme, theChildren[4].token.lexeme]\n range_sorted = raw_range.sort\n ch_range = char_range(range_sorted[0], range_sorted[1])\n char_class(false, ch_range)\n end",
"def reduce_any_l... | [
"0.56431746",
"0.5321983",
"0.5181111",
"0.51556695",
"0.5087949",
"0.5080007",
"0.5034374",
"0.49998444",
"0.49993026",
"0.49961925",
"0.4989283",
"0.4929375",
"0.49053985",
"0.49018884",
"0.48989484",
"0.48989484",
"0.48989484",
"0.48772302",
"0.48247",
"0.48078308",
"0.476... | 0.65678203 | 0 |
Operations compile_parser_plan() generates a ParserPlan for a specific start rule | def compile_parser_plan( name )
case name
when Model::Markers::Reference, Plan::Symbol
name = name.name
end
assert( @production_sets.member?(name), "not a valid start rule name" )
state_table = StateTable.build( self, name )
return ParserPlan.new( self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_plan()\n return Plan::ParserPlan.build( self )\n end",
"def to_PLParser(startSym)\n\n thePLP = TextRect.new\n\n @ntIndex.each do |nt, s|\n\n theNT = TextRect.new(\"#{nt.name} ::= \")\n before = ' '\n\n s[:rules].each do |i|\n rhs = @ruleTable[i][:rule].rhs\n... | [
"0.72693294",
"0.57516396",
"0.5487987",
"0.5416214",
"0.53655916",
"0.53655916",
"0.53655916",
"0.53655916",
"0.5356571",
"0.52816594",
"0.52816594",
"0.52816594",
"0.52816594",
"0.526989",
"0.52506024",
"0.52485204",
"0.5246364",
"0.5225648",
"0.5221498",
"0.52035743",
"0.5... | 0.7557306 | 0 |
PAGE BLOCK / UNBLOCK | def unblock!
BlockedObject.unblock_page!(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_t... | [
"0.68944937",
"0.68944937",
"0.6604916",
"0.62867475",
"0.6128054",
"0.60872334",
"0.59948605",
"0.5919669",
"0.5906602",
"0.58931273",
"0.5814955",
"0.5722318",
"0.5694024",
"0.562722",
"0.5619188",
"0.5578735",
"0.5554629",
"0.5541825",
"0.5530828",
"0.55217445",
"0.5509632... | 0.7843868 | 0 |
GET /invites/new GET /invites/new.json | def new
@invite = Invite.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end",
"def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render... | [
"0.7493549",
"0.7443391",
"0.71866524",
"0.70564896",
"0.7012656",
"0.6996705",
"0.6996705",
"0.69863653",
"0.69833046",
"0.6968096",
"0.69313127",
"0.6828738",
"0.6754267",
"0.6735638",
"0.6729011",
"0.67265517",
"0.66909343",
"0.6641987",
"0.6636304",
"0.6627488",
"0.662025... | 0.77566123 | 1 |
log a message, and increment future messages in this thread. useful for nesting logic | def log_incr(*args)
log(*args) unless args.empty?
@log_indents[Thread.current] += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment\n @attempt += 1\n log\n end",
"def updated(message)\n @count += 1\n @out.puts \"#{@count}/#{@total}: #{message}\"\n end",
"def updated(message)\n @count += 1\n @out.print \".\"\n @out.flush\n end",
"def act(user_id, msg)\r\n # check if it's double\... | [
"0.65136504",
"0.6327033",
"0.6314633",
"0.5977783",
"0.5883685",
"0.5883685",
"0.5855488",
"0.5843392",
"0.5843274",
"0.5843274",
"0.5842695",
"0.5828528",
"0.5821041",
"0.5753555",
"0.5752149",
"0.56461215",
"0.5638304",
"0.56194335",
"0.558727",
"0.5581589",
"0.5572643",
... | 0.671669 | 0 |
GET /heading_bg_images GET /heading_bg_images.json | def index
@heading_bg_images = HeadingBgImage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def index\n @admin_bg_images = BgImage.all\n end",
"def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(... | [
"0.6790276",
"0.6626622",
"0.6578999",
"0.6426558",
"0.6372974",
"0.62523603",
"0.6239958",
"0.62089497",
"0.6175802",
"0.61658424",
"0.61657625",
"0.615235",
"0.61382",
"0.61350834",
"0.6124343",
"0.609146",
"0.6050378",
"0.60362095",
"0.603073",
"0.6007625",
"0.5997535",
... | 0.77676207 | 0 |
POST /heading_bg_images POST /heading_bg_images.json | def create
@heading_bg_image = HeadingBgImage.new(heading_bg_image_params)
respond_to do |format|
if @heading_bg_image.save
format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' }
format.json { render :show, status: :created, location: @heading_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end",
"def create\n @bgimage = Bgimage.new(params[:bgimage])\n\n respond_to do |format|\n if @bgimage.save\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successf... | [
"0.7049247",
"0.6899239",
"0.669983",
"0.6676121",
"0.6632883",
"0.64705336",
"0.6375366",
"0.6182906",
"0.6119136",
"0.60856164",
"0.6063008",
"0.6038866",
"0.59725153",
"0.5958938",
"0.5747429",
"0.5580354",
"0.5564568",
"0.5524865",
"0.5522614",
"0.55215967",
"0.5515622",
... | 0.7398027 | 0 |
PATCH/PUT /heading_bg_images/1 PATCH/PUT /heading_bg_images/1.json | def update
respond_to do |format|
if @heading_bg_image.update(heading_bg_image_params)
format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' }
format.json { render :show, status: :ok, location: @heading_bg_image }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n if @bgimage.update_attributes(params[:bgimage])\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render... | [
"0.7140328",
"0.6984076",
"0.65215087",
"0.6396768",
"0.62812066",
"0.62448156",
"0.62393636",
"0.61540604",
"0.608948",
"0.60528225",
"0.59571034",
"0.5954023",
"0.5947635",
"0.5944986",
"0.5939279",
"0.59181815",
"0.5906304",
"0.59062713",
"0.5894343",
"0.5874175",
"0.58734... | 0.7552205 | 0 |
DELETE /heading_bg_images/1 DELETE /heading_bg_images/1.json | def destroy
@heading_bg_image.destroy
respond_to do |format|
format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_t... | [
"0.7598086",
"0.7362263",
"0.7010724",
"0.6887027",
"0.6883116",
"0.68821466",
"0.673138",
"0.67213213",
"0.6695897",
"0.66865927",
"0.6625925",
"0.6621367",
"0.661563",
"0.6603099",
"0.6593489",
"0.65894014",
"0.65531045",
"0.6537283",
"0.6532978",
"0.6526688",
"0.6518221",
... | 0.7694713 | 0 |
Assign a callback to enable _password authentication_. As soon as an callback is assigned here, _password authentication_ is enabled for the service. The assigned `Proc`instance will get two arguments: 1. The username of the authentication request, 2. The password received from the client. The return value of the callb... | def password(&blk)
@authentication_methods ||= {}
@authentication_methods[:password] = blk
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate(request, realm, &password_procedure); end",
"def login_with_username username, password, callback\n\t\t\t@method_callbacks['login'] = callback\n\t\t\t@auth_client = SRP::Client.new\n\t\t\t@username = username\n\t\t\t@password = password\n\t\t\t\n\n\t\t\ta = @auth_client.start_authentication()\n\... | [
"0.678788",
"0.65130705",
"0.63509667",
"0.6343934",
"0.62818825",
"0.6265266",
"0.6260336",
"0.6154966",
"0.6154966",
"0.61415225",
"0.60966676",
"0.6053996",
"0.60286903",
"0.59829164",
"0.59793717",
"0.5945088",
"0.5945088",
"0.5907736",
"0.58849216",
"0.587753",
"0.582972... | 0.6806943 | 0 |
Test +has_content+ method to return false if a post have no content | def test_has_content
assert(!@contentless_post.has_content?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_content?\n !content.nil?\n end",
"def has_content?\n ( not self.title.nil? and not self.title.length == 0 ) or \n (not self.description.nil? and not self.description.length == 0 ) or \n (not self.teaser.nil? and not self.teaser.length == 0 )\n end",
"def content?\n !content... | [
"0.86837167",
"0.8039077",
"0.79284716",
"0.7381666",
"0.7365182",
"0.73450917",
"0.7279623",
"0.72548395",
"0.72285765",
"0.71555996",
"0.7096712",
"0.7013007",
"0.6975677",
"0.6899152",
"0.68618256",
"0.6848791",
"0.6807338",
"0.68008524",
"0.68008524",
"0.67762303",
"0.677... | 0.8497628 | 1 |
Scarica dal sito FTP il file associato al tipo di flusso Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "K:/.../esiti_xml/20141009/20141010MGPPrezzi.xml" (path del flusso scaricato) | def download_file(file)
#name_file = "20141010MGPPrezzi.xml"
name_file = parse_name_file file
path_xml = crea_dir_per_xml
full_path = path_xml+name_file
#entro dentro la directory nel server ftp
@ftp.chdir("/MercatiElettrici/#{file}")
#scarico nella directory corren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_name_file file\r\n #name_file = \"#{@giorno_flusso}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".xml\" \r\n name_file = case file\r\n when /OffertePubbliche/ then \"#{@giorno}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".zip\" \r\n when /MGP/ then \"#{@giorno}\" + \"... | [
"0.5706662",
"0.5615323",
"0.54685116",
"0.54543585",
"0.53751504",
"0.5345411",
"0.5313451",
"0.5194258",
"0.5150226",
"0.5145376",
"0.5145376",
"0.5145376",
"0.5145376",
"0.5143473",
"0.51386917",
"0.5077058",
"0.5052922",
"0.5045206",
"0.5037909",
"0.50337553",
"0.5001857"... | 0.68472946 | 0 |
Fa il parse dal tipo di flusso, mi crea il nome del file da scaricare Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "20141010MGPPrezzi.xml" (nome del file da scaricare) | def parse_name_file file
#name_file = "#{@giorno_flusso}" + "#{file.gsub "MGP_","MGP"}" + ".xml"
name_file = case file
when /OffertePubbliche/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".zip"
when /MGP/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".xml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_path\n \"studio/#{type}/#{id}.xml\"\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def get_raw_filename (file)\n\t\n\t\t# convert to string\n\t\tfile = get_filename(file)\n\t\t# remove extension\n\t\tfile.sub(get_ext(file), \"\")\n... | [
"0.6458312",
"0.5919844",
"0.5889206",
"0.5834126",
"0.57996136",
"0.5780383",
"0.5776114",
"0.5747106",
"0.5729227",
"0.56961703",
"0.56716084",
"0.56539774",
"0.5615984",
"0.5579325",
"0.55407673",
"0.5537919",
"0.5535777",
"0.55299205",
"0.55248857",
"0.5524413",
"0.551755... | 0.74010056 | 0 |
Crea la directory che contiene il flusso e si posiziona al suo interno Parameters : nil Return : "K:/.../esiti_xml/20141009" (path della directory che contiene il flusso scaricato) | def crea_dir_per_xml
path_xml = (Pathname.new(__dir__).parent)+"esiti_xml"+@giorno
path_xml.mkdir(0700) unless path_xml.exist?
return path_xml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatedReportFolder\n currentData, currentTime = DateTime.now.strftime(\"%Y_%m_%d %H_%M\").split(' ')\n path = \"#{$ROOT}/../output\"\n creatFolder(path)\n path += \"/#{currentData}\"\n creatFolder(path)\n path += \"/#{currentTime}\"\n creatFolder(path)\n path\n end",
"def gen_news... | [
"0.65916455",
"0.6519942",
"0.6290221",
"0.62499833",
"0.62050813",
"0.61929095",
"0.6168694",
"0.61671066",
"0.6141717",
"0.61197937",
"0.6118008",
"0.6118008",
"0.6112808",
"0.6100345",
"0.6099804",
"0.60835993",
"0.6065124",
"0.60574055",
"0.603878",
"0.60367334",
"0.60239... | 0.868211 | 0 |
returns an array of the answers sorted by their vote score in descending order | def highest_voted_answers
answers.sort_by {|answer| answer.vote_score}.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n answers = Post.find_all_by_post_type_and_parent_id('answer', self.id)\n answers.sort{|x,y| y.rating <=> x.rating }\n end",
"def index\n @answers = Answer.joins(:post).order('votes DESC')\n end",
"def get_chosen_answers\n ChosenAnswer.order('created_at DESC')\n end",
"def answer... | [
"0.7481147",
"0.68326414",
"0.6691776",
"0.66833985",
"0.642999",
"0.64024454",
"0.64024454",
"0.63260174",
"0.6305289",
"0.6238024",
"0.619802",
"0.6185966",
"0.6174613",
"0.61741894",
"0.6155579",
"0.6088728",
"0.6088554",
"0.6081778",
"0.60578936",
"0.59995997",
"0.5967209... | 0.8469105 | 0 |
A definition of a term | def termdef(name)
element(name, {:name => name, :class=>:term}, 'a')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term; end",
"def term\n @term\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:nam... | [
"0.8450216",
"0.73270005",
"0.7184933",
"0.7184933",
"0.7184933",
"0.7182944",
"0.71664697",
"0.7082566",
"0.6986552",
"0.6804663",
"0.6804663",
"0.6802982",
"0.6773592",
"0.67692256",
"0.67692256",
"0.67692256",
"0.67021185",
"0.6594718",
"0.65766084",
"0.65515333",
"0.65326... | 0.7654662 | 1 |
A reference to a defined term (excluding role adjectives) | def termref(name, role_name = nil)
role_name ||= name
element(role_name, {:href=>'#'+name, :class=>:term}, 'a')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term\n @term\n end",
"def term\n Term.find(self.term_id)\n end",
"def term\n self.name\n end",
"def termref(name, role_name = nil, o = nil)\n if o && !@definitions[o]\n element(name, :class=>:object_type)\n else\n role_name ||= name\n element... | [
"0.7376947",
"0.7266853",
"0.7164853",
"0.7057247",
"0.705128",
"0.705128",
"0.6895083",
"0.6875203",
"0.6833116",
"0.675118",
"0.67177707",
"0.64436173",
"0.63903314",
"0.6357252",
"0.6262721",
"0.6262721",
"0.6252465",
"0.6252465",
"0.6252465",
"0.62485987",
"0.62372154",
... | 0.7302213 | 1 |
Creates a log event to indicate a scope change (e.g. sprint started, issue closed). | def log_activity(issue, type, change)
activities.build(:issue_id => issue.id,
:type_of_change => type,
:scope_change => change)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scopeChanged\n pp [:got_scopeChanged] if $DEBUG\n end",
"def write_initial_event\n publish_to_feed(\"project:#{self.id}:create\", \"#{self.group.display_name} created a new project: #{self.display_name}\")\n end",
"def provenance_log_create\n curation_concern.provenance_create( current_use... | [
"0.5870572",
"0.5510152",
"0.54862803",
"0.545429",
"0.5380848",
"0.5293876",
"0.5244658",
"0.5223669",
"0.517622",
"0.5153984",
"0.5148474",
"0.5142857",
"0.5141063",
"0.5138201",
"0.51122475",
"0.51114655",
"0.51103956",
"0.5067827",
"0.50516737",
"0.5024196",
"0.49972418",... | 0.63244087 | 0 |
POST /tapiocas POST /tapiocas.json | def create
@tapioca = Tapioca.new(tapioca_params)
respond_to do |format|
if @tapioca.save
format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }
format.json { render action: 'show', status: :created, location: @tapioca }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n fo... | [
"0.6131813",
"0.60093284",
"0.586882",
"0.5858763",
"0.5846922",
"0.57569057",
"0.5745011",
"0.5740417",
"0.5723218",
"0.5709544",
"0.56913114",
"0.5662861",
"0.5643988",
"0.56313294",
"0.562105",
"0.5578551",
"0.5571476",
"0.5570174",
"0.5552587",
"0.5532697",
"0.55326873",
... | 0.68628556 | 0 |
PATCH/PUT /tapiocas/1 PATCH/PUT /tapiocas/1.json | def update
respond_to do |format|
if @tapioca.update(tapioca_params)
format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @tapioca.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.630356",
"0.62408584",
"0.6227141",
"0.6220228",
"0.61816573",
"0.6161129",
"0.6144715",
"0.61440086",
"0.61382145",
"0.61067414",
"0.6091236",
"0.60742587",
"0.60506177",
"0.60506177",
"0.59808683",
"0.5949832",
"0.5927379",
"0.59171987",
"0.59117854",
"0.5898775",
"0.589... | 0.6973547 | 0 |
DELETE /tapiocas/1 DELETE /tapiocas/1.json | def destroy
@tapioca.destroy
respond_to do |format|
format.html { redirect_to tapiocas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"de... | [
"0.7292021",
"0.7255884",
"0.7255884",
"0.7255884",
"0.7255884",
"0.72435254",
"0.7203925",
"0.71367854",
"0.70688",
"0.70488787",
"0.70350146",
"0.70326376",
"0.7016501",
"0.7010592",
"0.6976672",
"0.696649",
"0.6962057",
"0.6935283",
"0.6904715",
"0.69023746",
"0.6899159",
... | 0.77813435 | 0 |
:nodoc: Return a expanded path to repository mirror build with information from configuration for repository. Replace keywords (:keyword) with value matched by it pattern. | def mirror_path(repository_owner, repository_name)
mirror_path = repository_info(repository_owner, repository_name).path || raise(GithubMirrorError, "Path for repository '#{repository_owner}/#{repository_name}' doesn\'t exist in config")
mirror_patterns = repository_info(repository_owner, repository_name).patte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n Config.artifactory_publish_pattern % package.metadata\n )\n end",
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metada... | [
"0.51905787",
"0.4863092",
"0.48016113",
"0.47350195",
"0.47256953",
"0.4716721",
"0.4687411",
"0.46648857",
"0.4656888",
"0.4625272",
"0.46233362",
"0.4597609",
"0.4588955",
"0.450325",
"0.45013463",
"0.44999027",
"0.4498575",
"0.4486967",
"0.4459705",
"0.44430637",
"0.44391... | 0.5798709 | 0 |
Handle request from Github, return always success response, but write an error message in body if an error raised | def handle_request
raise GithubMirrorError, 'Only POST request allowed' unless @request.post? # return fail message if request is not a POST
raise GithubMirrorError, 'Token not match' if config['token'] && !@request.path_info.end_with?('/' + config['token'])
payload = JSON.parse(@request[:payload]) rescue ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_github_response\n Retriable.retriable(retry_options) do\n yield\n end\n rescue MovedPermanentlyError => e\n fail_with_message(e, \"The repository has moved, update your configuration\")\n rescue Octokit::Forbidden => e\n fail_with_message(e, \"Exceeded retry limit\")\n ... | [
"0.68274355",
"0.6453231",
"0.6271996",
"0.61509717",
"0.6090275",
"0.60855705",
"0.60430235",
"0.5970443",
"0.5966946",
"0.5830605",
"0.5812657",
"0.5804717",
"0.5800088",
"0.57575405",
"0.5746899",
"0.5736847",
"0.56812423",
"0.5675688",
"0.56490225",
"0.5618825",
"0.561208... | 0.66120815 | 1 |
helper method to get image from url | def image_from_url
io = open(URI.parse(image_url))
def io.original_filename; base_uri.path.split('/').last; end
self.image = io.original_filename.blank? ? nil : io
rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_url (origin_url)\n begin\n html = open(origin_url).read\n urls = URI.extract(html)\n .select { |lnk| lnk[/\\.jpg$|\\.png$|\\.gif$|\\.jpeg/m] }\n return urls.empty? ? nil : urls[0]\n rescue Exception => e\n puts \"[ERROR] in 'Dav... | [
"0.7597434",
"0.7441028",
"0.73810947",
"0.7166025",
"0.7112345",
"0.70828986",
"0.7024592",
"0.7016788",
"0.6996657",
"0.6988121",
"0.69312656",
"0.6928905",
"0.6912796",
"0.69104064",
"0.6886367",
"0.6862008",
"0.6861769",
"0.6852125",
"0.684585",
"0.6840781",
"0.68401504",... | 0.77521545 | 0 |
action for when payment is successful. finding the correct product listing my the eventid, assigning the buyer to the current user, creating a new sale and then making the item unapproved by changing the boolean value from true to false. | def success
# using find to find exact result that matches the conditions(params with correct eventId)
@product_listing = ProductListing.find(params["eventId"])
@sale = Payment.create(user_id: current_user.id, buyer_email: current_user.email, seller_email: @product_listing.user.email, product_listing_id: @p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_sub_existing_edu_bridge #like newcustomer action #channeling back to original checkout process\n @user = current_user\n @plan = params[:snc][:plan] #gives my_plan_id\n @event_type = params[:snc][:event_type] #gives 'reception' or 'wedding' depending on the channel; actually, will just be 'receptio... | [
"0.6630691",
"0.65302056",
"0.64458394",
"0.6417934",
"0.6382279",
"0.6348252",
"0.63372695",
"0.6313289",
"0.6240675",
"0.62329525",
"0.62276113",
"0.62220705",
"0.6205922",
"0.6197361",
"0.6179753",
"0.6163918",
"0.6156938",
"0.6153812",
"0.614195",
"0.614129",
"0.61407804"... | 0.78068453 | 0 |
GET /garbages/new GET /garbages/new.xml | def new
@garbage = Garbage.new(params[:garbage])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n ... | [
"0.6720236",
"0.6146797",
"0.6136578",
"0.6127441",
"0.60301995",
"0.6021557",
"0.6003334",
"0.5982964",
"0.59825677",
"0.59700555",
"0.59499127",
"0.5934086",
"0.5903696",
"0.5872607",
"0.5869017",
"0.585763",
"0.58523476",
"0.58399767",
"0.5836569",
"0.58240443",
"0.5818218... | 0.62358534 | 1 |
prepare an UpdateRequest that will be displayed if the user entered a search that has no nearby_hits | def prepare_location_unavailable
@update_request = UpdateRequest.new(
search_location: @search_form.search_location # TODO: set by JS
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end",
"def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n ... | [
"0.5943165",
"0.5862006",
"0.56999207",
"0.56999207",
"0.5656402",
"0.5646221",
"0.5646221",
"0.5560123",
"0.5559098",
"0.5556221",
"0.55299383",
"0.5523097",
"0.5522777",
"0.5522777",
"0.5513652",
"0.54755884",
"0.5455988",
"0.54506475",
"0.54491895",
"0.5445691",
"0.5444222... | 0.7450269 | 1 |
def product_params params.permit(:roomname, :image, :text) end | def product_params
params.require(:product).permit(:roomname, :text, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_params\n params.require(:product).permit(:name, :image)\n end",
"def room_params\n params.require(:room).permit(:roomtype,:image, :romnum, :pricepn,:hotel_id,:quantity)\n end",
"def product_params\n params.require(:product).permit(:title, :price, :image)\n end",
"def produ... | [
"0.8410431",
"0.828694",
"0.82692325",
"0.82331",
"0.8221226",
"0.8167253",
"0.8149526",
"0.8133822",
"0.8123091",
"0.8122155",
"0.8101613",
"0.80931664",
"0.80878526",
"0.8064436",
"0.80643433",
"0.8060577",
"0.8028389",
"0.8027768",
"0.8004703",
"0.7995737",
"0.798819",
"... | 0.96327066 | 0 |
Get the string prefix for tagging versions of this package. Only makes any sense if the package is in a recognized repo, and will error out if that's not the case. The most basic prefix is "v" for packages located at the root of the repository. | def version_tag_prefix
if root_path == repo.root_path
'v'
else
(repo_rel_path / 'v').to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_tag(tag)\n tag = Origen::VersionString.new(tag)\n if tag.semantic?\n tag.prefixed\n else\n tag\n end\n end",
"def version_prefix\n '/v2'\n end",
"def version_tag\n version_composition.join(\".\")\n end",
"def prefixed(str = 'v')\n ... | [
"0.70594865",
"0.6634987",
"0.6620091",
"0.6477108",
"0.6475548",
"0.646715",
"0.6141901",
"0.60339195",
"0.5953307",
"0.58897",
"0.5819408",
"0.58188736",
"0.575975",
"0.5679773",
"0.56518424",
"0.56303906",
"0.56298345",
"0.56200975",
"0.56118286",
"0.55761737",
"0.55416447... | 0.8411623 | 0 |
GET /gig_rosters GET /gig_rosters.json | def index
@gig_rosters = GigRoster.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def index\n @rosters = Roster.all\n end",
"def index\n @rosters = Roster.all\n end",
"def index\n @r... | [
"0.65916413",
"0.64172494",
"0.64172494",
"0.64172494",
"0.6379612",
"0.6309769",
"0.60598445",
"0.60334337",
"0.6032572",
"0.6008764",
"0.6003748",
"0.6003748",
"0.5969598",
"0.596937",
"0.5965246",
"0.59634304",
"0.59591174",
"0.59420156",
"0.59392005",
"0.5916362",
"0.5913... | 0.72896755 | 0 |
POST /gig_rosters POST /gig_rosters.json | def create
@gig_roster = GigRoster.new(gig_roster_params)
respond_to do |format|
if @gig_roster.save
format.html { redirect_to @gig_roster, notice: 'Gig roster was successfully created.' }
format.json { render :show, status: :created, location: @gig_roster }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rigging = Rigging.new(rigging_params)\n\n respond_to do |format|\n if @rigging.save\n format.html { redirect_to @rigging, notice: 'Rigging was successfully created.' }\n format.json { render :show, status: :created, location: @rigging }\n else\n format.html { rend... | [
"0.6435959",
"0.6203761",
"0.57345134",
"0.5713185",
"0.57082677",
"0.56806153",
"0.5640973",
"0.5598938",
"0.5576061",
"0.5535237",
"0.55335325",
"0.5497338",
"0.5493931",
"0.54831547",
"0.5470487",
"0.5462567",
"0.5458965",
"0.5448089",
"0.544026",
"0.5428171",
"0.5377553",... | 0.6308921 | 1 |
GET /operating_hours GET /operating_hours.json | def index
@operating_hours = OperatingHour.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def hours\n response[\"hours\"]\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end",
"def venue_hours venue_id\n response ... | [
"0.77675194",
"0.6915026",
"0.6870751",
"0.6722812",
"0.6709238",
"0.66452754",
"0.6640017",
"0.663736",
"0.6567424",
"0.6560896",
"0.65436554",
"0.64627033",
"0.64618456",
"0.6422234",
"0.63852084",
"0.6296425",
"0.6276442",
"0.62562305",
"0.6254565",
"0.6218148",
"0.6203615... | 0.73309386 | 1 |
POST /operating_hours POST /operating_hours.json | def create
@operating_hour = OperatingHour.new(operating_hour_params)
respond_to do |format|
if @operating_hour.save
format.html { redirect_to @operating_hour, notice: 'Operating hour was successfully created.' }
format.json { render :show, status: :created, location: @operating_hour }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @operation_hour = OperationHour.create(params[:operation_hour])\n end",
"def operating_hour_params\n params.require(:operating_hour).permit(:monday_from, :monday_to, :tuesday_fro... | [
"0.7029278",
"0.6969807",
"0.696099",
"0.668269",
"0.66538256",
"0.6569062",
"0.65684414",
"0.6528205",
"0.6489911",
"0.64667356",
"0.6458775",
"0.645536",
"0.63673955",
"0.6336778",
"0.6315144",
"0.6312436",
"0.62817925",
"0.6260089",
"0.62549",
"0.62451255",
"0.6218185",
... | 0.7498469 | 0 |
PATCH/PUT /operating_hours/1 PATCH/PUT /operating_hours/1.json | def update
respond_to do |format|
if @operating_hour.update(operating_hour_params)
format.html { redirect_to @operating_hour, notice: 'Operating hour was successfully updated.' }
format.json { render :show, status: :ok, location: @operating_hour }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @officehour = Officehour.find(params[:id])\n\n respond_to do |format|\n if @officehour.update_attributes(params[:officehour])\n\tformat.html { redirect_to @officehour, notice: 'Officehour was successfully updated.' }\n\tformat.json { head :no_content }\n else\n\tformat.html { render ac... | [
"0.6957177",
"0.6809584",
"0.67332685",
"0.6700032",
"0.66670865",
"0.6665308",
"0.65441567",
"0.65397495",
"0.65312797",
"0.6507327",
"0.64885247",
"0.64714897",
"0.6471246",
"0.64312595",
"0.64300615",
"0.6399684",
"0.6390729",
"0.6374497",
"0.63423795",
"0.6340942",
"0.623... | 0.7313313 | 0 |
DELETE /operating_hours/1 DELETE /operating_hours/1.json | def destroy
@operating_hour.destroy
respond_to do |format|
format.html { redirect_to operating_hours_url, notice: 'Operating hour was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @operation_hour = OperationHour.find(params[:operation_hour_id])\n end",
"def destroy\n @officehour = Officehour.find(params[:id])\n @officehour.destroy\n\n respond_to do |format|\n format.html { redirect_to officehours_url }\n format.json { head :no_content }\n end\n end"... | [
"0.7393105",
"0.73661083",
"0.7305524",
"0.72960526",
"0.71667707",
"0.71382725",
"0.7083069",
"0.70824856",
"0.70786387",
"0.7032269",
"0.6990246",
"0.6966996",
"0.69027466",
"0.6892751",
"0.68895733",
"0.68853384",
"0.6829551",
"0.68104416",
"0.68099415",
"0.6790999",
"0.67... | 0.7612083 | 0 |
Show the window and start the main loop. Also starts the window given in parameters. (Used for VimWindow) | def start(start_window)
gtk_window.show_all
start_window.start
Gtk.main_with_queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.... | [
"0.7169551",
"0.70637137",
"0.7041796",
"0.7041715",
"0.70123523",
"0.65191764",
"0.63550496",
"0.6334149",
"0.6309114",
"0.6265318",
"0.62008744",
"0.61828953",
"0.6163721",
"0.6139799",
"0.61134076",
"0.6090274",
"0.60805815",
"0.605429",
"0.60373545",
"0.6036179",
"0.59933... | 0.73490226 | 0 |
Takes a number and checks to see if it is in any of the ranges given | def in_ranges?(num, ranges)
result = false
ranges.each do |range|
if range.include?(num)
result = true
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_in_ranges?(nums, ranges)\n if nums.empty?\n return false\n end\n nums.each do |num|\n if !in_ranges?(num, ranges)\n return false\n end\n end\n true\nend",
"def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= rang... | [
"0.77839947",
"0.77281946",
"0.7620122",
"0.75642455",
"0.75542367",
"0.7548862",
"0.7440546",
"0.7440546",
"0.7386601",
"0.73120075",
"0.7290764",
"0.7260176",
"0.7239734",
"0.7208907",
"0.7207142",
"0.71877927",
"0.7149205",
"0.7149205",
"0.71406585",
"0.7124057",
"0.712071... | 0.85276127 | 0 |
Checks to see if every num in nums is in the ranges given | def all_in_ranges?(nums, ranges)
if nums.empty?
return false
end
nums.each do |num|
if !in_ranges?(num, ranges)
return false
end
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_ranges?(num, ranges)\n result = false\n ranges.each do |range|\n if range.include?(num)\n result = true\n end\n end\n return result\nend",
"def in_ranged_array?(ranged_ary, num)\n !!ranged_ary.find {|n| n === num }\n end",
"def OverlappingRanges(arr)\n first_num = arr[0]\n secon... | [
"0.85513437",
"0.7055554",
"0.6961255",
"0.68587863",
"0.6835786",
"0.68346953",
"0.6824846",
"0.67745215",
"0.67015386",
"0.6700452",
"0.6654732",
"0.6644599",
"0.65470695",
"0.65087354",
"0.647819",
"0.645934",
"0.64191777",
"0.64030087",
"0.63996524",
"0.6397252",
"0.63972... | 0.87066746 | 0 |
Takes a map of fields to ranges and an array of numbers and returns a set of fields are possible candidates for the numbers | def possible_fields(map, nums)
result = Set.new()
map.each do |field, ranges|
if all_in_ranges?(nums, ranges)
result << field
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_valid_numbers(fields)\n bounds = fields.map { |line| line.scan(/\\d+/).map(&:to_i) }\n valid_numbers = []\n bounds.each do |set|\n pair = []\n (0..set.length - 1).step(2) { |ind| pair += (set[ind]..set[ind + 1]).to_a }\n valid_numbers << pair\n end\n valid_numbers\n end",
... | [
"0.72231054",
"0.6411788",
"0.634999",
"0.60745585",
"0.5802601",
"0.57660764",
"0.5691889",
"0.56850946",
"0.5672138",
"0.5663853",
"0.5661722",
"0.56319577",
"0.56286985",
"0.5620134",
"0.5618506",
"0.5618176",
"0.5602175",
"0.5592634",
"0.55566716",
"0.55435187",
"0.553392... | 0.87087697 | 0 |
Takes a 2D matrix and returns the transpose | def transpose(matrix)
if matrix.empty? || matrix.first.empty?
raise ArgumentError
end
result = Array.new(matrix.first.length) { Array.new(matrix.length, 0) }
matrix.each_with_index do |row, x|
row.each_with_index do |val, y|
result[y][x] = val
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose_of_matrix matrix\n\treturn Matrix.new(matrix.line, matrix.col, matrix.values.transpose)\nend",
"def transpose(matrix)\n size = matrix.first.size\n matrix.each_with_index.with_object(Array.new(size) {[]}) do |(arr, idx), trans_arr|\n arr.each_with_index do |el, i|\n trans_arr[i] << el\n ... | [
"0.8549761",
"0.8145293",
"0.8130179",
"0.8044132",
"0.8036772",
"0.80194366",
"0.78922045",
"0.78857267",
"0.78701156",
"0.7835674",
"0.77904093",
"0.7743675",
"0.7709621",
"0.7679929",
"0.76343864",
"0.7625317",
"0.7614516",
"0.76110506",
"0.75981283",
"0.75806314",
"0.7516... | 0.82158756 | 1 |
Schreiben der aktuellen Connection in last logins, wenn neue dabei | def write_connection_to_last_logins
database = read_from_client_info_store(:current_database)
last_logins = read_last_logins
min_id = nil
last_logins.each do |value|
last_logins.delete(value) if value && value[:sid] == database[:sid] && value[:host] == database[:host] && value[:user] == databas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_completed\n\tend",
"def connection_completed\n end",
"def session_reconnect_state\n super\n end",
"def checkin_connection(*)\n conn = super\n @connection_timestamps[conn] = Sequel.start_timer\n conn\n end",
"def connection_status_mcnet_login; end",
"def nic... | [
"0.64820606",
"0.6450973",
"0.62735546",
"0.6263115",
"0.6245871",
"0.6197363",
"0.60673416",
"0.59512275",
"0.59512275",
"0.59512275",
"0.59430104",
"0.59274954",
"0.59274954",
"0.59274954",
"0.5922495",
"0.59065956",
"0.582445",
"0.5822487",
"0.5807724",
"0.5801186",
"0.578... | 0.7601629 | 0 |
repeat last called menu action | def repeat_last_menu_action
controller_name = read_from_client_info_store(:last_used_menu_controller)
action_name = read_from_client_info_store(:last_used_menu_action)
# Suchen des div im Menü-ul und simulieren eines clicks auf den Menü-Eintrag
respond_to do |format|
format.js {render :js => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat_menu\n puts \"\\n-----------------------\".colorize(:blue)\n puts \"You currently have $#{@player.wallet} left.\".colorize(:red)\n puts \"What do you want to do?\".colorize(:red)\n puts \"1)Add more money to my wallet\".colorize(:blue)\n puts \"2)Play another game\".colorize(:blue)\n p... | [
"0.7005092",
"0.65725285",
"0.6523264",
"0.647607",
"0.64039874",
"0.63643485",
"0.63577473",
"0.63189715",
"0.63114065",
"0.62921345",
"0.6250853",
"0.6189849",
"0.61826587",
"0.61795837",
"0.6158655",
"0.61436075",
"0.61418915",
"0.61282444",
"0.61279035",
"0.6114345",
"0.6... | 0.7359739 | 0 |
GET /graphics/1 GET /graphics/1.json | def show
@graphic = Graphic.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @graphic }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end",
"def index\n @graphics = Graphic.fetch_ordered_by_page(params[\"page\"])\n end",
"def get_game_graphics_with_http_info(opts = {})... | [
"0.71110284",
"0.6976917",
"0.6875089",
"0.67676455",
"0.6766882",
"0.6766882",
"0.6689983",
"0.6537907",
"0.64281446",
"0.6420917",
"0.64197826",
"0.6398936",
"0.6398936",
"0.6395809",
"0.63739014",
"0.63421196",
"0.63392407",
"0.6324268",
"0.630673",
"0.62881243",
"0.623386... | 0.7641829 | 1 |
return to the patient dashboard if patient lab test has been ordered within 1 hour | def patient_should_proceed_after_lab_order?
test_type = concept 'Test type'
tb_concept = concept 'Tuberculous'
observation = Observation.joins(:encounter).where(
'person_id = ? AND concept_id = ? AND value_coded = ? AND encounter.encounter_type = ?',
@patient.patient_id, test_type.conc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_test\n virtualtest_status = current_user.sk.test_status(@virtualtest)\n render 'errors/access_refused' and return if virtualtest_status == \"not_started\"\n redirect_to virtualtests_path and return if virtualtest_status == \"finished\" # Smoothly redirect because it can happen when timer stops\n e... | [
"0.5937826",
"0.57870626",
"0.5786309",
"0.57496786",
"0.5606584",
"0.5595736",
"0.5577767",
"0.5557089",
"0.5510528",
"0.54581636",
"0.5450569",
"0.541663",
"0.5366033",
"0.53527725",
"0.53487706",
"0.5346876",
"0.5345055",
"0.5323697",
"0.53066516",
"0.5300956",
"0.52988535... | 0.6458008 | 0 |
GET /size_groups/1 GET /size_groups/1.xml | def show
@size_group = SizeGroup.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @size_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @size_group = SizeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @size_group }\n end\n end",
"def create\n @size_group = SizeGroup.new(params[:size_group])\n result = @size_group.save\n if result\n for size in params[:s... | [
"0.65454197",
"0.62095326",
"0.6137497",
"0.6137497",
"0.61343664",
"0.61343664",
"0.6099301",
"0.6062929",
"0.60226846",
"0.6018285",
"0.5973926",
"0.59366924",
"0.5931665",
"0.5912144",
"0.58946514",
"0.5890749",
"0.58822984",
"0.5878934",
"0.5878934",
"0.58274955",
"0.5813... | 0.7347719 | 1 |
GET /size_groups/new GET /size_groups/new.xml | def new
@size_group = SizeGroup.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @size_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @size_group = SizeGroup.new(params[:size_group])\n result = @size_group.save\n if result\n for size in params[:size]\n new_size = Size.new(size)\n new_size.save\n @size_group.sizes << new_size\n end\n end\n respond_to do |format|\n if result\n ... | [
"0.70232415",
"0.70123994",
"0.6879285",
"0.68778497",
"0.68778497",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.68588465",
"0.67709875",
"0.6763431",
"0.67387205",
"0.6655991",
"0.66238534",
"0.6618393",
... | 0.795332 | 0 |
POST /size_groups POST /size_groups.xml | def create
@size_group = SizeGroup.new(params[:size_group])
result = @size_group.save
if result
for size in params[:size]
new_size = Size.new(size)
new_size.save
@size_group.sizes << new_size
end
end
respond_to do |format|
if result
flash[:notice] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @size_group = SizeGroup.find(params[:id])\n result = @size_group.update_attributes(params[:size_group])\n if result\n for size in params[:size]\n new_size = Size.new(size)\n new_size.save\n @size_group.sizes << new_size\n end\n for id,size in params[:existi... | [
"0.5995169",
"0.58783054",
"0.5840016",
"0.56524163",
"0.55683625",
"0.55562866",
"0.5534543",
"0.55304486",
"0.5512635",
"0.5499622",
"0.54731584",
"0.5427323",
"0.5425655",
"0.5409382",
"0.5392204",
"0.53908646",
"0.53552854",
"0.53524065",
"0.5310443",
"0.52829945",
"0.527... | 0.7314921 | 0 |
PUT /size_groups/1 PUT /size_groups/1.xml | def update
@size_group = SizeGroup.find(params[:id])
result = @size_group.update_attributes(params[:size_group])
if result
for size in params[:size]
new_size = Size.new(size)
new_size.save
@size_group.sizes << new_size
end
for id,size in params[:existing_size]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n if @size_group.update_attributes(params[:size_group])\n flash[:notice] = 'SizeGroup was successfully updated.'\n render :partial => 'show', :object => @size_group\n else\n render :partial => 'edit', :object => @size_group, :status => 409\n end\n end",
"def create\n @siz... | [
"0.70120364",
"0.69220966",
"0.64207184",
"0.6169009",
"0.61627525",
"0.61554444",
"0.6005169",
"0.5867542",
"0.5837684",
"0.5837",
"0.5837",
"0.582717",
"0.582717",
"0.58034146",
"0.57465315",
"0.57335705",
"0.57080644",
"0.56834555",
"0.568102",
"0.5675042",
"0.5661914",
... | 0.72886235 | 0 |
DELETE /size_groups/1 DELETE /size_groups/1.xml | def destroy
@size_group = SizeGroup.find(params[:id])
@size_group.destroy
respond_to do |format|
format.html { redirect_to(admin_size_groups_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @size_group.destroy\n\n render :nothing => true\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n e... | [
"0.68580616",
"0.6644248",
"0.65351576",
"0.6386295",
"0.63792574",
"0.6376121",
"0.63417333",
"0.63287413",
"0.62927246",
"0.62733734",
"0.62576354",
"0.62544245",
"0.6248362",
"0.6243852",
"0.62153274",
"0.62153274",
"0.6206107",
"0.6206107",
"0.6206107",
"0.6206107",
"0.62... | 0.7525298 | 0 |
Get API URL for projects | def project_url project_id
server = lookup_server_from_project(project_id)
pivotal_url = server[:url]
{ :url => "#{pivotal_url}/projects/#{project_id}", :token => server[:token] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_url\n \"#{@@base_url}/#{format}/#{resource}?apikey=#{@@api_key}#{parameters}\"\n end",
"def api_url\n \"#{protocol}://api:#{api_key}@#{host}/#{api_version}\"\n end",
"def url\n api_url\n end",
"def api_url(url = '')\n configuration.api_base + url\n end",
"def api_url... | [
"0.74141026",
"0.7386156",
"0.7374278",
"0.7340665",
"0.73117703",
"0.73117703",
"0.7289823",
"0.7239361",
"0.72179276",
"0.7103249",
"0.7100108",
"0.7074547",
"0.70710313",
"0.70709234",
"0.7026073",
"0.70146257",
"0.69928813",
"0.69693124",
"0.6960771",
"0.6940271",
"0.6929... | 0.8046829 | 0 |
Get API URL for stories | def stories_url project_id
server = lookup_server_from_project(project_id)
pivotal_url = server[:url]
{ :url => "#{pivotal_url}/projects/#{project_id}/stories", :token => server[:token] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def story_url(story_id)\n \"https://www.pivotaltracker.com/story/show/#{story_id}\"\n end",
"def url\n api_url\n end",
"def url(path)\n \"#{API}/#{path}\"\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n base_url.concat api_query_param... | [
"0.7448583",
"0.72236496",
"0.6772528",
"0.67207557",
"0.67207557",
"0.67196035",
"0.6717534",
"0.6714422",
"0.67048585",
"0.66923547",
"0.666768",
"0.66118526",
"0.6591959",
"0.6572398",
"0.65012187",
"0.64627016",
"0.6439124",
"0.64307356",
"0.6406254",
"0.6401658",
"0.6390... | 0.7973754 | 0 |
Given a project id, get the server's information | def lookup_server_from_project pid
PT2TODO_CONFIG.each do |token, p|
if p[:project_ids].include? pid
return {:token => token, :url => p[:url], :project_ids => p[:project_ids], :append => p[:append]}
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end",
"def project_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}\", :token => server[:to... | [
"0.67969173",
"0.648968",
"0.64702517",
"0.6435057",
"0.64251554",
"0.64251554",
"0.6384335",
"0.63254493",
"0.6290833",
"0.62401676",
"0.62401676",
"0.619968",
"0.61897004",
"0.61771",
"0.61661965",
"0.61661965",
"0.6119398",
"0.61099523",
"0.61099523",
"0.61099523",
"0.6091... | 0.6733728 | 1 |
Call the Pivotal Tracker API with the given `url`. This method provides the API Token as a HTTP Header. | def pivotal_tracker(server)
clnt = HTTPClient.new
clnt.get(server[:url], nil, { "X-TrackerToken" => server[:token] })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_gh_api(url)\n auth = \"Bearer #{session[:access_token]}\"\n HTTParty.get(url, headers: { 'Authorization' => auth })\n end",
"def get(url)\n login unless token\n response = client.request(request(url, token))\n end",
"def get_token(url)\n req = Net::HTTP::Post.new('/... | [
"0.68637234",
"0.6151754",
"0.6093218",
"0.60747206",
"0.60580873",
"0.6014395",
"0.59499055",
"0.592737",
"0.5898902",
"0.5775516",
"0.57221746",
"0.56850064",
"0.5679265",
"0.5676035",
"0.56410974",
"0.5560159",
"0.5545748",
"0.55317",
"0.54871213",
"0.5484402",
"0.5480123"... | 0.6553887 | 1 |
Given a project's id (`pid`), get the project's name. | def project_name(pid)
Nokogiri::HTML(pivotal_tracker(project_url(pid)).content).css('project > name').text.split(' ').join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_name\n return project.nil? ? \"nil\" : project.name\n end",
"def name\n project.name\n end",
"def name\n project.name\n end",
"def get_project_name\n project_id = params[:project_id]\n name_from_repository = payload.fetch(\"repository\", {}).fetch(\"name\", nil)\n ... | [
"0.72045237",
"0.7092095",
"0.7092095",
"0.7077162",
"0.69105375",
"0.6875942",
"0.6819747",
"0.6638206",
"0.66316247",
"0.6622742",
"0.65775937",
"0.654773",
"0.64752764",
"0.64124054",
"0.64104426",
"0.64066786",
"0.6398371",
"0.6375751",
"0.63715607",
"0.636676",
"0.635479... | 0.74874276 | 0 |
Formats a Pivotal Tracker story in the todo.txt format. Letterbased priorities are given to it depending on what the story's current status is. The story's labels and story type are todo.txt's contexts, while the story's project name is the todo's story. The URL of the story is also added to the | def format_todotxt(project_id, priority_group, story)
task_priority =
case priority_group
when :today then "(A)"
when :next then "(B)"
when :someday then "(C)"
end
done = task_priority.nil?
# TODO: escape newlines...
title = story.css('name').text
url = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_todos(project_id, body)\n body.css('stories > story').select do |s|\n s.css('owned_by').text == OWNER\n end.inject({}) do |tasks, s|\n state = map_state s.css('current_state').text\n tasks[state] ||= []\n tasks[state] << s\n tasks\n end.map do |priority_group, sto... | [
"0.5548532",
"0.5497139",
"0.5434224",
"0.54246116",
"0.5349843",
"0.5301151",
"0.5189603",
"0.51767135",
"0.5167253",
"0.5122934",
"0.5066005",
"0.5065631",
"0.5051362",
"0.4954177",
"0.49262172",
"0.4900673",
"0.48756233",
"0.4872546",
"0.4846569",
"0.48429677",
"0.48277056... | 0.6737708 | 0 |
POST /extrainfos POST /extrainfos.json | def create
@extrainfo = Extrainfo.new(extrainfo_params)
respond_to do |format|
if @extrainfo.save
format.html { redirect_to @extrainfo, notice: 'Extrainfo was successfully created.' }
format.json { render :show, status: :created, location: @extrainfo }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @exura = Exura.new(params[:exura])\n\n respond_to do |format|\n if @exura.save\n format.html { redirect_to @exura, :notice => 'Exura was successfully created.' }\n format.json { render :json => @exura, :status => :created, :location => @exura }\n else\n format.html... | [
"0.6477917",
"0.6452822",
"0.6386044",
"0.63467216",
"0.6341108",
"0.62873137",
"0.62272525",
"0.61360425",
"0.6111131",
"0.61053085",
"0.60925347",
"0.5999772",
"0.597448",
"0.5958246",
"0.5928762",
"0.592325",
"0.5868088",
"0.5863465",
"0.5855971",
"0.58298975",
"0.5807835"... | 0.699139 | 0 |
PATCH/PUT /extrainfos/1 PATCH/PUT /extrainfos/1.json | def update
respond_to do |format|
if @extrainfo.update(extrainfo_params)
format.html { redirect_to @extrainfo, notice: 'Extrainfo was successfully updated.' }
format.json { render :show, status: :ok, location: @extrainfo }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def put!\n request! :put\n... | [
"0.6490018",
"0.63941336",
"0.6353184",
"0.62906724",
"0.6274898",
"0.6227476",
"0.608346",
"0.6076439",
"0.6041",
"0.60309714",
"0.6018341",
"0.6018341",
"0.60180306",
"0.60087246",
"0.5976015",
"0.5969854",
"0.5966978",
"0.59630626",
"0.5961317",
"0.5929762",
"0.5929762",
... | 0.64578694 | 1 |
DELETE /extrainfos/1 DELETE /extrainfos/1.json | def destroy
@extrainfo.destroy
respond_to do |format|
format.html { redirect_to extrainfos_url, notice: 'Extrainfo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to d... | [
"0.7043066",
"0.7011445",
"0.6942014",
"0.69308174",
"0.6903876",
"0.6897384",
"0.68756527",
"0.6838577",
"0.6838577",
"0.6838577",
"0.6838577",
"0.6828904",
"0.68108577",
"0.6798737",
"0.6778925",
"0.67766374",
"0.6763466",
"0.67148453",
"0.67148453",
"0.67074263",
"0.670496... | 0.7034075 | 1 |
genera la secuencia sugerida para la nueva cuenta a crear, dependiendo del nivel, grupo y antesosor(padre) | def secuenciasugerida
#recupera los hijos del padre de la cuenta a crear
hijos = Catalogo.where("padre_id = ? AND activo = ?", idcuenta, true)
#configuracion del nivel a crear
idnivel = Catalogo.find_by(id: idcuenta).nivel_id
nivelh = Nivel.find_by(id: idnivel).numnivel + 1
nivel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crear_cuotas\n case params[:adquisicion][:tipo_pago].to_s\n when TIPOS_PAGO[:unico].to_s\n @adquisicion.cuotas.destroy_all\n cuotas = params[:cant_cuotas]\n monto_cuota = @adquisicion.precio / cuotas.to_d\n cuotas.to_i.times do |i|\n @adquisicion.cuotas.create(monto: monto_cuot... | [
"0.6265763",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.62145287",
"0.6134717",
"0.6045473",
"0.6026282",
"0.60232174",
"0.6023134",
"0.59959847",
"0.5969039",
"0.596721",
"0.59435815",
"0.5931124",
"0.5926837",
"0.5911679",
"0.591013",
"0.590389... | 0.71432227 | 0 |
only considers quickerydefined attributes that has corresponding _is_synced attribute | def autoload_unsynced_quickery_attributes!
model = self.class
new_values = {}.with_indifferent_access
defined_quickery_attribute_names = model.quickery_builders.keys
defined_quickery_attribute_names.each do |defined_quickery_attribute_name|
if has_attribute?(:"#{def... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _synced?(foreign_key)\n !!_synced[foreign_key]\n end",
"def scrub_synchronization_attribute(deal,attr)\n if deal.class.respond_to?(:textiled_attributes) && deal.class.textiled_attributes.include?(attr)\n new_value = deal.send(\"#{attr}_source\")\n else\n new_value = deal.send(... | [
"0.6095924",
"0.59599996",
"0.58271426",
"0.5730572",
"0.5705877",
"0.5695839",
"0.5673582",
"0.55953157",
"0.5543445",
"0.55270517",
"0.5524354",
"0.5520179",
"0.5516502",
"0.551319",
"0.55001205",
"0.54952997",
"0.5477083",
"0.5475733",
"0.5455401",
"0.5431728",
"0.5431087"... | 0.71277004 | 0 |
Public: resolves a template file by looking in the template path. template the template name. extension the extension of the desired template. Returns a string with the full path of the template file, or nil if it is not found. | def which(template, extension)
template_with_extension = with_extension(template, extension)
path = absolute_paths.find do |path|
File.exists?(File.join(path, template_with_extension))
end
if path
File.join(path, template_with_extension)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_generic_base_path_for(template_path, extension)\r\n self.generic_view_paths.each do |generic_path|\r\n template_file_name = File.basename(\"#{template_path}.#{extension}\")\r\n generic_file_path = File.join(generic_path, template_file_name)\r\n return generic_file_path if File.file?(gene... | [
"0.68350315",
"0.67410886",
"0.6671121",
"0.6603019",
"0.6590045",
"0.65762275",
"0.6571085",
"0.65390545",
"0.6436278",
"0.64287364",
"0.6421778",
"0.6420174",
"0.6385109",
"0.63465685",
"0.63382506",
"0.63286084",
"0.62684655",
"0.6265778",
"0.6265469",
"0.62527573",
"0.624... | 0.776013 | 0 |
Internal: parses the SNP_PATH environment variable, if it is set. The format of this variable follows the same convention of the shell's PATH variable: a series of directories separated by a collon. | def path_from_env
ENV['SNP_PATH'] && ENV['SNP_PATH'].split(':')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_components\n ENV[\"PATH\"].split(File::PATH_SEPARATOR)\n end",
"def search_paths\n if Facter::Util::Config.is_windows?\n ENV['PATH'].split(File::PATH_SEPARATOR)\n else\n # Make sure facter is usable even for non-root users. Most commands\n # in /sbin ... | [
"0.6350788",
"0.61692876",
"0.6108359",
"0.60479987",
"0.6006013",
"0.56962854",
"0.560953",
"0.54449874",
"0.5419041",
"0.53316724",
"0.5322733",
"0.52796775",
"0.523518",
"0.52253497",
"0.52247226",
"0.52175707",
"0.514121",
"0.5131753",
"0.5096797",
"0.5081887",
"0.5060693... | 0.76109356 | 0 |
Internal: The default path to be used when the SNP_PATH environment variable is not set. | def default_path
['~/.snp']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def default_path\n [ (std_path || key).to_s ]\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def default_location(path)\n @default_l... | [
"0.720874",
"0.7201132",
"0.6855536",
"0.68170434",
"0.65672755",
"0.65531117",
"0.65386796",
"0.6502629",
"0.64971036",
"0.6458221",
"0.6452482",
"0.6447052",
"0.64297146",
"0.636688",
"0.63502985",
"0.6346362",
"0.6315723",
"0.63072366",
"0.6253574",
"0.623244",
"0.6228113"... | 0.78266937 | 0 |
Internal: checks if the given name ends with the passed `extension`. template the template file name. | def has_extension?(template, extension)
comparison_length = extension.size + 1 # account for the separator `.`
template[-comparison_length, comparison_length] == ".#{extension}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_extension(template, extension)\n if has_extension?(template, extension)\n template\n else\n [template, extension].join(\".\")\n end\n end",
"def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_t... | [
"0.6975325",
"0.6791653",
"0.66175735",
"0.6517187",
"0.6449324",
"0.63726413",
"0.6355915",
"0.63004774",
"0.6284425",
"0.6154373",
"0.6081745",
"0.6077228",
"0.6063268",
"0.6059363",
"0.6023971",
"0.60202056",
"0.59951144",
"0.5989277",
"0.5966371",
"0.5961906",
"0.5943594"... | 0.7559135 | 0 |
Internal: appends a given extension to the template file name, unless it is already present. template the template name. extension the extension to be appended. Examples with_extension('template', 'erb') => 'template.erb' with_extension('template.erb', 'erb') => 'template.erb' | def with_extension(template, extension)
if has_extension?(template, extension)
template
else
[template, extension].join(".")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extension(extension)\n @parts[-1] += extension\n self\n end",
"def has_extension?(template, extension)\n comparison_length = extension.size + 1 # account for the separator `.`\n template[-comparison_length, comparison_length] == \".#{extension}\"\n end",
"def add_extension(extension... | [
"0.6594336",
"0.65772706",
"0.63158554",
"0.63143957",
"0.61433566",
"0.6132027",
"0.61304796",
"0.6016413",
"0.6016127",
"0.59928286",
"0.59236294",
"0.57205904",
"0.56855106",
"0.5682433",
"0.5664156",
"0.5629763",
"0.5608832",
"0.56020075",
"0.55786294",
"0.55632615",
"0.5... | 0.8158917 | 0 |
We need to sign the customer in ourselves, since iVeri is not sending the relevant data back to us to do so. | def sign_the_customer_in
transaction = ::Refinery::Transactions::Transaction.find_by_unique_guid(params['REFERENCE'])
sign_in(:customer, ::Refinery::Customers::Customer.find(transaction.order.customer_id))
@current_cart = get_cart # get the cart again now that the customer is signed in.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_customer\n if signed_in?\n # technically we need nothing here\n end\n end",
"def signing_input; end",
"def signing_input; end",
"def yes_email_customer_from_authorizes_side\n add_field 'x_email_customer', 'TRUE'\n end",
"def sign_key; end",
"def authenticate_customer ... | [
"0.6846734",
"0.63465387",
"0.63465387",
"0.63450724",
"0.6340723",
"0.63189065",
"0.6277125",
"0.6246811",
"0.6063762",
"0.60343224",
"0.60134095",
"0.60134095",
"0.60125744",
"0.59851396",
"0.59639746",
"0.59639627",
"0.5956256",
"0.5952504",
"0.590299",
"0.5901953",
"0.589... | 0.71816576 | 0 |
TODO: Dynamically get all rows rather than pass 'range' | def rows(range = 'Sheet1!A1:E')
get_spreadsheet_data('1eu1Dk67gKnrIgQQ9Fm0Y-RCMzRfZf1UaTQzEt7hjWp0', range)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rows_range(first = 0, last = nil) # :nodoc:\n raise UserError, 'first must be <= last' unless first <= last\n\n rows = []\n unless columns.empty?\n first.upto(last) do |rnum|\n row = {}\n columns.each do |col|\n row[col.header] = col[rnum]\n end\n ... | [
"0.672839",
"0.67164075",
"0.6694675",
"0.66362226",
"0.6615368",
"0.66138285",
"0.6606335",
"0.6586247",
"0.6586247",
"0.6586247",
"0.6510116",
"0.65025324",
"0.6498556",
"0.6463678",
"0.6440741",
"0.64182705",
"0.6337631",
"0.6328529",
"0.6287581",
"0.6259047",
"0.6258721",... | 0.7596468 | 0 |
returns array with hospital id, medication_id, number of times medication_id was used at hospital [42, 16765295]=>111 | def specific_type_of_medication_per_hospital
self.group(:hospital_id, :medication_id).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_difficulties\n hash = {}\n i = 0\n while i < 20\n hash[i] = 0\n i += 1\n end\n Drink.all.each do |drink|\n hash[drink.ingredient_cards.count] += 1\n end\n puts hash\nend",
"def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ?... | [
"0.58500665",
"0.58138436",
"0.58138436",
"0.576875",
"0.57653105",
"0.5693156",
"0.565424",
"0.56382746",
"0.56226605",
"0.5613709",
"0.55733454",
"0.5559981",
"0.5547532",
"0.55389106",
"0.553436",
"0.55102015",
"0.54824936",
"0.54754084",
"0.5461262",
"0.5435352",
"0.53868... | 0.72497386 | 0 |
GET /driver_records/1 GET /driver_records/1.json | def show
@driver_record = DriverRecord.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @driver_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # Show one record\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end",
"def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb... | [
"0.6861106",
"0.6809781",
"0.6809781",
"0.6574814",
"0.6574814",
"0.65286845",
"0.64505",
"0.64355457",
"0.6401136",
"0.62814564",
"0.62053055",
"0.6124168",
"0.60773325",
"0.6062787",
"0.5990919",
"0.5952037",
"0.5906692",
"0.58758545",
"0.58706003",
"0.5868208",
"0.5864481"... | 0.7367887 | 0 |
GET /driver_records/new GET /driver_records/new.json | def new
@driver_record = DriverRecord.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @driver_record }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record }\n end\n end",
"def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record }\n end\n... | [
"0.7258903",
"0.72587854",
"0.7236554",
"0.718399",
"0.69215286",
"0.6864256",
"0.68528205",
"0.68060476",
"0.67966753",
"0.6787377",
"0.67457736",
"0.6743945",
"0.668736",
"0.66867137",
"0.667267",
"0.66495174",
"0.66326463",
"0.66323626",
"0.66277874",
"0.6599418",
"0.65901... | 0.7901467 | 0 |
POST /driver_records POST /driver_records.json | def create
@driver_record = DriverRecord.new(params[:driver_record])
respond_to do |format|
if @driver_record.save
format.html { redirect_to @driver_record, notice: 'Driver record was successfully created.' }
format.json { render json: @driver_record, status: :created, location: @driver_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # Logic to create a driver and submit to DB\n @driver = Driver.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, locatio... | [
"0.6331399",
"0.62563723",
"0.61658174",
"0.6081424",
"0.60665923",
"0.59789217",
"0.5924245",
"0.5627075",
"0.5605765",
"0.5591048",
"0.5588457",
"0.5579364",
"0.5578564",
"0.557839",
"0.5564735",
"0.55064946",
"0.5502049",
"0.5485057",
"0.5479977",
"0.54617584",
"0.5436395"... | 0.69242376 | 0 |
PUT /driver_records/1 PUT /driver_records/1.json | def update
@driver_record = DriverRecord.find(params[:id])
respond_to do |format|
if @driver_record.update_attributes(params[:driver_record])
format.html { redirect_to @driver_record, notice: 'Driver record was successfully updated.' }
format.json { head :no_content }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t\t\trespond_with Driver.update(params[:id],params[:driver])\n\t\t\tend",
"def update\n #@driver = Driver.find(params[:id])\n @driver = @event.drivers.find(params[:id])\n\n respond_to do |format|\n if @driver.update_attributes(params[:driver])\n format.html { redirect_to [@eve... | [
"0.66712904",
"0.6377764",
"0.63377064",
"0.60311097",
"0.5984553",
"0.5977846",
"0.5977846",
"0.59686136",
"0.59617054",
"0.5920817",
"0.58608276",
"0.58064646",
"0.5797752",
"0.57845855",
"0.57702583",
"0.57278895",
"0.56001943",
"0.55585754",
"0.55535144",
"0.55468",
"0.55... | 0.653862 | 1 |
DELETE /driver_records/1 DELETE /driver_records/1.json | def destroy
@driver_record = DriverRecord.find(params[:id])
@driver_record.destroy
respond_to do |format|
format.html { redirect_to driver_records_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Logic to delete a record\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\trespond_with Driver.destroy(params[:id])\n end... | [
"0.7188934",
"0.7096676",
"0.7003741",
"0.6833237",
"0.6816964",
"0.6704521",
"0.66454375",
"0.66403776",
"0.66403776",
"0.66403776",
"0.6638277",
"0.6633604",
"0.66118133",
"0.6610802",
"0.66096276",
"0.65934575",
"0.6559825",
"0.6555986",
"0.6537249",
"0.6534184",
"0.651305... | 0.75246847 | 0 |
Fetch the size of an url | def fetch_filesize(url)
uri = URI.parse(url)
header = {
'User-Agent' => "A tiny script in ruby to analyse your videos :) - But don't worry a user is also there.",
}
h = Net::HTTP.new uri.host, uri.port
getfile = uri.path
getfile << '?' << uri.query if not uri.query.nil?
res = h.request_head(getfile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_size(url)\n Rails.cache.fetch(\"/content_size/#{url}\", expires_in: 10.minutes) do\n begin\n meta = meta_file(url)\n size_text = meta.xpath(\"//m:metalink//m:file//m:size[1]//text()\", 'm' => 'urn:ietf:params:xml:ns:metalink')\n size = Integer(size_text.to_s)\n size\... | [
"0.81279415",
"0.78865814",
"0.7780762",
"0.77487236",
"0.76869905",
"0.76749206",
"0.7631035",
"0.75966054",
"0.7353377",
"0.72136194",
"0.7048881",
"0.693597",
"0.6932003",
"0.69188637",
"0.6882509",
"0.68779504",
"0.6874736",
"0.68506676",
"0.6802141",
"0.6795249",
"0.6780... | 0.81690514 | 0 |
Transform amount of bytes in humanreadable format | def transform_byte(byte)
byte = byte.to_f
return two_digits(byte / 1073741824).to_s << " GB" if byte > 1073741824
return two_digits(byte / 1048576).to_s << " MB" if byte > 1048576
return two_digits(byte / 1024).to_s << " KB" if byte > 1024
return two_digits(byte).to_s << " B"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def human_bytes(bytes)\n number_to_human bytes, units: BYTE_UNITS\n end",
"def human_bytes(bytes)\n s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];\n #indicates if thousands, millions ...\n place = (Math.log(bytes)/Math.log(1024)).floor\n (bytes/(1024 ** place.floor)).to_s+\" \"+s[place];\n end",
... | [
"0.70848453",
"0.70743954",
"0.6750771",
"0.6711211",
"0.66790736",
"0.66623867",
"0.6643506",
"0.6584201",
"0.6547346",
"0.6420426",
"0.6404685",
"0.6282758",
"0.62650555",
"0.62376094",
"0.6218412",
"0.621097",
"0.6174452",
"0.6171634",
"0.61682737",
"0.61593324",
"0.6157",... | 0.73856795 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.