query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ef05acd77f03d697a182e4b5ae27a68a", "score": "0.0", "text": "def set_active_rental\n @rental = Rental.find_by(customer_id: rental_params[:customer_id], video_id: rental_params[:video_id], returned_on: nil)\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165094", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60450804", "text": "def action_hook...
38ec3b6dde1427a6af8553c852fffbfa
define TreeView_SetCheckState(hwndTV, hti, fCheck) TreeView_SetItemState(hwndTV, hti, INDEXTOSTATEIMAGEMASK((fCheck)?2:1), TVIS_STATEIMAGEMASK)
[ { "docid": "1b58b29f7a461d1de74e8d87743525b7", "score": "0.8927899", "text": "def TreeView_SetCheckState(hwndTV, hti, fCheck)\r\n TreeView_SetItemState(hwndTV, hti, INDEXTOSTATEIMAGEMASK(fCheck ? 2 : 1), TreeViewItemState[:STATEIMAGEMASK])\r\n end", "title": "" } ]
[ { "docid": "aa75282cbfbada2def1009f5e932f427", "score": "0.76279193", "text": "def ListView_SetCheckState(hwndLV, i, fCheck)\n ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK(fCheck ? 2 : 1), ListViewItemState[:STATEIMAGEMASK])\n end", "title": "" }, { "docid": "713e6dbdfc...
f39bf9c74e54a0e7a356046203f4f649
Check if user is admin if not redirect to home page
[ { "docid": "bb366743d27c123e0ec3da56c5a2cd5a", "score": "0.0", "text": "def check_for_admin\n \n user = User.find_by_id(session[:user_id])\n unless user.is_admin\n flash[:msg]=\"You are not adminstrator ?? , Are You ? Login as administrator .... to access it\"\n redirect_to_home\n ...
[ { "docid": "a43d3c27fd214255a647742a1e15f6a3", "score": "0.87784964", "text": "def admin_user\n\t\t\tredirect_to(root_url) unless is_admin?\n\t\tend", "title": "" }, { "docid": "9801aedb31583e60ee59cb4c634236b9", "score": "0.8776005", "text": "def check_if_admin\n redirect_to(ro...
f4c1d772806026098e38284fe396f008
Version v2 of routes
[ { "docid": "b0204999070f2cd6d8221ae38f8b86bf", "score": "0.0", "text": "def v2\n @v2 ||= V2.new self\n end", "title": "" } ]
[ { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.7788181", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.7788181", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", ...
eddbb3bfe793f4fe8e0cfd8f53de1fa0
GET /admin/admin_users/1 GET /admin/admin_users/1.json
[ { "docid": "014f506cac77f2b16237ba6827bffa16", "score": "0.73487616", "text": "def show\n @admin_admin_user = Admin::AdminUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_admin_user }\n end\n end", "title": "" }...
[ { "docid": "4152fb6556ae83f7cdd6c362f17ad9bf", "score": "0.7365619", "text": "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n ...
555dae3a008b54a60a0767e708d2b52f
Print an error message and exit immediately with exit errno 1
[ { "docid": "46860f22cc275ad5d3bbbbfa732415e7", "score": "0.7781118", "text": "def die(msg, errno=1)\n\t\terror(msg)\n\t\texit errno\n\tend", "title": "" } ]
[ { "docid": "fad522463b2c6ee6aaac80df44f931af", "score": "0.8105288", "text": "def exit_with_error(errno)\n puts 'ERROR'.colorize({ color: :white, background: :red })\n puts \"The program has abnormally terminated with status code #{errno}\".colorize({ color: :red })\n exit(errno)\nend", "title": ...
44add3967042261bbafc2d9589f4dee2
GET /favorites/1 GET /favorites/1.json
[ { "docid": "82eb120be28e65d5b57578beeb96918e", "score": "0.7373914", "text": "def show\n @favorite = Favorite.find(params[:id])\n respond_with(@favorite)\n end", "title": "" } ]
[ { "docid": "1d3a5fda5ab5778e7c46623e538cb679", "score": "0.7922183", "text": "def index\n if !current_user.favorites.blank?\n return current_user.favorites\n else\n render json: { errors: \"No favorites for current user\" }, status: :not_found\n end\n end", "title": "" }, { ...
ae4005bb9cd27e490855f5cbe7e9c54f
def send_membership_emails(user, cart) inform_management = Postman.create_inform_ben_membership(user, self, params[:credit_card], session[:health_approval], cart) inform_customer = Postman.create_inform_user_membership(user, self, params[:credit_card], session[:health_approval], cart) Postman.deliver(inform_management)...
[ { "docid": "482e5e1818125521c6bf8c3284532b71", "score": "0.0", "text": "def build_options(u, state = nil, zip = nil, city = nil, address1 = nil, address2 = nil)\n # this is my attempt at populating the options hash for the credit card\n {\n :email => u.email,\n :billing_address => {\n ...
[ { "docid": "69d7d8263c8c0a9e34571d8417543a3a", "score": "0.7081153", "text": "def send_cart_mail(user)\n \n mail to: user.email, subject: \"Cart\", from:'charlienoreply@gmail.com'\n end", "title": "" }, { "docid": "566cafab7a471721dad30f8755f45438", "score": "0.69020945", ...
1c89527088e0198c7c298b0f5930f461
t1 > t11 > t2, t1 > t12 > t2
[ { "docid": "0d361e40a05b64bd1ce15da232dce776", "score": "0.0", "text": "def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t...
[ { "docid": "a21af3e001dcffd9341e33ad433abf96", "score": "0.6347003", "text": "def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend", "title": "" }, { "docid": "61533ce3a1fdb6e76716cb7cbe478710", "score": "0.60509133", "text": "def temp(temp1, temp2)\n return ( temp1 < 0 && ...
f9973f87fa8ab7355e6d115597aefeb7
Scans an email body to determine which bits are quoted and which should be hidden. EmailReplyParser is used to split the comment into an Array of quoted or unquoted Blocks. Now, we loop through them and attempt to add tags around them so we can hide the hidden blocks, and style the quoted blocks differently. Since mult...
[ { "docid": "a0a753be2a11b55077a08ccf252e6490", "score": "0.6628049", "text": "def call\n found_hidden = nil\n paragraphs = EmailReplyParser.read(text.dup).fragments.map do |fragment|\n pieces = [escape_html(fragment.to_s.strip).gsub(/^\\s*(>|&gt;)/, '')]\n if fragment.quo...
[ { "docid": "ddaf2376904ffa5672540ca3ed790ba4", "score": "0.568543", "text": "def get_body_for_html_display\n text = self.body.strip\n self.remove_privacy_sensitive_things!(text)\n text = MySociety::Format.wrap_email_body_by_lines(text) # reparagraph and wrap it so is good preview of...
afb94e7545d8b08d37d1722caa0fdb65
Set the BGM position
[ { "docid": "255e48598fb1c90b9ae194e131ed45bc", "score": "0.751735", "text": "def bgm_position=(position)\n synchronize(@bgm_mutex) do\n @bgm_channel&.setPosition(position, FMOD::TIMEUNIT::PCM)\n end\n rescue StandardError\n log_error(\"bgm_position= : #{$!.message}\")\n end",...
[ { "docid": "e19a91be26aa48527f59e03c7cf4e75d", "score": "0.71010864", "text": "def bgm_position=(position)\n return if @bgm_sound.stopped?\n\n @bgm_sound.set_playing_offset(position / @bgm_sound.get_sample_rate.to_f)\n rescue StandardError\n log_error(\"bgm_position= : #{$!.message}\")...
1ff821c696acac8579382e6813d4d853
Escape equal signs in the extensions. Canonicalize newlines. LEEF spec leaves it up to us to choose \r or \n for newline. We choose \n as the default.
[ { "docid": "e59f8c53fc7da38f6b5dbdb183e96e2d", "score": "0.6647212", "text": "def sanitize_extension_val(value)\n output = \"\"\n\n value = value.to_s.gsub(/\\r\\n/, \"\\n\")\n\n value.each_char{|c|\n case c\n when \"\\\\\", \"=\"\n output += \"\\\\\" + c\n when \"\\n\", \...
[ { "docid": "2f213b39ba0521159a0dd56ba4074add", "score": "0.7237328", "text": "def escape_extension_value(val)\n escapes = {\n %r{=} => '\\=',\n %r{\\n} => ' ',\n %r{\\\\} => '\\\\'\n }\n escapes.reduce(val) do |memo,replace|\n memo=memo.gsub(*rep...
4c50de96f112dddac2f415c419fa0a84
an empty array accessible to all methods
[ { "docid": "c713a5367300fa2bcc98afa42df714f5", "score": "0.0", "text": "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to students.csv\"\n puts \"4. Load the list from students.csv\"\n puts \"9. Exit\" #to add more items\nend", "title":...
[ { "docid": "98ce7de31cb5fa948b0ef71cac8a0222", "score": "0.73341405", "text": "def array\n raise \"Not implemented\"\n end", "title": "" }, { "docid": "cf862ee5a12d195b7c191da90773b8cf", "score": "0.7154377", "text": "def another; return []; end", "title": "" }, { ...
b3af7be5c4eeca74c083cd007d2149a0
a list of all the Chrs linked through chr groups, perhaps should be moved to Text subclass as it doesn't make sense for all others
[ { "docid": "d2719709014adce12f85c71018514503", "score": "0.77482516", "text": "def chrs \n self.mapped_chr_groups.inject([]) {|sum, cg| sum << cg.chrs}.flatten # not unique, chrs can be in multiple chr groups\n end", "title": "" } ]
[ { "docid": "b282449e103e69efce57d65c4cdbaf21", "score": "0.567027", "text": "def groups\n if @groups then\n return @groups\n end\n\n @groups = (0...@numGroups).map do |n|\n start = 16 + n * 12\n startCharCode, endCharCode, startGlyphCode = @byt...
a8a6e593b382d5e547d0909e70aaea55
get the character at the given index the index starts at one, but may be negative to count from the end indexes out of range will raise an error the return "character" is an integer
[ { "docid": "5d8c37a0780986434babf3452f84c373", "score": "0.80215824", "text": "def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end", "title": "" } ]
[ { "docid": "a9d4fd0e5ffe2ffa28fb4ee7c7c2dfce", "score": "0.7840401", "text": "def get_character(full_string, index)\n full_string[index]\nend", "title": "" }, { "docid": "0135869c35f60a6724720e158ab13c6b", "score": "0.78140855", "text": "def character(index = nil)\n return ''...
e0a58d45ee57070e03f943febeb62ad6
AJAX: update more properties
[ { "docid": "ae418ce28e6429e92505d62bf2655151", "score": "0.0", "text": "def update_more\n style_setting = @survey.style_setting || {}\n style_setting['has_progress_bar'] = !!params[:has_progress_bar] if params.has_key?(:has_progress_bar)\n style_setting['has_question_number'] = !!params[:has_qu...
[ { "docid": "9b054304f7a7112255a50b212fa09995", "score": "0.6580082", "text": "def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n ...
d66b7f8f471fafbfc33b5ecb7602d4d5
PATCH/PUT /patients/1 PATCH/PUT /patients/1.json
[ { "docid": "dabc1154953eb1a30d47b7e87000255b", "score": "0.6550274", "text": "def update\n respond_to do |format|\n if @patient.update(patient_params)\n if !user_signed_in?\n format.html { redirect_to root_path }\n else\n flash[:notice] = 'Pacient je bil uspešno ...
[ { "docid": "d5466e81427206f20085bd53c82258c4", "score": "0.73592407", "text": "def update\n @patient = Patient.find(params[:id])\n\n if @patient.update(params[:patient])\n head :no_content\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end", "titl...
befd751224adec5a2e7feb8f38b46101
Is Umlaut configured to use Sunspot?
[ { "docid": "cf59b84bc9c4cdc1e5076911969d7e11", "score": "0.74473745", "text": "def sunspot?\n begin\n Sunspot and Sunspot.const_defined?(:Rails)\n rescue\n false\n end\n end", "title": "" } ]
[ { "docid": "6cb3ed40de0e51a9d95d136e1115b7d7", "score": "0.6896062", "text": "def solr_powered?\n self.solr_powered\n end", "title": "" }, { "docid": "2450590ddf649721fc736357ec91d26a", "score": "0.6271513", "text": "def search_engine?\n @_se ||= (@platform == 'web' && browser...
059bae02c3771e272d06627655bfd50b
This method is used to save the request and response of an +IHttpRequestResponse+ object to temporary files, so that they are no longer held in memory. Extensions can used this method to convert +IHttpRequestResponse+ objects into a form suitable for longterm storage.
[ { "docid": "5e629e64496dbdcfc4e4cf98afe596ea", "score": "0.7618478", "text": "def saveBuffersToTempFiles(httpRequestResponse)\n _check_and_callback(:saveBuffersToTempFiles, httpRequestResponse).tap{|obj| Buby::HttpRequestResponseHelper.implant(obj)}\n end", "title": "" } ]
[ { "docid": "9faa918efaf6a99f19564b77276bb6ad", "score": "0.6580966", "text": "def binary_response\n return save_file if @save_path\n @file = @object.body\n end", "title": "" }, { "docid": "a9c3a0ebee20f102d6c0fe0d6b94eddb", "score": "0.6355987", "text": "...
84bd9dc388d6803396da95e1c57507b2
Create short url on save if not yet defined
[ { "docid": "eba5734d75585409bd6c411bf0ceabff", "score": "0.76688135", "text": "def create_short_url\n return if short_url\n # Check if the required parameters are present\n unless upload_image || long_url\n logger.info \"url : #{url_info.inspect} self : #{inspect}\"\n raise 'Missing l...
[ { "docid": "9d809b9d826a967d36e19ba5ebceb844", "score": "0.8300352", "text": "def create_short_url\n if self.short_url.nil?\n self.short_url = self.id\n self.save\n end\n end", "title": "" }, { "docid": "b6a38f812c0aadf496ae0b54eb17e3c8", "score": "0.82315123", "text...
ec2c2d2b3f51c3d7657aa4677dc93440
Make friendship records in both directions
[ { "docid": "014de790e17010c5d673cb7ef648f5e4", "score": "0.6604731", "text": "def make_friends!\n friendship = create_friendship(user: user, friend: invitee)\n if friendship.save\n true\n else\n errors.add(:base, \"Can't create friendship: #{friendship.errors.full_messages.join(', ')}...
[ { "docid": "0135ced5d16bd4967e93c95811b0581f", "score": "0.7297577", "text": "def reverse_friendship\n Friendship.new(user_id: friend_id, friend_id: user_id)\n end", "title": "" }, { "docid": "3569358468ae0bd2f27d77365b8ec0c4", "score": "0.7159081", "text": "def reciprocal_friend...
815a9ed622edb5e5edeacad7692daa84
Define a boolean method, substring?(long_string, short_string), that accepts two strings as arguments. Return true / false if the short_string is a substring of the long_string
[ { "docid": "48bac1931fdd4f59200c294914f2734d", "score": "0.9167012", "text": "def substring?(long_string, short_string)\nend", "title": "" } ]
[ { "docid": "2f1467c470f6a4d6234049df6865dd49", "score": "0.9070397", "text": "def substring?(long_string, short_string)\n\nend", "title": "" }, { "docid": "66ce8ec5147e7cefdc809bd7fe8ab817", "score": "0.90555054", "text": "def substring?(long_string, short_string)\n long_string.incl...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0517e117a332836e7511e237d624f27e", "score": "0.0", "text": "def set_page\n @page = Page.find_by_permalink!(params[:id])#.split(\"/\").last)\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;...
a87779c4b612949560461d10b78f7ab4
sets current_path variable for easier accessing one resource
[ { "docid": "1f7e3ecd4d7b2fa1cd67d9cb97c03e16", "score": "0.80145454", "text": "def set_current_path(path)\n @current_path = path\nend", "title": "" } ]
[ { "docid": "5b28c782fa96ad278d5cc4144024d245", "score": "0.87641656", "text": "def set_current_path; end", "title": "" }, { "docid": "4ed454314d9b9fbd410ecdbba775babc", "score": "0.7479664", "text": "def set_current_path\n case params.values_at(:controller, :action).join('/')\n ...
c9b21c9cf16c0d9b199880fc14102b5b
GET /subevents GET /subevents.xml
[ { "docid": "1036f90a9bf93ce5bde045a58295e966", "score": "0.7467698", "text": "def index\n @subevents = Subevent.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subevents }\n end\n end", "title": "" } ]
[ { "docid": "a67a3069824b3b448a6483c25e289b04", "score": "0.72699255", "text": "def index\n @sub_events = SubEvent.all\n end", "title": "" }, { "docid": "c5d8473d235fac222e40107345ea8a6d", "score": "0.702379", "text": "def show\n @subevent = Subevent.find(params[:id])\n\n re...
4aabf095b6773a6ca8af6399116e4eed
Checks if all values are filled in and unique for the row at the specified index.
[ { "docid": "c417de7ac9579d8485edbef6f369f0c7", "score": "0.78782153", "text": "def valid_row?(index)\n row_values = row(index).compact\n row_values == row_values.uniq\n end", "title": "" } ]
[ { "docid": "e66381e2c88ee52b43925c2a0bd1dab5", "score": "0.6771135", "text": "def valid_column?(index)\n column_values = column(index).compact\n column_values == column_values.uniq\n end", "title": "" }, { "docid": "af8246c2970a96876115ec5b860ddd65", "score": "0.64296603", ...
727892aa962765de40de9aa79634438f
This method will update the last post to whichever post is the second most recent.
[ { "docid": "8b4c24b25cf141d9d24b538b7e7aca97", "score": "0.7992427", "text": "def update_last_post\n return unless posts.length > 1\n write_attribute :last_post_id, posts[-2].id\n end", "title": "" } ]
[ { "docid": "ead1e04fdf9a0d02c53833c3176f3184", "score": "0.733047", "text": "def find_latest_post\n # Posts for a forum are ordered in reverse.\n if last = forum.posts.first\n Post.update_latest_post(last)\n else\n forum.last_post = nil\n forum.last_post_forum = nil\n forum....
db1589468a8a4b8993a86e3e783bada1
Iterator returning the next sentence from the parsed text.
[ { "docid": "d9f0a7d29bc3d85e1d888cb0179c715a", "score": "0.7150067", "text": "def each_sentence\n while sentence = get_next_sentence(@file)\n yield sentence\n end\n end", "title": "" } ]
[ { "docid": "6ef2880b6755cd02b8c741d55e8d6a3e", "score": "0.7427712", "text": "def each_sentence\n text_index = 0\n\n while sentence = get_next_sentence(@file)\n sentence.text_index = text_index\n text_index += 1\n\n yield sentence\n end\n end", "title": "" }, { "doci...
f68f3aeac97946962759c9f24f1c7c41
Sets the authentication credentials. Also accepts whether to use WSSE digest.
[ { "docid": "d68dac4817d0d34507f3aa046857e05c", "score": "0.7503084", "text": "def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end", "title": "" } ]
[ { "docid": "d88294d8db1f8f87b6028de0e4fe00eb", "score": "0.76725245", "text": "def set_credentials(credentials)\n @credentials = credentials\n end", "title": "" }, { "docid": "6e30eae09142ce036576587b9b13dab5", "score": "0.71587014", "text": "def set_auth(username, passwo...
7192ea8c316b9e2b1897597988d1d70f
Formats the device as ext3 and mounts it to a mount point.
[ { "docid": "ff876f8fbdf29d5abacc739a35c8d1c0", "score": "0.84775203", "text": "def format_and_mount_device(device)\n Chef::Log.info \"Formatting #{device} as ext3...\"\n execute_command(\"mkfs.ext3 -F #{device}\")\n\n Chef::Log.info \"Mounting #{device} at #{MOUNT_POINT}...\"\n execu...
[ { "docid": "de48d5fd43e50b1a6cfc71dd7bf84637", "score": "0.84259385", "text": "def format_and_mount_device(device, mount_point)\n Chef::Log.info \"Formatting #{device} as ext3...\"\n execute_command(\"mkfs.ext3 -F #{device}\")\n\n Chef::Log.info \"Mounting #{device} at #{mount_point}...\"...
d92e41e86b96219f171a9deb9597c068
Strips the end of a string after a delimiter.
[ { "docid": "b8c6c1e582226a8019f71b985e42acfc", "score": "0.6710507", "text": "def _strip!( url, delimiter )\n\n\t\t\tindex = url.rindex( delimiter )\n\t\t\tfound = !index.is_nil?\n\n\t\t\tif found\n\t\t\t\turl = url[ 0..index ]\n\t\t\tend\n\n\t\t\tfound\n\t\tend", "title": "" } ]
[ { "docid": "13943ca5f5f89c58cb8c38a3a4207736", "score": "0.6563147", "text": "def without_end(str)\n str[1...str.length - 1]\n end", "title": "" }, { "docid": "b2e96e570f7a667fd31ef107b60a6936", "score": "0.63675916", "text": "def exclude_ends(str)\n str.slice(1,str.length...
ac06e15d16c0a20b1266a64f4bbef635
Time Complexity: O(n) where n is the number of nodes in the tree Space Complexity: O(n) where n is the number of nodes in the tree left root right
[ { "docid": "225eb8f1b0dd93a38f235988930f7516", "score": "0.0", "text": "def inorder\n current = @root\n values = []\n if current != nil\n current.inorder(values)\n end\n return values\n end", "title": "" } ]
[ { "docid": "98397e3da81726f6947ebfede268f9e5", "score": "0.73150325", "text": "def size_tree (node)\n\t\t\tif node.left == nil && node.right == nil\n\t\t\t\treturn 1\n\t\t\telse\n\t\t\t\treturn 1 + size_tree(node.left) + size_tree(node.right)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "...
0f27229f25230798fa37d0d234eba207
Run `report character_inventory` in all repositories
[ { "docid": "93b4e5ac6258d09840bcffb55ded0b4f", "score": "0.71653545", "text": "def report_character_inventory(repo_set_spec, content_type)\n run_repositext_command(repo_set_spec, \"rt #{ content_type.name } report character_inventory -g\")\n end", "title": "" } ]
[ { "docid": "62b405864a970c439dfe7180bbb1de2e", "score": "0.79315627", "text": "def git_repo_report_character_inventory(options)\n RepositorySet.new(Repositext::PARENT_DIR).report_character_inventory(\n :all_content_repos,\n content_type\n )\n end", "title": "" ...
c2ca014bb92159c7f273f3a3f0a2b44b
rubocop:disable Naming/VariableName This variable has to be camelCase because it is taken straight from JSON
[ { "docid": "46881e2ccd16c5175314fa0f9da8ea17", "score": "0.0", "text": "def close_tab(badgeCount: nil)\n check_level(:tab, 'tab closed')\n @tab[:badgeCount] = badgeCount unless badgeCount.nil?\n (@judgement[:groups] ||= []) << @tab unless @hiddentab\n @tab = nil\n @level = :judgement\n e...
[ { "docid": "c033bfb1f592e576c243b31b6954c9de", "score": "0.64489394", "text": "def json_response\n JSON.parse response.body, symbolize_names: true\n end", "title": "" }, { "docid": "03f2399f4fd5ff254b7ec5596dd10588", "score": "0.63233054", "text": "def json_response\n @json_resp...
a6a34473d87da59e6180c1b42c4535ef
Checks if the given element matches any pattern
[ { "docid": "c41d6b7c1f9bd92da2c71e18b32f0047", "score": "0.6793708", "text": "def match?\n patterns.each do |pattern|\n result = if pattern.respond_to? :yield\n pattern.yield element\n else\n element.to_s.scan(pattern).flatten\n end\n\n...
[ { "docid": "227566c0099f99d77a950c2fe6dbadab", "score": "0.66105217", "text": "def filter_is_matched?(filter, element)\n return true unless filter\n filter = [filter] unless filter.is_a? Array\n filter.any? do |expression|\n expression = Regexp.new expression.to_s\n expressi...
f8d4f3e7cb7f2cce78e6a8dd0d2e82b9
this will be determined differently depending on the action that calls it. redirect_callbacks is called upon returning from successful omniauth authentication, and the target params live in an omniauthspecific request.env variable. this variable is then persisted thru the redirect using our own dta.omniauth.params sess...
[ { "docid": "727bf83c2166fbb681e723d22c59f6b1", "score": "0.6244687", "text": "def omniauth_params\n if !defined?(@_omniauth_params)\n if request.env['omniauth.params'] && request.env['omniauth.params'].any?\n @_omniauth_params = request.env['omniauth.params']\n elsif session['dta.omn...
[ { "docid": "f9b2b2bc138c800a6170bdaf03a6f801", "score": "0.82438016", "text": "def redirect_callbacks\n # derive target redirect route from 'resource_class' param, which was set\n # before authentication.\n devise_mapping = request.env['omniauth.params']['resource_class'].underscore.to_sym\n ...
85b1b665b53cd5ae48835939fbcd8a5f
This method builds a pipe and ataches the IsUniquePipe to the end then iterates the pipeline until it finds a unique element or hits the end.
[ { "docid": "b0348f4a88ebc8559eec8f0f313844e2", "score": "0.61230755", "text": "def unique?\n check = nil\n is_unique { |pipe| check = pipe }.each do\n return false unless check.isUnique\n end\n true\n end", "title": "" } ]
[ { "docid": "be575596e9a1169fb18737788c7f60bb", "score": "0.59051204", "text": "def uniq\n chain_route :pipe_class => DuplicateFilterPipe, :route_name => 'uniq'\n end", "title": "" }, { "docid": "b693a323d8e1eebb6f46c5a141e5d947", "score": "0.57341003", "text": "def unique...
f9b8275bb23bb153b3e91816dc9e3714
Optional way of writing the above in a ternary operator
[ { "docid": "ba7e97bf59c544b472778cf4b7b1d181", "score": "0.0", "text": "def position_taken?(board,index)\n board[index] == \" \" || board[index] == \"\" || board[index] == nil ? false:true\nend", "title": "" } ]
[ { "docid": "a8298214eebae3fb5607c76a85229ee9", "score": "0.7256599", "text": "def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend", "title": "" }, { "docid": "60ebf196e4c98e12818afda96d7f7a86", "score": "0.68491423", "text": "def not_if(...
f66c09a9528c82ac565490c2e202da44
GET /car/brands/1 GET /car/brands/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e27729d4ea768b422214fdf952e2065f", "score": "0.75822073", "text": "def get_brandings\n request :get,\n '/v3/brandings.json'\n end", "title": "" }, { "docid": "b927d9e5a8b214a777c81b986e0cf48f", "score": "0.7562054", "text": "def brands\n call_api('/bra...
d2ed44911ef55a99453764397c438926
Warning: This function is dangerous, use shib_logout_url if you can.
[ { "docid": "b12020154fc696e138f79f656458103a", "score": "0.734228", "text": "def shib_logout_and_redirect_url(redirect_url=nil)\n logger.warn \"WARNING: shib_logout_and_redirect_url is a dangerous function with Shibboleth because it does not log the user out of the IDP, consider using shib_logout_u...
[ { "docid": "ef548a6d94241614ce62ed9d4e4cd686", "score": "0.76291335", "text": "def logout; end", "title": "" }, { "docid": "6a7bde15528fe1c07ffa711be9985e47", "score": "0.756543", "text": "def logout\n go_to('http://www.okcupid.com/logout')\n end", "title": "" }, { "d...
ad6bf6b32108ca81be8cddceabdb7cee
running code ================ joke = 'Why cant a fish play piano' response = 'you cant tuna fish' user_response = tell_var_joke_and_check_with_my_test(joke, response) if user_response == true puts 'yay! you got it' else puts 'cmon mann' end Exercise 2
[ { "docid": "0564714833cd4d65b335dff32325b031", "score": "0.0", "text": "def tell_two_jokes(joke1, answer1, joke2, answer2)\n result1 = tell_a_joke(joke1, answer1)\n result2 = tell_a_joke(joke2, answer2)\n if result1 && result2\n return true\n else\n return false\n end\nend", "title": "" ...
[ { "docid": "7881db72a9e9b93693a11aeb46c74c84", "score": "0.7770493", "text": "def joke(joke_to_tell, correct_response)\n\tputs(joke_to_tell)\n\tuser_input = gets.chomp\n\t\tif user_input == correct_response\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\nend", "title": "" }, { "do...
dfad13a0e5ea932e8c07f95fee3c64f8
Executable type, resolving :auto if possible.
[ { "docid": "a2442db518b7eb6b3effc606b378dbdb", "score": "0.64577127", "text": "def effective_executable_type\n if executable_type == :auto\n case File.extname(project.executable)\n when '.rbw'\n :windows\n when '.rb'\n :console\n else\n ...
[ { "docid": "3daf9ae079913cdac1b479655e58823c", "score": "0.5858183", "text": "def class_type_name\n \"Exec\"\n end", "title": "" }, { "docid": "a5ff66fef5a6d86369b50114ee3ca955", "score": "0.5640419", "text": "def executable(type)\n type = type.to_s\n exe_path = Fil...
9d6503be40ee84464e5bb053a9cdf95e
UNIT TESTS FOR METHOD node_to_string(arr) Equivalence classes The array is empty > return empty array The array has arrays of nodes > return an array of each array's node's character's stitched together into a string this test acceps an array of one array, and converts the one array to a string using the node's charact...
[ { "docid": "f547e23ceb005db77bfbea9a78f7e729", "score": "0.68147105", "text": "def test_node_to_string_1\n find = Finder.new\n node1 = Minitest::Mock.new\n node2 = Minitest::Mock.new\n node3 = Minitest::Mock.new\n def node1.ch; 'C'; end\n def node1.id; '1'; end\n def node2.ch; 'A'; ...
[ { "docid": "98be19d2fe6106cae128496e2cd15840", "score": "0.76120305", "text": "def test_node_to_string_3\n find = Finder.new\n arr = []\n arr3 = find.node_to_string(arr)\n assert_equal arr3, []\n end", "title": "" }, { "docid": "345f5b753b755d724f2b609a4ff17e96", "score": "0...
74fadbbd70e98c5581eaa91a76d4434a
TODO return nil if the model doesn't have an identity tag
[ { "docid": "37d6e50ba9b0e3df8d148c494901c876", "score": "0.6739228", "text": "def identity_tag(model)\n \"#{tag_prefix}/#{model.storage_name(name)}\"\n end", "title": "" } ]
[ { "docid": "b2d7bdb6a5921188c7097770f614930f", "score": "0.70003927", "text": "def identity_query(model)\n identity_tag = identity_tag(model)\n \"has #{identity_tag}\" if identity_tag\n end", "title": "" }, { "docid": "5c7e3f6296948437fa49f3bcf92e74d9", "score": "0.6663349",...
c353c75d2b25d19cf4f48bc9ed81f92a
=begin rdoc List children (filenames) of path. Returns [] if path is not a directory. =end
[ { "docid": "2516a896210f0b34cebda35525047544", "score": "0.65896386", "text": "def list_children(path=root.path)\n @db.list(path).keys.sort\n end", "title": "" } ]
[ { "docid": "6de9908aa1a1fc97c1382c2f69b52057", "score": "0.8110442", "text": "def list_files\n\t\tresult = []\n\t\t@path.each_child { |path|\n\t\t\tresult << path if File::file?(path)\n\t\t}\n\t\treturn result\n\tend", "title": "" }, { "docid": "a1a6df77e8dd3e83c45cd3890e320e08", "score"...
e36e952b8f62af65255b5505e4e52e5d
Read a 'fabric.FcNetworkPolicy' resource.
[ { "docid": "df2bf605a2512a1f382734c8669fb6af", "score": "0.48773515", "text": "def get_fabric_fc_network_policy_list(opts = {})\n data, _status_code, _headers = get_fabric_fc_network_policy_list_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "cf199691b772ec2278a2d3c59403a527", "score": "0.56501275", "text": "def get_network_policy request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_netw...
69beaa3e957d1fc356539d0314d703e1
Custom attribute writer method checking allowed values (enum).
[ { "docid": "586c0456f4475ffd5708a3981513f878", "score": "0.0", "text": "def severity=(severity)\n validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n unless validator.valid?(severity)\n fail ArgumentError, \"invalid value for 'severity', must be one of #{...
[ { "docid": "af6d0e33773bc681443214ce777b13e1", "score": "0.7088127", "text": "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "title": "" }, { "docid": "85eec95603dc239e3d18923b2c672b31", "score": "0.6482...
0b1907a154c7e748617f7b6ca5c4e70c
The rater widget basic generator
[ { "docid": "0c2181d38523573c227b4f6e967449cd", "score": "0.0", "text": "def rater_tag(name, value, options={})\n hidden_field_tag(name, value, Util.rater_options(self, options)) +\n \"\\n\" + Util.rater_generator(self, name, value, options)\n end", "title": "" } ]
[ { "docid": "e60f278a1a48efdf588b72cfe16b5d81", "score": "0.73717916", "text": "def ruboto_generate_widget(options)\n ruboto_generate_widgets(options)\nend", "title": "" }, { "docid": "73ac6ef4b166e6e51bff69ff37c24814", "score": "0.6451567", "text": "def rater_generator(context, name...
d91b427b3eab00e345193e720f2ecb45
GET /big_pictures GET /big_pictures.json
[ { "docid": "84669cbe83e385085ce5f4492d52418e", "score": "0.7389928", "text": "def index\n @big_pictures = BigPicture.all\n end", "title": "" } ]
[ { "docid": "bbf8a21fd9d89e915d4a49ab0060b6ec", "score": "0.73258334", "text": "def index\n @pictures = Picture.page(params[:page]).per(params[:per])\n render json: @pictures\n end", "title": "" }, { "docid": "780a9c2186e1c140d98dab4d2ca5ab5b", "score": "0.7307387", "...
09c459a7cd9316b9d6d5d23299d0c76d
Attempt to find the maximum fuel we can generate from a given quantity of ore, using binary search on a range from 0 to max_fuel_cutoff fuel. Printed output is useful, because it seems to usually find the one just _past_ the value we want...
[ { "docid": "ec79ada0e3ec05058bf25a055448647d", "score": "0.8470896", "text": "def max_fuel(input, max_ore, max_fuel_cutoff: 10_000_000)\n (0..max_fuel_cutoff).bsearch do |x|\n\n ore_cost = fuel_ore_cost(input, needed_fuel: x)\n puts \"#{x}: #{ore_cost}\"\n\n max_ore < ore_cost\n end...
[ { "docid": "0fad688f8bd0387c4179de3f8dd6d486", "score": "0.63636523", "text": "def fuel_requirement(mass)\n # to find the fuel required for a module,\n # take its mass, divide by three, round down, and subtract 2\n [(mass / 3).round - 2, 0].max\nend", "title": "" }, { "docid": "3ee4bd88f6...
8ba3f446982d119354dea9d066e719a3
Setter methods Accept package as id or package name
[ { "docid": "2145737090280707ecc3d88bb080fc81", "score": "0.0", "text": "def create_package_instance(rlm_base_url, rlm_username, rlm_password, package, locked_status='No', instance_name = nil)\n raise 'No valid package name/ID provided.' if package.nil?\n command = locked_status == 'No' ? 'inst...
[ { "docid": "65070b788cfc766d810ba67db6d2765a", "score": "0.71899796", "text": "def set_package\n @package = Package.find(params[:package_id])\n end", "title": "" }, { "docid": "fd52e0b2648d89637c5c36eeae614bcd", "score": "0.7184712", "text": "def set_package\n @package =...
ba709fac309173f2ff8175c6e9bae259
Iterate over keys (team), values (i) score = score + i (Happiness = 0 .. 10) If Happiness <= 5 return "Get Out Now!" else return "Nice Work Champ" i= total score / meet [key = name, value = i] If boss then (i (of the boss) 2)
[ { "docid": "a65f15d493227f960459b3acca064251", "score": "0.7006081", "text": "def outed(meet, boss)\n score = 0\n meet.each do |name, ind| \n score += ind unless name == boss\n score += ind * 2 if name == boss\n end\n \n avg = score/meet.length\n if avg <= 5 \n \"Get Out Now!\"\n else \n ...
[ { "docid": "7e86a61918582f523017b661461719fb", "score": "0.69510674", "text": "def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum ...
858c97ea216b10e53403c2e4b6f57d9e
Returns a new HTTP request (a subclass of Net::HTTPRequest) suitable for sending the next batch of logs to the service. Defaults to a POST of JSON data. This executes inside the sending thread.
[ { "docid": "0556289324955c9ffa69590033c7dfb3", "score": "0.7233127", "text": "def make_batch_request\n\t\trequest = Net::HTTP::Post.new( self.endpoint.path )\n\t\trequest[ 'Content-Type' ] = 'application/json'\n\n\t\treturn request\n\tend", "title": "" } ]
[ { "docid": "a67e1ab04c8151b051b75281d368031a", "score": "0.6357519", "text": "def to_http_request\n return ['POST', request_uri, request_headers, request_body]\n end", "title": "" }, { "docid": "ae0eac52ed03450a58c9dc67e72339ed", "score": "0.6342814", "text": "def send_re...
31733048fb3667ebb2808c50edb2684e
Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
[ { "docid": "f598c530e58f5260de3f16f14e51f9c1", "score": "0.8012173", "text": "def matches?(crypted, *tokens)\n encrypt(*tokens) == crypted\n end", "title": "" } ]
[ { "docid": "6a9af7096a25e2ef7cb7f33823eeb150", "score": "0.80569583", "text": "def matches?(crypted, *tokens)\n encrypt(*tokens) == crypted\n end", "title": "" }, { "docid": "6a9af7096a25e2ef7cb7f33823eeb150", "score": "0.80569583", "text": "def matches?(crypted, ...
a3c76d1fc4b0bda9173e55587c6a1c09
Company keywords Get keywords associated with a given company
[ { "docid": "bd2d0ccd76707344e8bca790c408e689", "score": "0.0", "text": "def company_country_code_company_id_keywords_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company...
[ { "docid": "b5b53c713d7179cdb7bd8474da4b0671", "score": "0.6851543", "text": "def get_keywords(query_obj=nil)\n uri = URI.parse(@uri + \"/Keywords\")\n results = get(uri,query_obj)\n end", "title": "" }, { "docid": "ade37b4a5b9b1cc8c39c2afb214bd241", "score":...
8b8172116398ccd43e01c91a6d3367c3
Never generate automatically a new slug because it has problems with multiple locales.
[ { "docid": "33368694e9765be94e34077126cad6fa", "score": "0.0", "text": "def should_generate_new_friendly_id?\n false\n end", "title": "" } ]
[ { "docid": "4f7fc5c8d9075a517dc41e8cc45e7dc9", "score": "0.809758", "text": "def generate_slug\n self.slug = self.name.parameterize unless self.name.nil?\n end", "title": "" }, { "docid": "3b235104ca5d87d5aa7743dbec60c92f", "score": "0.7992788", "text": "def generate_slug\n...
22dc170ab055f2b2927a493ebc824a0c
Write a method, Arraybubble_sort, that takes in an optional proc argument. When given a proc, the method should sort the array according to the proc. When no proc is given, the method should sort the array in increasing order.
[ { "docid": "b7f1a2b15e17ac072550c7c64f29ff02", "score": "0.72340065", "text": "def bubble_sort(&prc)\n if prc == nil\n return self.sort!\n end\n\n (0...self.length).each do |i1|\n (i1 + 1...self.length).each do |i2|\n if prc.call(self[i1], self[i...
[ { "docid": "da54464344be103fb3318e33b5407345", "score": "0.8094718", "text": "def bubble_sort(&prc)\n prc ||= proc { |a, b| a <=> b }\n sort!(&prc)\n end", "title": "" }, { "docid": "62dd3b151d5adba766f57ccca380359e", "score": "0.79013497", "text": "def bubble_sort(&prc)\n\n ...
244180cf9c91ad35c40d528018ffe15a
Generates a new random login token and stores a secure hash of the token in the record, along with an expiry date of 1 week from now.
[ { "docid": "fd126393ff83a4d884798c03af7a2a14", "score": "0.86403686", "text": "def generate_login_token!\n new_login_token = SecureRandom.hex(24)\n salt = SecureRandom.hex(24)\n hash = token_hash(new_login_token, salt)\n\n update_attributes(:login_token => concatenate_token_record(hash, salt...
[ { "docid": "6291abdb5b1a468fbd859bc73fd2a1e7", "score": "0.7858855", "text": "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "title": "" }, { "docid": "7f388bf2841d88c47947315444af61d3", "score": "0.7803908", "text": "def generate_token\n self.token...
291c0f18cfba867bc94536f6a0d0ee53
GET /manufacturers/new GET /manufacturers/new.xml
[ { "docid": "391cb8a576877affdbad3fb15a6023e9", "score": "0.7710835", "text": "def new\n @manufacturer = Manufacturer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @manufacturer }\n end\n end", "title": "" } ]
[ { "docid": "5229ecd9c7b99c3d5d0223c73421e017", "score": "0.7728047", "text": "def new\n @manufacturer = Manufacturer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @manufacturer }\n end\n end", "title": "" }, { "docid": "3bc62435...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "219fdda3b207ea07a262c469acdcbbf6", "score": "0.0", "text": "def set_location\n @location = Location.find(params[: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;...
b89b42335d3aedcc5c5825ce93e9af05
Whatever needs doing after refreshing that is not a cascading refresh
[ { "docid": "f0f487c7f3cabe045591cf5c916324cf", "score": "0.74353856", "text": "def after_refresh(_options = {}); end", "title": "" } ]
[ { "docid": "b550ec75cd84ebcc1c959802d7b0e56f", "score": "0.79816073", "text": "def refresh; end", "title": "" }, { "docid": "b550ec75cd84ebcc1c959802d7b0e56f", "score": "0.79816073", "text": "def refresh; end", "title": "" }, { "docid": "b550ec75cd84ebcc1c959802d7b0e56f",...
bd3d692c9abdf6b66fe91de5af9af9e0
Set the changed state of the +Document+ then notify observers that it has changed. Example: person.notify
[ { "docid": "c9963be145a9c19ebfa159907c080b47", "score": "0.71812415", "text": "def notify\n changed(true)\n notify_observers(self)\n end", "title": "" } ]
[ { "docid": "82a71a30a329924fd2066e070379d943", "score": "0.7204986", "text": "def notify\n changed(true)\n notify_observers(self)\n end", "title": "" }, { "docid": "13ee39ce05b4bd8afb74175a5d8ad9f5", "score": "0.65548944", "text": "def mark_changed\n @changed = true...
693700830372d8a79db54a4ee8251ca1
Complete the function below, the input variable "matrix" is a twodimensional array of integers, zero or one, organized by row (i.e. find elements by subscripting matrix[row][col]) The return value should be an integer specifying the number of valid paths through the matrix.
[ { "docid": "5c2d417f0523a83fdc256c02a07b44f5", "score": "0.7040196", "text": "def numberOfPaths(m)\n result = 0\n\n unless invalid?(m[0][0], m[m.length - 1][m[0].length - 1])\n matrix = MatrixSolver.new(m)\n matrix.find_solutions\n\n result = matrix.solution_count\n end\n\n return result\ne...
[ { "docid": "90e1e728543f26368bb91451e480a950", "score": "0.7992285", "text": "def countPaths(matrix, row, col)\n if !validSquare(matrix, row, col)\n return 0;\n end\n\n if isAtEnd(matrix, row, col)\n return 1;\n end\n\n return countPaths(matrix, row + 1, col) + countPaths(matrix, row, col + 1...
e1a88736915830d17f6f45a797f644d6
Returns information about a specific order using an identifier number
[ { "docid": "e54fa6c10f6f6a19c69f024652eb5b6d", "score": "0.6705867", "text": "def get_identifier_by_identifier(organization, identifier, incoming={})\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('identifier'...
[ { "docid": "83042954b067e7757c5e97f7e05a1e68", "score": "0.7353398", "text": "def get_orderid(order)\n return order.number\n end", "title": "" }, { "docid": "24a86a2415365cd3660e43dcb64cfa9a", "score": "0.73395056", "text": "def order id\n get_request \"orders/#{id}\"\n e...
b2651238d04c6a096ee731865a5df409
POST /pe_trade_exchanges POST /pe_trade_exchanges.json
[ { "docid": "01aab5a9668c75c468490470ee59c0ab", "score": "0.6683373", "text": "def create\n @pe_trade_exchange = PeTradeExchange.new(pe_trade_exchange_params)\n\n respond_to do |format|\n if @pe_trade_exchange.save\n format.html { redirect_to @pe_trade_exchange, notice: 'Pe trade exchan...
[ { "docid": "e44bdac8bacf37ac6f54f8c2140e43aa", "score": "0.6679557", "text": "def pe_trade_exchange_params\n params.require(:pe_trade_exchange).permit(:order, :target_type, :target_value, :need_type, :need_value)\n end", "title": "" }, { "docid": "f43a7b6b5e29bb4a6dc6fd5f19c7cd5a", ...
346f71ffa515e42d85d49db0f267f658
NOTE: Assumes the Opscode Site API responds with versions in reverse sorted order
[ { "docid": "4e9ce1889cfc1cdbe729c7a7d1159991", "score": "0.0", "text": "def manifests(name)\n line(name).manifests\n end", "title": "" } ]
[ { "docid": "88837c5aa644ac6c29d3b4e1994b70a7", "score": "0.73384506", "text": "def versions\n @versions = @page.versions.reverse # TODO set versions to order by revisions descending by default\n end", "title": "" }, { "docid": "76e37091c08ac8db132413a939d45bae", "score": "0.71861035"...
d54281eeb088bc9a390c282aff8b1164
Validates and creates Androidspecific provisioning request data
[ { "docid": "f907d8e261acf3bcce8dce2c8c117754", "score": "0.0", "text": "def post_digitalwalletprovisionrequests_androidpay(opts = {})\n data, _status_code, _headers = post_digitalwalletprovisionrequests_androidpay_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "d2dd88e69105edcddbeca3c622835bac", "score": "0.5905147", "text": "def build_provision_request(tags_hash, options_hash)\n log(:info, \"Processing build_provision_request...\", true)\n\n # arg1 = version\n args = ['1.1']\n\n # arg2 = templateFields\n template_args = options_hash...
cf639b7317819aea6064d695a61cf279
PATCH/PUT /polls/1 PATCH/PUT /polls/1.json
[ { "docid": "7f41e98827a57e46fb727b4dadd13d13", "score": "0.66142625", "text": "def update\n respond_to do |format|\n if @poll.update(poll_params)\n format.html { redirect_to @poll, notice: 'Poll was successfully updated.' }\n format.json { render :show, status: :ok, location: @poll...
[ { "docid": "903ea6414b0289e62090727cc8aa3fdf", "score": "0.73080623", "text": "def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verif...
a2b47cc1b861328bf65ec4f1c7dfea42
PATCH/PUT /link_sound_clouds/1 PATCH/PUT /link_sound_clouds/1.json
[ { "docid": "e6ff47f748fa8c9047bfea89eb1e092b", "score": "0.6164982", "text": "def update\n respond_to do |format|\n if @link_sound_cloud.update(link_sound_cloud_params)\n @status = 'success'\n @action = 'update'\n format.js { render :index} \n else\n @stat...
[ { "docid": "abac4d109d2dddb38d400271ec9a7220", "score": "0.62748104", "text": "def update\n respond_to do |format|\n if @soundness.update(soundness_params)\n format.html do\n redirect_to [@bridge, @soundness],\n notice: I18n.t('controller.common.success_on_up...
06fef3ee6fef625febf0dd0445591ec4
service to update the chapter details input : chapter_id output : returns sync chapters
[ { "docid": "e345afc70db26ebc93fa7beeddacc0cd", "score": "0.7457958", "text": "def update_chapter\n @retval = Hash.new()\n unless params[:chapter_id].blank? && params[:chapter_name].blank? && params[:auto_share].blank?\n if !params[:auto_share].blank? && params[:auto_share]=='1'\n auto_...
[ { "docid": "786f6ab24204fa4d2bbb64edbd0fde02", "score": "0.7050578", "text": "def update\n \n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n if @chapter.update_attributes(params[:chapter])\n format.html { redirect_to @chapter, notice: 'chapter was successfully upda...
d227e1e50ac12ed970220d1bb7285876
Point to test: The valid of threshold 1 Input: + Invalid threshold 1 value is inputed. + Request to save metric threshold. Output: Unable to save metric threshold with invalid data.
[ { "docid": "05e8823ebe231d2af319dc335e673d2b", "score": "0.64928573", "text": "def test_ut_t4_smt_mtm_002\n metric_threshold = MetricsThreshold.new(:metric_name => METRIC_NAME,\n :pj_id => PJ_ID,\n :metric_type => METRIC_TYPE,\n :analyze_tool_id => ANALYZE_TOOL_ID,\n :threshold_1 ...
[ { "docid": "e791dc72773da6f924cf7055320a572d", "score": "0.7003218", "text": "def test_ut_t4_smt_mtm_023\n threshold = create_a_metric_threshold\n threshold.threshold_2 = \"\"\n threshold.save\n #\n value = THRESHOLD_1 + 2\n assert_equal threshold.match_threshold?(value),0\n end", ...
95805a443ae60fc9d91bd9268e8c8a5d
DELETE /mkbs/1 DELETE /mkbs/1.json
[ { "docid": "e7a270f46ee72ade89cdef9a3eafb32a", "score": "0.76103514", "text": "def destroy\n @mkb = Mkb.find(params[:id])\n @mkb.destroy\n\n respond_to do |format|\n format.html { redirect_to client_mkbs_path(@client) }\n format.json { head :ok }\n end\n end", "title": "" } ...
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.6905487", "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": "...
0a38c87e477265dedb1710eecc35eb88
Allows the definition of privileges to be allowed for the current role, either in a has_permission_on block or directly in one call. role :admin has_permission_on :employees, :to => :read has_permission_on [:employees, :orders], :to => :read has_permission_on :employees do to :create if_attribute ... end has_permission...
[ { "docid": "a857dcd42b435cd445a26c0b582e2466", "score": "0.72367734", "text": "def has_permission_on(*args)\n options = args.extract_options!\n context = args.flatten\n \n raise DSLError, \"has_permission_on only allowed in role blocks\" if @current_role.nil?\n options...
[ { "docid": "833dd2f4350fc4b765180f3cef28b3ec", "score": "0.7164983", "text": "def has_permission_on(*args)\n options = args.extract_options!\n context = args.flatten\n\n raise DSLError, 'has_permission_on only allowed in role blocks' if @current_role.nil?\n options = { to: []...
b03cca02dd16202693e15ffe979c8334
Examples p no_dupes?([1, 1, 2, 1, 3, 2, 4]) => [3, 4] p no_dupes?(['x', 'x', 'y', 'z', 'z']) => ['y'] p no_dupes?([true, true, true]) => []
[ { "docid": "fa5c4b628ca12660d37c86edf2da2cc7", "score": "0.0", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" } ]
[ { "docid": "eb005fe7c175b0172fffa1c466349d00", "score": "0.7764086", "text": "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "title": "" }, { "docid": "ae083e64a445cf1350a79a8ac965a52a"...
275ccfb1ce3ebb0dcbcf19a34e8f892f
attr_reader :name def name
[ { "docid": "f8bbc23a7026b447fb5ad4bccad191d4", "score": "0.0", "text": "def meow\n \"Meow, I am a beautiful kitty\"\n end", "title": "" } ]
[ { "docid": "c1756231d57cb1a837e06081b5a12375", "score": "0.86338913", "text": "def name_reader\n @name\n end", "title": "" }, { "docid": "82bc55cde643a1bd04dc1b65af38aee6", "score": "0.8594176", "text": "def name() return @name end", "title": "" }, { "docid": "82bc55c...
e5a5515a20d959cdd32bc5a576129110
Code should not be reloaded while tests are running, as this tends to cause Active Record connection errors, and causes unreliable test runs. `reload_classes` will ensure that the code is reloaded before tests commence.
[ { "docid": "ad29e427761e3666fcb605e6f6a1fcd9", "score": "0.0", "text": "def disable_reloading\n was = Rails.application.reloader.check\n Rails.application.reloader.check = lambda { false }\n\n yield\n ensure\n Rails.application.reloader.check = was\n end", "titl...
[ { "docid": "39e04df3e5f30e62edb0f253e81f514b", "score": "0.68604964", "text": "def reload_classes\n klasses = [:Inject]\n\n # unload classes\n Object.class_eval do\n klasses.each do |klass|\n remove_const klass.to_s if const_defined? klass.to_s\n end\n end\n\n # reload cl...
03e3efca7e449bd7c0431a5b4924a2ad
Handle uploaded header image
[ { "docid": "d305b511f26f2bdad43bc26a42ccd133", "score": "0.7144437", "text": "def change_header_image\n authorize!(:update, @classroom)\n\n himg = @classroom.images.build\n himg.attachment = params[:classroom][:header_image]\n himg.description = _('New header image')\n himg.asse...
[ { "docid": "5a08cc88d832fad08fdbf597880185ec", "score": "0.7009301", "text": "def header\n @header unless @header.nil?\n @image.pos=0\n @image.read(100)\n end", "title": "" }, { "docid": "4cb1d03bbe329d067081f701e64d9d7a", "score": "0.6688615", "text": "def set_header_image...
60ee956360be3e6ebe57a6dd0594084e
tell_joke Redefine ('override') a method that this class inherited from its parent class
[ { "docid": "951a9937a06e5918b8caa6470d22dcd8", "score": "0.0", "text": "def hello\n super # Run the version of 'hello' that is defined in the parent class,\n # Person. and then add some custom behaviour as detailed below\n puts \"Please watch my Netflix special and come to my shows\"\n end", ...
[ { "docid": "7f446b6a2d77828174e09738f235d6ba", "score": "0.7999526", "text": "def method_to_be_overridden; end", "title": "" }, { "docid": "f63ea5d5e4f334aab53394b5ea1d38f9", "score": "0.7265579", "text": "def override()\n puts \"child override()\"\n end", "title": "" }, ...
bb032a6230c65bee3aafcb46d287527c
Create a new fish detail parser
[ { "docid": "63ba1b3edfcdccdbaf041202f781adec", "score": "0.0", "text": "def initialize\n @parser = Grammar::RootParser.new\n end", "title": "" } ]
[ { "docid": "50f29aa4b65f3bfb287d323cbfe7064c", "score": "0.5609841", "text": "def parser; end", "title": "" }, { "docid": "50f29aa4b65f3bfb287d323cbfe7064c", "score": "0.5609841", "text": "def parser; end", "title": "" }, { "docid": "50f29aa4b65f3bfb287d323cbfe7064c", ...
43c25115c6669ed5f15a4f5ed429a8f4
DELETE /accounts/1 DELETE /accounts/1.json
[ { "docid": "20454f3c6228b0c509df9867e356e655", "score": "0.0", "text": "def destroy\n @sale = @context.find(params[:id])\n @business = @sale.business unless @business\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to business_sales_url(@business) }\n end\n end",...
[ { "docid": "2447472b8075acdc6568be871ae128aa", "score": "0.73785126", "text": "def destroy\n @account = current_user.accounts.find(params[:id])\n @account.destroy\n destroyRequest(@account)\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :...
34c35fc8cff0c0eb002f45c6c20e0892
only logged user can vote (carefull with url chenges)
[ { "docid": "b7b2bac6cdeacb014078e61841313aff", "score": "0.0", "text": "def up_vote\n answer = Academy::Answer.find(params[:answer])\n vote = Academy::Vote.where(:user_id => current_user.id, :answer_id => answer.id)\n \n if vote.empty?\n answer.vote_up\n vote = Academy::Vote.new(:v...
[ { "docid": "c5facb96aa6d758b54d2e129c77c378a", "score": "0.8000169", "text": "def voter(user)\n if RuntimeConfig.vote_signin_active? || RuntimeConfig.voting_active?\n can :access, :elections\n can :access, Election\n end\n\n if RuntimeConfig.voting_active?\n can :access, :votes\n...
0f18fdfe980446e02600834b06e8b211
FUNCTION LIST defines display_products to print out products
[ { "docid": "d703e6c17d04e5cc20185c2586aeeb98", "score": "0.7222353", "text": "def display_products(productarray)\n\tputs \"AVAILABLE PRODUCTS\"\t\n\tproductarray.each_with_index do |arr,i|\n\t\tputs \"Product Number:#{i+1} \\n #{arr[:description]} -- $#{arr[:price]/100.0}\"\n\tend\nend", "title": ""...
[ { "docid": "d7199ff19fbebcd6abe8554bd119fdda", "score": "0.8420816", "text": "def products_list\n\t\tputs \"This is the products list\"\n\t\tputs \"-----------------------------------------------------------------------\"\n\tend", "title": "" }, { "docid": "bb2dbebad8768e766d7d38feca0282d2",...
e5db9c0df154b88c2b6cae230d23065c
I worked on this challenge [by myself, with: Meagan Munch] I spent [1.5] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? An array, a number and an obj...
[ { "docid": "7ca4f73fbf65310043588ceaeb9fb519", "score": "0.69940186", "text": "def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend", "title": "" }...
[ { "docid": "9b08d0def96ad8ae20d112d5a76f2b1d", "score": "0.76194495", "text": "def pad(array, size, padding_object=nil)\n new_array = array.clone\n if array.length >= size\n return new_array\n else\n while new_array.length < size\n new_array << padding_object\n end\n end\n return new_...
7b465608fa59ed811ed5159f9976fc4b
Get Time Since Last Block. bitcoin_node tslb
[ { "docid": "620b246deb3379f6224dbabf67c6216a", "score": "0.7720107", "text": "def handle_tslb\n { tslb: (Time.now - @node.last_block_time).to_i }\n end", "title": "" } ]
[ { "docid": "83d2d4392011357be49693a09153184b", "score": "0.66796196", "text": "def last_time\n @last_time\n end", "title": "" }, { "docid": "13f4c949bd1f7bc77798e9841bc2bab7", "score": "0.6533263", "text": "def last_update\n Time.parse(@record.SystemModstamp)\n en...
a83c367ca5476376aaa353c5431c2009
endregion Member class region GroupDetail class
[ { "docid": "400f73662b77c95d2a37f6e4cb70208d", "score": "0.72547317", "text": "def test_groupdetail_constructor_and_accessors\n\n obj = SmsCountryApi::Group::GroupDetail.new\n refute_nil obj, \"Object wasn't created successfully.\"\n assert_kind_of SmsCountryApi::Group::GroupDetail,...
[ { "docid": "9494534ddafdad27f17a23ae41cf7b10", "score": "0.70044", "text": "def group; Group.get(self.group_id); end", "title": "" }, { "docid": "282a71627413fcac1d85ff37255543f2", "score": "0.69309145", "text": "def group_info\n super\n end", "title": "" }, { "do...
74e953b33fac167f19a73b6807d6f990
GET /additive_frequencies/1 GET /additive_frequencies/1.json
[ { "docid": "9e58957dd3a561cf23687a0a869ada3a", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a7c170f6b2961c5e1dea38e91dec72df", "score": "0.7311356", "text": "def index\n #@additive_frequencies = AdditiveFrequency.paginate(page: params[:page],:per_page => 5)\n @additive_frequencies = AdditiveFrequency.all\n end", "title": "" }, { "docid": "787a5e7811f1dd5a8e177e29...
bdba01e738d6f23fc8a0345f933c0b9c
DELETE /anearts/1 DELETE /anearts/1.json
[ { "docid": "2dd3260d7076a593b9d861aa2e23aa15", "score": "0.7148039", "text": "def destroy\n @aneart.destroy\n respond_to do |format|\n format.html { redirect_to anearts_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.7369891", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" }, { "docid": "179ff0053e8f4f967cb3d92206094cf0", "score": "0.7319735", "text": "def delete_aos_version(args = {}) \n delete(\"/aosversions...
75c850348da450f20c33d011160e06e9
Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 integers. No floats or empty arrays will be passed. For example, when an array is passed like [19,5,42,2,77], the output should be 7. [10,343445353,3453445,3453545353453] should return 3453455. Hint: Do not modify the ...
[ { "docid": "06830e0a8f7e52ea649fe92634efe8ca", "score": "0.728798", "text": "def sum_of_two_smallest_numbers(arr)\n arr.sort[0] + arr.sort[1]\nend", "title": "" } ]
[ { "docid": "4d353b2c4364814bfefc45677ea0eaac", "score": "0.79844725", "text": "def sum_of_two_smallest_numbers(arr)\n arr.min(2).reduce(:+)\nend", "title": "" }, { "docid": "49a9d5d340efc1cef0b51028d356ca58", "score": "0.74251604", "text": "def sum_two_smallest_numbers(numbers)\n nu...
f53bded8b9948a0473619389e6d5521d
Inhibit destroy of historical records
[ { "docid": "0f42d3cdb4d150fde33cf1b3689a4b39", "score": "0.8470377", "text": "def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records'\n end", "title": "" } ]
[ { "docid": "226e03021eac43e84ad37dd925aa96b5", "score": "0.8418415", "text": "def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end", "title": "" }, { "docid": "226e03021eac43e84ad37dd925aa96b5", "score": "0.8418415...
a85d43de4f89caabeb390634f2a3e6f9
GET /seguros GET /seguros.json
[ { "docid": "da75a24fe05bd5d489e1e97dab378efd", "score": "0.6973026", "text": "def index\n @seguros = Seguro.all\n end", "title": "" } ]
[ { "docid": "2d0b78ad74a35059384951e525324ae8", "score": "0.72679585", "text": "def index\n @secciones = Seccion.order(\"grado_id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @secciones }\n end\n end", "title": "" }, { "docid": ...
6e2f535406adabde19bad6c21368cf15
TODO probably this returns reference to the same array that's inside the matrix
[ { "docid": "ee9f40a40147baccbe2a02d0fea6da54", "score": "0.0", "text": "def to_a\n @elements\n end", "title": "" } ]
[ { "docid": "a587570186ff78bf19562c38ee25ff0a", "score": "0.7389589", "text": "def getmatrix\r\n\t\t\treturn @matrix.clone\r\n\t\tend", "title": "" }, { "docid": "27a0185748b0a248105ca2a79d6fab29", "score": "0.6915235", "text": "def to_ptr\n @mat.pointer\n end", "title": "...
6ae712d19ad9ba56c64aa32915e10a4a
Makes a copy of the style in the document.
[ { "docid": "7799471b44a22fc8c8473dccd6cd1349", "score": "0.0", "text": "def copy_style_online(request)\n begin\n data, _status_code, _headers = copy_style_online_with_http_info(request)\n rescue ApiError => e\n if e.code == 401\n request_token\n data...
[ { "docid": "deab0d32a60d3a03af1cb53e89fb0170", "score": "0.70122886", "text": "def copy(book, to)\n book.style.copy(to)\n end", "title": "" }, { "docid": "ceb95b32a205d54698aeef94c3759ede", "score": "0.67966884", "text": "def style=(style); end", "title": "" }, { ...
90885c7ddd544ea7657e07390107be4e
Return the Puppet resource as a Hash
[ { "docid": "aec7f0570efc85cd9238843e65324662", "score": "0.0", "text": "def get_resource_properties(array)\n return {} if array.nil?\n row = process_db_row array\n row[:ensure] = :present\n row\n end", "title": "" } ]
[ { "docid": "9a9cb62a7b5a1f21dbdc289b4a748d2d", "score": "0.69606555", "text": "def resource2hash(resources)\n JSON.parse resources.to_h.to_json\n end", "title": "" }, { "docid": "0e74ca47a6d52add138665aa70ef3555", "score": "0.69157696", "text": "def catalog_data_hash\n Puppe...
69f0987d55d6e4b1ad39b6389f87d805
creates c_result for category of flight if it doesn't exist returns the c_result
[ { "docid": "456f1dfba11701d915c756d325c959a4", "score": "0.64630806", "text": "def find_or_create_c_result(cat)\n c_result = c_results.where(:category_id => cat.id).first\n if !c_result\n c_result = c_results.build(:category_id => cat.id)\n save\n end\n c_result\n end", "title...
[ { "docid": "447eb308f228e9809429a39874c4914a", "score": "0.72857237", "text": "def process_category(rfr, category_results)\n cat_flights = category_results.flight_names\n puts \"category is #{category_results.description}\"\n d_category_id = nil\n rfr.flights.each do |flight|\n puts \"flight is #...
d41a399aab85b57639fffe8ba3ab0b90
Accepts: autor, titulo, palavras_chave, id_artigo
[ { "docid": "f5331d3f02b12bbc5c276e4ebc0b20d0", "score": "0.0", "text": "def detailed_articles(query = {})\n run(:get, \"consulta/biblioteca/artigos/#{query_to_url(query)}/detalhado\")\n end", "title": "" } ]
[ { "docid": "6fed5473539de04f9f016864f396ead1", "score": "0.6814344", "text": "def set_articulo\n\t\t#esta funcion hace refactor de el trozo de codigo:\n\t\t@articulo = Article.find(params[:id])\n\t\t#lo cual me permite no repetirlo cada vez que inicia\n\t\t#una funcion que necesita inicializar el array ...
c5b16d9676d84fb743f4cf28bee38aa4
POST /tasks POST /tasks.json
[ { "docid": "e60cbf41f340328107f85362b4d51b34", "score": "0.0", "text": "def create\n @task = current_user.lists.find(params[:list_id]).tasks.build(params[:task])\n\n respond_to do |format|\n if @task.save\n format.js\n else\n render :js => \"TODO_IT.UI.show_alert('Something...
[ { "docid": "780b88f768513ebf1032946b44a23f64", "score": "0.7529737", "text": "def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end", "title": "" }, { "docid": "ae173c1e45b9ac44ef7f6d4ccb1da825", "score": "0.7497622...
fd387413e31f8306c3a005b159a1fd7f
wallet api create wallet
[ { "docid": "eb8becb9df2268779894d93d695559b1", "score": "0.75102377", "text": "def createwallet(wallet_id = 1, wallet_path_prefix = Bitcoin::Wallet::Base::DEFAULT_PATH_PREFIX)\n wallet = Bitcoin::Wallet::Base.create(wallet_id, wallet_path_prefix)\n node.wallet = wallet unless node.wallet\n...
[ { "docid": "506f9ec1dfea6d8dd69d2588ef6c389e", "score": "0.85348946", "text": "def create\n @wallet = rpc(action: :wallet_create)[:wallet]\n self\n end", "title": "" }, { "docid": "e34d9f451d9095a5636333dc5814c5a0", "score": "0.82473195", "text": "def create_wallet\n ...
83eeb9c7d558638e733b8d34b75782c7
Modifies a data sequence to be standardized. Changes each element data[i] as follows: data[i] = (data[i]mean)/standardDeviation.
[ { "docid": "afeb65b6225f1cb9ee36a7053bbdaef4", "score": "0.6645246", "text": "def standardize!\n DoubleDescriptive.standardize(@array_list, mean, standard_deviation)\n end", "title": "" } ]
[ { "docid": "b4025a1dd24686ec26c82a64818dcf72", "score": "0.70439905", "text": "def standard_deviation(data)\n n, mean, m2 = 0, 0, 0\n\n data.each do |x|\n n = n + 1\n delta = x - mean\n mean = mean + delta / n\n m2 = m2 + delta * (x - mean)\n end\...
f46b6ccb00a91065f4eb30d08d064806
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
[ { "docid": "e3055488d0f321b1d7e20e1f0ddb2e48", "score": "0.692831", "text": "def squares_diff(n)\n (1..n).inject(:+)**2 - (1..n).map{|i| i*i}.inject(:+)\nend", "title": "" } ]
[ { "docid": "f7df517a0d477335aeede297b7820f69", "score": "0.7833602", "text": "def sum_square_difference(num)\n 1.upto(num).sum**2 - 1.upto(num).reduce(0) { |total, n| total + n**2 }\nend", "title": "" }, { "docid": "d934ffc49d78dbf71b1f9ad6c0e7de99", "score": "0.76419663", "text": "...
abd7bbf0e5a4a58600301d2e09f90b3a
Time Complexity: O(n) where n is size of products Space Complexity: O(n) where n is size of products
[ { "docid": "5d04258cd1c1a2830588d053e8e06ac2", "score": "0.0", "text": "def inventory_clusters\n # Using rails method\n # InventoryData.products.group_by{|product| product[:categories]}.values\n\n # without using rails inbuilt method\n result = {}\n InventoryData.products.each do |product...
[ { "docid": "fe9343e192ce782ae285cdf1a557ea23", "score": "0.7404718", "text": "def prod(array, product)\r\n result = []\r\n array.each { |val| array.each { |val2| result.push(val, val2) if val * val2 == product } }\r\n result.uniq\r\nend", "title": "" }, { "docid": "f2491ff5ee068e8f2852d14...