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 |
|---|---|---|---|---|---|---|
make sure the fieldset child has the type field does not explicitly check to make sure the fieldset_child exists, still have to validate presence | def type_of_fieldset_child
# yet another casualty of me not understanding how the objects are getting duplicated in development (JH 3-6-2012)
if self.fieldset_child && !self.fieldset_child.child.class.superclass.to_s.eql?("DynamicFieldsets::Field")
self.errors.add(:fieldset_child, "The fieldset chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_type\n# errors[:base] << 'Child Type must be of Type 2' unless self.link_to_type1.present? &&\n# self.extraction_forms_projects_section_type_id != 2\n end",
"def child_type\n # errors[:base] << 'Child Type must be of Type 2' unless self.link_to_type1.present? &&\n # self.extracti... | [
"0.70231944",
"0.6922956",
"0.6440982",
"0.6440982",
"0.6440982",
"0.63344896",
"0.6288977",
"0.6173091",
"0.61467975",
"0.5995092",
"0.59652615",
"0.5923634",
"0.5919762",
"0.58465743",
"0.5844478",
"0.58345366",
"0.5817065",
"0.5791394",
"0.57801014",
"0.5755942",
"0.573684... | 0.79009604 | 0 |
GET /collections/1/tags GET /collections/1/items/1/tags | def index
@tags = Tag.all(@collection,@item)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def tags\n get.tagGu... | [
"0.7338382",
"0.66649437",
"0.6623007",
"0.6521329",
"0.6483277",
"0.64694893",
"0.64522207",
"0.63400835",
"0.6217848",
"0.6176708",
"0.6155274",
"0.6133791",
"0.6121962",
"0.6099889",
"0.6090993",
"0.6086942",
"0.6063106",
"0.6053097",
"0.60441285",
"0.60392934",
"0.6028122... | 0.69974333 | 1 |
GET /collections/1/tags/new GET /collections/1/items/1/tags/new | def new
# puts("*** Entering CTRL: new tag")
@tag = Tag.new(@collection,@item)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @tagged_item = TaggedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.7237599",
"0.6976424",
"0.6761104",
"0.66958153",
"0.66379064",
"0.6616588",
"0.6525163",
"0.6525163",
"0.6525163",
"0.6521081",
"0.6519361",
"0.64841324",
"0.6470943",
"0.6470943",
"0.6417732",
"0.64093906",
"0.63941395",
"0.638898",
"0.63870424",
"0.6334915",
"0.63241",
... | 0.73462933 | 0 |
POST /moments or /moments.json | def create
@moment = current_user.moments.build(moment_params)
respond_to do |format|
if @moment.save
format.html { redirect_to moments_url, notice: "Moment was successfully created." }
format.json { render :show, status: :created, location: @moment }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def index\n @moments = @current_user.moments\n end",
"def create\n @moment = current_user.moments.new(moment_params)\n\n respond_to do |format|\n if @moment.save\n format.html { redirect_to @moment, noti... | [
"0.6251371",
"0.61615825",
"0.606678",
"0.5811625",
"0.56125194",
"0.55918616",
"0.55745524",
"0.5552562",
"0.5508678",
"0.5492725",
"0.5454414",
"0.54143167",
"0.5404124",
"0.538497",
"0.53615993",
"0.5343025",
"0.53336287",
"0.5321239",
"0.5309081",
"0.5293213",
"0.5284544"... | 0.619527 | 1 |
Normalize the userspecified +user name+ by ensuring all characters are lowercase | def normalize_user_name
self.user_name = user_name.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_name\n @normalize_name ||= begin\n return '' if name.empty?\n\n exclude = %w[corporation institute organization university\n all and of the].join('|')\n tmp = name.dup\n tmp.gsub!(/#{exclude}/i, '')\n tmp.gsub!(/\\s+/, ' ')\n tmp.stri... | [
"0.7732587",
"0.7538877",
"0.74109554",
"0.735674",
"0.7326526",
"0.7292984",
"0.72748536",
"0.72128844",
"0.7164341",
"0.71568537",
"0.71217805",
"0.7112293",
"0.70809937",
"0.70594114",
"0.7049664",
"0.70431054",
"0.704309",
"0.6993066",
"0.6992056",
"0.69883704",
"0.698662... | 0.86338985 | 0 |
If no +Role+ is defined for this +User+, then set its value to the 'Guest' role. | def set_valid_role
return unless self.role.nil?
guest_role = Role.find_by(name: 'Guest')
if guest_role.nil?
Role.create!(name: 'Guest')
guest_role = Role.find_by(name: 'Guest')
end
self.role = guest_role
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_role\n self.role ||= :user\n end",
"def set_role\n return if role?\n\n self.role = 'regular'\n end",
"def set_default_role\n\n\t\tself.role ||= :user\n\n\tend",
"def set_default_role\n if User.count == 0\n self.role ||= :admin\n else\n self.role ||= :user\n e... | [
"0.72533274",
"0.7250189",
"0.71939766",
"0.7093607",
"0.70343244",
"0.70343244",
"0.70343244",
"0.70343244",
"0.7007119",
"0.69974685",
"0.69734913",
"0.6920022",
"0.69128937",
"0.69079375",
"0.6904565",
"0.69039685",
"0.69001675",
"0.68688977",
"0.6865399",
"0.686186",
"0.6... | 0.7731917 | 0 |
Xbonacci Define a Xbonacci method that works similarly to the fibonacci sequence. The fibonacci sequence takes the previous two numbers in the sequence and adds them together to create the next number. First five fibonacci numbers = [1, 1, 2, 3, 5] The fourth fibonacci number (3) is the sum of the two numbers before it... | def xbonacci(starting_sequence, number_of_xbonacci_numbers_to_return)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xbonacci(starting_sequence, number_of_xbonacci_numbers_to_return)\n result = starting_sequence\n nums_to_sum = starting_sequence.length\n until result.length == number_of_xbonacci_numbers_to_return\n last_x_nums = result[-nums_to_sum..-1]\n result << last_x_nums.reduce(:+)\n end\n result\nend",
"d... | [
"0.80176884",
"0.7984108",
"0.7539609",
"0.6772939",
"0.67596626",
"0.67449975",
"0.66255",
"0.6601159",
"0.6588812",
"0.6583255",
"0.6569543",
"0.6542776",
"0.65291697",
"0.64864016",
"0.6470655",
"0.64652467",
"0.6459252",
"0.6455869",
"0.6429513",
"0.64017355",
"0.6399866"... | 0.85519403 | 0 |
Define a method that accepts two arguments, a string and an integer. The method should return a copy of the string with the nth letter removed. | def remove_nth_letter(string, n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_nth_letter(string, n)\n string.delete!(string[n])\nend",
"def remove_nth_letter(string, n)\n string[0...n] + string[n + 1..-1]\nend",
"def remove_nth_letter(string, n)\n string[0..n-1] + string[n+1..-1]\nend",
"def remove_char(str)\n str[1..-2]\nend",
"def remove_char(s)\n #s = string\n s =... | [
"0.8249591",
"0.81215423",
"0.8022631",
"0.6744611",
"0.6646624",
"0.6597645",
"0.6569726",
"0.64991504",
"0.6421217",
"0.6401433",
"0.63977814",
"0.6355863",
"0.63133025",
"0.6309298",
"0.62609863",
"0.6213753",
"0.6187083",
"0.6177191",
"0.616081",
"0.6143124",
"0.6131583",... | 0.8559825 | 0 |
Define a method that returns a boolean indicating whether its second argument is a substring of its first. | def substring?(long_string, short_string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_substring?(s1, s2) \n return s1.include?(s2)\nend",
"def is_substring?(s1, s2)\n s1.include?(s2) #disregarding efficiency, method is assumed to be given\nend",
"def substring?(long_string, short_string)\n\n long_string.match(short_string) != nil\n\nend",
"def custom_start_with?(string, substr... | [
"0.80157924",
"0.8008926",
"0.7671386",
"0.74924386",
"0.74549687",
"0.73277915",
"0.72978634",
"0.7234973",
"0.7149062",
"0.70759195",
"0.7059196",
"0.7057094",
"0.69128174",
"0.68623054",
"0.6855076",
"0.6848719",
"0.6781607",
"0.6775764",
"0.6766136",
"0.67593026",
"0.6733... | 0.81432194 | 0 |
Define a method that returns the number of times that two adjacent numbers in an array sum to n. Don't reuse numbers. count_adjacent_sums([1, 5, 1, 3, 3], 6) => 2 | def count_adjacent_sums(array, n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_adjacent_sums(array, n)\n count = 0\n array.each_with_index do |i, idx |\n # if array[idx] + array[idx + 1] == n\n # count++\n # end\n count += 1 if array[idx] + array[idx + 1] == n\n end\n count\nend",
"def count_adjacent_sums(array, n)\n\n idx = 0\n counter = 0\n \n while idx < ... | [
"0.86977625",
"0.86005074",
"0.8300431",
"0.68299156",
"0.68127006",
"0.6784018",
"0.67761976",
"0.6737117",
"0.6686882",
"0.6580209",
"0.65610546",
"0.655766",
"0.65525687",
"0.6506808",
"0.64997923",
"0.6481732",
"0.64759845",
"0.64552367",
"0.6437471",
"0.6395303",
"0.6380... | 0.8816689 | 0 |
Produces a bossa nova song. | def song
fetch('bossa_nova.songs')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song\n fetch('cowboy_bebop.song')\n end",
"def new_song(name, style)\n Song.new(name, self, style) \n end",
"def print_song\n\t\t... | [
"0.677008",
"0.677008",
"0.677008",
"0.677008",
"0.677008",
"0.677008",
"0.677008",
"0.677008",
"0.6574899",
"0.6495615",
"0.62428176",
"0.62312734",
"0.6161128",
"0.61214226",
"0.6114154",
"0.6102777",
"0.6102777",
"0.6102777",
"0.6092748",
"0.6011688",
"0.6011688",
"0.598... | 0.74547887 | 0 |
Create a Gift object form a file IO or string. | def initialize(io_or_string)
parser = GiftParser.new()
case io_or_string
when String
# Add blank line to make sure we can parse.
@root = parser.parse(io_or_string + "\n\n")
when IO
@root = parser.parse(io_or_string.read + "\n\n")
end
raise Arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newobj(type, name, hash)\n transport = Puppet::TransObject.new(name, \"file\")\n transport[:path] = path\n transport[:ensure] = \"file\"\n assert_nothing_raised {\n file = transport.to_ral\n }\n end",
"def file\n FileFactory.new(self)\n end",
"def create_from_file\n end",
... | [
"0.6215055",
"0.6087504",
"0.59770167",
"0.5920798",
"0.58932143",
"0.58302087",
"0.5805236",
"0.5805236",
"0.57885206",
"0.57885206",
"0.5723193",
"0.57144445",
"0.56876266",
"0.56876266",
"0.56876266",
"0.56109446",
"0.5602758",
"0.55791974",
"0.5553969",
"0.55070716",
"0.5... | 0.63050574 | 0 |
The set of possible answers for this question. Returns a array of hashes with contents depending on the subclass. | def answers
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordered_subclasses\n [Question]\n end",
"def questions\n qs = []\n qs |= self.class.questions if self.class.respond_to? :questions\n qs |= (@_questions||=[])\n qs.map{|q| q.for_instance(self) }\n end",
"def all_answered_questions\n self.all_answered_options.map{ |answe... | [
"0.6821087",
"0.66207427",
"0.6586905",
"0.65616286",
"0.65408945",
"0.63938844",
"0.63335985",
"0.63327706",
"0.6297968",
"0.6291678",
"0.62664795",
"0.6229333",
"0.6177843",
"0.6176609",
"0.61300033",
"0.6108227",
"0.6064622",
"0.6025899",
"0.5969433",
"0.59585416",
"0.5941... | 0.66339445 | 1 |
The markup language that the question text is encoded in. This library does not do any of the markup translation, programs can use this info to translate as needed. | def markup_language
_markup.text_value.gsub(/[\[\]]/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_text\n self.answer_type_fields.find_by_is_default_language(true).help_text\n end",
"def questioning\n return text\n end",
"def questioning\n return text\n end",
"def language_of_text\n @descriptive_detail.language_of_text || @default_language_of_text\n end",
"def ... | [
"0.6688618",
"0.66108584",
"0.66108584",
"0.651397",
"0.6307233",
"0.62202495",
"0.62202495",
"0.62202495",
"0.62202495",
"0.61555916",
"0.6148029",
"0.60509473",
"0.602616",
"0.6018582",
"0.6003887",
"0.59653527",
"0.5949383",
"0.5949383",
"0.5949383",
"0.5949383",
"0.593021... | 0.69142354 | 0 |
GET /sleeps/1 GET /sleeps/1.json | def show
@sleep = current_user.sleeps.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @sleep }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @sleep = Sleep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sleep }\n end\n end",
"def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end",
"def sleep_goal\n get_call(\"user/#{user_id}/sleep/... | [
"0.7033228",
"0.65402895",
"0.6471279",
"0.6355584",
"0.6207425",
"0.6160613",
"0.6124297",
"0.59676063",
"0.5946991",
"0.59293646",
"0.58729357",
"0.58701843",
"0.56785387",
"0.5649006",
"0.5620961",
"0.55976325",
"0.5564828",
"0.55265474",
"0.55041295",
"0.54826033",
"0.546... | 0.7087445 | 0 |
GET /sleeps/new GET /sleeps/new.json | def new
@sleep = Sleep.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @sleep }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.7751493",
"0.6891105",
"0.6804084",
"0.6660628",
"0.6572316",
"0.6370298",
"0.63644415",
"0.62571985",
"0.6257131",
"0.61897904",
"0.6181295",
"0.6128751",
"0.61108243",
"0.60903966",
"0.60765994",
"0.60338145",
"0.60338145",
"0.6033535",
"0.59845555",
"0.5976159",
"0.5964... | 0.7870836 | 0 |
DELETE /sleeps/1 DELETE /sleeps/1.json | def destroy
@sleep = current_user.sleeps.find(params[:id])
@sleep.destroy
respond_to do |format|
format.html { redirect_to sleeps_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sleep = Sleep.find(params[:id])\n @sleep.destroy\n\n respond_to do |format|\n format.html { redirect_to sleeps_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_sleep_log(sleep_log_id)\n delete(\... | [
"0.6978338",
"0.66678244",
"0.65641034",
"0.6484028",
"0.63624436",
"0.63587046",
"0.6356147",
"0.6307889",
"0.6278891",
"0.62632215",
"0.62600636",
"0.6258791",
"0.623899",
"0.62232816",
"0.6196048",
"0.6174435",
"0.6138644",
"0.61303335",
"0.61303335",
"0.6125539",
"0.61043... | 0.70261747 | 0 |
it's just a proof of concept RSA public key calculation c = m ^ e (mod n) | def rsa_public(input, n, e)
input_bn = OpenSSL::BN.new(input.to_s)
n_bn = OpenSSL::BN.new(n.to_s)
e_bn = OpenSSL::BN.new(e.to_s)
(input_bn.mod_exp(e_bn, n_bn)).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_rsa_keys(p, q)\r\n # Find \"n\", the product of two primes\r\n n = p * q\r\n # Calculate Euler's Totient For The Two Primes\r\n eulers_totient = (p - 1) * (q - 1)\r\n # Find Public Key \"e\" such that 1 < e < totient, e is coprime to totient\r\n key_public = 2\r\n loop do\r\n ... | [
"0.73996276",
"0.7374323",
"0.70588946",
"0.67916286",
"0.67742676",
"0.67610824",
"0.67261845",
"0.6719489",
"0.6437336",
"0.6436067",
"0.64295506",
"0.6402239",
"0.63930297",
"0.6307873",
"0.6262078",
"0.6162276",
"0.61330074",
"0.6114726",
"0.6107234",
"0.6094144",
"0.6080... | 0.7945688 | 0 |
RSA private key calculation s = m ^ d (mod n) | def rsa_private(input, n, d)
input_bn = OpenSSL::BN.new(input.to_s)
n_bn = OpenSSL::BN.new(n.to_s)
d_bn = OpenSSL::BN.new(d.to_s)
(input_bn.mod_exp(d_bn, n_bn)).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsa(m, e, *args)\n puts \"m:#{m}\\te:#{e}\\targs:#{args.join(',')}\" if LOG\n d, n, *crt = key(e,*args)\n assert (mm = crypt(c = crypt(m,e,n),d,n)) == m\n if crt.length==5# && crt[0]>2 && crt[1]>2\n mm = decrypt(c = crypt(m,e,n),*crt)\n assert (mm = decrypt(c = crypt(m,e,n),*crt)) == m\n end\n puts... | [
"0.71216524",
"0.69650006",
"0.693128",
"0.66293466",
"0.6515575",
"0.64085954",
"0.6328955",
"0.62957424",
"0.6280935",
"0.62627316",
"0.6240747",
"0.6236703",
"0.6186807",
"0.6151163",
"0.60458994",
"0.60344005",
"0.60343975",
"0.5964335",
"0.5890286",
"0.5887269",
"0.58619... | 0.8065144 | 0 |
GET /secondary_courses GET /secondary_courses.json | def index
@secondary_courses = SecondaryCourse.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_secondary_course\n @secondary_course = SecondaryCourse.find(params[:id])\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def get_courses\n\t\tif current_st... | [
"0.671804",
"0.6518391",
"0.6447152",
"0.64219534",
"0.6415659",
"0.6411548",
"0.63990957",
"0.6391386",
"0.63908356",
"0.6389487",
"0.63824373",
"0.6372654",
"0.63601285",
"0.6354478",
"0.63308",
"0.63034195",
"0.6291291",
"0.6227879",
"0.62151533",
"0.615767",
"0.61557716",... | 0.76493543 | 0 |
POST /secondary_courses POST /secondary_courses.json | def create
@secondary_course = SecondaryCourse.new(secondary_course_params)
respond_to do |format|
if @secondary_course.save
format.html { redirect_to @secondary_course, notice: 'Secondary course was successfully created.' }
format.json { render :show, status: :created, location: @seconda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(params)\n response = self.class.post(\n '/webservice/rest/server.php',\n {\n :query => query_hash('core_course_create_courses', token),\n :body => {\n :courses => {\n '0' => {\n :fullname => params[:full_name],\n ... | [
"0.6606048",
"0.65685135",
"0.6503068",
"0.64794147",
"0.64541143",
"0.6408886",
"0.6399077",
"0.6397026",
"0.63491493",
"0.6310666",
"0.63069636",
"0.6291308",
"0.6270198",
"0.6238796",
"0.62306225",
"0.62085557",
"0.61936975",
"0.6159501",
"0.6117307",
"0.6117208",
"0.61165... | 0.7494607 | 0 |
PATCH/PUT /secondary_courses/1 PATCH/PUT /secondary_courses/1.json | def update
respond_to do |format|
if @secondary_course.update(secondary_course_params)
format.html { redirect_to @secondary_course, notice: 'Secondary course was successfully updated.' }
format.json { render :show, status: :ok, location: @secondary_course }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end",
"def update\n @student_sub_course = StudentSubCourse.find(params[:id])\n\n respond_to do |format|\n if @student_sub_course.update_attributes(params[:student_sub_course])\n format.html { redirect_to @stu... | [
"0.69133186",
"0.68619424",
"0.68246317",
"0.6747003",
"0.67293483",
"0.6680268",
"0.66721076",
"0.6656701",
"0.66452223",
"0.6639222",
"0.66114986",
"0.66043603",
"0.65963286",
"0.6588651",
"0.6588651",
"0.6588651",
"0.6588651",
"0.6588651",
"0.6588651",
"0.6588651",
"0.6588... | 0.74869126 | 0 |
DELETE /secondary_courses/1 DELETE /secondary_courses/1.json | def destroy
@secondary_course.destroy
respond_to do |format|
format.html { redirect_to secondary_courses_url, notice: 'Secondary course was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def destroy\n @student_sub_course = StudentSubCourse.find(params[:id])\n @student_sub_course.... | [
"0.73871005",
"0.7347695",
"0.7217331",
"0.7162525",
"0.7159878",
"0.7109211",
"0.7091951",
"0.7091951",
"0.7091951",
"0.7091951",
"0.7090404",
"0.7067364",
"0.70549494",
"0.7051256",
"0.70508605",
"0.70508605",
"0.70508605",
"0.70508605",
"0.70508605",
"0.70508605",
"0.70508... | 0.76484114 | 0 |
Returns the xml representation of the field. For example, field 1 (Request ID) would be in the following format: | def to_xml
# Defer xml generation to the com.kd.ars.models.structure.ArsField object
@ars_field.to_xml_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_id(field=nil, value=nil)\n result = (namespace && !is_nested) ? \"#{namespace}_\" : ''\n result << field_id_fragment\n result << \"_#{field}\" if field\n result << \"_#{value}\" if value\n result\n end",
"def xml_value_from_field(b, field, value)\n ... | [
"0.609222",
"0.6019175",
"0.59776735",
"0.5932099",
"0.5888229",
"0.5888229",
"0.5820379",
"0.5793207",
"0.57753015",
"0.57582986",
"0.5736052",
"0.5736052",
"0.57317674",
"0.57036847",
"0.5691926",
"0.5679866",
"0.56626165",
"0.56311774",
"0.5607284",
"0.5511035",
"0.5508682... | 0.60367894 | 1 |
get the number of seconds | def seconds
_nudge[2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds\n @time\n end",
"def seconds\n (Time.now - @start_time).to_i\n end",
"def sec\n return @t_sec\n end",
"def in_seconds\n @seconds\n end",
"def seconds\n ((@died_at - @time) / 1000).to_i\n end",
"def time_sec; Time.now.sec; end",
"def to_i\n @seconds\n end"... | [
"0.85110354",
"0.8152603",
"0.8106849",
"0.80560905",
"0.7988258",
"0.79868126",
"0.79193056",
"0.78875625",
"0.7844001",
"0.78369176",
"0.7831762",
"0.7775197",
"0.7768916",
"0.776406",
"0.776406",
"0.7699226",
"0.7692181",
"0.7583608",
"0.753461",
"0.7530171",
"0.7512235",
... | 0.87163454 | 0 |
get the number of minutes | def minutes
_nudge[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes() 60 * seconds end",
"def minutes\n (seconds % 3600) / 60\n end",
"def minutes\n value_parts[1]\n end",
"def minutes\n value_parts[1]\n end",
"def seconds_in_minutes(num_min)\n\tnum_min * 60\nend",
"def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend",
"def minutes\n ... | [
"0.86173064",
"0.82713306",
"0.8123096",
"0.8123096",
"0.8021019",
"0.79677665",
"0.7960234",
"0.7921002",
"0.79096866",
"0.79003567",
"0.78529155",
"0.78529155",
"0.7696832",
"0.7686784",
"0.7686784",
"0.76445335",
"0.76311475",
"0.76150346",
"0.7595901",
"0.7548849",
"0.751... | 0.87584347 | 0 |
get the number of hours | def hours
_nudge[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours() 60 * minutes end",
"def hours\n self.to_i * 3_600\n end",
"def hours\n seconds / 3600\n end",
"def hours\n return \"There are #{self * (60 * 60)} seconds in #{self} hours\"\n end",
"def hours\n @seconds.abs / 60 / 60 * (@seconds < 0 ? -1 : 1)\n end",
"def hours\n ... | [
"0.83909804",
"0.82278347",
"0.8214109",
"0.8051538",
"0.8028283",
"0.79504836",
"0.7883483",
"0.7883483",
"0.7873682",
"0.77636313",
"0.77421266",
"0.7664587",
"0.76560074",
"0.7627916",
"0.76173365",
"0.7616956",
"0.7611184",
"0.761056",
"0.761056",
"0.76089287",
"0.7558555... | 0.83113873 | 1 |
get frame interval in fractions of a second | def frame_interval
1.0/@fps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sec\n return (self / Graphics.frame_rate).to_i + 1\n end",
"def frame_rate\n return (1 / DT).to_i\n end",
"def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end",
"def with_frames_as_fraction\n vp = value_parts.... | [
"0.7320206",
"0.7318437",
"0.7287294",
"0.7287294",
"0.71537125",
"0.7054459",
"0.7020367",
"0.67744434",
"0.6592424",
"0.6592424",
"0.6491766",
"0.648647",
"0.6372257",
"0.6308229",
"0.62983805",
"0.626975",
"0.6261458",
"0.6231384",
"0.6213084",
"0.6180261",
"0.61692625",
... | 0.7891125 | 1 |
Convert to different framerate based on the total frames. Therefore, 1 second of PAL video will convert to 25 frames of NTSC (this is suitable for PAL to film TC conversions and back). It does not account for pulldown or anything in that sense, because then you need to think about cadences and such | def convert(new_fps)
raise NonPositiveFps, "FPS cannot be less than 0" if new_fps < 1
self.class.new((total/fps)*new_fps, new_fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fps_normalize(fps)\n if fps == 29.97\n nominal_fps = 30\n\n elsif fps == 23.98\n nominal_fps = 24\n\n else\n nominal_fps = fps\n end\n\n return nominal_fps\nend",
"def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n e... | [
"0.6882249",
"0.6509444",
"0.6509444",
"0.64065224",
"0.64065224",
"0.64065224",
"0.62791723",
"0.6231475",
"0.61711085",
"0.61106384",
"0.61106384",
"0.6052366",
"0.6001439",
"0.600037",
"0.59762746",
"0.59317786",
"0.5922252",
"0.5861113",
"0.5782731",
"0.573905",
"0.572872... | 0.65619737 | 1 |
add number of frames (or another timecode) to this one | def +(arg)
if (arg.is_a?(Timecode) && arg.fps == @fps)
Timecode.new(@total+arg.total, @fps)
elsif (arg.is_a?(Timecode))
raise WrongFramerate, "You are calculating timecodes with different framerates"
else
Timecode.new(@total + arg, @fps)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def +(arg)\n if (arg.is_a?(Timecode) && framerate_in_delta(arg.fps, @fps))\n self.class.new(@total+arg.total, @fps)\n elsif (arg.is_a?(Timecode))\n raise WrongFramerate, \"You are calculating timecodes with different framerates\"\n else\n self.class.new(@total + arg, @fps)\n end\n end",... | [
"0.6582342",
"0.6582342",
"0.6476823",
"0.6331119",
"0.6214005",
"0.6214005",
"0.6150833",
"0.6077841",
"0.60714173",
"0.6063533",
"0.60555524",
"0.60511386",
"0.60215473",
"0.59965813",
"0.599654",
"0.5968167",
"0.5963076",
"0.5948747",
"0.59325975",
"0.5921193",
"0.59000856... | 0.6797121 | 0 |
Multiply the timecode by a number | def *(arg)
raise RangeError, "Timecode multiplier cannot be negative" if (arg < 0)
Timecode.new(@total*arg.to_i, @fps)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def *(arg)\n raise RangeError, \"Timecode multiplier cannot be negative\" if (arg < 0)\n self.class.new(@total*arg.to_i, @fps)\n end",
"def *(arg)\n raise RangeError, \"Timecode multiplier cannot be negative\" if (arg < 0)\n self.class.new(@total*arg.to_i, @fps)\n end",
"def mulSelf(value)\n i... | [
"0.6406095",
"0.6406095",
"0.62792426",
"0.6182835",
"0.6165811",
"0.61048955",
"0.6012388",
"0.5958706",
"0.5919845",
"0.5911738",
"0.5858075",
"0.5836915",
"0.58128476",
"0.577806",
"0.5752801",
"0.57149386",
"0.56976116",
"0.5683782",
"0.5682455",
"0.56810576",
"0.56779784... | 0.6963363 | 0 |
Waits for page to load | def wait_page_load
@browser.wait_for_load
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_to_load\n activity_div.wait_until(&:exists?)\n @page = @bank_page.load_page\n end",
"def wait_for_page\n sleep 0.7\n end",
"def wait_loading\n puts \"[BrowserOperator] wait_loading\" << '..' * 10\n browser.div(:id, 'pageLoading').wait_while_present()\n end",
"def wait_unt... | [
"0.80149734",
"0.7955221",
"0.78885996",
"0.7820291",
"0.77520406",
"0.77520406",
"0.76652384",
"0.7647323",
"0.74580157",
"0.735378",
"0.7249732",
"0.7242735",
"0.71515954",
"0.7041796",
"0.7000301",
"0.69844854",
"0.6821148",
"0.680868",
"0.67917013",
"0.6777607",
"0.677760... | 0.84721273 | 0 |
+insert_with_csv_size+ number of records to insert in a single batch +indices+ Hash of indices to create in memory. Greatly speeds up the replaying. Key corresponds to the name of the 'Record' Values contains list of lists on which columns to index. E.g. [[:first_index_column], [:another_index, :with_to_columns]] | def initialize(insert_with_csv_size = 50, indices = {})
@insert_with_csv_size = insert_with_csv_size
@record_store = Hash.new { |h, k| h[k] = Set.new }
@record_index = Index.new(indices)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def records_for_bulk_index(ids, batch_size = 1000)\n transaction do\n offset = 0\n ids.each_slice(batch_size) do |id_slice|\n records = find( :all, :conditions => [\"id in (?)\", id_slice] )\n #yield records, offset\n yield find( :all, :conditions => [\"id in (?)\", id... | [
"0.6371657",
"0.59109616",
"0.58063257",
"0.5790502",
"0.57109296",
"0.5705849",
"0.5694008",
"0.56123483",
"0.55146706",
"0.55124956",
"0.5489649",
"0.5426274",
"0.5420668",
"0.5420668",
"0.5408773",
"0.53709275",
"0.53709275",
"0.5254493",
"0.52394044",
"0.52339655",
"0.521... | 0.72667706 | 0 |
Check if word is uncountable | def uncountable?(word)
Noun[word].uncountable?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enough_flippable_words?\n (words - all_excluded_words).size > 1\n end",
"def invalid_word? word\n\t\tstopwords_list.collect{ |w| w if w.include? word.to_s.strip }.uniq.any?\n\tend",
"def illegal_words\n @words.select{ |word| word.length > @width }\n end",
"def negative?(word)\n [ 'dull',\n ... | [
"0.6977723",
"0.6825737",
"0.6788022",
"0.65245193",
"0.6497263",
"0.6495581",
"0.6422933",
"0.6388485",
"0.6353599",
"0.63326526",
"0.6296208",
"0.62863886",
"0.6278127",
"0.62732923",
"0.6264035",
"0.6234207",
"0.6232525",
"0.62146485",
"0.6204522",
"0.61979955",
"0.6162728... | 0.84846705 | 0 |
Subviews or empty collection of views to cater for issue with iOS7 dp3 | def teacup_subviews
self.subviews || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n view.subviews.each {|sv| sv.removeFromSuperview}\n @buttons = []\n end",
"def test_s38_Lots_of_empty_subviews\n W('s38a');\n\n p1 = Metakit::BytesProp.new(\"p1\");\n\n Metakit::Storage.open(\"s38a\", 1) {|s1|\n v = s1.get_as(\"v[v1[p1:S]]\");\n\n v.set_size(100000);\n s... | [
"0.6023489",
"0.59117246",
"0.53579307",
"0.53063625",
"0.52630204",
"0.525141",
"0.5116552",
"0.5113996",
"0.5075528",
"0.5075528",
"0.5054035",
"0.5020839",
"0.49803007",
"0.49638206",
"0.49585706",
"0.49530816",
"0.4949544",
"0.4935303",
"0.49218422",
"0.48965463",
"0.4883... | 0.68150187 | 0 |
Alter the stylename of this view. This will cause new styles to be applied from the stylesheet. If you are using Pixate, it will also set the pixate `styleId` property. | def stylename=(new_stylename)
@stylename = new_stylename
if respond_to?(:'setStyleId:')
setStyleId(new_stylename)
end
if respond_to?(:'setNuiClass:')
setNuiClass(new_stylename)
end
restyle!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def setStyleName(style)\n styleNameHelper(MODE_SET, style)\n end",
"def stylesheet=(new_stylesheet)\n @stylesheet = new_stylesheet\n restyle!\n subviews.each{ |subview| subview.stylesheet = new_stylesheet }\n en... | [
"0.82668674",
"0.6807916",
"0.6708576",
"0.6673849",
"0.66273504",
"0.6525418",
"0.64593065",
"0.64140767",
"0.63493323",
"0.626923",
"0.6210081",
"0.60744315",
"0.58860934",
"0.58779055",
"0.58779055",
"0.5876157",
"0.5869049",
"0.5868729",
"0.58227384",
"0.58036524",
"0.579... | 0.83407277 | 0 |
Alter the stylesheet of this view. This will cause new styles to be applied using the current stylename, and will recurse into subviews. If you would prefer that a given UIView object does not inherit the stylesheet from its parents, override the 'stylesheet' method to return the correct value at all times. | def stylesheet=(new_stylesheet)
should_restyle = Teacup.should_restyle_and_block
@stylesheet = new_stylesheet
if should_restyle
Teacup.should_restyle!
restyle!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylesheet=(new_stylesheet)\n @stylesheet = new_stylesheet\n restyle!\n subviews.each{ |subview| subview.stylesheet = new_stylesheet }\n end",
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def stylesheet= val\n @stylesheet = val\n end",
"def styl... | [
"0.76844454",
"0.56915677",
"0.56739634",
"0.5590264",
"0.5540561",
"0.5288922",
"0.5218333",
"0.5154983",
"0.514362",
"0.5055158",
"0.49120903",
"0.4900255",
"0.4897962",
"0.48847994",
"0.48632473",
"0.4862835",
"0.48320407",
"0.48184744",
"0.47864902",
"0.47730973",
"0.4760... | 0.63462263 | 1 |
Animate a change to a new stylename. This is equivalent to wrapping a call to .stylename= inside UIView.beginAnimations. | def animate_to_stylename(stylename, options={})
return if self.stylename == stylename
teacup_animation(options) do
self.stylename = stylename
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animate_to_stylename(stylename, options={})\n return if self.stylename == stylename\n\n UIView.beginAnimations(nil, context: nil)\n # TODO: This should be in a style-sheet!\n UIView.setAnimationDuration(options[:duration]) if options[:duration]\n UIView.setAnimationCurve(options[:curve]) if opti... | [
"0.86381",
"0.7472754",
"0.7424447",
"0.6238177",
"0.61284477",
"0.59574157",
"0.5807035",
"0.559552",
"0.5582941",
"0.53988945",
"0.53421533",
"0.53408986",
"0.5336489",
"0.52136326",
"0.51596487",
"0.51344943",
"0.5130734",
"0.51232743",
"0.5072442",
"0.5049117",
"0.5049117... | 0.8184476 | 1 |
Animate a change to a new list of style_classes. This is equivalent to wrapping a call to .style_classes= inside UIView.beginAnimations. | def animate_to_styles(style_classes, options={})
return if self.style_classes == style_classes
teacup_animation(options) do
self.style_classes = style_classes
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def style_classes=(new_style_classes)\n @style_classes = new_style_classes\n if respond_to?(:setStyleClass)\n setStyleClass(new_style_classes.join(' '))\n end\n restyle!\n end",
"def animate_to_stylename(stylename, options={})\n return if self.stylename == stylename\n\n UIView... | [
"0.7112219",
"0.6425609",
"0.6405789",
"0.59698427",
"0.5778127",
"0.5464998",
"0.54457587",
"0.5387358",
"0.51081073",
"0.5105042",
"0.49108204",
"0.48273936",
"0.4808243",
"0.47899678",
"0.47873652",
"0.47318444",
"0.47178677",
"0.47178677",
"0.4710713",
"0.4708346",
"0.468... | 0.77710205 | 0 |
Animate a change to new styles This is equivalent to wrapping a call to .style() inside UIView.beginAnimations. | def animate_to_style(style)
teacup_animation(options) do
self.style(style)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animate_to_stylename(stylename, options={})\n return if self.stylename == stylename\n\n UIView.beginAnimations(nil, context: nil)\n # TODO: This should be in a style-sheet!\n UIView.setAnimationDuration(options[:duration]) if options[:duration]\n UIView.setAnimationCurve(options[:curve]) if opti... | [
"0.76705813",
"0.697173",
"0.67711276",
"0.60735965",
"0.6024564",
"0.5680601",
"0.5677347",
"0.56516963",
"0.56447566",
"0.56447566",
"0.56066936",
"0.5591818",
"0.55843717",
"0.5583413",
"0.53818893",
"0.5359751",
"0.53549534",
"0.53524786",
"0.5348308",
"0.5346227",
"0.531... | 0.74694514 | 1 |
GET /grupoassuntos GET /grupoassuntos.json | def index
@grupoassuntos = Grupoassunto.all
render json: @grupoassuntos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end",
"def show\n render json: @grupoassunto\n end",
"def index\n\tperfilId = session[:perfilLogado]\n\n\tif(perfilId)\n\t\tperfil = Perfil.find(perfi... | [
"0.7355178",
"0.72924685",
"0.6912724",
"0.6826672",
"0.6826672",
"0.67512566",
"0.6632601",
"0.65789694",
"0.656536",
"0.6529461",
"0.6463101",
"0.6436627",
"0.64278466",
"0.6425982",
"0.6424016",
"0.64180017",
"0.6392095",
"0.6365888",
"0.63561887",
"0.63522077",
"0.6346447... | 0.80307937 | 0 |
GET /grupoassuntos/1 GET /grupoassuntos/1.json | def show
render json: @grupoassunto
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end",
"def show\n @grupa = current_user.grupy.find(params... | [
"0.78045803",
"0.7327661",
"0.7055048",
"0.696515",
"0.68419796",
"0.68419796",
"0.68195456",
"0.68040264",
"0.6764725",
"0.6701397",
"0.6631259",
"0.66223025",
"0.65760624",
"0.6544101",
"0.6488448",
"0.646121",
"0.6410046",
"0.63959914",
"0.6380931",
"0.63659465",
"0.636109... | 0.7432388 | 1 |
POST /grupoassuntos POST /grupoassuntos.json | def create
@grupoassunto = Grupoassunto.new(grupoassunto_params)
if @grupoassunto.save
render json: @grupoassunto, status: :created, location: @grupoassunto
else
render json: @grupoassunto.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @grupo = Grupo.new(grupo_params)\n\n respond_to do |format|\n if @grupo.save\n format.html { redirect_to @grupo, notice: 'Grupo was successfully created.' }\n format.json { render :show, status: :created, location: @grupo }\n else\n format.html { render :new }\n ... | [
"0.6955513",
"0.68713737",
"0.6749975",
"0.67151904",
"0.66671306",
"0.66366345",
"0.66021484",
"0.65837234",
"0.6562145",
"0.6525032",
"0.65128714",
"0.6461547",
"0.6445387",
"0.6444265",
"0.64045846",
"0.6383675",
"0.63778096",
"0.6189776",
"0.6178694",
"0.61626655",
"0.613... | 0.76106495 | 0 |
PATCH/PUT /grupoassuntos/1 PATCH/PUT /grupoassuntos/1.json | def update
@grupoassunto = Grupoassunto.find(params[:id])
if @grupoassunto.update(grupoassunto_params)
head :no_content
else
render json: @grupoassunto.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @grupo = Grupo.find(params[:id])\n\n respond_to do |format|\n if @grupo.update_attributes(params[:grupo])\n format.html { redirect_to root_path, notice: 'Grupo actualizado' }\n format.js { redirect_to root_path }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.7121679",
"0.70120114",
"0.69938254",
"0.69189394",
"0.68694925",
"0.68325454",
"0.68100554",
"0.66699064",
"0.6630291",
"0.66224",
"0.6594435",
"0.65909815",
"0.6584417",
"0.6571544",
"0.6417064",
"0.64016926",
"0.6389561",
"0.63838416",
"0.6383245",
"0.634276",
"0.631480... | 0.7294595 | 0 |
Merge two array of hashes | def merge_2_array_of_hashes(a_arr, b_arr)
merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr
merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr
merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)
merge_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_data first_array, second_array\n\n output = []\n\n first_array.each_with_index do |element, index|\n new_hash = {}\n\n first_array[index].each do |key, value|\n new_hash[key] = value\n end\n\n second_array[index].each do |key, value|\n new_hash[key]... | [
"0.75345105",
"0.74925506",
"0.73708093",
"0.7370572",
"0.723306",
"0.7131989",
"0.7119481",
"0.70577526",
"0.70304644",
"0.70304644",
"0.70304644",
"0.70160645",
"0.69669116",
"0.6959734",
"0.6943549",
"0.6795985",
"0.67769194",
"0.6775962",
"0.67559785",
"0.6717466",
"0.670... | 0.7762574 | 0 |
Vagrant public networks are less private than private networks, and the exact meaning actually varies from provider to provider, hence the ambiguous definition. The idea is that while private networks should never allow the general public access to your machine, public networks can. The Vagrant VirtualBox provider supp... | def public_networks(vm, host)
if host.has_key?('public_networks')
public_networks = host['public_networks']
public_networks.each do |public_network|
options = {}
options[:ip] = public_network['ip'] if public_network.key?('ip') && public_network['ip'] != 'dhcp'
options[:auto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_private_network(config, ips, net_name)\n ips.each do |ip|\n config.vm.network 'private_network',\n ip: ip,\n netmask: '255.255.255.0',\n virtualbox__intnet: net_name\n end\nend",
"def config_network(instance, vm_config)\n\n vm_con... | [
"0.75249135",
"0.73994714",
"0.7316689",
"0.7201299",
"0.7072279",
"0.68947595",
"0.68519115",
"0.66385144",
"0.66082555",
"0.65605104",
"0.6467986",
"0.6467986",
"0.6391158",
"0.63330364",
"0.6268844",
"0.62530047",
"0.6251637",
"0.6233452",
"0.62223834",
"0.6217484",
"0.620... | 0.7617707 | 0 |
Synced folders enable Vagrant to sync a folder on the host machine to the guest machine. By default, Vagrant mounts the synced folders with the owner/group set to the SSH user and any parent folders set to root. By default, Vagrant will share your project directory (the directory with the Vagrantfile) to `/vagrant`. Op... | def synced_folders(vm, host, global)
if folders = get_config_parameter(host, global, 'synced_folders')
folders.each do |folder|
vm.synced_folder folder['src'], folder['dest'], folder['options']
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synced_folder(hostpath, guestpath, options=nil)\n if Vagrant::Util::Platform.windows?\n # On Windows, Ruby just uses normal '/' for path seps, so\n # just replace normal Windows style seps with Unix ones.\n hostpath = hostpath.to_s.gsub(\"\\\\\", \"/\")\n end\n\n ... | [
"0.7821668",
"0.71588343",
"0.6842111",
"0.6693556",
"0.66666275",
"0.66191894",
"0.64648455",
"0.64192206",
"0.6236011",
"0.61735415",
"0.61318105",
"0.61276066",
"0.6104518",
"0.5889102",
"0.5883887",
"0.58473206",
"0.5705736",
"0.57002133",
"0.56739455",
"0.5670238",
"0.56... | 0.7345158 | 1 |
The Vagrant file provisioner allows you to upload a file or directory from the host machine to the guest machine. The file/folder is uploaded as the SSH user over SCP, so this location must be writable to that user. Options: source (string) Is the local path of the file or directory to be uploaded. destination (string)... | def file_provisioners(vm, host, global)
if fps = get_config_parameter(host, global, 'file_provisioning')
fps.each do |fp|
vm.provision :file, source: fp['source'], destination: fp['destination']
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_script(vagrantcfg, source, target)\n vagrantcfg.vm.provision \"file\", source: source, destination: target\n vagrantcfg.vm.provision \"shell\", inline: \"dos2unix #{target}\"\n vagrantcfg.vm.provision \"shell\", inline: \"chmod a+x #{target}\"\nend",
"def provision_ssh(args)\n env = config.env... | [
"0.640335",
"0.63729584",
"0.62754226",
"0.62325805",
"0.6177341",
"0.6091378",
"0.6078432",
"0.5967302",
"0.596268",
"0.59380877",
"0.5936373",
"0.5898889",
"0.5894433",
"0.5881479",
"0.5875687",
"0.585956",
"0.5801022",
"0.57885456",
"0.57863015",
"0.57706666",
"0.57622826"... | 0.65788484 | 0 |
Script based shell provisioners to be run on every `up` or `reload` | def shell_provisioners_always(vm, host, global)
if scripts = get_config_parameter(host, global, 'scripts_always')
scripts.each do |script|
vm.provision :shell, run: "always" do |s|
s.path = script['script']
s.args = script['args']
s.name = script['name']
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_provisioners(vm, host, global)\n if scripts = get_config_parameter(host, global, 'scripts')\n scripts.each do |script|\n vm.provision :shell do |s|\n s.path = script['script']\n s.args = script['args']\n s.name = script['name']\n end\n end\n end\nend",
"def shell_... | [
"0.7389948",
"0.73423886",
"0.70329213",
"0.69739187",
"0.6884391",
"0.6592584",
"0.6526074",
"0.6394899",
"0.6306011",
"0.6297022",
"0.61362135",
"0.61305696",
"0.6047709",
"0.6038666",
"0.6008353",
"0.6008133",
"0.5997986",
"0.5961139",
"0.5928839",
"0.58923477",
"0.5872196... | 0.7428699 | 0 |
Script based shell provisioners to be run never | def shell_provisioners_never(vm, host, global)
if scripts = get_config_parameter(host, global, 'scripts_never')
scripts.each do |script|
vm.provision script['name'], type: "shell", run: "never" do |s|
s.path = script['script']
s.args = script['args']
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inline_shell_provisioners_never(vm, host, global)\n if scripts = get_config_parameter(host, global, 'inline_shell_never')\n scripts.each do |script|\n vm.provision script['name'], type: \"shell\", run: \"never\" do |s|\n s.inline = script['inline']\n s.args = script['args']\n end\... | [
"0.7871953",
"0.781922",
"0.7752323",
"0.7685908",
"0.75137484",
"0.7244901",
"0.6964738",
"0.69460845",
"0.65526956",
"0.64080495",
"0.63745004",
"0.6264979",
"0.61330324",
"0.61330324",
"0.61330324",
"0.61060834",
"0.6092986",
"0.6054245",
"0.60031205",
"0.5890151",
"0.5870... | 0.8613811 | 0 |
Inline shell provisioners to be run just once | def inline_shell_provisioners(vm, host, global)
if scripts = get_config_parameter(host, global, 'inline_shell')
scripts.each do |script|
vm.provision :shell do |s|
s.inline = script['inline']
s.args = script['args']
s.name = script['name']
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_provisioners_once(vm, host)\n if host.has_key?('shell_once')\n host['shell_once'].each do |script|\n vm.provision \"shell\", inline: script['cmd']\n end\n end\nend",
"def inline_shell_provisioners_always(vm, host, global)\n if scripts = get_config_parameter(host, global,... | [
"0.8130225",
"0.7880856",
"0.75106364",
"0.74877304",
"0.74844646",
"0.73881286",
"0.7317153",
"0.70160127",
"0.70037806",
"0.67209804",
"0.6380217",
"0.62527573",
"0.611371",
"0.5999754",
"0.59333515",
"0.5928581",
"0.59266275",
"0.5899363",
"0.5893468",
"0.5871728",
"0.5831... | 0.7896272 | 1 |
Inline shell provisioners to be run never | def inline_shell_provisioners_never(vm, host, global)
if scripts = get_config_parameter(host, global, 'inline_shell_never')
scripts.each do |script|
vm.provision script['name'], type: "shell", run: "never" do |s|
s.inline = script['inline']
s.args = script['args']
end
end
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_provisioners_never(vm, host, global)\n if scripts = get_config_parameter(host, global, 'scripts_never')\n scripts.each do |script|\n vm.provision script['name'], type: \"shell\", run: \"never\" do |s|\n s.path = script['script']\n s.args = script['args']\n end\n end\n end\... | [
"0.7914408",
"0.78586036",
"0.7710453",
"0.76938766",
"0.7680398",
"0.7625495",
"0.7377693",
"0.6991434",
"0.6878313",
"0.66613907",
"0.61417514",
"0.6110881",
"0.601173",
"0.5935807",
"0.59293085",
"0.5903859",
"0.58551574",
"0.5825108",
"0.5825108",
"0.5825108",
"0.5812257"... | 0.8374327 | 0 |
Change the properties of a registered virtual machine which is not running by merging options from the global and VM specific section. | def merge_vm_parameters(host, global, vb)
# These are arrays of hashes
if global['vm_options'] or host['vm_options']
merge_hash = merge_2_array_of_hashes(global['vm_options'], host['vm_options'])
merge_hash.each do |key, value|
vb.customize ["modifyvm", :id, "--#{key}", value]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_other_parallels_vm(options)\n options['os-type']=\"other\"\n configure_parallels_vm(options)\n return\nend",
"def customize_virtualbox(name,options)\n custom_config = \"\"\n options.each_pair do |key,value|\n next if VALID_VM_OPTIONS.include?(key)\n case key\n when... | [
"0.6747302",
"0.6605254",
"0.65591204",
"0.6529511",
"0.65241146",
"0.65199393",
"0.6470733",
"0.63283575",
"0.6281032",
"0.62743646",
"0.62743646",
"0.6058973",
"0.60236824",
"0.6022392",
"0.5991978",
"0.59514135",
"0.59495705",
"0.5946498",
"0.59403694",
"0.59329396",
"0.59... | 0.66870195 | 1 |
Create new "Fixed Shared" disks and attach them to a disk controller. Disk information is merged from the global and VM specific section. | def merge_vm_shared_disks(host, global, vb, controller)
vb_dir=global['vm_basedir'] ? global['vm_basedir'] + global['vm_groups'].partition(',')[0] + "/" : "./.virtualbox/"
if global['vm_shared_disks'] or host['vm_shared_disks']
merge_hash = merge_2_array_of_hashes(global['vm_shared_disks'], host['vm_shared_disk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_disks(vb, server, hostname, name)\n vminfo = vm_info(name)\n disks = server['disks'] || {}\n unless vminfo =~ /Storage Controller Name \\(1\\): *SATA Controller/\n # puts \"Attaching SATA Controller\"\n vb.customize [\n 'storagectl', :id,\n '--name', 'SATA Controller',\n '--ad... | [
"0.7391996",
"0.6785718",
"0.656712",
"0.6538379",
"0.65322715",
"0.64895564",
"0.6439195",
"0.6358529",
"0.6289985",
"0.62305933",
"0.6211705",
"0.6137105",
"0.61176944",
"0.60796255",
"0.607627",
"0.60662675",
"0.60517865",
"0.6009216",
"0.595972",
"0.59347415",
"0.5933334"... | 0.6947111 | 1 |
Generate an RPM spec file | def make_rpm_spec
puts 'creating rpm.spec'
File.unlink('rpm.spec') if File.exist?('rpm.spec')
f = File.open('rpm.spec', 'w')
f.puts <<EOF
# DO NOT EDIT -- automatically generated by ./configure
Name: #{@project.id}
Summary: #{@project.summary}
Version: #{@project.version}
Release: 1
Licen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rpm\n # unpack gem software\n unpack @rpm_unpack_dir\n # generate install\n generate_install\n # generate post install\n #generate_post\n # generate executable files\n generate_bin\n # create gemspec file\n File.open(@gemspec_filename, 'w') { |f|\n f.write(@spec.to_rub... | [
"0.7513944",
"0.6740639",
"0.6716979",
"0.669953",
"0.66588515",
"0.6474459",
"0.6460861",
"0.6421497",
"0.6393698",
"0.6344552",
"0.6244586",
"0.6191473",
"0.61480176",
"0.6144173",
"0.61250204",
"0.60873747",
"0.60819274",
"0.6077583",
"0.5932404",
"0.58804905",
"0.5871611"... | 0.8171545 | 0 |
Creates and returns a new TestCase object. If _cmdline_ is true, output is printed on STDOUT, otherwise it is not. _tc_file_ is the sourcefile of the testcase, used when tests are run on factory. Optional args: :hostlist array of hostnames this testcase is running on :outputdir directory to store output files, used whe... | def initialize(cmdline, tc_file, args={})
@dirs = TestDirs.new(self, 'unknown', 'unknown')
@command_line_output = cmdline
@testcase_file = tc_file
@cmd_args = args
@hostlist = args[:hostlist]
@outputdir = args[:outputdir]
@sanitizers = nil
@valgrind = args[:valgrind]
@valgrind_opt = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(output)\n super(output)\n @testcases_data = {}\n end",
"def load_test(tc)\n data = Hash.new\n File.open(tc, \"r\") do |infile|\n while (line = infile.gets)\n #test = /^.*\\/(.*\\.rb)/.match(tc)[1]\n test = /^.*\\/([A-Za-... | [
"0.52127904",
"0.51879996",
"0.51354516",
"0.49484497",
"0.49205092",
"0.4899513",
"0.48738554",
"0.48661548",
"0.4853922",
"0.4851352",
"0.4842393",
"0.4810698",
"0.48082033",
"0.47871605",
"0.47871605",
"0.478308",
"0.4746584",
"0.47394606",
"0.47212818",
"0.47157615",
"0.4... | 0.6996561 | 0 |
method wrapping timeout_seconds, to multiply timeout by 5 if test is run through valgrind | def get_timeout
if @valgrind
return timeout_seconds * TestBase::VALGRIND_TIMEOUT_MULTIPLIER
elsif has_active_sanitizers
return timeout_seconds * TestBase::SANITIZERS_TIMEOUT_MULTIPLIER
else
return timeout_seconds
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout_after(time); end",
"def timeout=(_arg0); end",
"def timeout!; end",
"def timeout_seconds\n return 1200\n end",
"def timeout_at; end",
"def timeout; end",
"def timeout; end",
"def timeout; end",
"def timeout_increment\n ->(_try_count) { base_timeout }\n end",
"def timeouts_... | [
"0.76125956",
"0.7336209",
"0.7264318",
"0.7206306",
"0.70663947",
"0.70593566",
"0.70593566",
"0.70593566",
"0.70444155",
"0.70070666",
"0.70043564",
"0.6969453",
"0.6950483",
"0.6947433",
"0.6936969",
"0.69172895",
"0.6894728",
"0.68829274",
"0.6880799",
"0.6811469",
"0.681... | 0.74730253 | 1 |
Runs all methods in array _test_methods_. Returns an array of TestResult objects. :callseq: tc.run(test_methods) > array of TestResult | def run(test_methods)
test_results = []
test_methods.each do |test_method|
runmethod(test_method.to_s, test_method, test_results)
end
dump_results(test_results) if @outputdir
if (@command_line_output and not @connection_error)
output_results(test_results)
end
test_results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.fl... | [
"0.64296865",
"0.6405154",
"0.5940818",
"0.5940443",
"0.58535796",
"0.5821924",
"0.5781077",
"0.57563895",
"0.56630516",
"0.5651736",
"0.56265706",
"0.55965126",
"0.55804163",
"0.5580102",
"0.5543344",
"0.5538437",
"0.55029047",
"0.5499023",
"0.5398888",
"0.5363229",
"0.53226... | 0.8126251 | 0 |
Sets the owner of the test (username). | def set_owner(ownername)
@result.owner = ownername
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_owner\n @owner = Owner.find_by_owner_user_id(current_owner_user.id)\n end",
"def set_owner(owner)\n self.__owner__ = owner if owner\n self\n end",
"def set_owner #:doc:\n self.owner_class.owner= get_current_owner\n end",
"def owner=(new_owner)\n if @owner != ne... | [
"0.7501434",
"0.7316686",
"0.7095066",
"0.7010622",
"0.6999486",
"0.6967395",
"0.6921517",
"0.6921517",
"0.6921517",
"0.6921517",
"0.6921517",
"0.6913948",
"0.68929404",
"0.68514764",
"0.68514764",
"0.68514764",
"0.68514764",
"0.68514764",
"0.68514764",
"0.68514764",
"0.68191... | 0.7588034 | 0 |
Serializes all the TestResult objects to disk. | def dump_results(test_results)
File.open("#{@outputdir}/testresults.serialized", "w+") do |file|
Marshal.dump(test_results, file)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist_test_results(filepath)\n return if filepath.empty?\n\n results = @test_cases.select { |c| %i[fail error].include? c.test_status }.map(&:path)\n File.open(filepath, 'w') { |file| file.puts JSON.dump(results) }\n end",
"def dumpScannedResult()\n file = scannedResultFilename() ;\n ... | [
"0.6527563",
"0.63041383",
"0.6046166",
"0.5956339",
"0.59562194",
"0.58988535",
"0.5799745",
"0.57426417",
"0.57251924",
"0.567122",
"0.5631233",
"0.55704415",
"0.5524894",
"0.5514353",
"0.5509414",
"0.5502264",
"0.54742277",
"0.54717404",
"0.5433209",
"0.5389143",
"0.537501... | 0.76440907 | 0 |
Outputs _str_ to the testlog file on disk and to the TestResult's testlog. | def output_log(str)
if @outputdir
outputfilename = @outputdir+"/testoutput.log"
FileUtils.mkdir_p(@outputdir)
else
outputfilename = @dirs ? @dirs.testoutput : '/dev/null'
end
begin
File.open(outputfilename, "a") do |file|
file.print(str)
end
rescue Errno::ENOENT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def salog( test, result )\n\tlfile = File.open( \"error_log.txt\", \"a+\" )\n\tif result == \"PASS\"\n\t\tputs test + \": PASS\"\n\t\tlfile.puts test + \": PASS\"\n\telsif result == \"LOG\"\n\t\tputs test\n\t\tlfile.puts test\n\telse\n\t\tputs test + \": FAIL\"\n\t\tlfile.puts test + \": FAIL\"\n\tend\nend",
"de... | [
"0.6731953",
"0.6698702",
"0.6594732",
"0.6252469",
"0.62240523",
"0.6173244",
"0.6108551",
"0.6108551",
"0.6068625",
"0.60531384",
"0.60157144",
"0.6009751",
"0.6008834",
"0.59645265",
"0.59645265",
"0.5961596",
"0.59379005",
"0.5913243",
"0.59106475",
"0.58712184",
"0.58441... | 0.82654506 | 0 |
Get an array of log components (i.e. ['qrserver\\d+']) that should be checked, specified using regular expressions. Override this in componentspecific test base classes | def get_default_log_check_components
return ['[\\w-]+'] # All components
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matchers\n @components.values\n end",
"def assert_log_every_input_match(re)\n message = \"\"\n each_input do |input_id, input_log|\n if input_log !~ re\n message += \"Input #{input_id} did not match #{re.inspect}.\\n\"\n end\n end\n assert(message.empty?, message)\n end"... | [
"0.56709737",
"0.55461925",
"0.5314211",
"0.52979404",
"0.5248103",
"0.52159",
"0.52043486",
"0.5141568",
"0.5123972",
"0.5036444",
"0.50135076",
"0.50055146",
"0.4956646",
"0.49523205",
"0.48557535",
"0.48517928",
"0.48511577",
"0.4840842",
"0.48295993",
"0.47967687",
"0.478... | 0.64830095 | 0 |
Attach a file or a directory from a remote node It will be linked to on the testrun page | def attach_to_factory_report_from_remote(node_proxy, path)
if node_proxy.file?(path)
node_proxy.copy_remote_file_into_local_directory(path, dirs.filesdir)
elsif node_proxy.directory?(path)
node_proxy.copy_remote_directory_into_local_directory(path, dirs.filesdir)
else
raise path + " is nei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path... | [
"0.6238353",
"0.6238353",
"0.6218562",
"0.603959",
"0.5986941",
"0.595521",
"0.5848822",
"0.5842645",
"0.5777601",
"0.5747944",
"0.57382375",
"0.57290703",
"0.5680108",
"0.56782836",
"0.5677769",
"0.5673372",
"0.55774546",
"0.5520428",
"0.55003566",
"0.54946196",
"0.5465968",... | 0.65769815 | 0 |
GET /todos/1 GET /todos/1.xml | def show
@todos = Todos.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @todos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :x... | [
"0.7044965",
"0.7043853",
"0.7043853",
"0.68986905",
"0.6739965",
"0.6544043",
"0.6458865",
"0.6384096",
"0.62954205",
"0.62954205",
"0.6289708",
"0.62669724",
"0.6252782",
"0.6252571",
"0.62465763",
"0.6232013",
"0.6211228",
"0.61934924",
"0.61371195",
"0.6114085",
"0.609583... | 0.72757405 | 0 |
GET /todos/new GET /todos/new.xml | def new
@todos = Todos.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @todos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
... | [
"0.78287596",
"0.78287596",
"0.74718887",
"0.7340153",
"0.7200954",
"0.7084404",
"0.70002633",
"0.6998663",
"0.6989566",
"0.6989566",
"0.6989566",
"0.6989566",
"0.6989566",
"0.69575757",
"0.69225734",
"0.69225734",
"0.69225734",
"0.69225734",
"0.690977",
"0.6872552",
"0.68725... | 0.79343647 | 0 |
POST /todos POST /todos.xml | def create
@todos = Todos.new(params[:todos])
respond_to do |format|
if @todos.save
flash[:notice] = 'Todos was successfully created.'
format.html { redirect_to(@todos) }
format.xml { render :xml => @todos, :status => :created, :location => @todos }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @todo = Todo.new(params[:todo])\n @todo.save\n respond_with @todo\n end",
"def create\n @todo = current_user.todos.new(params[:todo])\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to(todos_path, :notice => 'Todo was successfully created.') }\n ... | [
"0.65824264",
"0.6506293",
"0.6453232",
"0.63732845",
"0.63702404",
"0.62953436",
"0.6288048",
"0.6286797",
"0.6279942",
"0.6279942",
"0.6279942",
"0.6251903",
"0.62483865",
"0.6234886",
"0.6232238",
"0.62073565",
"0.6201172",
"0.61930174",
"0.61618674",
"0.61017233",
"0.6092... | 0.6980201 | 0 |
PUT /todos/1 PUT /todos/1.xml | def update
@todos = Todos.find(params[:id])
respond_to do |format|
if @todos.update_attributes(params[:todos])
flash[:notice] = 'Todos was successfully updated.'
format.html { redirect_to(@todos) }
format.xml { head :ok }
else
format.html { render :action => "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.j... | [
"0.642216",
"0.6362623",
"0.6332916",
"0.6327132",
"0.62969285",
"0.6254822",
"0.6252563",
"0.6238321",
"0.6206846",
"0.6205299",
"0.61909324",
"0.618376",
"0.6183591",
"0.61531574",
"0.60949785",
"0.60949785",
"0.60870785",
"0.605261",
"0.603564",
"0.60282654",
"0.6013246",
... | 0.6693722 | 0 |
DELETE /todos/1 DELETE /todos/1.xml | def destroy
@todos = Todos.find(params[:id])
@todos.destroy
respond_to do |format|
format.html { redirect_to(todos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def delete_list(id)\n record \"/todos/dele... | [
"0.75948596",
"0.7291006",
"0.7064224",
"0.6975554",
"0.6949999",
"0.6841684",
"0.6827639",
"0.6794455",
"0.67712855",
"0.67564994",
"0.6750926",
"0.6750926",
"0.6745374",
"0.6742216",
"0.6715187",
"0.67060983",
"0.6700116",
"0.66994596",
"0.6696412",
"0.6663086",
"0.6651109"... | 0.743332 | 1 |
Sets environment variables from an array of 'key=value' pairs | def set_env_variables(env_vars = [])
env_vars.each do |_v|
key, value = _v.split("=")
ENV[key] = value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_from_env\n ENV_TO_KEY.each do |env_key, key|\n next unless (value = ENV[env_key])\n\n type, key = key if key.is_a? Array\n\n value =\n case type\n when :int then value.to_i\n when :float then value.to_f\n when :bool then !%w[0 false].include?(va... | [
"0.72641814",
"0.69050425",
"0.688766",
"0.67942667",
"0.6675444",
"0.66385573",
"0.66036606",
"0.6590425",
"0.6589243",
"0.64388716",
"0.6365812",
"0.63145083",
"0.63021374",
"0.6294562",
"0.6235947",
"0.62057495",
"0.6183998",
"0.61740756",
"0.6172367",
"0.6113919",
"0.6040... | 0.7829831 | 0 |
Unsets environment variables from an array of 'key=value' pairs | def unset_env_variables(env_vars = [])
env_vars.each do |var|
key, value = var.split("=")
ENV.delete(key)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_bundler_env_vars\n empty_env = with_environment { with_unbundled_env { ENV.to_h } }\n aruba_env = aruba.environment.to_h\n (aruba_env.keys - empty_env.keys).each do |key|\n delete_environment_variable key\n end\n empty_env.each do |k, v|\n set_environm... | [
"0.70644647",
"0.68566024",
"0.6793087",
"0.66561115",
"0.66126984",
"0.6407155",
"0.64020896",
"0.6179394",
"0.6108692",
"0.60507655",
"0.60507536",
"0.6029041",
"0.594762",
"0.59369904",
"0.5894722",
"0.57951885",
"0.57325494",
"0.5727446",
"0.5701359",
"0.5700877",
"0.5653... | 0.7505416 | 0 |
DEPRACATE View is returned in post puts each line if output=true else returns an array of view lines | def return_view( view, options={} )
output = options.fetch( :output, true )
if output
if view.is_a? String
puts view
else
view.each { |line| puts line }
end
end
view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output lines\n nil\n end",
"def process_debug_info(inputfile, outputfile, view)\r\n \r\n input_data = File.open(inputfile){|f| f.readlines }\r\n \r\n output_data = Array.new\r\n\r\n input_data.each{|l|\r\n l.gsub!(@view_pattern){|p| \r\n if $1.stri... | [
"0.581999",
"0.57743",
"0.5564454",
"0.5562273",
"0.5480305",
"0.54510474",
"0.52905595",
"0.5226091",
"0.5218447",
"0.52071106",
"0.5155262",
"0.51502687",
"0.51502687",
"0.51502687",
"0.51502687",
"0.51260376",
"0.5098708",
"0.50641334",
"0.5060562",
"0.5060234",
"0.5060234... | 0.65433973 | 0 |
Finalizes the session by storing the session in a cookie, if the session has changed. | def finalize_session
new_session = request.session.read_cookie
if @original_session != new_session
options = {:expires => (Time.now + _session_expiry)}
options[:domain] = _session_cookie_domain if _session_cookie_domain
cookies.set_cookie(_session_id_key, new_session, options)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish\n @cookies.delete(Action::RACK_SESSION)\n if changed?\n @cookies.each do |k, v|\n next unless changed?(k)\n\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end\n end\n end",
"def finish\n @cookies.delete(R... | [
"0.7708068",
"0.7624797",
"0.75007784",
"0.73445016",
"0.69458795",
"0.6804209",
"0.67352766",
"0.6684932",
"0.66571945",
"0.66379887",
"0.650791",
"0.6455298",
"0.63640815",
"0.63402885",
"0.6339493",
"0.63375586",
"0.63163406",
"0.6302188",
"0.6273602",
"0.62733287",
"0.626... | 0.7947754 | 0 |
==== Returns String:: The session store type, i.e. "cookie". | def session_store_type
"cookie"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_session_store\n Merb::Config[:session_store] && Merb::Config[:session_store].to_sym\n end",
"def user_type\n return Sessions.type(session[:session_id])\nend",
"def user_type\n return Sessions.type(session[:session_id])\nend",
"def user_type\n return session[:user_type] if sessi... | [
"0.7284258",
"0.69473517",
"0.6935956",
"0.6493814",
"0.6391545",
"0.63326806",
"0.6331821",
"0.617271",
"0.6101947",
"0.60748744",
"0.6005579",
"0.59866357",
"0.59099096",
"0.5862932",
"0.5823269",
"0.5801984",
"0.5797789",
"0.5755362",
"0.5749253",
"0.57441837",
"0.572123",... | 0.8641349 | 0 |
Marshal a session hash into safe cookie data. Include an integrity hash. ==== Parameters session:: The session to store in the cookie. ==== Returns String:: The cookie to be stored. | def marshal(session)
data = Base64.encode64(Marshal.dump(session)).chop
Merb::Request.escape "#{data}--#{generate_digest(data)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal(session)\n data = [ Marshal.dump(session) ].pack('m').chop\n \"#{data}--#{generate_digest(data)}\"\n end",
"def marshal(session)\n @verifier.generate(persistent_session_id!(session))\n end",
"def save_session(session)\n \n end",
"def put(session, context = Conte... | [
"0.71635246",
"0.6561648",
"0.6059348",
"0.6003758",
"0.59908825",
"0.5939369",
"0.5703221",
"0.5674113",
"0.5587094",
"0.55778265",
"0.5563193",
"0.5504547",
"0.5471552",
"0.5450257",
"0.543752",
"0.5428367",
"0.5422158",
"0.54097646",
"0.54083955",
"0.53881073",
"0.5361094"... | 0.704057 | 1 |
Unmarshal cookie data to a hash and verify its integrity. ==== Parameters cookie:: The cookie to unmarshal. ==== Raises TamperedWithCookie:: The digests don't match. ==== Returns Hash:: The stored session data. | def unmarshal(cookie)
if cookie
data, digest = cookie.split('--')
return {} if data.blank?
unless digest == generate_digest(data)
delete
raise TamperedWithCookie, "Maybe the site's session_secret_key has changed?"
end
Marshal.load(Base64.decode64(data))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmarshal(cookie)\n if cookie.blank?\n {}\n else\n data, digest = Merb::Parse.unescape(cookie).split('--')\n return {} if data.blank? || digest.blank?\n unless digest == generate_digest(data)\n clear\n unless Merb::Config[:ignore_tampered_cookies]\n ... | [
"0.8010594",
"0.7470434",
"0.7331093",
"0.7185754",
"0.6455716",
"0.64197123",
"0.587153",
"0.5809742",
"0.57926905",
"0.577221",
"0.57612324",
"0.5682469",
"0.56215006",
"0.5602521",
"0.55514246",
"0.5474787",
"0.54714173",
"0.5373337",
"0.5357627",
"0.5313641",
"0.5313641",... | 0.791309 | 1 |
Post Status Update button handler | def postStatusUpdateClick( sender )
# Post a status update to the user's feedm via the Graph API, and display an alert view
# with the results or an error.
message = "Updating #{@loggedInUser[ :first_name ]}'s status at #{NSDate.date}"
params = { :message => message }
# use the "st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @status_buttons.each do |i|\n i.update\n end\n end",
"def status\n if current_user.admin?\n status_name = Post.statuses[params[:status_name]]\n respond_to do |format|\n if status_name\n @post.update(status: status_nam... | [
"0.7216641",
"0.69400686",
"0.68454546",
"0.6835045",
"0.66085994",
"0.65929717",
"0.654814",
"0.6541666",
"0.645253",
"0.6418652",
"0.6393086",
"0.6366038",
"0.6366038",
"0.6366038",
"0.6366038",
"0.6366038",
"0.6366038",
"0.6364995",
"0.6337559",
"0.6337559",
"0.6333818",
... | 0.79356885 | 0 |
Post Photo button handler | def postPhotoClick( sender )
# Just use the icon image from the application itself. A real app would have a more
# useful way to get an image.
img = UIImage.imageNamed( "Icon-72@2x.png" )
# Build the request for uploading the photo
photoUploadRequest = FBRequest.requestForUploadPhoto( img )
# Then ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_photos\n end",
"def uploading_pictures\n end",
"def create\n\n p_attr = params[:photo]\n p_attr.permit!\n @photo = Photo.new(p_attr)\n\n respond_to do |format|\n if @photo.save\n #save new link between photo and post\n if (params[:post_id].length)\n\n countI... | [
"0.61414784",
"0.60925674",
"0.60164565",
"0.58982563",
"0.5880943",
"0.5872625",
"0.5871914",
"0.58512354",
"0.58512354",
"0.57969177",
"0.5791274",
"0.5788158",
"0.5783428",
"0.5758195",
"0.5709369",
"0.57079256",
"0.56864005",
"0.5681332",
"0.5676992",
"0.5670253",
"0.5668... | 0.8175517 | 0 |
Pick Friends button handler | def pickFriendsClick( sender )
# Create friend picker, and get data loaded into it.
friendPicker = FBFriendPickerViewController.alloc.init
@friendPickerController = friendPicker
friendPicker.loadData()
# Create navigation controller related UI for the friend picker.
friendPicker.navigationItem.title = "Pi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friendPickerDoneButtonWasPressed( sender )\n\n\t\tself.navigationController.popViewControllerAnimated( true )\n\n\t\tif @friendPickerController.selection.count == 0 \n\t\t message = \"<No Friends Selected>\"\n\t\telse\n\t\t # we pick up the users from the selection, and create a string that we use to upd... | [
"0.69450885",
"0.62445277",
"0.618641",
"0.60952824",
"0.60833853",
"0.6025743",
"0.59869015",
"0.59297866",
"0.59179866",
"0.58503276",
"0.5844482",
"0.58330435",
"0.5820428",
"0.5818169",
"0.5731283",
"0.5731283",
"0.56997633",
"0.5693503",
"0.5666061",
"0.56619257",
"0.565... | 0.7242478 | 0 |
Handler for when friend picker is dismissed | def friendPickerDoneButtonWasPressed( sender )
self.navigationController.popViewControllerAnimated( true )
if @friendPickerController.selection.count == 0
message = "<No Friends Selected>"
else
# we pick up the users from the selection, and create a string that we use to update the text view
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def viewWillDisappear(animated)\n super\n\n @current_picker.hidden = true\n end",
"def imagePickerControllerDidCancel(picker)\n p \"imagePickerControllerDidCancel\"\n picker.dismissModalViewControllerAnimated(true)\n end",
"def remove_friend\n end",
"def destroy\n if @friendship.accepted\... | [
"0.6258801",
"0.5620163",
"0.54022443",
"0.53854185",
"0.53552204",
"0.52976215",
"0.5268013",
"0.5257007",
"0.52532524",
"0.5220903",
"0.52051204",
"0.51814586",
"0.51786596",
"0.51523954",
"0.5142525",
"0.51207906",
"0.51128924",
"0.5092758",
"0.5091406",
"0.50898814",
"0.5... | 0.6267219 | 0 |
UIAlertView helper for post buttons | def showAlert( message, result: result, error: error )
if error
alertMsg = error.localizedDescription
alertTitle = "Error"
else
resultDict = result
alertMsg = "Successfully posted #{message}.\nPost ID: #{resultDict[:id]}"
alertTitle = "Success"
end
alertView = UIAlertView.alloc.in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom\n begin\n $results.log_action(\"button(#{@params[0]})\")\n if @driver.find_element(:id, \"btn-\" + @params[0]).displayed?\n @driver.find_element(:id, \"btn-\" + @params[0]).click\n $results.success\n else\n $results.fail(\"button(#{@params[0]})\")\n end\n r... | [
"0.60643834",
"0.59872335",
"0.58932114",
"0.58932114",
"0.58386576",
"0.5831859",
"0.582593",
"0.57888836",
"0.57464266",
"0.57205397",
"0.57171804",
"0.5693635",
"0.56758046",
"0.5670252",
"0.56169224",
"0.5594717",
"0.5574633",
"0.55743885",
"0.5549946",
"0.55259037",
"0.5... | 0.6104211 | 0 |
Count the number of recently posted messages which relates to the specified project. | def recent_count(project)
# Count task messages
task_message_count = 0
project.tasks.each do |task|
task_message_count += self.count(:conditions =>
["task_id = ? AND updated_at > ?", task.id, $duration_for_activity_calculation.day.ago])
end
return task_message_count
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n Project.count\n end",
"def count_messages\r\n @messages.size\r\n end",
"def projects_count\n ProjectDetail.all.count\n end",
"def project_counts\n @project_counts ||= Kithe::Model.joins(:contains_contained_by).\n where(published: true, contains_contained_by: {container... | [
"0.68011034",
"0.67397773",
"0.6570165",
"0.6546252",
"0.6508109",
"0.6325919",
"0.61468613",
"0.6143891",
"0.6133265",
"0.60848683",
"0.6059869",
"0.60591835",
"0.6048668",
"0.6039473",
"0.6020767",
"0.5995909",
"0.5969791",
"0.59503424",
"0.5884554",
"0.58767134",
"0.587376... | 0.84374803 | 0 |
Enters an action date | def enter_botgarden_action_date(data_set)
action_date = data_set[InventoryMovement::LOCATION_DATE.name]
if action_date
enter_simple_date(botgarden_acton_date_input_locator, action_date)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_botgarden_action_date(data_set)\n action_date = data_set[BOTGARDENCurrentLocationData::ACTION_DATE.name]\n if action_date\n logger.debug \"Entering accession date '#{action_date}'\"\n enter_simple_date(botgarden_acton_date_input_locator, action_date)\n end\n end",
"def enter_dat... | [
"0.7935647",
"0.688303",
"0.670834",
"0.6593349",
"0.65456533",
"0.63809556",
"0.63237",
"0.6316151",
"0.62951845",
"0.6194732",
"0.6194732",
"0.6194732",
"0.6194732",
"0.6194732",
"0.6194732",
"0.6194732",
"0.6131421",
"0.6131421",
"0.6131421",
"0.6131421",
"0.6131421",
"0... | 0.7616289 | 1 |
Selects an garden location | def select_botgarden_garden_location(data_set, type=nil)
garden = data_set[InventoryMovement::CURRENT_LOCATION.name]
garden_location_opts_loc = input_options_locator([], InventoryMovement::CURRENT_LOCATION.name)
enter_auto_complete(botgarden_garden_location_input_locator, garden_location_opts_loc, garden, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_botgarden_garden_location(data_set)\n garden = data_set[BOTGARDENCurrentLocationData::GARDEN_LOCATION.name]\n if garden\n logger.debug \"Entering garden location '#{garden}'\"\n garden_location_options_locator = input_options_locator([], BOTGARDENCurrentLocationData::GARDEN_LOCATION.name... | [
"0.7622988",
"0.71469367",
"0.6565909",
"0.6560477",
"0.64191556",
"0.62992734",
"0.62122124",
"0.6123376",
"0.6074374",
"0.6073113",
"0.6010205",
"0.6005575",
"0.5934027",
"0.59010696",
"0.5891709",
"0.5885169",
"0.58827794",
"0.5867166",
"0.5857736",
"0.58544147",
"0.584779... | 0.76127845 | 1 |
Asserts that a callback is made within a specified time, or will wait forever for the callback to occur if no time is specified. The supplied block will be called with the callback Proc which should be executed using `call` exactly once. | def assert_callback(time = nil, message = nil)
called_back = false
EventMachine.next_tick do
yield(lambda { called_back = true })
end
start_time = Time.now.to_i
while (!called_back)
select(nil, nil, nil, 0.1)
if (time and (Time.now.to_i - start_time > time))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_eventually(time = nil, message = nil)\n end_time = (time and Time.now + time)\n exception = nil\n\n while (true)\n begin\n yield\n rescue Object => e\n exception = e\n else\n break\n end\n \n select(nil, nil, nil, 0.1)\n \n if (end_ti... | [
"0.640447",
"0.6400669",
"0.630412",
"0.6140209",
"0.60295683",
"0.59776855",
"0.59400046",
"0.58941233",
"0.58485454",
"0.58399945",
"0.5765203",
"0.5725324",
"0.57226735",
"0.56965053",
"0.5690362",
"0.5617259",
"0.5582617",
"0.5546612",
"0.5543845",
"0.5539423",
"0.5524969... | 0.7493452 | 0 |
Asserts that a callback is made within a specified time, or will wait forever for the callback to occur if no time is specified. The supplied block will be called with the callback Proc which should be executed using `call` as many times as specified, or 1 by default. | def assert_callback_times(count = 1, time = nil, message = nil)
called_back = 0
EventMachine.next_tick do
yield(lambda { called_back += 1 })
end
start_time = Time.now.to_i
while (called_back < count)
select(nil, nil, nil, 0.1)
if (time and (Time.now.to_i - start_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_callback(time = nil, message = nil)\n called_back = false\n \n EventMachine.next_tick do\n yield(lambda { called_back = true })\n end\n \n start_time = Time.now.to_i\n\n while (!called_back)\n select(nil, nil, nil, 0.1)\n \n if (time and (Time.now.to_i - start_ti... | [
"0.74126494",
"0.6246186",
"0.6245209",
"0.61002874",
"0.60492957",
"0.6036297",
"0.5886072",
"0.5881244",
"0.5799476",
"0.57154274",
"0.56924266",
"0.5673136",
"0.56711876",
"0.5641788",
"0.56001997",
"0.5589447",
"0.5560119",
"0.55565614",
"0.5537325",
"0.55356324",
"0.5508... | 0.67467606 | 1 |
Tests and retests assertions until all of them will pass. An optional limit on time can be specified in seconds. A short delay is introduced between tests to avoid monopolizing the CPU during testing. When the supplied block fails to produce an exception it is presumed to have been a successful test and execution will ... | def assert_eventually(time = nil, message = nil)
end_time = (time and Time.now + time)
exception = nil
while (true)
begin
yield
rescue Object => e
exception = e
else
break
end
select(nil, nil, nil, 0.1)
if (end_time and Time.now > en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout_check_equal(duration, expected, &block)\n execute_ok = false\n duration.times do\n sleep(1)\n text = instance_eval(&block)\n execute_ok = true and break if (text == expected)\n end\n execute_ok.should == true\n end",
"def wait_unti... | [
"0.7043615",
"0.6891554",
"0.68401235",
"0.67999655",
"0.6527846",
"0.64867574",
"0.648294",
"0.64556724",
"0.64496887",
"0.64496887",
"0.63764304",
"0.6353516",
"0.62966007",
"0.6284301",
"0.62840706",
"0.6157335",
"0.6143846",
"0.6138376",
"0.61346394",
"0.61320007",
"0.611... | 0.7153634 | 0 |
Constructs a Mixlib::ShellOut double for use with stub_shellout, mimicking execution of the given command, as if it outputted the given strings on STDOUT and STDERR and exited with the given exit code. | def shellout_double(command:, stdout: "", stderr: "", exitstatus: 0)
shellout = double(::Mixlib::ShellOut)
expect(shellout).to receive(:environment).and_return({})
expect(shellout).to receive(:run_command)
allow(shellout).to receive(:stdout).and_return(stdout)
allow(shellout).to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stub_shellouts(*sequence)\n expect(::Mixlib::ShellOut).\n to receive(:new).and_return(*sequence)\n end",
"def failing_shellout_double(stdout='', stderr='', exitstatus=1)\n shellout = double(Mixlib::ShellOut)\n shellout.stub(:environment).and_return({})\n shellout.stu... | [
"0.736346",
"0.73314494",
"0.7313071",
"0.6991749",
"0.68966293",
"0.6892879",
"0.68042326",
"0.68026537",
"0.6626798",
"0.66042113",
"0.660242",
"0.63136965",
"0.62498987",
"0.6218088",
"0.61662567",
"0.61520934",
"0.61322963",
"0.61062163",
"0.6003764",
"0.6003764",
"0.5988... | 0.79357976 | 0 |
GET /recipes/1/ingredients GET /recipes/1/ingredients.json | def list_ingredients
rid = params[:id]
items = Aws.get_ingredients_from_db(rid)
render :json => items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end",
"def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"def by_ingredient\n... | [
"0.8285828",
"0.76407874",
"0.737684",
"0.73613507",
"0.7236437",
"0.7200404",
"0.719426",
"0.71904147",
"0.71753854",
"0.71034276",
"0.709348",
"0.7068875",
"0.70051116",
"0.6992278",
"0.69822216",
"0.6969833",
"0.6961507",
"0.6940411",
"0.6939646",
"0.6931194",
"0.6917286",... | 0.8040809 | 1 |
Find a file inside this report or one of its ancestors | def find(file, report = self)
current_path = File.join self.path, file
if File.exist? current_path
current_path
else
if superclass == Object
raise FileNotFoundError.new file, report
end
superclass.find file, report
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file( path )\n find_files( path ).first\n end",
"def find_file_named(name)\n top_level.class.find_file_named(name)\n end",
"def find file\n unless defined? @find_dirs_glob\n base_dirs = ENV['WMII_CONFPATH'].to_s.split(/:+/).unshift(DIR)\n ruby_dirs = base_dirs.map {|di... | [
"0.7418552",
"0.73229593",
"0.70465326",
"0.7000764",
"0.7000764",
"0.6937221",
"0.6915537",
"0.6703",
"0.6678376",
"0.66508704",
"0.65845084",
"0.65753067",
"0.65482754",
"0.65264624",
"0.6523993",
"0.6473109",
"0.64416474",
"0.6321218",
"0.63128895",
"0.6281298",
"0.6262738... | 0.78493863 | 0 |
Returns the file system path this report's views reside in | def view_path
File.join path, 'views'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_path\n @@view_path\n end",
"def view_path\r\n @view_name ||= File.basename(self.class.to_s.gsub(/Proxy$/, '').underscore).to_sym\r\n path = \"#{APP_ROOT}/views/#{view_name}.xaml\"\r\n @view_path = path unless @view_path == path\r\n @view_path\r\n end",
"def views_pat... | [
"0.7140084",
"0.7030694",
"0.701776",
"0.6997629",
"0.698188",
"0.6931004",
"0.6856102",
"0.6812478",
"0.6799619",
"0.6799619",
"0.6799619",
"0.67827237",
"0.6764068",
"0.6764068",
"0.6759558",
"0.6759558",
"0.6747166",
"0.65563995",
"0.654141",
"0.64918065",
"0.64850163",
... | 0.7477229 | 0 |
Creates a new report for the given repository and commit range | def initialize(repository, range = repository.current_branch)
@range = range
@repository = repository
@commits = repository.commits range
init
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(repo, range, commit)\n super repo, range\n\n @additions = commit.stats.additions\n @authored_date = commit.authored_date\n @committed_date = commit.committed_date\n @deletions = commit.stats.deletions\n @id = commit.id\n @messag... | [
"0.63294685",
"0.6034894",
"0.6034894",
"0.5816458",
"0.5768685",
"0.57676",
"0.57416266",
"0.5679495",
"0.55734193",
"0.5436227",
"0.5411021",
"0.53678733",
"0.5288881",
"0.5279589",
"0.5254102",
"0.52465934",
"0.5217972",
"0.52039546",
"0.5194012",
"0.51829994",
"0.51654685... | 0.61113125 | 1 |
Generates this report's output into the given target directory This will generate individual HTML files for the main views of the report. | def generate(target_dir, with_assets = true)
target_dir = File.expand_path target_dir
copy_assets target_dir if with_assets
render.each do |view_name, output|
file_name = File.join target_dir, view_name.to_s.downcase + '.html'
begin
output_file = File.open file_name, 'wb'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_dir(options = {})\n options[:dir] = \"generate\"\n build_webby_path(options)\n end",
"def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n pa... | [
"0.66022563",
"0.644847",
"0.6331076",
"0.61660296",
"0.61539555",
"0.6087046",
"0.6057765",
"0.5984926",
"0.5983471",
"0.5983339",
"0.59712344",
"0.59501296",
"0.59425306",
"0.5910768",
"0.5871075",
"0.5859655",
"0.5853141",
"0.583951",
"0.57921064",
"0.5747988",
"0.5747988"... | 0.75089633 | 0 |
Renders the views of this report (or the its ancestors) and returns them in a hash | def render
Mustache.view_namespace = self.class
result = {}
self.class.views.each do |view_name|
template = File.join 'templates', "#{view_name}.mustache"
template_path = self.class.find template
view = File.join 'views', "#{view_name}.rb"
view_path = self.class.find ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def webpage_views\n count_unique_views\n count_total_views\n\n @unique_views_hash.each do |webpage, unique|\n @webpage_views_hash.store(webpage, 'Unique views' => unique)\n end\n\n @total_views_hash.each do |webpage, total|\n @webpage_views_hash[webpage].store('Total views', total)\n en... | [
"0.6333712",
"0.6299372",
"0.6268134",
"0.6267164",
"0.62189317",
"0.61965984",
"0.6195866",
"0.6157919",
"0.61248565",
"0.6047699",
"0.5999267",
"0.5989607",
"0.5865362",
"0.5864315",
"0.5838328",
"0.5838328",
"0.5838328",
"0.5838328",
"0.5785256",
"0.57532233",
"0.5744626",... | 0.66808105 | 0 |
Copies the assets coming with this report to the given target directory This will copy the files and directories that have been specified for the report from the report's path (or the report's ancestors) into the target directory. | def copy_assets(target_dir)
FileUtils.mkdir_p target_dir
self.class.assets.map do |asset|
asset_path = self.class.find asset
asset_dir = File.join target_dir, File.dirname(asset)
FileUtils.mkdir_p asset_dir unless File.exists? asset_dir
FileUtils.cp_r asset_path, asset_dir
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_target_directory\n # create result directory\n Dir.mkdir(@target_dir) unless Dir.exists?(@target_dir)\n\n # copy vendor assets\n vendor_dir = File.expand_path('../../../vendor/assets', __FILE__)\n FileUtils.cp_r(vendor_dir, @target_dir, remove_destination: true)\n\n # copy local as... | [
"0.687144",
"0.6770511",
"0.6630492",
"0.653304",
"0.6446856",
"0.64058644",
"0.63774616",
"0.6298499",
"0.62915426",
"0.61486197",
"0.6073549",
"0.59313905",
"0.5900789",
"0.58545727",
"0.58101636",
"0.580529",
"0.5710264",
"0.57019573",
"0.5696725",
"0.569314",
"0.5678652",... | 0.7626773 | 0 |
display available city names | def city_names(available_cities)
puts "Available Cities Are"
available_cities.each {|k,v| puts "City: #{k}"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_name_city\n @cidades = Cidade.order(:nome)\n end",
"def city_names\n cities.pluck(:name).join(\", \")\n end",
"def cities\n CS.get :us, :ca\n end",
"def cities_helper\n [\n ['基隆市', '基隆市'],\n ['台北市', '台北市'],\n ['新北市', '新北市'],\n ['桃園縣', '桃園縣'],\n [... | [
"0.71811795",
"0.7172483",
"0.7168999",
"0.70227575",
"0.7009288",
"0.696977",
"0.6940944",
"0.69322515",
"0.6831255",
"0.68289155",
"0.68000025",
"0.66811645",
"0.6676815",
"0.66702485",
"0.6659554",
"0.66544557",
"0.65920836",
"0.6528307",
"0.65261406",
"0.6525321",
"0.6524... | 0.74443424 | 0 |
GET /oma_relation_types/1 GET /oma_relation_types/1.json | def show
@oma_relation_type = OmaRelationType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @oma_relation_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @oma_relation_type = OmaRelationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oma_relation_type }\n end\n end",
"def load_type\n :relation\n end",
"def relation_types\n Spree::RelationType.where(applies_to: to_relat... | [
"0.6792405",
"0.66945076",
"0.6684685",
"0.63382334",
"0.62139684",
"0.62082493",
"0.62014604",
"0.61564946",
"0.6065629",
"0.60378885",
"0.60161984",
"0.5928868",
"0.59109145",
"0.5896801",
"0.585025",
"0.5847225",
"0.58433723",
"0.5813948",
"0.5799794",
"0.5796874",
"0.5785... | 0.7311313 | 0 |
GET /oma_relation_types/new GET /oma_relation_types/new.json | def new
@oma_relation_type = OmaRelationType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @oma_relation_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @oma_relation_type = OmaRelationType.new(params[:oma_relation_type])\n\n respond_to do |format|\n if @oma_relation_type.save\n format.html { redirect_to @oma_relation_type, notice: 'Oma relation type was successfully created.' }\n format.json { render json: @oma_relation_type,... | [
"0.7591892",
"0.743201",
"0.7172289",
"0.71281374",
"0.7091824",
"0.7012513",
"0.7004589",
"0.69935274",
"0.6881779",
"0.67866826",
"0.6728959",
"0.672259",
"0.6720251",
"0.67104673",
"0.66610533",
"0.66562456",
"0.66432554",
"0.6641344",
"0.66349876",
"0.6634422",
"0.6626635... | 0.8161994 | 0 |
POST /oma_relation_types POST /oma_relation_types.json | def create
@oma_relation_type = OmaRelationType.new(params[:oma_relation_type])
respond_to do |format|
if @oma_relation_type.save
format.html { redirect_to @oma_relation_type, notice: 'Oma relation type was successfully created.' }
format.json { render json: @oma_relation_type, status: :c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relation_type_params\n params.require(:relation_type).permit(:name, :color, :num_nodes, :project_id, :entity_type => [])\n end",
"def create\n exit_if_not_manager and return\n @relation_type = RelationType.new(relation_type_params)\n if params[:relation_type][:entity_type].present?\n @r... | [
"0.7061783",
"0.65411675",
"0.6266542",
"0.62070185",
"0.6179905",
"0.60270345",
"0.60270345",
"0.5989962",
"0.5989962",
"0.59102595",
"0.59013635",
"0.5816188",
"0.5810226",
"0.5807395",
"0.57548136",
"0.57359886",
"0.5623325",
"0.5578757",
"0.5575196",
"0.55531865",
"0.5551... | 0.67837 | 1 |
PUT /oma_relation_types/1 PUT /oma_relation_types/1.json | def update
@oma_relation_type = OmaRelationType.find(params[:id])
respond_to do |format|
if @oma_relation_type.update_attributes(params[:oma_relation_type])
format.html { redirect_to @oma_relation_type, notice: 'Oma relation type was successfully updated.' }
format.json { head :no_content... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_type\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname){\"params=#{params.inspect}\"}\n\t\t@relation = Relation.find(params[:id])\n\t\t@types = Typesobject.get_types(\"relation\")\n\t\t@status = Statusobject.get_status(\"relation\")\n\t\tctrl_update_type @relation, params[:object_t... | [
"0.686125",
"0.6314409",
"0.6275389",
"0.6144712",
"0.6064373",
"0.60263664",
"0.6016727",
"0.585929",
"0.5846402",
"0.58342636",
"0.5816895",
"0.5748995",
"0.57207614",
"0.5700338",
"0.56947494",
"0.5665205",
"0.5640566",
"0.56150806",
"0.5602059",
"0.55894357",
"0.55732304"... | 0.7172155 | 0 |
DELETE /oma_relation_types/1 DELETE /oma_relation_types/1.json | def destroy
@oma_relation_type = OmaRelationType.find(params[:id])
@oma_relation_type.destroy
respond_to do |format|
format.html { redirect_to oma_relation_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @expression_relationship_type = ExpressionRelationshipType.find(params[:id])\n @expression_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationship_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @... | [
"0.6915499",
"0.68692565",
"0.68133074",
"0.67925435",
"0.67512673",
"0.67101187",
"0.66820294",
"0.66228694",
"0.65907633",
"0.656271",
"0.65347403",
"0.6528727",
"0.65285736",
"0.6520388",
"0.6512361",
"0.65046895",
"0.64874125",
"0.6486599",
"0.6479763",
"0.6469267",
"0.64... | 0.79502684 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.