query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
d21b33ea8378210d04db451bb1dad0b6
Gets or sets the root task model
[ { "docid": "aafe6d089690100376eb1617dcc4ba30", "score": "0.0", "text": "def root(*new_root)\n if !new_root.empty?\n @root = Root.new(new_root.first, self)\n elsif @root then @root\n elsif superclass.respond_to?(:root)\n ...
[ { "docid": "7f8a3f96ef231ae404779400c02d6693", "score": "0.8047971", "text": "def root_task\n instance_for(model.root).task\n end", "title": "" }, { "docid": "0285952e53bda6696235ae00c981180d", "score": "0.692269", "text": "def root_model\n node = @mo...
b9ab390ff62ac1c9d0213de925c01986
and prints the string as many times as the integer indicates.
[ { "docid": "b8496cea2d2ce606752d3396f63e32c2", "score": "0.72183335", "text": "def repeat(string, int)\n int.times { puts string }\nend", "title": "" } ]
[ { "docid": "c2f175b2006b339a4e28f9094dc74b5c", "score": "0.76058453", "text": "def printi(text, n = 1)\n print idt(n) + text\n end", "title": "" }, { "docid": "53350f0eaad7c4f81d60d9a6e8c4faea", "score": "0.73250645", "text": "def repeat(str, int)\n int.times { puts str }\nend",...
9f9b26e3bebe3eeaed3e2263eefedcfd
GET /transforms/new GET /transforms/new.json
[ { "docid": "b95790a159827530a46a8553560140b3", "score": "0.7487677", "text": "def new\n @transform = Transform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transform }\n end\n end", "title": "" } ]
[ { "docid": "7284631c8f7c390f42ff98d84f278dcd", "score": "0.686541", "text": "def new\n respond_with(transformation)\n end", "title": "" }, { "docid": "2b184191891ca9c02802baacd92360ff", "score": "0.6828216", "text": "def create\n @transform = Transform.new(params[:transform])\...
99b1635580cacf51ac172776de5d33a9
Return a list of all ids in a table.
[ { "docid": "10f26ad534e43fe861797de592140cd8", "score": "0.8656487", "text": "def ids(table)\n res = connection.query(\"SELECT id FROM #{table} GROUP BY id\")\n id_list = []\n res.each { |i| id_list << i[0].to_i }\n return id_list\n end", "title": "" } ]
[ { "docid": "1f8f683c783b108923d16ce4a05c8996", "score": "0.80731314", "text": "def get_ids(table)\r\n valid_ids = []\r\n table_info = @db.execute(\"SELECT * FROM #{table}\")\r\n table_info.each do |line|\r\n line_info = []\r\n line.each do |name, valu...
0355fbc2248b6964fc36177c8abe945a
GET /partnership_applications/1 GET /partnership_applications/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "6ad743daf00909d0dbb724dc9c7550d2", "score": "0.7637627", "text": "def index\n @partnership_applications = PartnershipApplication.all\n end", "title": "" }, { "docid": "ddacf620c1fb11da71cb5a652be1e9e9", "score": "0.700496", "text": "def create\n @partnership_applic...
303d13bc2a10f129118ea15e1e350b93
Create check for whether user input is convertible or not.
[ { "docid": "196c77bbdd81d5d9fdfb3c0f1e0dfc40", "score": "0.0", "text": "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "title": "" } ]
[ { "docid": "b00b0f99595217197a6466f8662478e7", "score": "0.6790622", "text": "def should_coerce?(value, into)\n !into.nil?\n end", "title": "" }, { "docid": "d17928176ffb517f4325573bcab9d978", "score": "0.66369975", "text": "def can_convert?\n false # really, it's on...
48d909ca44f3658604b444547ee83c6f
begin ActiveModel compat methods
[ { "docid": "f117d5061b6041bd47981b83bc6fef7f", "score": "0.0", "text": "def to_model\n self\n end", "title": "" } ]
[ { "docid": "af61d4734dcbed26ae094af8ab1cb7c9", "score": "0.6801409", "text": "def active_record; end", "title": "" }, { "docid": "66c432c549d63dea6fa47b3cd83d4332", "score": "0.660898", "text": "def fixedModel; end", "title": "" }, { "docid": "d451e6fc1d8b9fe5aba0293f5574...
04fe7d19d38552f34890b1f3c94ddbae
initialize object: try to connect to Nessus Scanner using URL, user and password (or any other defaults) Usage: n = NessusREST::Client.new(url: ' username: 'user', password: 'password')
[ { "docid": "c81df71159b051e2b6ba021dd0ea712e", "score": "0.7487767", "text": "def initialize(params = {})\n # defaults\n @username = params.fetch(:username, 'nessus')\n @password = params.fetch(:password, 'nessus')\n autologin = params.fetch(:autologin, true)\n @defsleep = param...
[ { "docid": "9aeb6135473d2b4de2460bb6b62da9f9", "score": "0.7377774", "text": "def initialize(url, user, password, address = self.class.default_address, protocol = self.class.default_protocol)\n @address = address\n @url = url\n @user = user\n @password = password\n @protocol = protocol\n ...
c7b0cbee36debefc0fda742efdd7ebea
you can 'reply' to any message, so to/from decision is awkward
[ { "docid": "3f43c428680ec3e3cfe669c02d835632", "score": "0.0", "text": "def reply(new_content)\n child = self.class.new(\n account: account,\n from: outbound? ? from : to,\n to: outbound? ? to : from,\n outbound: true,\n content: new_content\n )\n child.send!\n child...
[ { "docid": "0b40621584f1522d494f614eb110fd6c", "score": "0.7447836", "text": "def reply(message)\n tell(message)\n end", "title": "" }, { "docid": "212bc4874ff0177b295d6c6f3493a80a", "score": "0.73661995", "text": "def reply(message, to = nil)\n if to == :room\n connectio...
02bd842126830c3dfe86ac5e048aa8e2
GET /playlist_items/new GET /playlist_items/new.json
[ { "docid": "f0f6accb11e569944ad7b9cf4e903606", "score": "0.8337567", "text": "def new\n @playlist_item = PlaylistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playlist_item }\n end\n end", "title": "" } ]
[ { "docid": "86b1a2d5a50a50542b32873c43f20e3e", "score": "0.79843736", "text": "def new\n # @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: { playlist: @playlist } }\n end\n end", "title": "" }, { "docid": "0193...
c5c942989aad2f1fc56a910b777c4cae
"Best" should be the member with the fastest ping time
[ { "docid": "cdb1f3057cd112c56a6f3948ae73269b", "score": "0.0", "text": "def best(members)\n Array(members.first)\n end", "title": "" } ]
[ { "docid": "6e1c952b6cb9ae62ad6dc4aa7e9c1b5d", "score": "0.63729024", "text": "def ping_time\n @ping_mutex.synchronize do\n if !@last_ping || (Time.now - @last_ping) > 300\n @ping_time = refresh_ping_time\n @last_ping = Time.now\n end\n end\n @ping_time\n ...
ea74e2ffb9d3219c7ce51e5d7bf44a69
Examples: puts reverse_sentence('') == '' puts reverse_sentence('Hello World') == 'World Hello' puts reverse_sentence('Reverse these words') == 'words these Reverse' The tests above should print true. Question: Write a method that takes a string as an argument and outputs a new string with the words in reverse Clarific...
[ { "docid": "980bf4b7a3a55e8b8e6a3b26f553ab22", "score": "0.80414045", "text": "def reverse_sentence(string)\n result = []\n\n array = string.split(' ')\n \n i = 0\n loop do\n break if i == array.size\n result << array.pop\n end\n\n answer = result.join(' ')\n answer\nend", "title": "" ...
[ { "docid": "cc9a596ed786eddf5c166472ffa8ca90", "score": "0.84636146", "text": "def reverse_sentence(string)\n=begin\n p string.reverse # ex. \"dlroW olleH\" --- reverses whole string\n p string.split(' ') # ex. [\"Hello\", \"World\"] --- returns array of strings split by the space\n p string.split(' ...
b91e0a4473d1c608952ec1726dbace6b
Activities show the owner
[ { "docid": "0b252daaa738104dd2d58c9dc2f9d6c7", "score": "0.7528993", "text": "def show_owner(owner)\n if owner\n raw(link_to(h(owner.name), owner))\n else\n t'activity.unknown'\n end\n end", "title": "" } ]
[ { "docid": "84bfddfb199bc8dded333a4fee0ffc49", "score": "0.78314894", "text": "def show\n @activities = PublicActivity::Activity.order(\"created_at desc\").where(owner_id: @profile.user.id, owner_type: \"User\")\n end", "title": "" }, { "docid": "5ae66971cf1449e18637f5139e121b27", "s...
4c07944642a9251c7346f066eddd63f3
Initialize a root emitter object
[ { "docid": "9340b0874d627092ce82cffda8dda649", "score": "0.0", "text": "def initialize\n end", "title": "" } ]
[ { "docid": "e5c653455651af872ef5beb427712045", "score": "0.64365464", "text": "def initialize(base)\n @base = base\n @events = []\n end", "title": "" }, { "docid": "bcb16cd2b0e4bd5d10422e27523380f3", "score": "0.6436014", "text": "def initialize(aRoot)\n ...
7f56ac0d6f8a26e082db8ec74e39aedb
Formats a command to run the given powershell script. === Parameters script_file_path(String):: powershell script file path == Returns command(String):: command to execute
[ { "docid": "8607d0255488cc6aeea66c5779a94c6d", "score": "0.7284292", "text": "def format_command(script_file_path)\n platform = RightScale::Platform\n shell = platform.shell\n\n # import ChefNodeCmdlet.dll to allow powershell scripts to call get-ChefNode, etc.\n lines_befo...
[ { "docid": "87a93b6952890451b818a1c0cd9e17d6", "score": "0.7316848", "text": "def format_powershell_command(shell_script_file_path, *arguments)\n return format_powershell_command4(POWERSHELL_V1x0_EXECUTABLE_PATH, nil, nil, shell_script_file_path, *arguments)\n end", "title": "" }, { ...
fcf8ae74ce246d7a74e33d313f7de492
Hash for additional SSLContext parameters. source://netsmtp//lib/net/smtp.rb268
[ { "docid": "2b33320e10866c3f044c4be6c7a07dc0", "score": "0.7809531", "text": "def ssl_context_params; end", "title": "" } ]
[ { "docid": "d85238c393386bfc12d89dd8351415e5", "score": "0.73546803", "text": "def ssl_params; end", "title": "" }, { "docid": "540edc911c6e8af8f2bdd239d5cc122e", "score": "0.72615063", "text": "def ssl_context_params=(_arg0); end", "title": "" }, { "docid": "18eae3ff33ff...
dd250a10ac16afd3483c4340e0eecff6
resizes and crops to fill bounds
[ { "docid": "bab919b3f27e766e806e5ce87e0f624f", "score": "0.61798376", "text": "def crop_to_fit(width, height)\n @image = @image.crop_to_fit(width, height)\n self\n end", "title": "" } ]
[ { "docid": "4a45a06e8bff22aac9ae16c4be5aaabc", "score": "0.72412753", "text": "def resize_to_fill(new_width, new_height)\n manipulate! do |image|\n\n image = resize_image image, new_width, new_height, :max\n\n if image.x_size > new_width\n top = 0\n left = (image.x_s...
764ee378112fbc30c7fd480519628a85
write_hole_size Write the element.
[ { "docid": "ac057da24c444c2ff7cd4dab6b16d2ad", "score": "0.86736375", "text": "def write_hole_size\n @writer.empty_tag('c:holeSize', [['val', @hole_size]])\n end", "title": "" } ]
[ { "docid": "65f79920a238dbbb845290f5b9e65717", "score": "0.6665424", "text": "def set_hole_size(size)\n return unless size\n\n if size >= 10 && size <= 90\n @hole_size = size\n else\n raise \"Hole size $size outside Excel range: 10 <= size <= 90\"\n end\n ...
278f4b74343fbbd807fd6aa123561915
List files not in 'all' Hash
[ { "docid": "a279bcb184a6a356c0c415919ed4d45f", "score": "0.57116777", "text": "def list_unique(folder, all)\n i = 0\n Find.find(folder) do |path|\n path = Pathname.new path\n if path.file? && !all.include?(path)\n if i % 1000 == 0\n puts \"#{i} #{path}\"\n end\n ...
[ { "docid": "10d16ffaeac2f3bad56b42d572eda8e8", "score": "0.68440926", "text": "def tracked_files\n all_files.reject{|f| ignore_matcher.matched?(f)}\n end", "title": "" }, { "docid": "86dc93eda5a87506dcc4d0eb9d733f3e", "score": "0.66671836", "text": "def nonhidden_files\n\t\tfiles...
5b0598f6e78ac2f707c6504a9e8823b4
DELETE /patologia/1 DELETE /patologia/1.json
[ { "docid": "32baacf77e4729b7244a3368faca7d9c", "score": "0.7045599", "text": "def destroy\n @patologium.destroy\n respond_to do |format|\n format.html { redirect_to patologia_url, notice: 'Patologium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.7504117", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "...
9d0e22b12275ea4ca3235c6f114bc460
Sets the enterpriseCloudPrintResourceIdentifier property value. OAuth resource URI for print service as configured in the Azure portal.
[ { "docid": "8866888513cf42994fb29c69a2045c16", "score": "0.8442071", "text": "def enterprise_cloud_print_resource_identifier=(value)\n @enterprise_cloud_print_resource_identifier = value\n end", "title": "" } ]
[ { "docid": "54097436f4e51e2fd6a030ae6f660472", "score": "0.75679624", "text": "def enterprise_cloud_print_mopria_discovery_resource_identifier=(value)\n @enterprise_cloud_print_mopria_discovery_resource_identifier = value\n end", "title": "" }, { "docid": "78bd21ce2...
2fc07ce2ce6843f4258f4c343b88987e
Save current user information
[ { "docid": "89e92f47397348d6904d408fb76f511f", "score": "0.0", "text": "def current_user\n\t@current_user = User.find(session[:user_id]) if session[:user_id]\nend", "title": "" } ]
[ { "docid": "51fb74a0f314bdf6cfa621f6625e1e8c", "score": "0.7337099", "text": "def save_user_info\n if current_user\n cookies[:provider] = current_user.provider\n cookies[:current_institution] = current_institution.code.downcase\n end\n end", "title": "" }, { "docid": "077e93...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "73bdc51876b22d6d4534af90434052aa", "score": "0.0", "text": "def other_medium_params\n params.require(:other_medium).permit(:name, :price, :code, :brand, :brandmodel, :mediatype, :capacity, :maxspeedsupported, :quantity, :features, :packaging, :other)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980629", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.67819995", "text": "def strong_params\n params.requ...
f25edfcd3d34ff4286314da763b1cc4b
Get Session Timer Profile Binding Map for Tier1 Logical Router LocaleServices API will get Session Timer Profile Binding Map for Tier1 Logical Router LocaleServices.
[ { "docid": "b45c186bd081f7c08e5194cef2f7bda9", "score": "0.61420816", "text": "def get_tier1_locale_services_session_timer_profile_binding_0(tier1_id, locale_services_id, session_timer_profile_binding_id, opts = {})\n data, _status_code, _headers = get_tier1_locale_services_session_timer_profile_bi...
[ { "docid": "1ccc8ad605c34c04d36b2996863f9cec", "score": "0.63935435", "text": "def patch_tier1_locale_services_session_timer_profile_binding_map_0(tier1_id, locale_services_id, session_timer_profile_binding_id, session_timer_profile_binding_map, opts = {})\n patch_tier1_locale_services_session_time...
79c941d9ac69e5c4ca06a57942e5c8d0
Gives you some context around a specific line in a file. the size argument works in both directions + the actual line, size = 2 gives you 5 lines of source, the returned array has the following format. [ line = [ lineno = Integer, line = String, is_searched_line = (lineno == initial_lineno) ], ..., ... ] Example __call...
[ { "docid": "54cfe8817e955273206eea3965bc9e8e", "score": "0.726221", "text": "def __caller_lines__(file, line, size = 4)\n return [['Template Error!', \"problem while rendering\", false]] if file =~ /\\(erubis\\)/\n lines = File.readlines(file)\n current = line.to_i - 1\n\n first = current - ...
[ { "docid": "4291322592261da23098995983315da5", "score": "0.71734786", "text": "def get_context(fname, line, size = 2)\n begin\n line = line.to_i\n from = [0, (line-size-1)].max\n lines = File.open(fname, 'r') { |file| file.lines.to_a[from...(line+size)] }\n\n i = [line -...
dd17bedd0e032be8988937ec13b09c5d
POST /medical_histories POST /medical_histories.json
[ { "docid": "90105d5cbaa9b45442a8ed46fed36aad", "score": "0.6898442", "text": "def create\n @medical_history = MedicalHistory.new(medical_history_params)\n\n respond_to do |format|\n if @medical_history.save\n format.html { redirect_to @medical_history, notice: 'Medical history was succ...
[ { "docid": "81872abf22b8ae366136f24cb8e75bde", "score": "0.7209309", "text": "def create\n megam_rest.post_billedhistories(to_hash)\n end", "title": "" }, { "docid": "0830466ea6fa581c9d01bb3e92fc33ee", "score": "0.6951542", "text": "def create\n @medhistory = Medhistory.ne...
f456e7533e3f4ad3b9ad5d44bee7972a
Load and render the erb template in the given +templatefile+ within the specified +context+ (a Binding object) and return output Both +templatefile+ and +outfile+ should be Pathnamelike objects.
[ { "docid": "59ae4c8dbb1f1d65ded5d07ee19794bd", "score": "0.7485005", "text": "def eval_template(templatefile, context)\n template_src = templatefile.read\n template = ERB.new(template_src, nil, '<>')\n template.filename = templatefile.to_s\n\n begin\n template.result(context)\...
[ { "docid": "e02de7767d737926a977f578101c4a77", "score": "0.7453962", "text": "def render_template( templatefile, context, outfile )\n output = eval_template(templatefile, context)\n \n # TODO delete this dirty hack when documentation for example for GeneratorMethods will not be cutted off by <s...
a5e75feb22593e4a88e82049f6219877
DELETE /students/1 DELETE /students/1.json
[ { "docid": "73a6a880e53c2f77fc19f3745f0bdef2", "score": "0.0", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: '删除学生成功!' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "a41be49f6458790d5a2d38db09348203", "score": "0.8147374", "text": "def destroy\n require 'net/http'\n require 'json'\n\n # Correct URL for deleting a resource.\n uri = URI(\"http://localhost:3000/students/#{params[:id]}.json\")\n\n request = Net::HTTP::Delete.new uri\n\n # H...
214baeb698b4c5234be05f1032d96b0c
> ['Pete', '201'] Write a method that changes the first arithmetic operator (+, , , /) in a string to a '?' and returns the resulting string. The original string should not be modified.
[ { "docid": "57b4a6ddce1dcff49d2ea6e346b2a06a", "score": "0.7040023", "text": "def mystery_math(string)\n string.sub(/[\\+\\-\\*\\/]/, '?')\nend", "title": "" } ]
[ { "docid": "1c1f95644a4ad18820348d739285842a", "score": "0.73619735", "text": "def mystery_math(str)\n str.sub(/[+-]|\\*|\\//, '?')\nend", "title": "" }, { "docid": "7effb21025635ae12ab5042288b5247f", "score": "0.7294247", "text": "def mystery_math(str)\n str.gsub(/[+-]|\\*|\\//, '...
8e7b13129d57ae01323a796ac76f9e37
GET /complaints/1 GET /complaints/1.json
[ { "docid": "cb09f7842e00b0b01e6cdbef3549276b", "score": "0.6947711", "text": "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "title": "" } ]
[ { "docid": "400b928a44722f227613f163816550ce", "score": "0.70340234", "text": "def all\n get(\"#{domain}/complaints\")\n end", "title": "" }, { "docid": "37922b2e171eba4979191d6e7080fb5d", "score": "0.6767759", "text": "def show\n @complaint = Complaint.find(params[:id...
06b18ed3f10898b60cbcf6d8c53dc6e2
def taxons_tree_product_show(root_taxon, current_taxon, max_level = 1) return '' if max_level < 1 || root_taxon.leaf? content_tag :ul do taxons = root_taxon.children.map do |taxon| concat(content_tag(:li,link_to(taxon.name, seo_url(taxon)) )) + taxons_tree(taxon, current_taxon, max_level 1) end safe_join(taxons, "\n") ...
[ { "docid": "c6538f34323a3369a5597079e76f1a7a", "score": "0.83322525", "text": "def taxons_home_tree(root_taxon, current_taxon, max_level = 1)\n return '' if max_level < 1 || root_taxon.leaf?\n count = 1;\n taxons = root_taxon.children.map do |taxon|\n content_tag :div, class: 'item' do\n ...
[ { "docid": "d733896ddb37080ece601b9293bf1d1c", "score": "0.81305057", "text": "def taxons_tree_with_count(root_taxon, current_taxon, max_level = 1)\n return '' if max_level < 1 || root_taxon.children.empty?\n content_tag :ul, :class => 'taxons-list' do\n root_taxon.children.map do |taxo...
2edc57d9215cb99b70066257f1be6693
Constructor function for the maze presenter.
[ { "docid": "a8c9a027d34e81bf86bc96b0aafe9dfc", "score": "0.62793386", "text": "def setup_maze_presenter(algorithm, state)\n state[:current_grid_length] = INITIAL_MAZE_GRID_LENGTH\n state[:remaining_time] = TIME_LIMIT\n state[:algorithm] = algorithm\n state[:needs_reset] = true\n state[:footsteps] =...
[ { "docid": "152f63961ea9a3e5d3faaedbc4f1325b", "score": "0.7452552", "text": "def initialize\n @start_vertical = nil\n @start_horizontal = nil\n @processed_maze = nil\n end", "title": "" }, { "docid": "d1e88573749989ad2227bbee7010a34f", "score": "0.7193498", "text": "def in...
bac05453050e7d8b50187f581028fbc4
Special method for creating/updating a tree of nodes via the children_attribs hash. Sets ranks_changed? flag if the ranks of any of the descendants' children change.
[ { "docid": "6bb00bd845d7b9561d8ca7036bcacd32", "score": "0.75372124", "text": "def update_children\n return if children_attribs.nil?\n\n reload # Ancestry doesn't seem to work properly without this.\n\n # Symbolize keys if regular Hash. (not needed for HashWithIndifferentAccess)\n ch...
[ { "docid": "f441c70cd6cc99d4a7a2936fe8b6772c", "score": "0.6177864", "text": "def update_descendants_with_new_ancestry\n # Skip this if callbacks are disabled\n unless ancestry_callbacks_disabled?\n # If node is valid, not a new record and ancestry was updated ...\n if changed.in...
97e922ae7f6ae58b97ac63aa6a1724d0
Get a Traits Schema Definition
[ { "docid": "4961eace59866733609d2ae114a8ab61", "score": "0.0", "text": "def get_schema_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.get_schema ...'\n end\n # verify the required parameter 'id' is set\n ...
[ { "docid": "f259c9752deb7dbc4232bf4c75f666f6", "score": "0.6356053", "text": "def schema_definition\n of.schema_definition \n end", "title": "" }, { "docid": "88a0c762e4c8e6304e2b264e747ce123", "score": "0.61154735", "text": "def schema\n @schema ||= metadata.ancestors('...
5894494503b9448d385e25837acbc4b4
Place arguments in instance variables
[ { "docid": "d0c269e89fb21b298522c5cc2705f65a", "score": "0.61461645", "text": "def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end", "title...
[ { "docid": "4c2ae8a983c1fbd64f2df680a82f3512", "score": "0.73907316", "text": "def initialize(*args)\n set_instance_variables args\n end", "title": "" }, { "docid": "f269c7e847272b9dad0af39f2135031e", "score": "0.7385387", "text": "def assign args={}\n args.keys.each{ |name|...
10e5a2ff3daa0cbba00923eaf4ec541b
setup and return an authed xen api instance
[ { "docid": "4f64b6e48fb1f3935f52626c8f8e4f05", "score": "0.70683914", "text": "def xapi\n @xapi ||= begin\n\n ui.fatal 'Must provide a xapi host with --host ' unless locate_config_value(:xapi_host)\n verify = :verify_none\n verify = :verify_peer if locate_config_value(:xapi_ssl...
[ { "docid": "7a8a99821a56dc95017c61a1143b2839", "score": "0.7296881", "text": "def xapi\n @xapi ||= begin \n\n session = XenApi::Client.new( Chef::Config[:knife][:xenserver_host] )\n \n # get the password from the user\n password = Chef::Config[:knife][:xenserver_password...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "f305fa9681e7ab76da5e3249e1e2e2f8", "score": "0.0", "text": "def farm_field_params\n params.permit(:name, :farm_id)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
a83ff5401e96985695bf9cc77c16adbe
set the 'jid' attribute of this stanza jid:: [Jabber::JID] or [String] the jid owning the subscription
[ { "docid": "feb7b80416ceb52cc5a15789a24b4ddb", "score": "0.8160619", "text": "def jid=(jid)\n attributes['jid'] = jid.to_s\n end", "title": "" } ]
[ { "docid": "e3e901d3f25397b41676cbc34de590d8", "score": "0.8543317", "text": "def jid=(jid)\n subscribe[:jid] = jid\n end", "title": "" }, { "docid": "5af18cc3cf731b63460de00bbdba8155", "score": "0.82564527", "text": "def jid=(jid)\n write_attr :jid, jid\n end", ...
1bebade24f34a8ce5439a96697246afe
Identify and describe the Ruby method(s) you implemented. Person 5
[ { "docid": "14a52ea465414e26f1454b5d1aebe967", "score": "0.0", "text": "def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "title": "" } ]
[ { "docid": "20d309fac0260c3a410b0ebf06462ff3", "score": "0.7141267", "text": "def visit_methods; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7030672", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804...
ea08e84124f70698a700152933d80584
pilot_info Should loop through the array of pilots and display the info of each pilot
[ { "docid": "ccb1d676acc5afc99c7ecfbef2b77b1d", "score": "0.8838043", "text": "def pilot_info\n @pilot_list.each do |pilot|\n puts pilot.info\n end\n end", "title": "" } ]
[ { "docid": "f0af76b88802565fdc06f13fda9b28b4", "score": "0.6178852", "text": "def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end", "title": "" }, { "docid": "404653d8e8...
6d0f80814ab4c6629d64a958e324752a
This method should return the temperature in degrees Celsius.
[ { "docid": "9144ea5c9438561b52ab1d2689be6c02", "score": "0.0", "text": "def temp_converter(input_type, temp)\n\n input = input_type.upcase\n if input == \"C\"\n # F=(9/5)C +32\n ((9 * temp)/5) + 32\n elsif input == \"F\"\n # C = (5/9) * (F -32)\n (5 * (temp - 32))/9\n else\n puts \"...
[ { "docid": "ac1dd548a003601a870271760230b73f", "score": "0.8214045", "text": "def ctof temperature_input\n\tcelsius = 0\n\tcelsius = temperature_input * (9.0/5.0) + 32\n\treturn celsius\nend", "title": "" }, { "docid": "4fba9af264bd797f5ff8e5ce5b6bf835", "score": "0.8052241", "text":...
12838c797312dd4b1800ba2f7c5d824b
GET /approvals GET /approvals.json
[ { "docid": "acf93fd9445c5fcfbd1acb4f96e142b5", "score": "0.54643035", "text": "def index\n if current_user.is?(:general_manager)\n @expenses = Expense.waiting_general_manager_approval\n @expenses += Expense.waiting_manager_approval.find_all_by_organization_id current_user.under_organization...
[ { "docid": "e23dd97b3b9bcc8cd1350816b283ea1a", "score": "0.7358646", "text": "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approvals }\n end\n end", "title": "" }, { "docid": "2d0072e97258...
47ce5a61cbff008e18403f9929404b75
GET /qc_globals/new GET /qc_globals/new.json
[ { "docid": "e27e8d43e1f04942359dceab3250ccb3", "score": "0.7201673", "text": "def new\n @qc_global = QcGlobal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qc_global }\n end\n end", "title": "" } ]
[ { "docid": "5bb7ab7adb54a3e3a0aae4b4843e14c1", "score": "0.6692675", "text": "def create\n @qc_global = QcGlobal.new(params[:qc_global])\n\n respond_to do |format|\n if @qc_global.save\n format.html { redirect_to @qc_global, notice: 'Qc global was successfully created.' }\n form...
26f79f90a508672d20fe2a0e090c80dd
Read DHCP relay configuration Read DHCP relay configuration
[ { "docid": "8cfcf9c9c6860343db1073773d580e5a", "score": "0.65707237", "text": "def read_dhcp_relay_config_0(dhcp_relay_config_id, opts = {})\n data, _status_code, _headers = read_dhcp_relay_config_0_with_http_info(dhcp_relay_config_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "6d54137b03da41fb25b54e4d9070b57d", "score": "0.6513596", "text": "def read_dhcp_relay_config_with_http_info(dhcp_relay_config_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPRelayConfigsApi.read_...
db124336dcaedb84853956f6087dce64
deals initial hand of cards, player first
[ { "docid": "1160e79fc7b4afdfd8b647be6013e7a7", "score": "0.75710315", "text": "def deal_initial_hands\n @current_player_turn = @player\n deal_card\n @current_player_turn = @dealer\n deal_card\n @current_player_turn = @player\n deal_card\n @current_player_turn = @dealer\n deal_car...
[ { "docid": "c898cc85941e8994fb6060b259d3727b", "score": "0.77579", "text": "def initial_cards\n\tsystem('cls')\n\tsystem('clear')\n\n\tputs 'Dealer ' + @dealer.name + ':'\n\tputs 'The dealer has ' + @dealer.cards\n\tputs 'which add up to ' + @dealer.score.to_s + ' points'\n\tputs\n\tputs 'Players:'\n\n\...
ec3f4363a8bca1125172ca69971380e9
perform the download test
[ { "docid": "56d8e043c63d71560d5f2a0b22708cf3", "score": "0.7720601", "text": "def download_test\n # need to ensure our file that we will be downloading is placed on s3\n upload_one\n\n iterations = @test.iterations\n for i in 1..iterations\n download_one\n end...
[ { "docid": "3b4f9fb641a008a03bd7ac86392c6dbb", "score": "0.71993417", "text": "def download_test(url)\r\n before = Dir['*']\r\n assert system(\"ruby bin/viddl-rb #{url} -e\")\r\n new_files = Dir['*'] - before\r\n assert_equal new_files.size, 2\r\n assert File.size(new_files[0]) > 100000\r...
e5b2f01d44ac56d44c1684cdbdc290d4
Get a unique HTML hex color for a particular string
[ { "docid": "2e50f771b4a812fbee0e43a3bbb90846", "score": "0.7827836", "text": "def uniq_color(string)\n \"#\" + Digest::SHA1.hexdigest(string)[0..5]\n end", "title": "" } ]
[ { "docid": "10e74dc37d11ba0795b5d39734f25924", "score": "0.7278106", "text": "def tag_color_name( _input )\n colors = [\n \"primary\",\n \"success\",\n \"info\",\n \"warning\",\n \"danger\",\n ]\n hash = Digest::MD5.hexdigest _input\n color_i...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "aa58b8172e4c621730a5e791504a62d7", "score": "0.0", "text": "def key_for_min_value(name_hash)\n minkey, minvalue = name_hash.first\n name_hash.each do |key,value|\n if minvalue > value\n minvalue = value\n minkey = key\n end\n end\n minkey\nend"...
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8880233", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend...
8095f7b1117ec3b3923057c2d8d76a31
just show our stuff .
[ { "docid": "1bfb4aa9ce16356fc40bfcc33f6b64b0", "score": "0.0", "text": "def puts_stacktrace(exception)\n logger.debug \"\\033[1m\\033[32m#{exception.message}\\033[0m\\033[22m\"\n filtered_trace = exception.backtrace.grep(/#{Regexp.escape(\"nilavu\")}/)\n unless filtered_trace.empty?\n full...
[ { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.81558985", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.81558985", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", ...
8ee72932ef69df11e88b53564d853e59
Returns the object in the form of hash
[ { "docid": "95c858e7a5ecae6053e5d9552a1057a6", "score": "0.0", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !...
[ { "docid": "027facb8b195665ceeb78f2c171e2881", "score": "0.8270299", "text": "def to_hash\n object\n end", "title": "" }, { "docid": "d730a9ea60df6695b2c6a153d7d3a8b7", "score": "0.794916", "text": "def hash\n as_hash.hash\n end", "title": "" }, { "docid":...
364dc2b2b2745f35e175abfe8e3caa46
TODO: how necessary is this ? The actioncontroller response overwrites these headers even when set in the controller
[ { "docid": "ae10caacf319010739153efa64cb93bd", "score": "0.0", "text": "def assert_headers\n assert_response :success\n assert_equal 'no-cache', @response.headers['Cache-control']\n assert_equal 'no-cache', @response.headers['Pragma']\n assert_equal '-1', @response.headers['Expires']\n end"...
[ { "docid": "66354986b497267f09e6e0987b17e3da", "score": "0.80149126", "text": "def headers\n { 'Status' => ActionController::Base::DEFAULT_RENDER_STATUS_CODE }\n end", "title": "" }, { "docid": "a1555ce8ef44fcc6feb58a8f128cf604", "score": "0.7333956", "text": "def add_headers; en...
7bbcee7dd99db7a8de614c9e1c5a87e9
ACTORS Actors index page methods
[ { "docid": "fa311a69e423682bc23ea9651fd5b50f", "score": "0.0", "text": "def get_all_actors\n query = %Q{\n SELECT * FROM actors\n ORDER BY name\n }\n\n results = db_connection do |conn|\n conn.exec(query)\n end\n\n results.to_a\nend", "title": "" } ]
[ { "docid": "75cbee6aef5b146ac9cb5a1fec01024d", "score": "0.81326115", "text": "def index; end", "title": "" }, { "docid": "75cbee6aef5b146ac9cb5a1fec01024d", "score": "0.81319374", "text": "def index; end", "title": "" }, { "docid": "75cbee6aef5b146ac9cb5a1fec01024d", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3f163c4fc6ed8154b572857efb575191", "score": "0.0", "text": "def set_item\n @item = Item.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
f5eec424bfed1a1f46e19c7dd1681f80
, SystemExit] Evaluate the step's matchers and code sample, wrapped in a beginrescue clause.
[ { "docid": "58bf7e46f83cf786d48d8dc159a477ad", "score": "0.6951108", "text": "def evaluate_test(step)\n advise!(:before_test, step)\n begin\n advise!(:test, step) # name ?\n evaluate_matchers(step)\n evaluate_example(step)\n rescue *FORCED_EXCEPTIONS\n raise\n...
[ { "docid": "69a58a4ddaf66e114726a8de15c6ba11", "score": "0.70393604", "text": "def test_parse_sample_does_not_executes_ruby_code\n begin\n ADL::parse_sample <<-AUTOMATON\n + Kernel.exit(-1)\n AUTOMATON\n rescue SystemExit\n assert false, 'SECURITY issue: ADL::parse_...
7171c9e3434ffd94126fe399c09f85cb
returns true if the event hasn't been processed yet
[ { "docid": "5bdfcf7653b16a900d67344aace74473", "score": "0.0", "text": "def is_new_event(log_event) \n # we've seen no records at all\n if @min_time.nil?\n return true\n # the record is too old\n elsif log_event.timestamp < @min_time \n return fals...
[ { "docid": "9dcb1a1bef5acc4f3fca98a906040981", "score": "0.8172716", "text": "def processed?\n !processed_events(event_id: id).empty?\n end", "title": "" }, { "docid": "972d086adba8597899f9cd9c0ca90a53", "score": "0.7619342", "text": "def has_queued_events?\n !@pro...
99f212f1dd95dd2399dbd4cb31041f64
GET /unidade_metricas/new GET /unidade_metricas/new.json
[ { "docid": "5b7c480e5e1ffee083c38f59b1e48cf2", "score": "0.81755483", "text": "def new\n @unidade_metrica = UnidadeMetrica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unidade_metrica }\n end\n end", "title": "" } ]
[ { "docid": "658af3f60fb6960e238269e39c448fd1", "score": "0.7824018", "text": "def create\n @unidade_metrica = UnidadeMetrica.new(params[:unidade_metrica])\n\n respond_to do |format|\n if @unidade_metrica.save\n format.html { redirect_to unidade_metricas_url }\n format.json { hea...
c53b5d51241d834bc7e700da31a72ede
takes in an array of strings returns an array containing the lengths of the strings
[ { "docid": "45e50de3581a5c4066fe9f312860229a", "score": "0.87152183", "text": "def string_lengths(arr)\n arr.map { |e| e.length }\nend", "title": "" } ]
[ { "docid": "57a5aef7fe9d236a90ed005af2573ec0", "score": "0.871156", "text": "def string_lengths array_of_strings\n array_of_strings.map {|str| str.length}\nend", "title": "" }, { "docid": "a36dbf91834f1754166d71adf4335416", "score": "0.8643753", "text": "def lengths(arrayOfStrings)\...
60c275fff7f28b592eef756079c9aca3
calculates speed_of_spread of the virus by population_density and state
[ { "docid": "b11cfeab9ed57ff580f658ed78c318f1", "score": "0.0", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n \r\n # if @population_density >= 200\r...
[ { "docid": "fe84e0d4db69a8048879b2ca98cf12a3", "score": "0.8656676", "text": "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n ...
7cfab927e34566212a75504541bc3125
Private: => Return an absolute path and load the name of the current script => Return the whole content of the 'text.txt' file
[ { "docid": "17ecaa795455fffcd1c24b85397a4343", "score": "0.7467445", "text": "def open_file\n File.open(File.dirname(__FILE__) + '/../text.txt')\n end", "title": "" } ]
[ { "docid": "eb8693e718f472779f1c25b727373db8", "score": "0.7464319", "text": "def get_text(path_to_file)\n File.read(path_to_file)\nend", "title": "" }, { "docid": "25e7f6173696a5172beae37104caa8d8", "score": "0.7359105", "text": "def text\n File.read(@path)\n end", "tit...
08d1a0a5ab42ca5727391d88ea2e191a
Checks if the url is valid.
[ { "docid": "e885be6ea716f161969f070d8a55a82c", "score": "0.7673592", "text": "def valid?(url)\n return true if url =~ /\\A#{URI::regexp}\\z/\n false\n end", "title": "" } ]
[ { "docid": "7b1d4cadbb9796724d63f4b74a07f748", "score": "0.86881137", "text": "def valid?\n HDIUtil.validate @url\n end", "title": "" }, { "docid": "7114fc597c2fc7a5a8531fb8ace8a147", "score": "0.8668224", "text": "def valid_url\n if self.url.present? && !URI.parse(self.ur...
0ed19bb4854b1469855145c1da1e3db1
show contacts from uptimerobot
[ { "docid": "5adb02007cbcd29c46cdcb5c83cfed84", "score": "0.0", "text": "def contacts\n payload = @common_payload.clone\n @log.debug(\"contacts payload: #{JSON.pretty_generate(payload)}\")\n response = @site['getAlertContacts'].get :params => payload, :accept => :json\n result = parse_respons...
[ { "docid": "577d0259380dce131d7a781813c0440c", "score": "0.6704925", "text": "def display_contacts(contacts)\n contacts.each do | contact |\n puts \"ID #{contact.id} #{contact.full_name} #{contact.email} #{contact.note}\"\n end\n end", "title": "" }, { "docid": "e5af7589242...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f171c565c2fbd29fd9e65f692407405e", "score": "0.0", "text": "def sub_category_type_params\n params.require(:sub_category_type).permit(:name, :sub_category_id)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980384", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782743", "text": "def strong_params\n params.requi...
13567753eeb144557c4ceae97dc62077
If this is a preflight OPTIONS request, then shortcircuit the request, return only the necessary headers and return an empty text/plain.
[ { "docid": "f6f729e61c76c280cc267d936ad4b27f", "score": "0.72894865", "text": "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Header...
[ { "docid": "c01beb23714dd89b52bf69d8ac226e17", "score": "0.7613599", "text": "def handle_options\n head(:ok) if request.request_method == \"OPTIONS\"\n end", "title": "" }, { "docid": "a1551a2cb6679b07269ec79c28d2ee03", "score": "0.74682564", "text": "def cors_preflight_check\n ...
bab7a9d94b9dd485cdf6c48041bee4ac
POST /worker_messages POST /worker_messages.json
[ { "docid": "96a5808a891b4d8928e3f04cc99f50fe", "score": "0.7324479", "text": "def create\n @worker_message = WorkerMessage.new(worker_message_params)\n\n respond_to do |format|\n if @worker_message.save\n format.html { redirect_to @worker_message, notice: 'Worker message was successful...
[ { "docid": "0af739bb1ba00513271a3442811e5907", "score": "0.61957544", "text": "def create\n MailerWorker.perform_async(message_params)\n flash[:notice] = \"Message sent! Thank you for contacting us.\"\n redirect_to root_url\n end", "title": "" }, { "docid": "11770f040afa29b1508d897...
b4cbcb1b21070644630cd39fc84b3097
delegate :errors?, :fatal_errors?, :dropped_errors?, :recovered_errors?, :to => :process_errors Since I don't have rails delegate...
[ { "docid": "a660aa13ecd86b1654b4bc078b483574", "score": "0.60689104", "text": "def errors?\n process_errors.errors?\n end", "title": "" } ]
[ { "docid": "17cab097417308d9b60d71065eb8bd33", "score": "0.6236275", "text": "def delegate_errors\n errors[:start_at].each { |e| errors.add(:start_date, e) } if errors.include?(:start_at)\n errors[:end_at].each { |e| errors.add(:end_date, e) } if errors.include?(:end_at)\n place.errors.full_mes...
9703db7cb6730a78e66058b6482c54b2
GET /strategies/new GET /strategies/new.xml
[ { "docid": "7ecd712e57189f83b1d9ac9a5dcd0673", "score": "0.6557062", "text": "def new\n @skill = Skill.find(params[:skill_id])\n @strategy = Strategy.new\n @strategy.label = @skill.strategies.collect(&:label).last.next unless @skill.strategies.empty?\n @strategy.label ||= '1'\n\n respond_...
[ { "docid": "24ed5485212806f27cbaae3abce70658", "score": "0.7591988", "text": "def new\n @strategy = Strategy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @strategy }\n end\n end", "title": "" }, { "docid": "75b1e9f201347641ede...
4e3b676979fdf65f2fee89877ce04355
Returns a new TableWrapper object which can be used to execute a select statement for the table with the specified filter conditions. If a block is given, executes the select statement and yields each row to the block.
[ { "docid": "0a5f0ba923512ee0ea154e8c001dff5b", "score": "0.54108936", "text": "def where *conditions, &block\n raise ArgumentError.new(\"Wrong number of arguments\") if conditions.empty?\n\n obj = self.dup\n obj.instance_variable_set :@query_where, @query_where + conditions\n ret obj, &block...
[ { "docid": "ddd835bc2286ea9bd71965538864146d", "score": "0.64752424", "text": "def prepare_query (&block)\n\n q = TableQuery.new(self)\n block.call(q) if block\n\n q\n end", "title": "" }, { "docid": "4da952b4abdb0aeab656ab6f57bbaef2", "score": "0.6415717", "text": ...
bccd59721e9a951925f1c0fa4fe41353
checks whether the user has selected one of the menu item's keys user_input String of the user's input returns boolean of whether the user response is in one of the menu item's keys
[ { "docid": "8725766cb4ff783d0d59dbfecf038557", "score": "0.79267853", "text": "def user_response_in_menu?(user_input)\n all_item_responses.include?(user_input)\n end", "title": "" } ]
[ { "docid": "57a235915facdd8806ca21129de1e241", "score": "0.7668352", "text": "def menu_input(input)\n input.upcase == \"P\" || input.upcase == \"Q\"\n end", "title": "" }, { "docid": "cab5bb0fcebc6d5676a88e0855096d8b", "score": "0.7503874", "text": "def inputcheck_menu(input)\r\n...
772e6c83813211575c7b3c34590a5928
Disegna la grafica del nemico
[ { "docid": "8eb6433d1ab266936bba18b379332ebc", "score": "0.0", "text": "def draw_enemy_graphic(x, y, width, height)\n contents.fill_rect(x, y, width, height, sc2)\n contents.fill_rect(x + 2, y + 2, width - 4, height - 4, sc1)\n battler_bitmap = Cache.battler(enemy.battler_name, enemy.battler_hu...
[ { "docid": "3099942e9264fe15b1ed124fb6b96b9e", "score": "0.6690345", "text": "def graficas\n end", "title": "" }, { "docid": "6d9b5323cf15bd7b9a2474bb24ecc3e2", "score": "0.66157925", "text": "def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\te...
c52183f52648bc859cf7ad542d5f040d
Shorthand for the cmis:name of an object
[ { "docid": "1aa7a58e292a14b720503d2e2a661e65", "score": "0.74856585", "text": "def name\n attribute('cmis:name')\n end", "title": "" } ]
[ { "docid": "34fd22007abb556b4a5ac72410e08abb", "score": "0.73133427", "text": "def name\n @object.to_s\n end", "title": "" }, { "docid": "4c74b6705b57e3a35cabc19cd82758d3", "score": "0.72159624", "text": "def object_name; end", "title": "" }, { "docid": "4c74b6705...
0f1a45217e230604766a9894580b000f
6 =begin The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed. To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croque...
[ { "docid": "a65776b5c0600c1898fb3f919d49c8fb", "score": "0.69039184", "text": "def openOrSenior(data)\n list = []\n data.each do |member|\n if member.first >= 55 && member.last > 7\n list << \"Senior\"\n else\n list << \"Open\"\n end\n end\n list\nend", "title": "" ...
[ { "docid": "e16b1a4a6fe313e998bc1805389d4dfe", "score": "0.7306203", "text": "def openOrSenior(data)\n membership_type = []\n\n data.each do |member|\n age = member[0]\n handicap = member[1]\n\n if age >= 55 && handicap > 7\n membership_type << \"Senior\"\n else\n membership_type...
8ed00556d4122e3eccfd9b5389522ebd
PUT /users/1 PUT /users/1.json
[ { "docid": "f04affb2b638f85774491902e90c7f3c", "score": "0.0", "text": "def update\n @user = User.find(params[:id])\n params[:user][:ip] = request.remote_ip\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was succ...
[ { "docid": "b5edb8a9b2cad14c7874c5f42c5809e9", "score": "0.7438286", "text": "def test_put_user\n json_data = '{\"name\":\"test\", \"last_name\":\"test\", \"document\" : \"098\"}'\n put '/users/4', json_data\n assert_equal 204, last_response.status, 'Código de respuesta incorrecto'\n end", ...
54687eedc4672a19455c87685a59c1cc
GET /budget_items/new GET /budget_items/new.xml
[ { "docid": "75c92bdfb067a6a6ded66c42ad82bbd1", "score": "0.79936993", "text": "def new\n @budget_item = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @budget_item }\n end\n end", "title": "" } ]
[ { "docid": "21010d5f0de01c7d2f84f94603c35fa7", "score": "0.7531278", "text": "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @budget }\n end\n end", "title": "" }, { "docid": "09c985f7893d271b20e2c823f...
5a2e4d139ba71ef9f1638ec4db54c113
We'll also write a method to return the column names except id: method called count, that returns a count of records in a table. Here's where we'll start to build the connection between Ruby and SQL
[ { "docid": "f3be24dcdb567ec22691f72635bdff70", "score": "0.6152776", "text": "def count \n connection.execute(<<-SQL)[0][0]\n SELECT COUNT(*) FROM #{table}\n SQL\n end", "title": "" } ]
[ { "docid": "07d8dec4236b1ed8ff1581247e57435b", "score": "0.7044325", "text": "def get_column_names db, table\n columns, *rows = db.execute2(\" select * from #{table} limit 1; \")\n return columns\nend", "title": "" }, { "docid": "104cd7bdb91a47e8650b50614d9db685", "score": "0.6830703",...
21d4940f16ee019a6c010ace8f74a5b4
REMOVE GUESTS FROM WAITING LIST
[ { "docid": "f2b6818021e0b6ca48f53a934a517f45", "score": "0.6534042", "text": "def test_remove_guess_from_waiting_list\n @room5.remove_guest_from_waiting_list(@guest15)\n assert_equal(0, @room5.waitinglist().count())\n end", "title": "" } ]
[ { "docid": "6af412551007fcd44d7737daf0fc3df2", "score": "0.70423967", "text": "def leave_waitlist\n @@floor_semaphore.synchronize {\n old_occupant_count = @occupants.length\n old_waitlist_count = @waitlist.length\n @waitlist.delete_if { |passenger| yield(passenger) }\n msg \"occup...
b2428fc11e302d426900984d8fb40d23
Convert a hash to a querystring for form population is used
[ { "docid": "9a5dbd67cb7a5801101db55414d8ca9d", "score": "0.8139014", "text": "def hash_to_query_string(hash)\n hash.delete 'password'\n hash.delete 'password_confirmation'\n hash.collect { |k, v| \"#{k}=#{v}\" }.join('&')\n end", "title": "" } ]
[ { "docid": "e2bc3cee47e4d2af3d7e9f08319827a7", "score": "0.81887835", "text": "def hash_to_query_string(hash)\n hash.delete \"password\"\n hash.delete \"password_confirmation\"\n hash.collect {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end", "title": "" }, { "docid": "ae5f93b9c8909ac459285...
a9076691a13e6678ce1ea8b58ec3e7eb
Get the coverage file to save all coverage data. Creates `tmp/coverage` if not exists.
[ { "docid": "53b173b9d3f696ee8e17e8ae24a9c442", "score": "0.75081664", "text": "def coverage_file\n File.join(coverage_root, 'coverage.json')\n end", "title": "" } ]
[ { "docid": "e4e996d5a53ceb14f595a9ead8a62b97", "score": "0.74401253", "text": "def coverage_path\n @coverage_path ||= begin\n coverage_path = File.expand_path(coverage_dir, root)\n FileUtils.mkdir_p coverage_path\n coverage_path\n end\n end", "title": "" }, { ...
f6d1c00ae096158d1e4845d6da5b3e9f
GET /simple_question_alternatives GET /simple_question_alternatives.json
[ { "docid": "142edf04f3a580dd2b52e85ec97dd63b", "score": "0.8176196", "text": "def index\n render status: :ok, json: @simple_question_alternatives\n end", "title": "" } ]
[ { "docid": "9e7abf54bb7a059775b1dfbec4bc8251", "score": "0.71048266", "text": "def show\n render status: :ok, json: @simple_question_alternative\n end", "title": "" }, { "docid": "f708c7880c8f75d31c6421062d3a93ac", "score": "0.7004162", "text": "def index\n render ...
19ee844e2bc73479c5e86000fcfea170
validate the supplied token
[ { "docid": "d8d3917a077307fae10bacb6792e9c32", "score": "0.7068927", "text": "def token_valid?( token )\n\n if @@secret.nil?\n @@secret = get_secret\n end\n\n begin\n JWT.decode token, @@secret, true, { algorithm: 'HS256' }\n return true\n rescue JWT::DecodeError\n puts...
[ { "docid": "2245afa33cfe7d86c0deff4c81a940dc", "score": "0.80487347", "text": "def validate_token_checked\n # check the key being passed in, or give an error message\n end", "title": "" }, { "docid": "03394f5cbcf5b5f45e8f4b6e4ace6f20", "score": "0.79952526", "text": "def valid_to...
902ffdfb22cdf7188002d7d4f738818e
Returns parent node's deptid
[ { "docid": "0f24c47b7eef187885218280c6449aca", "score": "0.7578878", "text": "def parent_deptid\n @parent_deptid ||= parent_deptids.last\n end", "title": "" } ]
[ { "docid": "3cfce9c1eaf2c09d5f4808a23c58d6bb", "score": "0.7518368", "text": "def parent_node\n return nil if parent_deptids.size == 0\n @parent_node ||= UCB::LDAP::Org.find_by_ou(parent_deptid)\n end", "title": "" }, { "docid": "fe044ad41f9914c78f1090ef5ec88c6a", "sco...
55551591510b1f7ac37331ff27d6c20c
Run this when monster recieves damage from player
[ { "docid": "798a3156874a13e5486b874a2a3e7dcf", "score": "0.7223345", "text": "def monster_take_damage(damage)\n @current_monster.hp -= damage\n if @current_monster.hp <= 0\n monster_death\n end\n end", "title": "" } ]
[ { "docid": "7f2a04c96425ea23fa57a9ec069e014c", "score": "0.73189414", "text": "def player_take_damage(monster_damage)\n @current_player.current_hp -= monster_damage\n if @current_player.current_hp <= 0\n player_death\n end\n end", "title": "" }, { "docid": "3464cc190...
a489f2cdbbc4896cda9cd209e1d3a639
placeholder for licode owner token
[ { "docid": "f7573815fa9c4f6018cf171e8bab370d", "score": "0.82165444", "text": "def owner_token\n end", "title": "" } ]
[ { "docid": "ccc5e4a17941855f15a238383da51c56", "score": "0.6642546", "text": "def token_secret=(_arg0); end", "title": "" }, { "docid": "ccc5e4a17941855f15a238383da51c56", "score": "0.6642546", "text": "def token_secret=(_arg0); end", "title": "" }, { "docid": "ccc5e4a179...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0f23fe0765079bdf7e683ba26b715bcd", "score": "0.0", "text": "def vehicletype_params\n params.require(:vehicletype).permit(:vtype, :vdescription, :image, :passnum, :bagagenum)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
8ee7701c977d84bbbe6884621437ba58
The default path for this installation's run directory.
[ { "docid": "39616d70caa0f66cb1bcb803bae58a98", "score": "0.6848772", "text": "def default_directory\n haproxy_name_path('/var/lib/%{name}')\n end", "title": "" } ]
[ { "docid": "3e47b74d061f7751ba8ee1f88804c492", "score": "0.7847608", "text": "def default_dir\n File.join(File.dirname(__FILE__), 'defaults')\n end", "title": "" }, { "docid": "19e03e9ef9d35d8750589239e345f127", "score": "0.77161664", "text": "def default_directory\n ...
af1efaa1128367e8887929a7f562bfbf
Coursera problem 2.6 convolution spectrum
[ { "docid": "1e3858ddd7ffc0126b764a3bf476e1dc", "score": "0.78121537", "text": "def spectral_convolution spectrum\n i = 0\n conv = []\n while i < spectrum.length - 1 do\n j = i + 1\n while j < spectrum.length do\n conv << (spectrum[i] - spectrum[j]).abs\n j += 1\n end\n i += 1\n ...
[ { "docid": "cbfba2af6eeafaa497928285fc2875d2", "score": "0.70878655", "text": "def convolution_debug(spectrum)\n spectrum.map!(&:to_i).sort!\n n = spectrum.length\n # n x n array for differences\n convolution = Array.new(n) { Array.new(n, nil) }\n\n (0...spectrum.lengt...
5aef7182fcfc5abcf96cc9bfb61d23eb
POST /facebook_users POST /facebook_users.json
[ { "docid": "084081776380ef06272b6afaf5f80e8b", "score": "0.7200736", "text": "def create\n @facebook_user = FacebookUser.new(params[:facebook_user])\n\n respond_to do |format|\n if @facebook_user.save\n format.html { redirect_to @facebook_user, notice: 'Facebook user was successfully c...
[ { "docid": "66d8675e87fb925ec7d194638e73f361", "score": "0.7491079", "text": "def create\n @user = User.new(@fb_params||user_params)\n\n if @user.save\n render json: @user, :except => [:password_digest, :facebook_id], status: :created\n else\n render json: @user.errors, status...
d2f70290b0949de174a115e8f2d0cfc0
Problem 23 Extract a given number of randomly selected elements from a list.
[ { "docid": "15551904c86c26164d97f08b52d8e6df", "score": "0.74273086", "text": "def rnd_select( list, n )\n list.sort_by { rand }[ 0...n ]\nend", "title": "" } ]
[ { "docid": "c0e0af9962211f15b5b26e11f7c00b8d", "score": "0.78174025", "text": "def list_select(list, cnt=5)\n nl = []\n cnt.times do\n rn = rand_num(list.length - 1)\n nl.push list[rn]\n end\n return nl\n end", "title": "" }, { "docid": "e1618e1819ad7abc2b5025ddf9b2833...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.0", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163443", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.604317", "text": "def action_hook; ...
d5cf9dcf17f8f4f2395b8a81c0eea0e1
PATCH/PUT /filmes/1 PATCH/PUT /filmes/1.json
[ { "docid": "a4a79c68489dd92cc9580ed4fe37c331", "score": "0.70393157", "text": "def update\n respond_to do |format|\n if @filme.update(filme_params)\n format.html { redirect_to @filme, notice: 'Filme was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ { "docid": "fa3f5abbf4a1646a947fb243bae9ec6e", "score": "0.71679187", "text": "def update\n @filme = resource_params\n if @filme.save\n render json: @filme\n else\n render json: @filme.errors, status: :unprocessable_entity \n end\n end", "title": "" }, { "docid": "bd1...
ef7381e7bffb1b937bf10370e8af5b74
GET /folha/folhas/new GET /folha/folhas/new.xml
[ { "docid": "20e4682f8adc805da38582471cdd54da", "score": "0.74017054", "text": "def new\n @folha_folha = Folha::Folha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @folha_folha }\n end\n end", "title": "" } ]
[ { "docid": "09659b5e0a0b570d5c8019b81ae00efa", "score": "0.72037786", "text": "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "title": "" }, { "docid": "a324dc8994a072232fc8c297fcdf05...
f790bf9ec65d31b09ad1bcdde74ff4bd
Returns true if the user logged in likes the current list
[ { "docid": "5e40a994ae68438e8e26102d651a6935", "score": "0.86136574", "text": "def user_likes_list?\n Like.exists?(:user_id => current_user, :list_id => @list)\n end", "title": "" } ]
[ { "docid": "51961393560d0bce43ca1a0fc9b6ceb7", "score": "0.8008556", "text": "def already_liked_by?(current_user)\n return false unless current_user\n self.likes.where(:user_id => current_user.id).count > 0\n end", "title": "" }, { "docid": "a0f7b01c4da7ea68c1281b5f10eaddd4", "sco...
212be15bfce9a8693cc28eabd03afe55
Add an item to this page. Returns The number if items that did not fit in the page.
[ { "docid": "f057f6910218ec01de9db0fe7750da20", "score": "0.689098", "text": "def add(raw_item)\n item = raw_item.to_s\n fail \"Item too large to fit.\" unless item.length < @page_width\n\n if (column = find_next_column)\n @page_data[column] << item\n else\n @page_data <...
[ { "docid": "937b53c3c6a62adf29572fff951a2cde", "score": "0.69770604", "text": "def add_item(item, count = 1)\n return @bag.add_item(item, count)\n end", "title": "" }, { "docid": "acd00af0602a8b63bcabdb41b9f1621c", "score": "0.69271016", "text": "def add(raw_item)\n item = raw...
47a9561cd27a968563957683c39f3390
Yields chunks of request data that should be sent to the socket. It's important to send the request in a single write call when possible in order to play nicely with Nagle's algorithm. Making two writes in a row triggers a pathological case where Nagle is expecting a third write that never happens.
[ { "docid": "456fa302ac35efabc4937a9df50846aa", "score": "0.470103", "text": "def each_chunk; end", "title": "" } ]
[ { "docid": "a5d95a5cc83220e8780df4f5f46a1ef1", "score": "0.61388344", "text": "def send_chunk(request, chunk, done: false)\n data = +''\n data << \"#{chunk.bytesize.to_s(16)}\\r\\n#{chunk}\\r\\n\" if chunk\n data << \"0\\r\\n\\r\\n\" if done\n return if data.empty?\n\n request.t...
a7b51891b97e32f731a3ac4d40da7ed3
Takes an optional array of values to request (default to all known values) Yields a provided block a commaseparated string corresponding to the requested values NOTE: Currently no way to end streaming
[ { "docid": "a37c2e8995822d9aeb8dbd8e6c54e745", "score": "0.56159055", "text": "def stream(values = ['speed', 'odometer', 'soc', 'elevation', 'est_heading', 'est_lat', 'est_lng', 'power', 'shift_state'])\n valuesString = values.join(',')\n\n streamUri = URI.parse \"#{StreamUrl}#{@vid}/?values=#{val...
[ { "docid": "0a1e221059d573c428869d01f7445bdd", "score": "0.61531246", "text": "def each\n if @value\n @value.each {|chunk| yield chunk }\n else\n @value = []\n @request.body {|chunk| @value << chunk; yield chunk }\n end\n end", "titl...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ae3a468b8fdbd8251cb8dd36d0238ccd", "score": "0.0", "text": "def set_admin_news\n @admin_news = Admin::News.find(params[:id])\n @commonplace_id = @admin_news.commonplace.id\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
164f7fae7317a310317dd2a054d536f6
DELETE /enabled_players/1 DELETE /enabled_players/1.json
[ { "docid": "1fc7bc82a2c017a077638311a9f182ea", "score": "0.7604207", "text": "def destroy\n @enabled_player.destroy\n respond_to do |format|\n format.html { redirect_to enabled_players_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "221858579afa4f11746f587f4bfaf259", "score": "0.7401634", "text": "def delete\n\n thePlayer = Player.find(@player_id)\n render :json => thePlayer.destroy, :except => [:password_digest]\n\n end", "title": "" }, { "docid": "547cec22ab8674e1291f9fee4e98454e", "score": "0.7...
15ec7ae026260b7447a5a1be32a46111
New form for the instance to be created
[ { "docid": "785ca7af6bc64e08d1478854d1e7c46e", "score": "0.0", "text": "def new\n @instance = Instance.new\n end", "title": "" } ]
[ { "docid": "20d9b617c1504c04c0b4665fd65cb4a6", "score": "0.8069874", "text": "def new\n @form = Form.new\n end", "title": "" }, { "docid": "793b0cd50d331b3fe80f61f290a02b8e", "score": "0.7721113", "text": "def new\n # TODO prepare the form if necessary\n\n\n\n end", "titl...
bf623d831b4376ab593c4f5d66cdf3ea
GET /snippets GET /snippets.json
[ { "docid": "4b7b812744caee3101870c292eb84842", "score": "0.5946518", "text": "def index\n @search = Snippet.search(params[:q])\n snippets = @search.result\n @snippets = snippets.paginate(:page => params[:page])\n end", "title": "" } ]
[ { "docid": "720614fed9c6791ca62c0539df884d79", "score": "0.77203226", "text": "def index\n @snippets = current_user.snippets.all\n\n respond_to do |format|\n format.html # _index.html.erb\n format.json { render json: @snippets }\n end\n end", "title": "" }, { "docid": "0f...
160f360a3e2ffb1b03fe95b14fbeffa7
DELETE /calendario_no_laborables/1 DELETE /calendario_no_laborables/1.json
[ { "docid": "83616118af9b8ad8cbcd6b81a9bc12f7", "score": "0.7769184", "text": "def destroy\n @calendario_no_laborable.destroy\n respond_to do |format|\n format.html { redirect_to calendario_no_laborables_url, notice: 'Fecha No Laborable se elimino exitosamente.' }\n format.json { head :no...
[ { "docid": "362eded073863812726ec04d9a700bf2", "score": "0.7125618", "text": "def destroy\n @laboratorio = Laboratorio.find(params[:id])\n @laboratorio.destroy\n\n respond_to do |format|\n addlog(\"Laboratório excluído\")\n format.html { redirect_to laboratorios_url }\n format.js...
96607f4150051f504f49c93b597b84aa
POST /hojavidas POST /hojavidas.json
[ { "docid": "a305a285df7bb932b5b8b87b6bffaab3", "score": "0.69128466", "text": "def create\n @hojavida = Hojavida.new(hojavida_params)\n\n respond_to do |format|\n if @hojavida.save\n format.html { redirect_to @hojavida, notice: 'Registro creado correctamente.' }\n format.json { ...
[ { "docid": "195b0f81c412fb8eb5f517427446f7bf", "score": "0.68229157", "text": "def create\n @jigyosho = Jigyosho.new(jigyosho_params)\n\n respond_to do |format|\n if @jigyosho.save\n format.html { redirect_to @jigyosho, notice: 'Jigyosho was successfully created.' }\n format.jso...