query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
abbe26f4dcad0f2419a67a4ecc0c0f86
Returns a list of all partitions that are currently led by this broker.
[ { "docid": "4380e582dfab94514990f82ad34fc331", "score": "0.7324754", "text": "def led_partitions\n result, mutex = [], Mutex.new\n threads = cluster.partitions.map do |partition|\n Thread.new do\n Thread.abort_on_exception = true\n select = partition.leader == self\n ...
[ { "docid": "5a52f60116a477a11a74e21bae942388", "score": "0.6711342", "text": "def partitions\n @tropo_client.get(\"partitions\")\n end", "title": "" }, { "docid": "b587b9b20d5ffa6910141991dfd8723c", "score": "0.6694807", "text": "def partitions\n return [] unless topic_metadat...
77db18f9fae14f6c1d334209b663ebd4
parser rule addOperand (in Giraffe.g) 236:1: addOperand returns [result] : op1= mulOperand ( MUL op2= addOperand | DIV op2= addOperand | MOD op2= addOperand )? ;
[ { "docid": "a9797aa8a55a8da661ce155484393614", "score": "0.8361845", "text": "def addOperand\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n return_value = AddOperandReturnValue.new\n\n # $rule.start = the first token seen before matchi...
[ { "docid": "d2dbc2d7431b0f77d67d7c9851ae7634", "score": "0.8391178", "text": "def addOperand\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = AddOperandReturnValue.new\n\n # $rule.start = the first token seen before matchi...
d0fad5cbfecccb62a1260caf98e9de7b
welcomes customers and tells them place in line
[ { "docid": "1ef794c52e7a3808e1e7b02045d0a1ae", "score": "0.0", "text": "def take_a_number(deli_line, name)\n #adds new customer name to deli_line array\n deli_line.push(name)\n puts \"Welcome, #{name}. You are number #{deli_line.length} in line.\"\nend", "title": "" } ]
[ { "docid": "5720dff73dd8132684da671019e2aa12", "score": "0.6788714", "text": "def print_customers\n puts \"You don't have access to star clients...\"\n end", "title": "" }, { "docid": "2bf2f86eab3a3a5fb74502d56e48fc13", "score": "0.64609313", "text": "def returning_customer_promp...
dc2c1c862927590a08ebb6a2cdfa5628
Message for activating new members
[ { "docid": "54b17fd3bb4d9ba3fdc41dc48dfc48a6", "score": "0.5786633", "text": "def membership_activation(user)\n begin\n @user = user\n @agents = User.get_agent_profiles_for_country(user.account.country_short)\n @message = AutomatedMessage.where(kind: 'new_member_activation', :countries...
[ { "docid": "6377affb753d65759e215b8d17ce1a66", "score": "0.72344816", "text": "def invite_members\n end", "title": "" }, { "docid": "8fef3b7092c3112ad671d2375377344e", "score": "0.7021122", "text": "def set_members\n members_ids = params[:group][:members].reject(&:empty?)\n ...
4b1cea85e8ffed70a363758bc8297f24
Implement the common set operations: intersection, union, symmetric difference The union function takes 2 arrays as input, and returns the union of those two arrays. Example: union([1,2,3], [3,4,5]) should return [1,2,3,4,5] union(["a", "b", "c"], ["d", "e", "f"]) should return ["a", "b", "c", "d", "e", "f"] The inters...
[ { "docid": "6c9f5f2ae9108e7fd9a731a128629b81", "score": "0.5838396", "text": "def intersection(set1, set2)\n # p set1\n # p set2\n intarray=[]\n for object in set1 #for each object in set1\n # p object\n if set2.include?(object) #check if the object is included in set2\n ...
[ { "docid": "862c9fb86e107f5e732b168c41f8427d", "score": "0.67872494", "text": "def union(*arrays)\n arrays.flatten\nend", "title": "" }, { "docid": "3234b0d559ccfa274dc17262a9630994", "score": "0.6694227", "text": "def union(*arrays)\n arrays.flatten.inject([]) { |acc, element| a...
adf134652a4188c99dea3d1e32fe213d
validates_uniqueness_of :form_field_id, :scope => :field_attribute_type_id
[ { "docid": "1f75ff6e2af7120d49909be0abb53c09", "score": "0.0", "text": "def name\n self.field_attribute_type.name\n end", "title": "" } ]
[ { "docid": "4a57df83d28bda3f31e66763a3a70006", "score": "0.74741006", "text": "def validates_uniqueness_of(*fields)\n validators.add(UniquenessValidator, *fields)\n end", "title": "" }, { "docid": "ac0be17be99dce5543164a530e4765dd", "score": "0.71996", "text": "def field_...
8f33217e5282488630fa772737bd3a19
Removes an item from the hash.
[ { "docid": "f62fe28addf2cca35946aa747667e012", "score": "0.0", "text": "def delete_item(table_name, key, options = {})\n range_key = options.delete(:range_key)\n data[table_name][:data].delete(\"#{key}.#{range_key}\")\n end", "title": "" } ]
[ { "docid": "5ff6d189a3e80e00ba2b56a37be99ddf", "score": "0.85355", "text": "def remove_item(hash, item)\r\n\thash.delete(item)\r\n\thash\r\nend", "title": "" }, { "docid": "e0ea2f8b7e6af737058f32a3344e0a92", "score": "0.84159386", "text": "def remove(item)\n if @hash.include?(it...
7d272103414dc6479de089f47058f302
PATCH/PUT /mfarmakos/1 PATCH/PUT /mfarmakos/1.json
[ { "docid": "f5cc1b9a81f1ef943c3e0c3a1f2f4040", "score": "0.6516604", "text": "def update\n respond_to do |format|\n if @mfarmako.update(mfarmako_params)\n format.html { redirect_to @mfarmako, notice: 'Mfarmako was successfully updated.' }\n format.json { render :show, status: :ok, ...
[ { "docid": "6720711b64f4361c908ce6f8b2bb91d4", "score": "0.64537776", "text": "def update\n respond_to do |format|\n if @farmako.update(farmako_params)\n format.html { redirect_to @farmako, notice: 'Farmako was successfully updated.' }\n format.json { head :no_content }\n else...
cf9a168e77086d8e3ac5c4be18f91dd4
TODO: when to call firestore deletions....
[ { "docid": "52deda4eba994ef2047fb1be9e7f232e", "score": "0.6828514", "text": "def delete_from_firestore\n FirestoreClient.client.batch do |batch|\n batch.delete(\"comment_threads/#{id}\")\n users_threads.each do |ut|\n batch.delete(\"users_threads/#{ut.id}\")\n end\n commen...
[ { "docid": "1e62ff75f342e282a1613764ef55c354", "score": "0.69984066", "text": "def drop_documents\n self.coll.remove()\n end", "title": "" }, { "docid": "1e62ff75f342e282a1613764ef55c354", "score": "0.69984066", "text": "def drop_documents\n self.coll.remove()\n end", "ti...
1f15f56b9b93408770a416485a87da1c
GET /profiles/new GET /profiles/new.xml
[ { "docid": "8d8989ce4c633121bce30411b848146b", "score": "0.69218147", "text": "def new\n @current_object = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_object }\n end\n end", "title": "" } ]
[ { "docid": "b841f038792f7312cb172afd988b0024", "score": "0.7562884", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end", "title": "" }, { "docid": "e90a7e602048825fa3ffd968d71ee4be", "score": "0.7...
366e347fe531e5f7dc932a17dffbba8c
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.actionmailer.notifier.received_feedback.subject
[ { "docid": "4c48a3d69383933d42eb1aaa237c3a14", "score": "0.56338614", "text": "def received_feedback(feedback)\n @feedback = feedback\n\n mail :to => \"yahivin@gmail.com\", :reply_to => feedback.email_address || (feedback.user ? feedback.user.email : nil)\n end", "title": "" } ]
[ { "docid": "8780eaf874a22b8575f2c8ae110d8df9", "score": "0.73212415", "text": "def message_subject=(value)\n @message_subject = value\n end", "title": "" }, { "docid": "f3c6c5e6185dd926ede5b19d88f3b473", "score": "0.72852993", "text": "def subject (recipient...
cb969d5e85e344c59bc944f394259aaa
GET /patients/1 GET /patients/1.xml
[ { "docid": "ae3e04cdb8b8adf722f17b77768011fb", "score": "0.72247374", "text": "def show\n\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient }\n end\n end", "title": "" } ]
[ { "docid": "8b9032c0a8fe0d82267c7a93ac8df892", "score": "0.71160966", "text": "def index\n @patients = Patient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patients }\n end\n end", "title": "" }, { "docid": "794e5e46d15fd9f...
cedc61fd0b2af3c5c9a105668a9b3979
First does a read from the internal buffer, and then appends anything needed from the secondary IO to complete the request.
[ { "docid": "2d9671d197fe5d54cb44c666c0e43d2b", "score": "0.58361846", "text": "def readline\n @buffer.rewind\n r = if @buffer.size > 0\n @buffer.readline\n else\n \"\"\n end\n\n if r[-1..-1] != \"\\n\"\n sec = \"\"\n\n begin\n ...
[ { "docid": "f294d582b07eba9a0302646196d842ab", "score": "0.6431486", "text": "def fill_read_buffer\n\t\t\t\tif buffer = @io.read(@block_size)\n\t\t\t\t\t@read_buffer << buffer\n\t\t\t\telse\n\t\t\t\t\t@eof = true\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "ebcab119585de0a18ce051ffd0...
f83ea5de52fa2fe224ff9b1e130a37bd
POST /super_secret_informations POST /super_secret_informations.json
[ { "docid": "b0f845253cb9d0c574c711d390673bc8", "score": "0.7291049", "text": "def create\n @super_secret_information = SuperSecretInformation.new(super_secret_information_params)\n\n respond_to do |format|\n if @super_secret_information.save\n format.html { redirect_to @super_secret_in...
[ { "docid": "9781e81c9bc72503f5c9848a39c33443", "score": "0.69155765", "text": "def set_super_secret_information\n @super_secret_information = SuperSecretInformation.find(params[:id])\n end", "title": "" }, { "docid": "704812b7823bc595ffc19c11714b0cf3", "score": "0.67290974", ...
396c4f0a3eb209dd780ea4930b9e4ee5
Call a named Esgob API function.
[ { "docid": "040f2735d05c7008da57587891fef46e", "score": "0.65742636", "text": "def call(function_name, args = {})\n uri = URI(config.endpoint + function_name)\n uri.query = build_query(default_arguments.merge(args))\n\n res = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https'...
[ { "docid": "04900b8d91448a8f210b73d2dc5a7081", "score": "0.62297946", "text": "def use_function(name)\n call \"_#{name}\"\n end", "title": "" }, { "docid": "d14605f95747f6476d8607441fb6ec6b", "score": "0.60736847", "text": "def run_function(name, params)\n payload = Payloa...
ce4a6cedcc30139576708d7f1c2b6ef2
POST /image_group_items POST /image_group_items.json
[ { "docid": "be28ff04dc87f796ddafaad9905badc6", "score": "0.7019956", "text": "def create\n respond_to do |format|\n begin\n @image_group_item = ImageGroupItem.new(image_group_item_params)\n @image_group = @image_group_item.image_group\n if @image_group_item.category_id\n ...
[ { "docid": "e9c5fd1afeceae3be6b8ced908023a02", "score": "0.70340616", "text": "def create\n @item = Item.new(item_params)\n @item.owner_id = current_user.id\n images = params[:images]\n \n if images.present?\n images['image'].each do |a|\n item_image = @item.images.new(:image ...
d662e467ec5060586a115548916ab96e
Given a list of nouns A1, A2, ..., An, which noun is the least related to the others? To identify the outcast, for each noun compute the sum of the squares of the distance between the noun and every other one. For instance, the sum for noun Ai (denoted as di) is calculated as follows: di = (dist(Ai, A1))2 + (dist(Ai, A...
[ { "docid": "3ddfc98e03c09831e532cd9641a15875", "score": "0.7001025", "text": "def outcast(nouns)\n ids = {}\n distances = {}\n max_dst = -1.0/0.0\n nouns.each do |n|\n @synsets.each do |key, value|\n if value.include?(n)\n if ids[n] == nil\n ids[n] = [key]\n ...
[ { "docid": "6e9e0cae02429b136e55759f194d96d5", "score": "0.55069053", "text": "def ClosestEnemy(arr)\n str = arr.join\n result = []\n result += str.scan(/1.*?2/)\n result += str.reverse.scan(/1.*?2/).map(&:reverse)\n return 0 if result.empty?\n result.min_by { |el| el.size }.size - 1\nend", "t...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c9ace5b9961a4bb5e8a48260d469ebb3", "score": "0.0", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @progress = args[:progress] if args.key?(:progress)\n @started = args[:started] if args.key?(:started)\n @task_id = args[:task_id] i...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
5823c75f7437cf9f59a185b6d2ebf8b8
GET /posts/1 GET /posts/1.json
[ { "docid": "bb4540fe91a2c2558ee49b7366b60ee2", "score": "0.0", "text": "def show\n \n end", "title": "" } ]
[ { "docid": "c884d3048f42b4b1b768c271940bbed7", "score": "0.74369013", "text": "def show\n post_id = params[:id]\n render json: V1::Post.get_a_post(post_id)\n end", "title": "" }, { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.7363138", "text": "def index\n ...
a85366f47f96d268b206631d44639d85
ProductregisterProductToAStoregrd1 product |> store :/ productInStore RegisterProductToShelfgrd5 product must not already be on shelf to register PD 1.2.3 The system can allocate products to specific shelves(location)
[ { "docid": "e846ac5c63fab46df47819cf22e20ad2", "score": "0.0", "text": "def get_remaining_products_for_register (location)\n current = []\n parent_location_stocks = []\n \n location.stocks.each do |s|\n #get stocks currently registered\n current << s.product\n end\n \n loc...
[ { "docid": "5b6148751994d9b31a61ca268bce05ce", "score": "0.6531781", "text": "def create\n if params[:store_id]\n @store = Store.find(params[:store_id])\n @product = @store.products.create!(params[:product])\n @product.update_inventory(@store.id)\n else\n @product = Product.cre...
4db836aac34c0229e83c0efe4cf0b246
generate_template is called via convert_widget It will analyze all the widget contents and transform keys as proper value
[ { "docid": "f87e32e6501f7b8af9e491d8a3d1f501", "score": "0.55004996", "text": "def generate_template(template, path, options, index)\n collect = {}\n rub = \"\"\n content = \"\"\n html = \"\"\n\n debug = []\n options[\"items\"] ||= 10\n html += options[\"after\"] if options[\"after\"] and index %...
[ { "docid": "0795ce10bdaffdfb3f43483e8c9b1306", "score": "0.59891087", "text": "def generate_template\n # TODO: loop through the components (from components)\n # \n \"\"\n end", "title": "" }, { "docid": "0a4b62b7bd60290296b48bd3e60b3cde", "score": "0.57926327", "text": "def...
a121bb78efa0fa4ad22f1d4a38cb8600
show usage and exit
[ { "docid": "19e06b4c7b66d81ad5f388bddd7c5bf7", "score": "0.79607606", "text": "def usage!\n self.class.help(self)\n exit\n end", "title": "" } ]
[ { "docid": "e210cf7e80221920d97129b9ca4a2da0", "score": "0.8847135", "text": "def print_usage_and_exit\n puts usage\n exit\n end", "title": "" }, { "docid": "a56793d947812428942986e95b3cde86", "score": "0.8844336", "text": "def print_usage_and_exit\n puts usage\n exi...
d65e4a569aa79fea91997f18f291eeb8
Calculate the range of radar image window under comparison
[ { "docid": "4e5a8f90e59bd8b4b700c2ac480587be", "score": "0.595114", "text": "def calculate_window_range(row_index, index, invader)\n row_range = (row_index..(invader.height + row_index - 1))\n column_range = (index..(invader.width + index - 1))\n\n return row_range, column_range\n ...
[ { "docid": "ecae3fea219083afe538170ff35e7028", "score": "0.6401054", "text": "def window_comparison(radar_window, invader)\n equal_pixels = radar_window.zip(invader.image).map do |x, y|\n x.zip(y).map do |w, z|\n w == z if w != border\n end\n end\n\n equ...
193ec8114992330a85c067613fad38ce
given a directory, add all .txt files
[ { "docid": "918bc6f3d34a56d2d94b91b21d5d9cfe", "score": "0.6672341", "text": "def add_all_sources(dirpath,show_pbar=true)\n file_list = Dir.glob(\"#{dirpath}*.txt\")\n pbar = ProgressBar.new(\"load files\", file_list.size) if show_pbar\n Dir.glob(\"#{dirpath}*.txt\").each do |f|\n ...
[ { "docid": "9588054719268d35380283509844999d", "score": "0.7271205", "text": "def get_all_txt_files directory\n\t\t\treturn [] if !directory_exists?(directory)\n\t\t\tDir[\"#{directory}/*.txt\"]\n\t\tend", "title": "" }, { "docid": "b7eefddfdb1dcfce5da4074adb17cd0b", "score": "0.6706551"...
92bb6879cc751e117afe546d9d3b091e
Returns all nodes with children cached to a nested set
[ { "docid": "b70bd589f626fca3097778d5debb3361", "score": "0.68492794", "text": "def nested_set\n sort_nodes_to_nested_set(find(:all, :order => \"#{nested_set_column(:left)} ASC\"))\n end", "title": "" } ]
[ { "docid": "0595d7053d9a7de5aecd037b6f6cea1c", "score": "0.83050257", "text": "def cache_nested_set\n @cached_children || base_class.sort_nodes_to_nested_set(family)\n end", "title": "" }, { "docid": "72df785934cf1cd852279c7d2eb71de8", "score": "0.7397518", "text": "def child...
81698b5fb1852930cbee48a735391406
Finds matching entity from a variety of models. Entity returned will match VAT number and title, or normalised title if model has normalised titles
[ { "docid": "500037709dbca52d44ec5671562cc44e", "score": "0.75192684", "text": "def find_entity\n match = nil\n EntityTypesToBeMatched.each do |ent_type|\n ent_class = ent_type.constantize\n match = ent_class.new.respond_to?(:normalised_title) ? \n ent_class.f...
[ { "docid": "3cac05db45d7a85c3d84844f05c3de72", "score": "0.63067883", "text": "def matching_models\n results = {}\n\n if Seek::Config.solr_enabled && contains_extractable_spreadsheet?\n search_terms = spreadsheet_annotation_search_fields | content_blob_search_terms | fs_search_fields | search...
9b1a36098f221f61542585384270e3e2
liste les autres status
[ { "docid": "c1a21735f13abb0e9fcd098bc7162690", "score": "0.0", "text": "def get_next_status_obsolete\n\t\tfname=\"#{self.class.name}.#{__method__}\"\n\t\talls = Statusobject.find(:all, :order => \"rank ASC\", :conditions => [\"forobject = '#{self.forobject}'\"])\n\t\tunless alls.is_a?(Array)\n\t\t\talls...
[ { "docid": "7943fc2eb17e07028c5f6b42bb7d89c6", "score": "0.7382329", "text": "def statuses; end", "title": "" }, { "docid": "7af80a9f35a14a1abc6b6e3b2fc3db09", "score": "0.7173352", "text": "def statuses\n api.get('status')\n end", "title": "" }, { "docid": "ac601...
ff32ea293b117422fca177200274006b
trim if var allows it. Return empty string on no or nil value.
[ { "docid": "ab9b0128a05edbfa2a5563100b6561c8", "score": "0.0", "text": "def clean_data( field )\n\tfield.to_s.strip\nend", "title": "" } ]
[ { "docid": "951054731bd93a86ec98aeeb46dc4519", "score": "0.6836351", "text": "def trim(**props)\n transform(type: :trim, **props) do |value|\n if value\n value = value.strip\n value = nil if value.empty?\n end\n value\n end\n end", "title": "" },...
8e3a513100c7a08114ff469625eb378f
Checks for the absence of a row with the given name
[ { "docid": "9bdd079c17fe7565abce4728f4f2d104", "score": "0.77231467", "text": "def has_no_row?(name)\n page.has_no_selector?(row_css, text: name)\n end", "title": "" } ]
[ { "docid": "a9f8ffd8f880ce17b44c3c2928faf68b", "score": "0.6779906", "text": "def has_row?(name)\n page.has_selector?(row_css, text: name)\n end", "title": "" }, { "docid": "7a286574cb72b7b8b234f843b74340c6", "score": "0.66126406", "text": "def get_row_with_name(name)\n ...
d5fb417a4b9df19be41f3cd6e95215b7
Adds given node to neighbours list
[ { "docid": "87066a920352347bf5f2e8e0ec2aa652", "score": "0.72160333", "text": "def addAdjacentNode(node)\n @adjacents[@adjacents.count] = node\n end", "title": "" } ]
[ { "docid": "bf2f88dee666dc5dda6813a8d2e32250", "score": "0.8510222", "text": "def add_neighbours(node)\n neighbours = []\n counter = 0\n\n ((node.x - 1)..(node.x + 1)).each do |i|\n ((node.y - 1)..(node.y + 1)).each do |j|\n\n # This check ensures that the list will not contains the...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f967659a2ddbb2bcd3e842750e8a4b43", "score": "0.0", "text": "def set_state\n @state = State.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...
0f8c5c102ddbcef918cf1d733e2f6598
the property is not saved
[ { "docid": "54ef0940bbd788345de9fb2fdd12eb58", "score": "0.0", "text": "def set_property(key, value)\n p=property(key)\n unless p\n p=characteristic_properties.build(:kee => key)\n end\n if (value.is_a?(Fixnum) || value.is_a?(Float))\n p.value=value.to_f\n else\n p.text_val...
[ { "docid": "a101654455b2ce2ca209635fa220c36d", "score": "0.7669573", "text": "def _save\n properties\n end", "title": "" }, { "docid": "3411c3d933dc77992020a3e60e07a522", "score": "0.6641327", "text": "def save\n write_properties\n notify(EVENT_SAVE, self)\n end"...
2d85826c8ede298ec75914f0ca2d7da8
Returns the value of attribute version. source://azurestoragecommon//lib/azure/storage/common/service/metrics.rb39
[ { "docid": "41de0d9efb42153ab12adf4dad158176", "score": "0.0", "text": "def version; end", "title": "" } ]
[ { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.76068926", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.76068926", "text": "def version\n attributes.fetch(:versi...
900652f809d7ea65db17eb312eef3b92
Establish connection to the cluster for administration
[ { "docid": "c6072e37b2599f8c6af6eb4e1789471f", "score": "0.6382006", "text": "def initialize(options)\n if options[:username].nil? || options[:password].nil?\n raise ArgumentError, \"username and password mandatory to connect to the cluster\"\n end\n\n options = {\n hostname...
[ { "docid": "44b4a41dce34089bb27dc59e2c5d7ccc", "score": "0.7420656", "text": "def connect\n update_cluster\n start_heartbeat_if_needed\n self\n end", "title": "" }, { "docid": "44b4a41dce34089bb27dc59e2c5d7ccc", "score": "0.7420656", "text": "def connect\n upda...
6405c060756b0f4b71d21ca34dab0a2d
n 1 (n1) g_f(5) => 24 g_f(10) => 362880
[ { "docid": "9eece1cdade65d23a522980b58932a24", "score": "0.0", "text": "def gamma_function\nend", "title": "" } ]
[ { "docid": "fede24ecb6fb054a77ef7a773b0128c3", "score": "0.78371125", "text": "def g(n,g)\n return 1 unless 1 < g and g < n-1\n (2..g).inject(1){|res,q| res + (q > n-g ? 0 : g(n-g,q))}\nend", "title": "" }, { "docid": "69835fe2cbd3918981ddf6e87d880bce", "score": "0.6971731", "text"...
45a70c26da9cabbe9a0cc6ea17d62362
Complete the beautifulDays function below.
[ { "docid": "3d263a3e74f91f264c71f104963e5950", "score": "0.0", "text": "def beautifulDays(i, j, k)\n i.upto(j).select {|n| ((n - n.to_s.reverse.to_i) / k.to_f).floor == ((n - n.to_s.reverse.to_i) / k.to_f) }.count\nend", "title": "" } ]
[ { "docid": "d0af15a6fa02ce71b657e5f6fa21a35b", "score": "0.6543002", "text": "def to_s\n day_abbrs = day_hash\n i = 0\n #Array of consec_days arrays\n consec_day_groups = []\n #Array of consecutive days. This gets\n #reset when we find a day that is not\n #part of a consecutive set of day...
7507ae698899a8f67451ea5c975d728c
DELETE /shop/products/categories/1 DELETE /shop/products/categories/1.xml DELETE /shop/products/categories/1.json AJAX and HTML
[ { "docid": "417c2e7ca01e964cd464dd6ebf21ec33", "score": "0.7150097", "text": "def destroy\n # Need to rewrite this method to check for errors and return xml or json.\n # For some reason the answer isn't obvious to me.\n @shop_category = ShopCategory.find(params[:id])\n @shop_category.destroy...
[ { "docid": "779665eb21034acf463db8296349f71b", "score": "0.7583716", "text": "def destroy\n @categorie = Categorie.find(params[:id])\n @categorie.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n format.json {render :jso...
252570d11f66524729e1807709e2f163
Extract all code blocks into the codemap and replace with placeholders.
[ { "docid": "cfeed7b6b1d573768a007074870dca2f", "score": "0.60764784", "text": "def extract_code(data)\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n ...
[ { "docid": "c20a49153a4d2a6168eb57a5aaff67a3", "score": "0.65872484", "text": "def process_code_blocks\n @html.scan(%r{<pre><code.*?>.*?</code></pre>}m).each do |codeblock|\n content = codeblock.match(%r{<pre><code.*?>(.*?)</code></pre>}m)[1]\n lang = codeblock.match(/code class=\"...
a1a814e02a863130cfc7e5601996a491
runs some simple validation against the cookie throws exceptions!
[ { "docid": "f4c148c61a8c405247b78f35b89c9794", "score": "0.77854306", "text": "def validate!\n raise 'Cookie name must be defined' unless name\n raise 'Cookie expires is not an instance of the Time class' if expires and ! expires.is_a? Time\n end", "title": "" } ]
[ { "docid": "b9be22a18cf66903a7ffc035d1bc9b5d", "score": "0.7386588", "text": "def validate!\n validate_cookie || authenticate!\n end", "title": "" }, { "docid": "13d84b021f1e7891a0043dd74a4789f0", "score": "0.72485656", "text": "def validate_cookie \n if cookies[:caboose...
80d37418feca50161397b761550f2458
this should be create but oh well
[ { "docid": "73a8cb97bdc5540a2e832eb361df3106", "score": "0.0", "text": "def new\n job_name = params[:id]\n\n if @valid_jobs.include? job_name \n if queue_job(job_name)\n flash[:notice] = \"Created job: #{job_name}\"\n else\n flash[:alert] = \"Job #{job_name} is already r...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7186619", "text": "def private; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66733307", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", ...
b257501b033f5cdcc0a12edf9055324b
can't be occupied by a Hero
[ { "docid": "d91c0d3bed57990f447b6eb6758e8c6c", "score": "0.0", "text": "def border?\r\n terrain == :empty or terrain == :wall\r\n end", "title": "" } ]
[ { "docid": "f319d03a7ef1e41b113bb1303c5ded5a", "score": "0.64186347", "text": "def enemy?\n owner != 0\n end", "title": "" }, { "docid": "0e1e2ef8e239dae216b43f9e0961641e", "score": "0.6205637", "text": "def ensure_no_monster()\n if(MONSTER[:present])\n raise(BeezException, \...
5eb30ce905014528c52372efc684674e
Get a pretty printed string inspection for the collection.
[ { "docid": "ac778f27c6907988f7ad812d14d9ba6f", "score": "0.0", "text": "def inspect\n \"#<Mongo::Collection:0x#{object_id} namespace=#{namespace}>\"\n end", "title": "" } ]
[ { "docid": "88c3fe488c0e692f0fabff58ab30cb2f", "score": "0.6799961", "text": "def pretty_inspect\n self.inspect\n end", "title": "" }, { "docid": "41d25ab77066b1e00a8ccabd990b5e80", "score": "0.65842086", "text": "def inspect\n redacted_string(:inspect)\n end", "t...
f6ecb2bb031f8ce060b8eac14ece8322
GET /admin/users/1 GET /admin/users/1.json
[ { "docid": "29a28c0b1b6864a4058e3f2335708e11", "score": "0.0", "text": "def show\n chosen_user\n end", "title": "" } ]
[ { "docid": "430706e49237e520d33d6c2eaffa95b2", "score": "0.74659705", "text": "def index\n set_users_for_admin\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" }, { "docid": "9f7c735ace683c5c2b12c914...
f1c91ba362f7a6e48b1b56cb0d865485
Get a specific migration unit Get a specific migration unit
[ { "docid": "474f71c7703d9bbdfa8bb594109cdb9a", "score": "0.6031544", "text": "def get_migration_unit_with_http_info(migration_unit_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MigrationApi.get_migration_unit ...\"\n end\n # verif...
[ { "docid": "06a48bb03ae200f57e7563f5d56a1029", "score": "0.66727704", "text": "def get_migration_unit(migration_unit_id, opts = {})\n data, _status_code, _headers = get_migration_unit_with_http_info(migration_unit_id, opts)\n data\n end", "title": "" }, { "docid": "c9ec88636d4dc...
9dbeceffae0d488cf992c64a69621a49
Retrieve the current frame's Google Analytics account credentials.
[ { "docid": "2664c36e4e18103f747f03aef34cf25f", "score": "0.79002416", "text": "def google_analytics_account\n @google_analytics_account ||= Setting.get_or_set( current_frame, 'Google Analytics' )\n end", "title": "" } ]
[ { "docid": "1e4c948a1709564d21f24e00ef4862f0", "score": "0.6708434", "text": "def credentials\r\n @@profile.credentials\r\n end", "title": "" }, { "docid": "a208c9a56a236bd53bb493edce5e9c72", "score": "0.649012", "text": "def google_credentials\n # Grab the list of possi...
e770473bbf728afcee538edb9831ba80
Overrides the default method for redirecting to home page given with devise. Simply returns the url/path.
[ { "docid": "9f39b1968c816cdcaed10a9815ef6705", "score": "0.0", "text": "def after_sign_in_path_for(resource_or_scope)\n session[:previous_url] || \"/#{resource_or_scope.class.name.downcase.pluralize}/dashboard\"\n end", "title": "" } ]
[ { "docid": "b5613664d0351d9c14244abda21d6166", "score": "0.7491221", "text": "def after_sign_up_path_for(user)\n return home_index_url\n end", "title": "" }, { "docid": "abd148be2d413886cfcafacb2487d831", "score": "0.7464768", "text": "def after_sign_in_path_for(resource)\n ...
69acf721dd8ccd6d9bf732293e142017
gives the time to cross
[ { "docid": "c0f941a52804c7c22e2eed09149e34fb", "score": "0.0", "text": "def passage_time_to(cell)\n @error.check_initialized(self)\n (@passages.has_key? cell) ? @passages[cell] : @@MAX_VALUE\n end", "title": "" } ]
[ { "docid": "4f3c6a1cd69a4bfd8fef2a0ebcf09fd1", "score": "0.63482124", "text": "def toronto_time(curr_time)\n\t\t# have to go previous date\n\t\treturn curr_time - 5.hour\n\tend", "title": "" }, { "docid": "78e3dd5f5e83440531e0d4b938342b09", "score": "0.63475", "text": "def calc_time\...
1bfb098c80fd1361b8222f65f2464c3d
GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now. This is useful if the user wants to cancel oauth signing in/up in the middle of the process, removing all OAuth session data.
[ { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.0", "text": "def cancel\n super\n end", "title": "" } ]
[ { "docid": "4ac94a220a636bd185fdaec6b50ca6d5", "score": "0.76362747", "text": "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end", "title": "" }, { "docid": "4ac94a220a636bd185fdaec6b50ca6d5", "score": "0.76362747", "text"...
b8d9072b654f3d183483c3e8215e7803
Workers should be initialized with an array of string queue names. The order is important: a Worker will check the first queue given for a job. If none is found, it will check the second queue name given. If a job is found, it will be processed. Upon completion, the Worker will again check the first queue given, and so...
[ { "docid": "51f8c4aad07f8e7208ce4abf1ffa243e", "score": "0.5966774", "text": "def initialize(queues = [], options = {})\n @options = Options.new(options)\n @worker_queues = WorkerQueueList.new(queues)\n @shutdown = nil\n @paused = nil\n @logger = @options.delete(:logger)\n ...
[ { "docid": "8cade81138899d7d83eed5fbfb4fe65b", "score": "0.72660625", "text": "def worker(*queues)\n options = queues.last.is_a?(Hash) ? queues.pop.dup : {}\n queues = queues.flatten\n queues = [\"*\"] if queues.empty?\n queues = queues.shuffle if options.delete(:shuffle_queu...
2f17510873c34de6a4a4ff1e11a41157
List all the albums he has by an artist now it returns an array with all the album names
[ { "docid": "12f0c2ec485284300e4cbd26b851430f", "score": "0.7695269", "text": "def albums()\n sql = \"SELECT album_name FROM albums WHERE artist_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return album_name_array = result.map {|album_hash| album_hash[\"album_name\"]}\nend", ...
[ { "docid": "da773ddc6ae7ebc81b98586a01aa2d52", "score": "0.81901646", "text": "def album_tracks(album)\r\n artist_album = RSpotify::Album.search(album).first\r\n artist_album = artist_album.tracks\r\n artist_album.collect do |track| \r\n track.name\r\n end\r\n ...
a545d3fba96c7462c54de0edc8c66f4e
GET /games GET /games.json
[ { "docid": "9eeaacffdf67fd75726b4675ecf1a9cf", "score": "0.70391256", "text": "def index\n @games = Game.all.select { |g| g.is_finish? }\n @games = @games.sort_by{|g| g.id }\n\n respond_to do |format|\n if @games.count > 0\n format.json { render json: @games, status: :ok }\n el...
[ { "docid": "5068a0ca27ae23b1d06258f1bf2f195a", "score": "0.80707425", "text": "def index\n @games = Game.all\n render json: @games, status: 200\n end", "title": "" }, { "docid": "b49a9213c2fcfbaf78c0ef75757e30ee", "score": "0.79704297", "text": "def index\n @games = Game.al...
02bdf6ea48ba3ceb8299e8f42d6aaa60
Create a CSV with the given rows and without the druid column
[ { "docid": "953a92c116508fcd5e9929ac6a8a07ed", "score": "0.7364368", "text": "def item_csv(headers, rows)\n CSV.generate do |table|\n table.add_row(headers - [\"druid\"])\n rows.map { |row| row.delete_if { |header, _| header == \"druid\" } }.each do |row|\n table.add_row(row)\n ...
[ { "docid": "683815a294427be119f6cceee806a60f", "score": "0.75180626", "text": "def to_csv\r\n arr_rows =[]\r\n #get all the fields\r\n @rows.each do |row|\r\n row.flattern\r\n #collect field names from rows\r\n #we need this because there can be duplicated rows which we can't pre...
e934f942a35de7bfe91de5e64c8e7884
this problems requirements are confusing
[ { "docid": "416fc7bac3178fc72b44f654ca1ae745", "score": "0.0", "text": "def run_guessing_game\n input = nil\n until input == \"exit\"\n n = 1 + rand(6)\n puts \"Guess a number between 1 and 6.\"\n input = gets.chomp\n # if n == input.to_i # this would make more sense?\n if input.to_i ==...
[ { "docid": "dca50efd9336033146517ff594352593", "score": "0.6263024", "text": "def problems; end", "title": "" }, { "docid": "5928f8efe9c6c2d408ea21a4cdce83ad", "score": "0.6247569", "text": "def preliminary?; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac863...
c42c5e1a6eae1984eae609028ac8f797
Can the login manager function on this platform? === Return val(true|false) whether LoginManager works on this platform
[ { "docid": "9fddf3983d7726bb6c337d61ab461472", "score": "0.0", "text": "def supported_by_platform?\n return RightScale::Platform.linux? || RightScale::Platform.darwin?\n end", "title": "" } ]
[ { "docid": "cf8e38b7ca8ca450c9b674e1f937deae", "score": "0.7263079", "text": "def can_login?\n !disabled? && !locked?\n end", "title": "" }, { "docid": "b010e4687e48e4227866ac3376a9864c", "score": "0.72105545", "text": "def login?\n @current_account ? true : false\n e...
3d67cb9b35cefe09408133dfef34cc27
DELETE /scribbles/1 DELETE /scribbles/1.json
[ { "docid": "ce18ab34c2ff1317be948e8ff7d5c43e", "score": "0.7345602", "text": "def destroy\n @scribble.destroy\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "d4fc7231f236ac09016f3faaa72c3cce", "score": "0.7325888", "text": "def destroy\n @scribble.destroy\n respond_to do |format|\n format.html { redirect_to scribbles_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8a08b80258599dfa7...
a5adc20885b9fa250b9de7470163f52d
escape characters and make it html safe
[ { "docid": "b1c91483974bb4b2d7eeccb6f5e588de", "score": "0.0", "text": "def escape_html\n\t\ts = self.dup\n\n\t\tfor i in 32..255\n\t\t\tnext if i == 35 # #\n\t\t\tnext if i == 38 # &\n\t\t\tnext if i == 59 # ;\n\t\t\tnext if i >= 48 && i <= 57 # 0-9\n\t\t\tnext if i >= 65 && i <= 90 # A-Z\n\t\t\tne...
[ { "docid": "abccbae7d0b74e12c0d4ab4ffd089614", "score": "0.87404877", "text": "def html_escape(s); end", "title": "" }, { "docid": "abccbae7d0b74e12c0d4ab4ffd089614", "score": "0.87404877", "text": "def html_escape(s); end", "title": "" }, { "docid": "abccbae7d0b74e12c0d4...
bac2e08c9ac993407ea84a3d89b6df9f
Hook up all the Sitepress pages
[ { "docid": "70509d6ed185549b1937fbd7202f1afc", "score": "0.59220207", "text": "def sitepress_pages(controller: DEFAULT_CONTROLLER, action: DEFAULT_ACTION, root: false, constraints: Sitepress::RouteConstraint.new)\n get ROUTE_GLOB_KEY,\n controller: controller,\n action: action,\n ...
[ { "docid": "80754424dc19e0a626ddec14b613d4be", "score": "0.6267403", "text": "def process_pages\n\t\t\t\t@site.page_files(true).each do |p|\n\t\t\t\t\tpage = Striker::Page.new(p, { :site_meta => @meta })\n\t\t\t\t\t# t = Template.new(page)\n\t\t\t\t\tpage.process\n\t\t\t\tend\n\t\t\tend", "title": "...
6347aa87fc36e0961dd7d993a1527e3d
Shows all Weed products
[ { "docid": "88b5178b586c7f60f21ba3712905cc66", "score": "0.0", "text": "def index\n @weeds = Weed.all.order(\"created_at DESC\")\n end", "title": "" } ]
[ { "docid": "e66272adeee13c8390585e08359e0cff", "score": "0.8046477", "text": "def show\n @products = Product.all\n \n end", "title": "" }, { "docid": "8a2560084b98f8286b26a470d3d969fc", "score": "0.7935362", "text": "def show\n @products = Product.all\n end", "titl...
72ae71c977addc4585a0468126662f1e
Choose from a set array of _choices_.
[ { "docid": "d549694293e4475c0f61d1511d407764", "score": "0.0", "text": "def choose message, *choices\n say message\n super *choices\n end", "title": "" } ]
[ { "docid": "e84a32f022d640217aa79aa55c2c4947", "score": "0.68824816", "text": "def choices( *names, &action )\n names.each { |n| choice(n, &action) }\n end", "title": "" }, { "docid": "42aa9065fb746017b084cc3bfc8ad392", "score": "0.6703199", "text": "def display_choices(messa...
4b3eefd07f29ffe3afdc3d6b736acc08
Refresh by sending 'build_values' to all TableWidget children
[ { "docid": "9c1ee204ed25d9454eef2d1d475a1a4f", "score": "0.7746611", "text": "def update_values\n @layout.count.times do |indx|\n widget = @layout.item_at(indx).widget\n widget.build_values if widget && widget.is_a?(Qt::TableWidget)\n end\n end", "title": "" } ...
[ { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.62510717", "text": "def update_values\n end", "title": "" }, { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.62510717", "text": "def update_values\n end", "title": "" }, { "docid": "97b9c97244...
01566636ec6556943499fa553ef9843f
POST /email_plans POST /email_plans.json
[ { "docid": "4e618361eb72395beeb0dedfa282af3d", "score": "0.7285971", "text": "def create\n @email_plan = EmailPlan.new(email_plan_params)\n\n respond_to do |format|\n if @email_plan.save\n format.html { redirect_to @email_plan, notice: 'Email plan was successfully created.' }\n ...
[ { "docid": "1149530eaabeaa6a12fa18355bf87690", "score": "0.71731305", "text": "def create\n @emailplan = Emailplan.new(params[:emailplan])\n\n respond_to do |format|\n if @emailplan.save\n format.html { redirect_to @emailplan, :notice => 'Emailplan was successfully created.' }\n ...
31da7ba11fad6807f5e8eb17cab15160
Get the bot's OAuth application's information
[ { "docid": "e2e69a2d4b39f87760b6b9e18b28f9bb", "score": "0.73985445", "text": "def oauth_application(token)\n request(\n :oauth2_applications_me,\n nil,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end", "title": "" } ]
[ { "docid": "f313d9e6466c61bedbbf8b4b69d46d95", "score": "0.75545704", "text": "def oauth_application(auth)\n request(\n :oauth2_applications_me,\n nil,\n :get,\n \"#{APIBASE_URL}/oauth2/applications/@me\",\n Authorization: auth\n )\n end", "title": "" ...
fc5df34d11e4e764431c07c6eef4fd9a
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
[ { "docid": "49aff3a0eb472ec92c96773b88962911", "score": "0.0", "text": "def inorder\n node_array = []\n if !@root\n return node_array\n end\n current = @root\n\n node_array = traverse_in_order(node_array, current)\n\n return node_array\n end", "title": "" } ]
[ { "docid": "b9dafa00485222bcb666586fee012d49", "score": "0.69031274", "text": "def tree(nodes)\r\n while nodes.length > 1\r\n l, r = nodes.shift, nodes.shift\r\n new_symbols = l.symbols + r.symbols\r\n new_occurrences = l.occurrences + r.occurrences\r\n new_value = Node::Value.new(new_symbo...
0edb5c5c4ecc26deeb70556109960bec
Perform an arbitrary action and provide useful logging.
[ { "docid": "39caa07e3c0f317c3e6b289ef86996d3", "score": "0.0", "text": "def perform_action(verb, output_verb)\n banner \"#{output_verb} #{to_str}...\"\n elapsed = action(verb) { |state| driver.public_send(verb, state) }\n info(\"Finished #{output_verb.downcase} #{to_str}\" \\\n \" ...
[ { "docid": "d4d3c6df72328cad01ece4199939e623", "score": "0.73639137", "text": "def log action, *args\n say '%15s %s' % [action, args.join(' ')]\n end", "title": "" }, { "docid": "98fc19b981bf1aea84fb641d32cfa9ad", "score": "0.7233433", "text": "def log action, *args\n s...
82de03d2ec39f2b989747208ddc9f014
truncate number to maximum of significant digits (either side of decimal point) and return as string for display. E.g. sigfig_to_s(34947.8, 3) ==> "34900"
[ { "docid": "815fe5ed8e4c74f139d1543ffd21814b", "score": "0.72535837", "text": "def sigfig_to_s(numero,digits) \n f = sprintf(\"%.#{digits - 1}e\", numero).to_f\n i = f.to_i\n (i == f ? i : f).to_s\n end", "title": "" } ]
[ { "docid": "076c441069dd6d85c26c44a0c6219db4", "score": "0.671088", "text": "def to_s_significant(decimals: 3)\n # NOTE: Similar to something like '\"%g\" % self' in pure ruby but arguably\n # easier to understand. Moreover, it's not an overhead since we have\n # Rails available any...
b849b0e2d54f3dad8ad68b742ad4ad0f
Baraja el mazo de tesoros
[ { "docid": "ea08835771c22b2d4b58aff2fe1dc2c6", "score": "0.0", "text": "def shuffleTreasures\n @unusedTreasures.shuffle!\n end", "title": "" } ]
[ { "docid": "b5372528b3f0196104272909376bd1aa", "score": "0.6815606", "text": "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "title...
b2413f8cc2cfe39ce64dd54cbb187626
Delete a sending domain
[ { "docid": "5a9f4588938f721aeed3b8b3d9b4e4b7", "score": "0.81952286", "text": "def delete(domain_name)\n domain_name = @client.url_encode(domain_name)\n @client.call(method: :delete, path: \"sending-domains/#{domain_name}\")\n end", "title": "" } ]
[ { "docid": "5609feb16828ad129ae0652bf6d3772f", "score": "0.7994086", "text": "def delete(domain)\n Mailgun.submit :delete, domain_url(domain)\n end", "title": "" }, { "docid": "d1adc9b5f339a2197c06932b7d1a017b", "score": "0.76858836", "text": "def delete_domain(domain)\n ...
d4585e5a567e61ce7029f4d35dca7b0b
initialize Builds the Chunk object
[ { "docid": "de601a6b81508f7bf888a62fcf98b3c3", "score": "0.0", "text": "def initialize(file, options = {})\n # merge the options together\n @@options.merge!(options.kind_of?(Hash) ? options : {})\n \n # check that the path ends with a /\n if @@options['path'][-1, 1] != '/'\n @@option...
[ { "docid": "bb18f952cc932c48b11ac2d17b172abe", "score": "0.6540649", "text": "def initialize_new_test_store\n verify_store_is_blank_for_init\n add_chunk MemoryChunk.new(:max_chunk_size=>max_chunk_size,:max_index_block_size=>max_index_block_size)\n end", "title": "" }, { "docid":...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ea2508095e10d7458883caf60c5dfdb0", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:email, :username, :first_name, :last_name, :isAdmin)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
4a563709dbeed31ae758d2b7acfe2b53
Returns HTML for the help text of the page.
[ { "docid": "5d7cb33ce3792208cfb5af623c787498", "score": "0.707434", "text": "def help_text\n build_html do\n p <<-P1\n This is the list of changes that a particular defect or\n feature introduced. The changes are grouped by release. Each\n change provides a link to the file or files i...
[ { "docid": "2d488c64d59f217fe6d0c787999b291b", "score": "0.8146696", "text": "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "title": "" },...
babe69dc9369a7e38678ddf2ca3aa026
GET /phone_rentals GET /phone_rentals.json
[ { "docid": "a80bf0dd2a6815c5ee1cc7a8b24fb83e", "score": "0.731829", "text": "def index\n @phone_rentals = PhoneRental.all\n end", "title": "" } ]
[ { "docid": "a39fa138b5e60f9f1ee7b80e850f48e7", "score": "0.689544", "text": "def rental(rental, options = {})\n get(\"rentals/#{rental}\", options).pop\n end", "title": "" }, { "docid": "c63e286c33179c0223751e0614a9d6cf", "score": "0.6534219", "text": "def set_phone_renta...
7754adb602e0355d11e8bdebe4e83dd3
Retrieve details for all available cartridge URL: /cartridges
[ { "docid": "8f38746f0dac545a0f9daa13cbcc5640", "score": "0.69237226", "text": "def index\n searching = false\n carts = CartridgeType.all\n if name = params[:name].presence\n if (ComponentInstance.check_name!(name) rescue nil)\n carts = carts.order_by(:name => 1).where(name: name)\n ...
[ { "docid": "4490df7591424be6d127ab69bf7453d3", "score": "0.71684283", "text": "def cartridges\n if @cartridges.empty?\n require 'ballistics/cartridge'\n\n cartridge_file = CHAMBER_CARTRIDGE[@chamber] or\n raise(ChamberNotFound, @chamber)\n @cartridges =\n Ballistics::Cart...
b0a5cd1faef1af8c239f9c1db0bf2090
Miq Alarm methods. Only called from initialize.
[ { "docid": "e50b6895f23f61814eca8a6a8ba19d89", "score": "0.5429641", "text": "def miqAlarmSpecEnabled\n VimHash.new(\"AlarmSpec\") do |as|\n as.name = @miqAlarmName\n as.description = \"#{MIQ_ALARM_PFX} alarm\"\n as.enabled = \"true\"\n as.expression = VimHash.new(\"StateA...
[ { "docid": "2f2e17a31fed88f9b55f50983c2a828b", "score": "0.6829195", "text": "def setAlarms\n if !@config['basis'].nil? and @config[\"alarms\"] and !@config[\"alarms\"].empty?\n @config[\"alarms\"].each { |alarm|\n alarm_obj = MU::MommaCat.findStray(\n \"A...
670528496381ac7c0d35199ebb437397
Represents a parenttochild association between resources. Options to pass in are: class, path.
[ { "docid": "90b0c44b7852595111f5ea0f430f4947", "score": "0.0", "text": "def has(resource, opts = {})\n klass = get_class(opts.delete(:class)) || get_class(resource)\n associations[klass] = { :name => resource, :save => !!opts.delete(:save) }\n\n define_method resource do |*args|\n ...
[ { "docid": "f63469f74f3888c5950d6266db1fbf9a", "score": "0.7168253", "text": "def belongs_to(parent, options = {})\n case parent\n when Symbol, String then\n options = DEFAULT_NESTING_OPTIONS.merge(:key => key_name(parent)).merge(options)\n @parents << { :name => parent, ...
bc87f4ea155954599c93c48a971175dd
Initializes joiners based on joins, positions and columns Possible input forms are: joins:: "4=0;4=1" or "4=1" positions:: "1,2;4,5" or "1,2" columns:: "1,2;3,4" This has the semantic of 'insert columns 1 and 2 at positions 1 and 2 for key 0 and columns 3 and 4 at positions 4 and 5 for key 1. Key 4 is the corresponding...
[ { "docid": "c2e805a13196f6a663eac1fe50cad079", "score": "0.649868", "text": "def create_joiners(j, c, p)\n js = j.split(';').collect { |j| j.split('=').collect { |j| j.to_i } }\n cs = c.split(';').collect { |c| c.split(',').collect { |c| c.to_i } }\n ps = col_positions(p, cs)\n\n ...
[ { "docid": "4be5c863775e4d253adaca8546914be6", "score": "0.6634983", "text": "def create_lookup_table\n File.open(source).each_with_index do |line|\n next if line.chomp.empty?\n\n values = unstring(line).chomp.split(';')\n\n next if values.empty?\n\n @joiners.e...
a9e2793bba9363056b403f6256335e86
shift gameboard so upward diagonals can be checked with vertical_win?
[ { "docid": "47452420a9a565d1ba2df5d81583d5c9", "score": "0.73385686", "text": "def shift_gameboard_for_upward_diagonal_check(array)\n array[0].push('-', '-', '-', '-', '-')\n array[1].push('-', '-', '-', '-').unshift('-')\n array[2].push('-', '-', '-').unshift('-', '-')\n array[3].push('-', ...
[ { "docid": "a083850119f391929365f6c7474ce3e9", "score": "0.73388666", "text": "def upward_diagonal_win?\n temp_board_array = []\n (0..5).each { |row| temp_board_array[row] = board_array[row].dup }\n shift_gameboard_for_upward_diagonal_check(temp_board_array)\n make_transposable_by_padding_bo...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "8bd7b8ca4c08192bb154bf7530c2e358", "score": "0.0", "text": "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "title": "" } ]
[ { "docid": "4152fb6556ae83f7cdd6c362f17ad9bf", "score": "0.81046426", "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 ...
a14fcec400aa6d1d28d4e688dc90f594
Gets the positions that the user holds and caches the result. ldap_conn: the LDAP connection to use dn: the dn of the user to look up groups: the LDAP groups that the user belongs to, used for RTP and drink admin positions
[ { "docid": "0e7566f888ffa452068d9240bca20481", "score": "0.7576588", "text": "def get_positions(ldap_conn, dn, groups)\n Rails.cache.fetch(\"positions-#{dn}\", expires_in: @@cache_time) do\n Rails.logger.debug { \"Getting positions for #{dn}\" }\n positions = []\...
[ { "docid": "e351548a40fdc0d2bc37afd875aa76c7", "score": "0.59247833", "text": "def listUsers\r\n\r\n listOfUsers = Array.new\r\n\r\n conn = ActiveDirectoryUser.ldapConnect(Encryptor.decrypt(@loginName, :key => KEY_TO_LOGIN),\r\n Encryptor.decrypt(@passwd, :key => KEY_TO...
2c2a740ebf65a8bc77e28b0d7abcf46e
Construct hex representation of value
[ { "docid": "52b52f2060e81f9de9571f1c5b13a922", "score": "0.78707856", "text": "def to_hex(value, num_digits=4) \n s = sprintf(\"%x\", value)\n s.rjust(num_digits,'0')\nend", "title": "" } ]
[ { "docid": "b5402847fb692d7343b9f9e6e0be9a86", "score": "0.85832655", "text": "def hex\n \"%032x\" % @value\n end", "title": "" }, { "docid": "810846b0c64d9b6888556e32b11f2c54", "score": "0.8319375", "text": "def to_hex\n @value.to_s(16)\n end", "title": "" }, ...
b88d2df7c172bc288ac555253e0af4d3
Private: Builds a DelimitedTextInterface for a data set with the specified name in the current DataLib. data_set_name Name of the data set to build the interface for. Returns a DelimitedTextInterface.
[ { "docid": "ec9b2ac83d2e56b57ff36c3615ee2604", "score": "0.7560699", "text": "def interface(data_set_name)\n Interfaces::DelimitedTextInterface.new(self, data_set_name)\n end", "title": "" } ]
[ { "docid": "3159a5899df1fcf43086614bd147c16f", "score": "0.501084", "text": "def interface(data_set_name)\n Interfaces::CanonicalInterface.new(self, data_set_name)\n end", "title": "" }, { "docid": "f5c429f9a663626c5db64e5edf017b85", "score": "0.4900513", "text": "def cre...
465937711eeb2d9ac3eecbe60d35531d
PATCH/PUT /stores/1 PATCH/PUT /stores/1.json
[ { "docid": "a164f36cb0b823e9e4cc2810713999f7", "score": "0.6299633", "text": "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to admin_url, notice: 'Saved!' }\n format.json { render :show, status: :ok, location: @store }\n else\n ...
[ { "docid": "d1808f3b6ba09ca76ad929a87c3624bb", "score": "0.69691384", "text": "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to api_v1_store_path(@store.id), notice: 'Store was successfull...
4059218dba6307d038602b0b47f26ef2
Removes an item from the database, if it is indexed.
[ { "docid": "850cf7a4ae936911e64127f85b912b5f", "score": "0.6778081", "text": "def remove_item(item)\n return unless @items.key? item\n\n @items.delete item\n @version += 1\n end", "title": "" } ]
[ { "docid": "7ce7321c87c504c9ca7ad6a9f3e8bf30", "score": "0.69561946", "text": "def exist_index_remove_item(index_no)\n index_no -= 1\n @r_item = @items[index_no].description\n @items.delete_at(index_no)\n conf_message(@r_item, \"removed\")\n end", "title": "" }, ...
aac0225d2ba18bf508b550cb5fe87b18
PUT /upload_pictures/1 PUT /upload_pictures/1.xml
[ { "docid": "c28e61243615d5490bd56cadc3a557f1", "score": "0.6566786", "text": "def update\n @upload_picture = UploadPicture.find(params[:id])\n\n respond_to do |format|\n if @upload_picture.update_attributes(params[:upload_picture])\n format.html { redirect_to(@upload_picture, :notice =...
[ { "docid": "73c01a59208db203c608384d367194fa", "score": "0.6408735", "text": "def update\n @picture = Picture.find(params[:id])\n\n respond_to do |format|\n if @picture.update_attributes(params[:picture])\n format.html { redirect_to '/main', notice: 'upload' }\n format.json { he...
a4c5dbf61cdf6916964c3a93adbbecdd
DELETE /reconocimientos/1 DELETE /reconocimientos/1.xml
[ { "docid": "4cf41c535eb5955207e8dd586f6f8bac", "score": "0.0", "text": "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n usuario=@reconocimiento.usuario\n @reconocimiento.destroy\n respond_to do |format|\n format.html {}\n format.js do\n render :update do |...
[ { "docid": "df26116eb86dbadafed7137f9e3c2f9e", "score": "0.67968994", "text": "def delete!\r\n return nil unless exists? \r\n xml = xml_at_top\r\n par = xml.instance_variable_get(:@parent) \r\n par['delete'] = 'delete'\r\n xml_on_delete( xml )\r\n rsp = write_xml_config!( xml.doc...
49926a0e51059022b19af2b300651c21
POST /posts POST /posts.json
[ { "docid": "eefc4996c24f3ed5eb6cc7139d672e84", "score": "0.6300574", "text": "def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n ...
[ { "docid": "1696d5d4d22767f1a79db670670b4d3b", "score": "0.7446393", "text": "def create\n render json: Post.create(params[\"post\"])\n end", "title": "" }, { "docid": "deba9d8e3b025d0e293927ebdb81e62a", "score": "0.73227876", "text": "def create\n respond_with Post.create...
a6d83968466f70993afd26b0bc80ff91
Save this record. Will create new records and update old ones.
[ { "docid": "e9527ecfa26c45d7b1bacf620d8d93cc", "score": "0.72370154", "text": "def save\n new_record? ? create : update\n end", "title": "" } ]
[ { "docid": "1006f91880bb64ad45d72e27ef61231c", "score": "0.799187", "text": "def save\n self.new_record ? self.create : self.update\n end", "title": "" }, { "docid": "f27a15735ba40d0dd402789072cdaeba", "score": "0.7945172", "text": "def save\n record.save\n end", ...
899713749e7f15e06a690284e3975599
Determine whether body is magnetic.
[ { "docid": "8a6abb5c33e123d7fd20a8ed091efe2e", "score": "0.83204246", "text": "def is_magnetic?\n Body.validate(self)\n MSPhysics::Newton::Body.is_magnetic?(@_address)\n end", "title": "" } ]
[ { "docid": "77432797b1754dfbb2b676efd0d17462", "score": "0.8879788", "text": "def magnetic?\n MSPhysics::Newton::Body.is_magnetic?(@address)\n end", "title": "" }, { "docid": "77432797b1754dfbb2b676efd0d17462", "score": "0.8879788", "text": "def magnetic?\n MSPhysics::Ne...
7d603e796131a722e11c1195f53fe80e
fetches the applicable alerts from configuration
[ { "docid": "cf70a231ed32af95dd9be1250ff5b87b", "score": "0.0", "text": "def get_email_alert\n ((model_event == :create) ? email_alert_for_model_on_create : email_alert_for_model_on_update)\n end", "title": "" } ]
[ { "docid": "a8d86a7b82e6604fa3f38612894f7bf1", "score": "0.67505413", "text": "def get_alerts()\n command = Command.new(\n command: :GetAlerts,\n result: Types::GetAlertsResults,\n version: 2,\n parameters: {}\n )\n perform_operation(command)\n ...
c7066c4e9b36f4b6ecb53bd84c70d19a
The base URL the Sprocket environment is mapped to. This defaults to '/assets'.
[ { "docid": "eadc3b6d30f75425c81131190e1e2b6a", "score": "0.0", "text": "def prefix\n @prefix ||= '/assets'\n @prefix.is_a?(Array) ? \"/#{@prefix.first}\" : @prefix\n end", "title": "" } ]
[ { "docid": "49669d91d3200b82ff235afa32dcccdd", "score": "0.8182049", "text": "def asset_url\n \"#{base_url}#{configuration.urls.assets}\"\n end", "title": "" }, { "docid": "bdd8f72c19b72a361b542c7d206c21b8", "score": "0.81485254", "text": "def asset_base_url\n @asset_url...
2bc78519267860b1598a498e11121245
GET /logs/new GET /logs/new.json
[ { "docid": "50eb7c6428833e11d3b37c281696b75f", "score": "0.7397947", "text": "def new\n\t\t@log = Log.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @log }\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "1cddbf5a13d8bd6a35b7199a6c4afb0e", "score": "0.79102206", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", "title": "" }, { "docid": "d737990e1e24529aec3cc4f6fd0ef012", "score": "0.770927...
a226372a92528b36933d82ef075b9437
FIXME_KD: Use named options while creating sql. OR you can use joined_on_or_before(date) and relieving_on_or_after(date) Fixed
[ { "docid": "416958e197ba4a4fcf4f96473d0d4dd3", "score": "0.0", "text": "def relieve(replacement_team_lead_id, new_relieving_date)\n if subordinates.any? && replacement_team_lead_id.blank?\n errors.add(:base, \"You must provide new team leader for the subordinates.\")\n elsif new_relieving_dat...
[ { "docid": "84e27e2db51600f799de9f3b16966471", "score": "0.65607285", "text": "def date_clause(table, field, from, to)\n s = []\n s << (\"#{table}.#{field} > '%s'\" % [connection.quoted_date((from - 1).to_time.end_of_day)]) if from\n s << (\"#{table}.#{field} <= '%s'\" % [connection.quote...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "181ef4f574fcf63c8eee0a3ae88c3633", "score": "0.0", "text": "def review_params\n\t\tparams.require(:review).permit(:heading, :review, :book_id, :user_id, :status, :cover_page)\n\tend", "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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "749757909ccbf720eb82e74c7bf155d2", "score": "0.0", "text": "def set_distance_sample\n @distance_sample = DistanceSample.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6031952", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015048", "text": "def...
e7144cd246a2d79060761b4103b0195c
DELETE /tipo_propiedads/1 DELETE /tipo_propiedads/1.json
[ { "docid": "91b9f9b978199e5a1733555fe308dfab", "score": "0.72902113", "text": "def destroy\n @tipo_propiedad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_propiedads_url, notice: 'Tipo propiedad was successfully destroyed.' }\n format.json { head :no_content }\n en...
[ { "docid": "4f4ac3c1cc1da6a602165a401c9219cc", "score": "0.7164256", "text": "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\...
f4c62657d5029ccba1e6f5290a51412c
Moves the target to the grid closest to the mouse in the first grid Only recalculate_searchess the search if the target changes position Called whenever the user is editing the target (puts mouse down on target)
[ { "docid": "ba4e537c6311dd73b961273c844ca41d", "score": "0.69565785", "text": "def process_input_bfs_target\n old_target = grid.target.clone\n unless bfs_cell_closest_to_mouse == grid.star\n grid.target = bfs_cell_closest_to_mouse\n end\n unless old_target == grid.target\n recalcul...
[ { "docid": "3978566238089aae65605a16d857ccb8", "score": "0.7505602", "text": "def process_input_greedy_target\n old_target = grid.target.clone\n unless greedy_cell_closest_to_mouse == grid.star\n grid.target = greedy_cell_closest_to_mouse\n end\n unless old_target == grid.target\n ...
31db2941167d44821b751492123ab4f9
DELETE /diymenus/1 DELETE /diymenus/1.json
[ { "docid": "6d045ad480d2783f3519d98d5a2ac613", "score": "0.72525775", "text": "def destroy\n @diymenu.destroy\n respond_to do |format|\n format.html { redirect_to diymenus_url, notice: 'Diymenu was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title...
[ { "docid": "dae57e1a7ba55850b06486da41e9c34b", "score": "0.7564345", "text": "def destroy\n @diymenu = Diymenu.find(params[:id])\n @diymenu.destroy\n\n respond_to do |format|\n format.html { redirect_to diymenus_url }\n format.json { head :no_content }\n end\n end", "title": "...
d65ed967fe9a1b72174d6f39595f6b49
get stats return value can be used to get ["currentjobsready"] or ["currentjobsreserved"]
[ { "docid": "f8158164af0db74cd140b74432ecc5f3", "score": "0.6285088", "text": "def stats\n unless @queue\n return {}\n end\n\n @queue.stats()\n end", "title": "" } ]
[ { "docid": "ea0f5f99ef8a2188931c34e4ead3708e", "score": "0.7424783", "text": "def stats\n beanstalk.stats.select{|k,v| k =~ /jobs/}\n end", "title": "" }, { "docid": "5307aa4345e1ec6f3e11be3405ae4c66", "score": "0.7302252", "text": "def current_jobs\n beanstalk.\n ...
a65b88c79e01b72c05f4cb0df792a54b
Update fields from XML file in storage.
[ { "docid": "4ae503a7b6d65016ee55e062fb927025", "score": "0.5345897", "text": "def put_import_fields_from_xml_in_storage_with_http_info(name, xml_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_import_fields_from_xml_in_stora...
[ { "docid": "72e82d7ec492ddf8636d30489086a97c", "score": "0.64855355", "text": "def update_info_from_file()\n @ole.UpdateInfoFromFile()\n end", "title": "" }, { "docid": "2ba2d6d766eaec2ef666f84eeb142c60", "score": "0.63965064", "text": "def update\n connection.put(elem...
8fc0c7b3a2098e173e15ecbc3ec66685
checks if row is valid
[ { "docid": "232a87470e5932f8bd5c1d1c6425576f", "score": "0.6786643", "text": "def valid_row?(row)\n valid_row = get_valid_sudoku\n row.each do |char|\n if valid_row[char]\n valid_row[char] -= 1\n if valid_row[char] < 0\n return false\n end\n end\n end\n return true\nend",...
[ { "docid": "21335a4815769e2ac4a6b08e47512dfa", "score": "0.8835907", "text": "def valid_row?\n true\n end", "title": "" }, { "docid": "1d65cddfdc90567fc30f47a6a9213d71", "score": "0.7536739", "text": "def if_valid_rows(*rows)\n rows_exist = !rows.include?(nil)\n row...
1f69311e2e10ca54c71677b4ef21a389
Delete the given +extension_name+ for +vmname+. DELETE
[ { "docid": "cde82771cb39e871e8d808c33b8a4846", "score": "0.8836858", "text": "def delete(vmname, extension_name)\n url = @uri + \"/#{vmname}/extensions/#{extension_name}?#{api_version}\"\n url\n end", "title": "" } ]
[ { "docid": "c571ab8edf229fe7eb68ada8fd601bfd", "score": "0.7533163", "text": "def delete(vm_name, ext_name, rgroup = configuration.resource_group)\n raise ArgumentError, \"no resource group provided\" unless rgroup\n url = build_url(rgroup, vm_name, ext_name)\n response = rest_delet...