query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7e14aba2a919aff204631dd8a6b2e18d
2 Declarar el procesamiento Menu
[ { "docid": "f8b2be5344cd16a8d011a3bb603f3505", "score": "0.0", "text": "def welcome_message(message)\n puts message\nend", "title": "" } ]
[ { "docid": "ae720af357ce3809866f4492d121d2a9", "score": "0.7771057", "text": "def menu\n\n end", "title": "" }, { "docid": "c9e6df62a165a56ec2277e67a7957bd3", "score": "0.7633731", "text": "def menu\n\tend", "title": "" }, { "docid": "897f00178b24efcaaa568d2e4cbd5568",...
956ee590426da708e018a40e68d0d00e
Add product to all products or raise error if such product is already in the list
[ { "docid": "7cc572590810ad38bb4c08ee2065246d", "score": "0.83348674", "text": "def add_to_products\n \t@@products.each do |product|\n \traise DuplicateProductError, \"#{@title} already exists.\" if product.title == @title\n end\n \t@@products << self\n end", "title": "" } ]
[ { "docid": "c6e66ef2908aae28c0cffe9f20efc8f6", "score": "0.81403446", "text": "def add_to_products()\n \t#we validate if we have products in the array, if so we check if the product\n \t#that we want to add is already there\n if @@products.count >0\n begin\n \tif Product.product_include_b...
eef70e6f97423c1331dcb30303b856d2
Time Complexity: O(n) because we will always need to go throught ALL nodes Space Complexity: O(n) because we will always need to go throught ALL nodes
[ { "docid": "43ffd09c02ce8f1f8dc4ed16bf4d134c", "score": "0.0", "text": "def height\n return 0 if @root == nil\n return 1 if @root && (@root.left == nil && @root.right == nil)\n height_helper(@root, 0)\n end", "title": "" } ]
[ { "docid": "db164f851d648f0b4a6b7afbc95323cd", "score": "0.6294565", "text": "def visit_nodes(node)\n return if node.blank?\n if node.respond_to?(:each) # e.g. a list of nodes from a has_many association\n node.each { |n| visit_nodes(n) }\n else\n class_name = node.class.nam...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0baecdfa2ae3c3db996563c90a75285c", "score": "0.0", "text": "def article2_params\n params.require(:article).permit(:name, :category_id, :image, :descript, :create_time)\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...
0c9ece2d7c012a74aecab7b635212c35
Finds the User with the ID stored in the session with the key :current_user_id This is a common way to handle user login in a Rails application; logging in sets the session value and logging out removes it.
[ { "docid": "0a531bd4b50c442477a0701f172bdf17", "score": "0.0", "text": "def current_user\n @_current_user ||= session[:current_user_id] && User.find_by_id(session[:current_user_id])\n end", "title": "" } ]
[ { "docid": "bd908b13b3f3fe0d3050959e6fee3b6b", "score": "0.8189361", "text": "def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n # setting variable to nil solves the issue we would have when logging out\n # where it cant find a user an e...
79ab2d957118257a5c90f4ff040292d8
manages the start cli command
[ { "docid": "492ba161b04039d27b06997d26ce6692", "score": "0.0", "text": "def start\n\n # prepare config\n config = {}\n begin\n config = YAML::load_file(CONFIG_FILE)\n rescue Exception => e\n load 'lib/cogbot/setup.rb'\n config['main'] = Cogbot::Setup.init\n ...
[ { "docid": "d47d020626f6ee41f0d0d1a6e0171868", "score": "0.75563985", "text": "def cli; end", "title": "" }, { "docid": "d47d020626f6ee41f0d0d1a6e0171868", "score": "0.75563985", "text": "def cli; end", "title": "" }, { "docid": "d41df262e17457fc4ff785d0642c5fe7", "sc...
9e100fd38709833fdff20506431556c0
PATCH/PUT /elevens/1 PATCH/PUT /elevens/1.json
[ { "docid": "3a62646758e9befd6a19a38d92f64ff4", "score": "0.6387548", "text": "def update\n respond_to do |format|\n if @eleven.update(eleven_params)\n format.html { redirect_to @eleven, notice: 'Eleven was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ { "docid": "869afac9ddca69e582caa22a1a126456", "score": "0.6523766", "text": "def update\n respond_to do |format|\n if @eveent.update(eveent_params)\n format.html { redirect_to @eveent, notice: 'Eveent was successfully updated.' }\n format.json { head :no_content }\n else\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "04f3e040217c061d4dd135bd5eb01fbc", "score": "0.0", "text": "def set_country\n @country = Country.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;...
6787597ed9fe1f36fa93c4904b1ce266
/galleryphoto/id photo from id
[ { "docid": "8b5879f00a2cc8bb80a33e9244242a51", "score": "0.78060436", "text": "def find(id, *args)\n path = \"galleryphoto/#{id}\"\n Rdigg.fetch(path, @@type, args)\n end", "title": "" } ]
[ { "docid": "2eb2a2ccd1af12e64aeabd76f623a4c8", "score": "0.76440054", "text": "def find_photo\n @photo = GalleryPhoto.find(params[:id])\n end", "title": "" }, { "docid": "728300e61a0c2cec1a22ebe8afdc4b0e", "score": "0.74528724", "text": "def client_gallery_image\n #Get the pho...
57d26b108bac4be986c40de5ba645a48
supplies payment and control information to a provider for a particular service
[ { "docid": "c880e444c35474cd5c1820caca19c80d", "score": "0.65723467", "text": "def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedur...
[ { "docid": "da366e787b6347bd7cca5aa7e1d665f8", "score": "0.6755701", "text": "def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)\n @service = @service.nil?? service : @service\n ['SVC', composite_med_proc_id, @service.amount('service_procedure_char...
decc11a4b3930b38a4bfee256ea1d8f8
reduce 719 omitted reduce 720 omitted
[ { "docid": "605fdeb007f99d6c3aa85fc08762861b", "score": "0.0", "text": "def _reduce_721(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n ...
[ { "docid": "5d54341fb90a0c63c354c3d68463fbf9", "score": "0.7042332", "text": "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "dd458ee5bd7f974c08686357ef463ece", "score": "0.7021443", "text": "def _re...
0c74d52f109d2d92bfbd38f3bf2ab3fd
POST /turnos POST /turnos.json
[ { "docid": "2ce61e2215f4e4052be99d482d0ec263", "score": "0.5371876", "text": "def create\n @turno = Turno.new(turno_params)\n @turno.update(taller_id: current_taller.id)\n\n respond_to do |format|\n if @turno.save\n format.html { redirect_to @turno, notice: 'Turno was successfully c...
[ { "docid": "d18081d46c54be5ddbf0e8fa16831d16", "score": "0.675073", "text": "def create\n @turno = Turno.new(params[:turno])\n\n respond_to do |format|\n if @turno.save\n format.html { redirect_to @turno, notice: 'Turno was successfully created.' }\n format.json { render json: @...
7945538e90ea7a34f5213dccb4751168
Insert a document into the collection. Also inserts the document's key into the key list set.
[ { "docid": "90ecdd08e65b000ec83cf2168f4c77d6", "score": "0.7724752", "text": "def insert(document)\n doc_key = super\n self.add_key(doc_key)\n doc_key\n end", "title": "" } ]
[ { "docid": "06277e28ddaf734a43b9a9cdd51244e0", "score": "0.76883996", "text": "def insert(document)\n @key_vault_collection.insert_one(document)\n end", "title": "" }, { "docid": "239fb5762eac3272355cb053b7e4c2fb", "score": "0.74360484", "text": "def insert\n if do...
a65d52ef8d1e29be78e423374e1da388
iqmp == coefficient e == public exponent n == modulus d == private exponent p == prime1 q == prime2 dmq1 == exponent2 dmp1 == exponent1
[ { "docid": "2683efc0382ef8fc9c67f8c8f0821e4a", "score": "0.0", "text": "def test_can_generate_rsa_key\n OpenSSL::PKey::RSA.generate(512)\n end", "title": "" } ]
[ { "docid": "20ac3e114820bdd22163ec8018b66ceb", "score": "0.7000471", "text": "def powermod(x, n, q); end", "title": "" }, { "docid": "9a2ae8b05f2e42b176feb183f28738d9", "score": "0.6783334", "text": "def get_d(p,q,e)\n # From wiki: The extended Euclidean algorithm is particularly us...
e5fd6809f4b034d448aea9dd49486213
Runs Open3 for the commad, returns exit status. Restarts command a few times if fails to run
[ { "docid": "cd11175dd162e5949f732504ddac82d2", "score": "0.71107", "text": "def runOpen3StuckPrevention(*cmd_and_args, errorPrefix: '', redError: false, retryCount: 5,\n stuckTimeout: 120)\n\n onError 'Empty runOpen3 command' if cmd_and_args.empty?\n\n if !File.exist?(cmd_an...
[ { "docid": "497d6b05f6327af5fc6e66f39f68b897", "score": "0.7502817", "text": "def runOpen3(*cmd_and_args, errorPrefix: '', redError: false)\n # puts \"Open3 debug:\", cmd_and_args\n\n onError 'Empty runOpen3 command' if cmd_and_args.empty?\n\n if !File.exist?(cmd_and_args[0]) || !Pathname.new(cmd_and...
6fe1fefc7acc49991c5f6c0979f8d1d1
Get the vm_id of this host
[ { "docid": "4cac0829e6ddeb7d8de6c9f4dfedf21f", "score": "0.64059126", "text": "def current_vm_id\n not_implemented(:current_vm_id)\n end", "title": "" } ]
[ { "docid": "fc32c56397f3ef8189a6ae536ad2d2b3", "score": "0.7117658", "text": "def host_id\n host.id if host\n end", "title": "" }, { "docid": "19da6b5414fdae167829bd83f8570e3e", "score": "0.70649123", "text": "def host_id\n host.id \n end", "title": "" }, { "d...
8d63935b547a7aea5c0a39fd736ae653
Calculates the Word Characters Frequency Target Scores (WCFBS) for a particular entry.
[ { "docid": "1d6de215c5a3d163ed5bb161761eb3a6", "score": "0.8041252", "text": "def calculate_wcfbs(target_word, bse_char_scrs)\n scores_sum = 0.0\n return scores_sum if target_word.nil?\n char_arr = target_word.entry.scan(/./)\n char_arr.each { |entry| scores_sum += cfils_score(entry, bse_char_scrs) ...
[ { "docid": "769dc5015d833de07b78cb7d5baba79e", "score": "0.71976346", "text": "def calculate_word_frequency ()\n @word_frequency = Hash.new(0)\n @content.split.each do |word|\n @word_frequency[word.downcase] += 1\n if @highest_wf_count < @word_frequency[word.downcase]\n @highest_w...
61f1e4788804cb4f3cbabe403f898aad
Add a value to a node of a linked_list def add(value)
[ { "docid": "9fad2b6268ac51133b3782f6120ab6ad", "score": "0.0", "text": "def reverse_list(head)\n return head if head == nil or head.next_node == nil\n\n new_head = reverse_list(head.next_node)\n head.next_node.next_node = head\n head.next_node = nil\n return new_head\n end", "title":...
[ { "docid": "1f94e92efe7ff30208cb9eb5d66dc18a", "score": "0.878508", "text": "def add(value)\n current_node = @head\n while current_node.next != nil\n current_node = current_node.next\n end\n current_node.next = Node.new(value, nil, current_node)\n end", "tit...
b4a700f28bcb39a6d46c39beeeffc0d4
PUT /edus/1 PUT /edus/1.json
[ { "docid": "dbe5f5363180b73bfe5c051c3b33a3c5", "score": "0.6154945", "text": "def update\n @edu = Edu.find(params[:id])\n\n respond_to do |format|\n if @edu.update_attributes(params[:edu])\n format.html { redirect_to @edu, notice: 'Edu was successfully updated.' }\n format.json ...
[ { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.6586725", "text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['desc...
3bc0eda16329773b7653fc7e15af58aa
might be in array or hash from from dockercompose
[ { "docid": "67951ed4c91468887b3a1039c6974fa6", "score": "0.0", "text": "def env_to_hash(environment)\n return environment if environment.is_a?(Hash)\n\n environment.to_h { |v| v.split(\"=\", 2) }\n end", "title": "" } ]
[ { "docid": "eb8670a31d051dc2bc37b0496afca0b0", "score": "0.60531735", "text": "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "title": "" }, { "docid": "63c800fc2488d61be2e45ef12...
a0a3cf4b39f9d7295297224096e5e527
GET /ventaunidads/1 GET /ventaunidads/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "397753e4473df4d73e604f5001dc8ac7", "score": "0.70217156", "text": "def index\n render json: @ads = Ad.all\n end", "title": "" }, { "docid": "be19c2173d10cd6028819c12f100d511", "score": "0.6899851", "text": "def show\n @ad = Ad.find(params[:id])\n\n render json: ...
0beab8312e84698f103b63c64d405d4a
GET /blogs GET /blogs.json
[ { "docid": "5c7e69d00e66b426e4dbfb45713e1089", "score": "0.0", "text": "def index\n if params[:search_inputs].present?\n @search_inputs = OpenStruct.new(params[:search_inputs])\n else\n @search_inputs = OpenStruct.new(model: \"Blog\")\n end\n @records = Search.new(@search_inputs).s...
[ { "docid": "07f973645e0e4ed1d926b804ac1f3cb6", "score": "0.7926349", "text": "def index\n @blogs = Blog.all\n render json: @blogs\n end", "title": "" }, { "docid": "5dea84b18dd26997d80ed5abe57af1ba", "score": "0.788539", "text": "def index\n @blogs = Blog.all\n\n ...
aa05e0bcc461134b512da0a1af0d3ded
Draws the current buffer to the screen.
[ { "docid": "9ae9fbd1834bfcbc913c548bf46bd0c5", "score": "0.7978071", "text": "def draw_buffer\r\n puts @buffer.map { |b| b.join }.join( \"\\r\\n\" )\r\n end", "title": "" } ]
[ { "docid": "c26e4de0e53f2fd67236066bf5f17530", "score": "0.76745963", "text": "def draw\n @screen_buffer.each do |buffer_x|\n line_buffer = \"\"\n buffer_x.each do |char_sprite|\n if char_sprite != :empty\n line_buffer << char_sprite\n else\n line_buffer << \...
1835ade1c1e00fad8ac75035b195c7dc
DELETE /sulabh_offer_statuses/1 DELETE /sulabh_offer_statuses/1.json
[ { "docid": "88efaf556cf16d31004ff195cc24e673", "score": "0.7748607", "text": "def destroy\n @sulabh_offer_status.destroy\n respond_to do |format|\n format.html { redirect_to sulabh_offer_statuses_url, notice: 'Sulabh offer status was successfully destroyed.' }\n format.json { head :no_co...
[ { "docid": "56a59b0efad2ac81717ba707df6174f7", "score": "0.6998249", "text": "def destroy\n @sale_offer_status = SaleOfferStatus.find(params[:id])\n\n respond_to do |format|\n if @sale_offer_status.destroy\n format.html { redirect_to sale_offer_statuses_url,\n ...
019ca4303ee55fc412b94416f8d6ef74
Checks if there is a usable versionpython already installed
[ { "docid": "52db22008fcd5853417d5f87cc653b6d", "score": "0.7830127", "text": "def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end", "title": "" } ]
[ { "docid": "9b8949f21b1d0b11721474b7f08d2a5e", "score": "0.7752465", "text": "def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_pyth...
b9fe524497d715e4facea8b10336cf25
GET /gynecologic_examinations/1 GET /gynecologic_examinations/1.json
[ { "docid": "3fcca3d4ffa12fdbbf877cc7c4b16021", "score": "0.67141306", "text": "def show\n @gyn_exam = GynecologicExamination.find(params[:id])\n @patient = @gyn_exam.patients.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gyn_exam }\n e...
[ { "docid": "7a71d2349cd921f37fd10073ab171f09", "score": "0.7201549", "text": "def show\n @gyn_exam = GynecologicExamination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gyn_exam }\n end\n end", "title": "" }, { "...
b64e211f7a353e02ffc227dca49e2707
Helper function to upload collections of rdf
[ { "docid": "9778f2489a1028b353c8bd4fde1adc1c", "score": "0.6793894", "text": "def upload(base)\n collection = Pho::RDFCollection.new(STORE, base)\n puts \"Uploading from to #{STORENAME} from #{base}\"\n collection.store()\n puts collection.summary() \nend", "title": "" } ]
[ { "docid": "e26a249e9907a00b6ee6acf4f309a93c", "score": "0.5893124", "text": "def uploadFolder(folder,foldersync,googlefolder)\n puts \"Feature Pending\"\n #Create the collection\n #uploadFile(file)\nend", "title": "" }, { "docid": "953d602510975af35c75e221011f3c75", "score": "0.58524...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0fb9e3e8027c57c8b20f5ad08fecd64e", "score": "0.0", "text": "def set_cite\n @cite = CfCite.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;...
0a630b776b5be42f2c9b168bc3a67240
DELETE /customers/1 DELETE /customers/1.json
[ { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.7429404", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "93d388920d3b2a8503a9842b3c29b282", "score": "0.748921", "text": "def delete(options = nil)\n request = Request.new(@client)\n path = \"/customers/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "907b30dff2a79537695592eb6555a421", "score": "0.0", "text": "def update!(**args)\n @header = args[:header] if args.key?(:header)\n @mutation_result = args[:mutation_result] if args.key?(:mutation_result)\n end", "title": "" } ]
[ { "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...
cc980eaa540a5372caf03b7d0f22d028
Get the original of a specific MS Office document in a course with GET /courses/:course_id/msOfficeDocuments/:ms_office_document_id/originalDocument using OAuth2 as a student, teacher or teaching assistant.
[ { "docid": "4e4a6143e12ff1b0f55fc885c7fcc3b5", "score": "0.8886672", "text": "def get_ms_office_document_original(course_id, ms_office_document_id)\r\n relative_url = PATH_COURSES_MSOFFICEDOCUMENTS_ORIGINALDOCUMENT % [course_id,\r\n ...
[ { "docid": "812b04b02de1be55954b344ea1577740", "score": "0.69176054", "text": "def get_ms_office_document(course_id, ms_office_document_id)\r\n get(PATH_COURSES_MSOFFICEDOCUMENTS_ % [course_id, ms_office_document_id])\r\n end", "title": "" }, { "docid": "d896d19ce8975359d9b8e7ddaeecd...
f0160834dfc4c0764b46652792e71d18
this method scans the array for all unmarked flags and returns true if all flags are marked, and false if any flag is unmarked. note that it goes thru the entire array looking for all unmarked flags and it doesn't just return upon the first unmarked flag
[ { "docid": "91d5befbcbaa97471659fcfe5038b449", "score": "0.6939786", "text": "def scan\n result = true\n 1.upto(@list.size-1) do |i|\n if (@list[i] == false)\n # puts(\"Entry #{i} unmarked\")\n result = false\n end\n end\n\n result\n end", "title": "" } ]
[ { "docid": "833a7cbda0c41e3f9bb3a63c43c2b0ec", "score": "0.6579023", "text": "def flagged?\n !(%w(flagged) & flags).empty?\n end", "title": "" }, { "docid": "5e64009c3c24ce5ef0c9d3d46725bde5", "score": "0.6518159", "text": "def flagged?\n !self.flags.empty?\n end", "t...
4b498d9f8c7d02cbaba3c212d2ad1401
PUT /dependent_representatives/1 PUT /dependent_representatives/1.xml
[ { "docid": "9a0c74426720810006972051bb7b351f", "score": "0.7126497", "text": "def update\n @dependent_representative = DependentRepresentative.find(params[:id])\n\n respond_to do |format|\n if @dependent_representative.update_attributes(params[:dependent_representative])\n flash[:notic...
[ { "docid": "e388272f78c28788862f99f0b776b7f4", "score": "0.62520325", "text": "def destroy\n @dependent_representative = DependentRepresentative.find(params[:id])\n @dependent_representative.destroy\n\n respond_to do |format|\n format.html { redirect_to(dependent_representatives_url) }\n ...
e8efb5af6b838eacc97913f4a2f8c060
write in file the product name, price, thumbnail, container, amount of alcohol, and price of alcohol
[ { "docid": "03ba60cb39ef61e60086ac1a537f51b9", "score": "0.7518211", "text": "def add_product(prod)\r\n\t\t@file.write \"\\n#{prod.name_of_product}* #{prod.price_of_product}* \" +\r\n\t\t\"#{prod.product_thumbnail}* #{prod.amount_of_product}* #{prod.amount_of_alcohol}* \"+\r\n\t\t\" #{prod.price_of_alco...
[ { "docid": "5f537b2cf8e75b66a258db5564ebc82d", "score": "0.7013618", "text": "def write_to_csv price,title,pic,cleantitle\n\t\t\t\t\tif price[1] != nil && title[1] != nil && pic[1] != nil && cleantitle != nil\n\t\t\t\t\t\tputs pricetag = price[1].gsub(/<\\/?[^>]*>/, \"\")\n\t\t\t\t\t\tpricetagint = pric...
7e650d6dc9ac3bad449375cdf64f4c5e
GET /music_groups/1 GET /music_groups/1.json
[ { "docid": "6ad46c6f1d2981bb925880a9d69d691d", "score": "0.7763144", "text": "def show\n @music_group = MusicGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music_group }\n end\n end", "title": "" } ]
[ { "docid": "d0058539cf74bfd5cccddbb49095f847", "score": "0.7444004", "text": "def groups\n fetch('music.hiphop.groups')\n end", "title": "" }, { "docid": "9799ce5d085fa5af105551bf463f9da9", "score": "0.7133827", "text": "def index\n @audios = if params[:group_id]\n...
a40f81b5a4d74c68e1045f8b0906f3fc
Gets all compute instances, instances must be filtered by the specified filter, filter (if set) must contain an Occi::Core::Mixins instance. Returned collection must contain Occi::Infrastructure::Compute instances wrapped in Occi::Core::Resources.
[ { "docid": "a8c4746d18e670a6ae542ff43ea41f89", "score": "0.6392519", "text": "def compute_list(mixins = nil)\n ###\n # To fill in the required collection, create\n # instances of the Occi::Infrastructure::Compute class and place\n # them in a fresh Occi::Core::Resources insta...
[ { "docid": "d2b12fa2dbf21fbb08891ca8c375922f", "score": "0.6652785", "text": "def compute_list(mixins = nil)\n # TODO: impl filtering with mixins\n compute = Occi::Core::Resources.new\n backend_compute_pool = ::OpenNebula::VirtualMachinePool.new(@client)\n rc = backend_comput...
a1eee2a3d9a84269ec812f0e7930a682
Resets all attributes to default values
[ { "docid": "d844fae46e4ba56d134aa43247a65bf5", "score": "0.0", "text": "def reset\n self.username = DEFAULT_USERNAME\n self.password = DEFAULT_PASSWORD\n self.uri = DEFAULT_URI\n self.api_version = DEFAULT_API_VERSION\n self.auth_type = DEFAULT_AUTH_TYPE\n\t self.project = nil\...
[ { "docid": "b5e6fdc871435d5bb97f64ced056d9bc", "score": "0.8389491", "text": "def reset\n DEFAULTS.each { |attr, value| instance_variable_set(\"@#{attr}\", value) }\n end", "title": "" }, { "docid": "b4af5d0628ae72f280ad1321248b95be", "score": "0.8054851", "text": "def cl...
db3776457eed4f5e5135f3cb0abd7493
builds the path to the associated collection based on the has_many reflection
[ { "docid": "c65d686f3eb56550bd122787449828f0", "score": "0.71993345", "text": "def association_path(reflection)\n prefix = self.class.prefix\n collection_name = self.class.collection_name\n member_id = URI.parser.escape id.to_s\n extension = reflection.kl...
[ { "docid": "6f78e9be0ab66553dda04780bfbf69a7", "score": "0.6851167", "text": "def path\n @association.generate_path(:with_parent => true)\n end", "title": "" }, { "docid": "1016431146fe609baa61842a06350fec", "score": "0.6510888", "text": "def path(document)\n Mongo...
c4eabd629e255d70309bf8febd73a734
Customer visits to sign up and save card details
[ { "docid": "8d418d813849de26644bd6acf914a35f", "score": "0.0", "text": "def new_customer\n @org = Organisation.find_by(permalink: params[:organisation_id])\n @customer = Customer.new\n\n Stripe.api_key = ENV[\"STRIPE_SECRET_KEY\"]\n end", "title": "" } ]
[ { "docid": "3cfa4d9b9b3fa597c8e7306e3ff692ea", "score": "0.67174685", "text": "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "title": "" }, { "docid": "e39f20bd22f34801a6e9173b0b41a4ae", "score": "0.66704625", "text": "def ca...
a2c33a114acd3e3d4ca57171557e3118
require 'yaml' GET /google_sheets GET /google_sheets.xml
[ { "docid": "76148b35cad751b63cf94a138e1ab59e", "score": "0.64250046", "text": "def index\n @google_sheets = GoogleSheet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @google_sheets }\n end\n end", "title": "" } ]
[ { "docid": "8294fc5954e1d6df02336964befe9617", "score": "0.62269235", "text": "def spreadsheets\n contents_url = concat_url(@collection_feed_url, \"/contents\")\n header = {\"GData-Version\" => \"3.0\", \"Content-Type\" => \"application/atom+xml\"}\n doc = @session.request(:ge...
d7ec4c4d57b6352b0636f073ebd2d573
olympic_data = get_all_olympic_athletes('../data/athlete_events.csv') p total_medals_per_team(olympic_data)
[ { "docid": "bad9c4a96151c71cc2bcba758aeea79f", "score": "0.62788254", "text": "def get_all_gold_medalists(olympic_data)\n gold_arr = []\n olympic_data.each do |athlete|\n if athlete[\"Medal\"] == \"Gold\"\n gold_arr << athlete\n end\n end\n return gold_arr\nend", "title": "" } ]
[ { "docid": "9f136a8f6fd62da711658e2ec0e5a372", "score": "0.8358188", "text": "def total_medals_per_team(olympic_data)\n\n teams_medals = get_all_olympic_athletes(olympic_data).group_by { |athlete| athlete[\"Team\"] }.map { |k, v| [k, v.size] }.to_h\n\n return ap teams_medals\nend", "title": "" }...
433bf358198b6785d688acd1cfacc0c6
Override Thread.new to prevent threads being created if there isn't runtime support for it
[ { "docid": "b80db916fca76713fadaac14183251f0", "score": "0.6995929", "text": "def new(*args,&block)\n unless defined? @_rubycocoa_threads_allowed then\n # If user has explicilty disabled thread support, also disable the \n # check (for debugging/testing only)\n @_rubycocoa_thre...
[ { "docid": "4879b6ae0d37f0a5c7274cc3a35e128f", "score": "0.6906716", "text": "def allowing_other_threads; end", "title": "" }, { "docid": "bc4d776256b5adb6444b94119fa98ad1", "score": "0.66781485", "text": "def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_o...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7226f883a67fee87e61af597bf4f65c2", "score": "0.0", "text": "def director_params\n params.require(:director).permit(:coddr, :nombre, :password)\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...
e97ca522138e431b779518c75c7e3577
this function sorts files from dirs, returning array with dirs first, then files
[ { "docid": "c28ca663de00a2cde5a3a1b6eee01e10", "score": "0.826712", "text": "def sortFilesFromDirs array, dir #array is elements in current directory: dir\n\n #temp arrays to hold files vs dirs\n dirs = Array.new\n files = Array.new\n\n array.each do |elem|\n\n #path to current entity i...
[ { "docid": "dcaeb60e8a096140efc0cea5256b3bc6", "score": "0.7437747", "text": "def sort!\n #N Without this, the immediate sub-directories won't get sorted\n dirs.sort_by! {|dir| dir.name}\n #N Without this, files contained immediately in this directory won't get sorted\n files.sort_by...
3bfffb18b8d96cbfa535cd3225e6fd18
Based on the entity link content, also create a user link record.
[ { "docid": "0b154a48a1ca5b7de31ecb077e634ed0", "score": "0.77845466", "text": "def createUserLinkData(entityLink)\r\n userLink = BotListUserLinks.new\r\n if !entityLink.userId.nil?\r\n userLink.userId = entityLink.userId\r\n userLink.linkId = entityLink.get_id\r\n return userL...
[ { "docid": "053f7ed5041e3b2ead5e01f3b118901e", "score": "0.71331954", "text": "def create_link\n link = Link.new(:organisation_id => self.id)\n link.set_user_creator(user_id)\n link.save!\n end", "title": "" }, { "docid": "05c235158358dcf799342bb3ea4a9eeb", "score": "0.6748132"...
975a830017e0ab4ceeaa88a427ee27fb
Constructs a new instance.
[ { "docid": "5e623d9f64380a21fa3b83b7a4c6d044", "score": "0.0", "text": "def initialize(value, unknown = nil)\n super(self.class.binding_type, value, unknown)\n end", "title": "" } ]
[ { "docid": "e2b31d60b2b5b380040a867c381a1b70", "score": "0.8045547", "text": "def new\n \n end", "title": "" }, { "docid": "e2b31d60b2b5b380040a867c381a1b70", "score": "0.8045547", "text": "def new\n \n end", "title": "" }, { "docid": "e2b31d60b2b5b380040a867c381a1b70...
45126a61131df03dee7d1752d902fe1d
List ServicePlans for ServiceOffering Returns an array of ServicePlan objects
[ { "docid": "bb93ac2bf9780ddd59b1f8a37116469e", "score": "0.58166564", "text": "def list_service_offering_service_plans_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceOfferingApi.list_service_offering_service_plans ...'\n...
[ { "docid": "7397fbaee4f3ee08aa6df6bd515bd0da", "score": "0.7031988", "text": "def list_service_offering_service_plans(id, opts = {})\n data, _status_code, _headers = list_service_offering_service_plans_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "faabbcbebd...
5d72133a671bac7438b44ee87de70913
Checks if the type of the field is `FLOAT`.
[ { "docid": "8522b80eb588d6962ed1108f918612e4", "score": "0.8395093", "text": "def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end", "title": "" } ]
[ { "docid": "66253a0baafea49680e4a9afdaf7283b", "score": "0.85790896", "text": "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "title": "" }, { "docid": "1f3bcb9c9c1deebdd6e695cb22f5c9d0", "score": "0.8445893", "text": "def float?(field)\n se...
b90b3d450031e7d295216d4bef2ef2db
Get a list of all registered post type objects.
[ { "docid": "1a2f5c1743ec94d9cb126cf879443511", "score": "0.7082513", "text": "def get_post_types(args = {}, output = 'names', operator = 'and')\n field = ( 'names' == output ) ? 'name' : false\n\n wp_filter_object_list(Railspress.GLOBAL.wp_post_types, args, operator, field)\n end", "title": "...
[ { "docid": "5c4168c9b254e7f5a79c362441bf069f", "score": "0.6519605", "text": "def get_all_post_types\n post_types = {'Interview' => '<i class=\"fa fa-fw fa-newspaper-o\"></i>',\n 'Case Study' => '<i class=\"fa fa-fw fa-list\"></i>',\n 'Facebook' => '<i class=\"fa fa-...
98dde77da68fd9e5e3bce93c88d1d970
Cancel all order Cancel all existing order.
[ { "docid": "bca44f728f91f2a32b5a300609e0d983", "score": "0.5883694", "text": "def v1_orders_cancel_all_post_with_http_info(cancel_all_order, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersApi.v1_orders_cancel_all_post ...'\n end\n ...
[ { "docid": "6ee6a04ca978d2d3c15b0c74e3f2ac0e", "score": "0.76615125", "text": "def cancel_all(params)\n Client.current.delete('/orders', params)\n end", "title": "" }, { "docid": "202eb489a08f3e38b55522ef1988f8ce", "score": "0.7605731", "text": "def cancel_order\n or...
00b24197aa76db7623cae9a300968a21
GET /sdev120s GET /sdev120s.json
[ { "docid": "4f6348d2244031cb45f8d4e2f2b2ec2d", "score": "0.73605096", "text": "def index\n @sdev120s = Sdev120.all\n end", "title": "" } ]
[ { "docid": "768edb7b5effe5b941b1a921a007196b", "score": "0.6933818", "text": "def index\n @sdev140s = Sdev140.all\n end", "title": "" }, { "docid": "eca0a25d9315cb1a015eeeb613b73cc5", "score": "0.6261073", "text": "def show\n @spl = Spl.find(params[:id])\n\n respond_to do |...
a074f71a19fe1cae6d7f29b2d1794bbd
When was this payment received by the client. We're expecting a dd.mm.yyyy format.
[ { "docid": "479e089d2eb6e8f5c1a8eda6c381cb56", "score": "0.67695576", "text": "def received_at\n date = params['VK_T_DATE']\n return nil unless date\n day, month, year = *date.split('.').map(&:to_i)\n Date.civil(year, month, day)\n end", "title": ...
[ { "docid": "4869ac7e29b13182fe9c05926facd439", "score": "0.73305243", "text": "def received_at\n if decode_Merchant_Parameters['Ds_Date']\n (day, month, year) = decode_Merchant_Parameters['Ds_Date'].split('/')\n Time.parse(\"#{year}-#{month}-#{day} #{decode_Merchant_...
ca427e760d52320b20f716ced122263f
When requires_approval is false, a `purchase` makes one call (`auth`).
[ { "docid": "77d235a97fac31c08439fbe7e07fdcff", "score": "0.64827675", "text": "def test_successful_purchase_with_requires_approval_false\n stub_comms(@gateway, :ssl_request) do\n @gateway.purchase(@accepted_amount, @credit_card, @options.merge(requires_approval: false))\n end.check_request do...
[ { "docid": "f9d3a15dc266998b44513d77de8bf95a", "score": "0.68502605", "text": "def test_successful_purchase_with_requires_approval_true\n options = @options.merge(requires_approval: true)\n\n response = @gateway.purchase(@amount, @credit_card, options)\n assert_success response\n assert_equa...
895c7adb6308e7eb629c83fc7fc9c1ea
Create a new RectangleBounds that is larger than the current bounds, given the specifed hash of parameters that contain the amount to expand in the four directions left, right, top, bottom.
[ { "docid": "83971f1b6eb60687310cad9eebda3dc0", "score": "0.6233579", "text": "def enlarge(params = {})\n self.class.new(left: left - params[:left].to_i,\n right: right + params[:right].to_i,\n top: top - params[:top].to_i,\n bottom: bottom + params[:bottom].to_i)\...
[ { "docid": "12fbf4948c6ca81b07df585b0046d011", "score": "0.68676513", "text": "def expand2(left, right, top, bottom)\n return Rectangle.new(@x - left,\n @y - top,\n @w + left + right,\n @h + top + bottom)\n end", "...
a49daf4e719129e51ab85ce6129e95f1
User Information Provides information about the user with the given ID.
[ { "docid": "f0b968073796933d64a19673fde88792", "score": "0.0", "text": "def get_user(id, opts = {})\n data, _status_code, _headers = get_user_with_http_info(id, opts)\n data\n end", "title": "" } ]
[ { "docid": "57ea47de4861acea59f017ac117c6da3", "score": "0.82626194", "text": "def show\n id = params[:id]\n render json: V1::User.get_user_info(id)\n end", "title": "" }, { "docid": "3b9753163b10ee1e06a1dfe1a583cb1b", "score": "0.7917499", "text": "def get_user_info(use...
5cbb22c581072d8a999ac154ef6a0913
This method performs some steps, that must be performed after last search pattern is added through NonDeterministicAutomatonaddPattern method.
[ { "docid": "40f8653488eb3d82810ee286980e41b5", "score": "0.0", "text": "def finalize\n aSize = @alphabet.size\n aSize.times do |index|\n @node0.addTransition(Transition.new(@alphabet[index], @node0))\n end\n end", "title": "" } ]
[ { "docid": "24d70908ac1ae0f06e36023e812028d9", "score": "0.61917794", "text": "def addPattern(pattern)\n node = @node0\n\n pl = pattern.length\n pl.times do |index|\n ch = pattern[index]\n if(!@alphabet.contains?(ch))\n raise \"Search pattern contains elements, whic...
f2ce246da898ad40260beb688389d241
Same thing as above but uses a database query More efficient than the previous method if called just once
[ { "docid": "5531b3520bf02f97d1373df71f15b55f", "score": "0.0", "text": "def find_new_statuses_allowed_to(roles, tracker, author=false, assignee=false)\n if roles.present? && tracker\n conditions = \"(author = :false AND assignee = :false)\"\n conditions << \" OR author = :true\" if author\n...
[ { "docid": "27c0120f4c85a642d3efebdaa72a864b", "score": "0.65279806", "text": "def _query; end", "title": "" }, { "docid": "921bab78fba869c9ff213b07e59908d2", "score": "0.6463469", "text": "def query; end", "title": "" }, { "docid": "921bab78fba869c9ff213b07e59908d2", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f7e7892756495d4d06be65ef4266f15a", "score": "0.0", "text": "def parser_params\n params[:parser]\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
6dd7c95c98533507a0d7590aed711a2d
GET /point_of_interests/new GET /point_of_interests/new.json
[ { "docid": "23afed2d5a069211bb029ef436c40c5f", "score": "0.82157785", "text": "def new\n @point_of_interest = PointOfInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point_of_interest }\n end\n end", "title": "" } ]
[ { "docid": "46a3e7574984daf968dc9ecf9c52aa6d", "score": "0.79491657", "text": "def new\n @interest_point = InterestPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest_point }\n end\n end", "title": "" }, { "docid": "dca...
f0a325f7326e23391804c3afce442bbe
Given a hash, pull out the parts into local variables
[ { "docid": "04bc9c56e9437a8b63f51c797954087d", "score": "0.0", "text": "def metadata=(hash)\n @uuid = hash[:uuid]\n @type = hash[:type]\n @from = hash[:from]\n @to = hash[:to] || \"\"\n @requires_response = hash[:requires_res...
[ { "docid": "b0af13e3f6dceb0d7bb6c0f9dd1a23dc", "score": "0.67570496", "text": "def split_hash raw_hash\n _, version, cost, blob = raw_hash.split '$'\n [version.to_s, cost.to_i, raw_hash[0, 29].to_s, blob[-31, 31].to_s]\n end", "title": "" }, { "docid": "322bf7366a92c51587d0ec532...
5be9a5370bd2dff0294ac5ee45b037a7
Copies the usual stuff from the icu player table
[ { "docid": "f5435e24a621f89700a1c6a4c2fce56e", "score": "0.51535684", "text": "def autofix\n if icu_id.present?\n self.first_name = icu_player.first_name\n self.last_name = icu_player.last_name\n self.fed = icu_player.fed if icu_player.fed.present?\n self.gender = icu_player.gende...
[ { "docid": "0e3290eadacd0f94d8e5c28158987e8a", "score": "0.5935452", "text": "def copyPlayer(player)\n \n @level = player.level\n @pendingBadConsequence = player.pendingBadConsequence\n @dead = player.dead\n @visibleTreasures = player.visibleTreasures\n @hiddenTreasures = player.hidden...
f4c10faf446f7ed6e0f4363ac09eb973
DELETE /parasitic_interaction_observations/1 DELETE /parasitic_interaction_observations/1.json
[ { "docid": "8d241d0433aa801a5e0c8e344b747273", "score": "0.7642845", "text": "def destroy\n @parasitic_interaction_observation = ParasiticInteractionObservation.find(params[:id])\n @parasitic_interaction_observation.destroy\n\n respond_to do |format|\n format.html { redirect_to parasitic_i...
[ { "docid": "1f8bfee56d35527f582c27c465e88a8a", "score": "0.727173", "text": "def destroy\n @trophic_interaction_observation = TrophicInteractionObservation.find(params[:id])\n @trophic_interaction_observation.destroy\n\n respond_to do |format|\n format.html { redirect_to trophic_interactio...
b7fcbb7ba0fe25ffead0cf6a5cbb5c0f
We call this before we start checking handles
[ { "docid": "f8ba65871d2606f055520305471389b4", "score": "0.0", "text": "def connect_to_twitter\n @client = Twitter::REST::Client.new do |config|\n # These come from settings.yaml – you need to enter your details in there\n config.consumer_key = @settings[\"twitter\"][\"consumer_key\"]\n ...
[ { "docid": "7c8578c0f718cc8ef299268a8ee6dc60", "score": "0.6068769", "text": "def process_init\n end", "title": "" }, { "docid": "9fbec9b2bcd97ad59997b3cbc61b2258", "score": "0.59926623", "text": "def handle; end", "title": "" }, { "docid": "9fbec9b2bcd97ad59997b3c...
cedf0d84f24940a6819eeba6726c225e
Use the first file if tei isn't set and the first file is an xml
[ { "docid": "bcbbd49cf20b4804a86add284574ebc3", "score": "0.61735016", "text": "def assign_default_tei\n return if tei_id\n\n # TODO: the Order::TargetProxy should respond to #first\n # https://github.com/projecthydra-labs/activefedora-aggregation/issues/95\n first_file = ordered_members.to_a...
[ { "docid": "db4480ab92a0508f793eae16324b8412", "score": "0.6152868", "text": "def load_to_dor?(filetype)\n filetype != \"xml\"\n end", "title": "" }, { "docid": "febb285d2dd987e391d166b613dc2578", "score": "0.6054244", "text": "def treat_xml_source(xml_file=nil)\n xml_file=@co...
abd953a2b038e5e594ef2ec29bbac1e1
Check if the name servers of a given donain name The fullyqualified domain name. Returns a list of name servers attached to this domain
[ { "docid": "79906326b6b0e45c4cd131cb5cb70062", "score": "0.7145353", "text": "def check_nameservers(name)\n provider.check_nameservers(name)\n end", "title": "" } ]
[ { "docid": "dfd2fa75d98e2bbdc56c21409423836c", "score": "0.7456132", "text": "def has_nameservers\n our_nameservers = ENV['EXTERNAL_DNS'].to_s.split(\",\")\n their_nameservers = Resolv::DNS.new.getresources(self.url, Resolv::DNS::Resource::IN::NS).collect{|name| name.name.to_s}\n (our_nam...
cef2733358c098052504567ac059aa3e
the oauth_signature calculated for this request.
[ { "docid": "954e0d81dc7a905bba13aa277fd8c885", "score": "0.0", "text": "def signature\n rbmethod = SIGNATURE_METHODS[signature_method] ||\n raise(ArgumentError, \"invalid signature method: #{signature_method}\")\n rbmethod.bind(self).call\n end", "title": "" } ]
[ { "docid": "d70d57e9aa4e97fc9308e05f328e4c01", "score": "0.7485899", "text": "def request_signature\n request.parameters['signature']\n end", "title": "" }, { "docid": "d395eb91edb6924c45cffa4e6316fb58", "score": "0.7152944", "text": "def request_signature; end", "title":...
a200980f59219f1b30785e3fc88fefd6
Returns collection of vendor objects associated with given market id
[ { "docid": "89b7135ed6295f1d009de609f898ce03", "score": "0.8290112", "text": "def vendors\n FarMar::Vendor.all.find_all { |vendor| vendor.market_id == id }\n end", "title": "" } ]
[ { "docid": "87b475eee690d95c8a51d86275d4f8bf", "score": "0.8648651", "text": "def vendors(market_id)\n FarMar::Vendor.all.select { |vendor| vendor.market_id == market_id }\n end", "title": "" }, { "docid": "5ef3d21ac2325f01e9ba2f91ac04a901", "score": "0.83693224", "text": "def ve...
507a3e290032b882bb0e9f2c316879bd
Checks if there is a proxy started
[ { "docid": "e26e589c777bf16d39ecbbde7eaf9c41", "score": "0.7690361", "text": "def has_proxy?\n proxy = Runtime.instance.get :proxy\n return !proxy.nil?\n end", "title": "" } ]
[ { "docid": "9400ecf5f36563b9ee52111d1c735bf7", "score": "0.7509832", "text": "def proxy?\n return !self.proxy.http.nil?\n end", "title": "" }, { "docid": "621332b52ec900aa7a0c9b0ada5e7af6", "score": "0.74177396", "text": "def do_proxy?\n ((!config.proxy_host_name.nil? && !...
1bddb8c37edd1ca0885203a3961aa607
rubocop:enable Style/For rubocop:enable Metrics/ModuleLength rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
[ { "docid": "557098c934760dc05355847f5a3475a5", "score": "0.0", "text": "def multiply_els(array)\n array.my_inject(1) { |index, result| result * index }\nend", "title": "" } ]
[ { "docid": "3d45e3d988480e2a6905cd22f0936351", "score": "0.6389532", "text": "def for; end", "title": "" }, { "docid": "3d45e3d988480e2a6905cd22f0936351", "score": "0.6389532", "text": "def for; end", "title": "" }, { "docid": "3d45e3d988480e2a6905cd22f0936351", "scor...
741a5627e3d278bf2d58eca10d9a20f1
Author: Nel Pontejos Created: Sept 15, 2016 Provider for directory and file manipulation =======================================================================================================================
[ { "docid": "5208bf47fc105856a086a9eb53ac9246", "score": "0.0", "text": "def create_directory(directory_path_string)\n puts \"testing if #{directory_path_string} exist...\"\n if not Dir.exists?(directory_path_string)\n puts \"directory does not exist #{directory_path_string}, creating directory...\"...
[ { "docid": "fe1dcbf04b1f0387b6b5331e232a7c46", "score": "0.724901", "text": "def opendir(path); end", "title": "" }, { "docid": "b368e80d13e20fab9c08cf134e5da3c9", "score": "0.72355956", "text": "def stat_directory(dir); end", "title": "" }, { "docid": "b368e80d13e20fab9c...
445e83e6308cfc5f8dee96592575d80f
ends any unscheduled maintenance
[ { "docid": "ace02abc6d12f67e1f2266ec7c05c586", "score": "0.6999332", "text": "def end_unscheduled_maintenance(end_time)\n raise ArgumentError, 'end time must be provided as a Unix timestamp' unless end_time && end_time.is_a?(Integer)\n\n if (um_start = @redis.get(\"#{@key}:unscheduled_main...
[ { "docid": "8354e3975221d792a8e69a721a71d1d5", "score": "0.6887651", "text": "def unscheduled?; end", "title": "" }, { "docid": "8354e3975221d792a8e69a721a71d1d5", "score": "0.6887651", "text": "def unscheduled?; end", "title": "" }, { "docid": "219e3373e8022ec0ee8dec46b4...
c8b467ea4c470e0c59c1982446fbe9b8
=begin Write a Ruby program to pick number of random elements from an given array =end
[ { "docid": "cd20277eb5efefcfe9b88d5835b6856e", "score": "0.63559633", "text": "def pick_random_number(numbers)\n return numbers.sample(1)\nend", "title": "" } ]
[ { "docid": "da66c923e588bdbf7d2a00140591873d", "score": "0.7504374", "text": "def random_num_of_elements(seven_arr_0)\n return seven_arr_0.sample[2]\nend", "title": "" }, { "docid": "f22cd8d9dd7978104e173a25dd9a2aab", "score": "0.7453069", "text": "def random_select(array, n)\n\tran...
a4f7ae3283936e83e41920ee8a49db1b
Checks equality by comparing each attribute.
[ { "docid": "fe15971d89110e9da678e73c2df38a0b", "score": "0.0", "text": "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n host_video == o.host_video &&\n panelists_video == o.panelists_video &&\n practice_session == o.practice_session &&\n ...
[ { "docid": "153b45ee9e17f104e42417688976c51c", "score": "0.768239", "text": "def compare_attributes(attrs)\n\t\t\t\tattrs.each do |name, value|\n\t\t\t\t\tnext true if compare_attribute(name, value)\n\t\t\t\t\tbreak false\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "6c59827132384193c...
edd3a8b83b34cec84e6d010db072a16f
Test parsing of a config file which is valid, but contains empty line breaks and whitespace in the definitions
[ { "docid": "e247888901d2a74fb387a05194640a1d", "score": "0.7682013", "text": "def test_valid_with_spaces\n assert_equal(correct_results,\n ConfigParser.parse(\"data/valid_with_spaces.config\"))\n end", "title": "" } ]
[ { "docid": "a3401968d6aacbbc324309ded9661aff", "score": "0.71744716", "text": "def test_invalid_defining_nothing\n cp = ConfigParser.new(\"data/invalid_defining_nothing.config\")\n assert_raise ConfigParser::ParseException do\n cp.results\n end\n end", "title": "" }, { "docid"...
5991cdb7ca234d2f7ebf00c90d40e818
This method removes `node` from the list and must keep the rest of the list intact.
[ { "docid": "ea5be3e74638c95ab1a5bb586eb6966e", "score": "0.6641963", "text": "def delete(node)\n temp_node = @head\n\n while temp_node != @tail\n if @head == node\n if @head == @tail\n @head = nil\n break\n else\n @head = @head.next\n break\n ...
[ { "docid": "8b68136b0db010ca87cb876979aba207", "score": "0.78272915", "text": "def remove(node)\n end", "title": "" }, { "docid": "9ab0139846bab78ab1b354c244323906", "score": "0.76646245", "text": "def remove_node(node)\n\t\t\tif has_node?(node)\n\t\t\t\tpull_edges_of(node)\n\t\t\...
140a93e509b297bca7cfc33e841de2f1
Sift up the element at index i
[ { "docid": "556291bb7e238bb63f88597296103c93", "score": "0.6941052", "text": "def sift_up(i)\n parent = (i - 1) / 2\n if parent >= 0 and @heap[parent] > @heap[i]\n @heap[parent], @heap[i] = @heap[i], @heap[parent]\n sift_up(parent)\n end\n end", "title": "" } ]
[ { "docid": "8e0622147754f332f3d090139163e4f5", "score": "0.69852555", "text": "def up(index, amount)\n ele = @items.slice!(index)\n i = index - amount\n @items.insert(i, ele)\n end", "title": "" }, { "docid": "6cfb09b6e61c47421f184eba8b...
16809530a5a0c7d4f04c445de013c4db
partition binarily split based on a cut point
[ { "docid": "f14e3a6f0f419bdc91b3c3e070bc0acc", "score": "0.72578335", "text": "def binary_split(cv, fv, bs, cut_point)\n cv1, cv2, fv1, fv2, bs1, bs2 = [], [], [], [], [], []\n fv.each_with_index do |v, i|\n if v < cut_point\n cv1 << cv[i]\n fv1 << v\n else\n cv2 << ...
[ { "docid": "1c46dff3fef40b4fb3cf5e51bc0ae790", "score": "0.667366", "text": "def partition_points(points)\n points.sort_by! {|x| x[0]} #why I think my algorithm needs to be nlogn\n return points.in_groups(2)\nend", "title": "" }, { "docid": "4afaf664f22407dc41af350109be1701", "score": ...
a60672e5284dd73d9d6ae05fd2058e80
create order with products, charge card for one time fee & recurring subscription
[ { "docid": "2f621b62919170fe8af9b7485292a5b4", "score": "0.6491219", "text": "def create\n @groups = (logged_in? ? Group.for_user(current_user) : [Group.direct_to_consumer])\n if session[:order].blank?\n redirect_to :action => 'new'\n \n else\n goto = \"new\"\n unless sessio...
[ { "docid": "52686a5fc6b0b97ec0f078a387e96ae9", "score": "0.73528194", "text": "def create\n \n @cart = JSON.parse params[:cart]\n @token = params[:token]\n @user = User.find(params[:userId])\n @address = Address.find(params[:addressId])\n #date.time now to determine ship date 15 or 1\n...
3ce098381e52ddcc747ff3a5213ad5df
Takes a motley collection of differentlydefined styles and renders them into the standard hashofhashes format. Solitary strings are assumed to be
[ { "docid": "968b32e856477978c9dd241c90639376", "score": "0.59486085", "text": "def normalize_style_rules(styles = {})\n styles.each_pair do |name, rule|\n unless rule.is_a? Hash\n if rule =~ /\\=/\n parameters = rule.split(',').collect { |parameter| parameter.split('=') } # array...
[ { "docid": "52c90f9a4592f09ff938adf67e9e89a4", "score": "0.71007437", "text": "def buildStyles(colorHash)\n\tstyles = \"\"\n\tcolorHash.each do |key, value|\n\t\ttext = <<-STYLE\n<Style id=\"#{key}a\">\n\t<IconStyle>\n\t\t<scale>0.35</scale>\n\t\t<Icon><href>http://supramap.osu.edu/supramap/images/circl...
a6cc7cf94ab708fa03d89e47e723086a
Rails adds the size attr by default, if the :size key does not exist.
[ { "docid": "d5119d38f75d7662d11c9b0175f5427c", "score": "0.7333671", "text": "def add_size!\n input_html_options[:size] ||= nil\n end", "title": "" } ]
[ { "docid": "46a6f9747694cccb38d2e11154882143", "score": "0.74051565", "text": "def size(size)\n @value[:size] = size\n self\n end", "title": "" }, { "docid": "735fddcb0dc4a5c799b06468239ee157", "score": "0.7204688", "text": "def default_size= size \n ...
56c67a25ef2baa7b6caf8abb3af367a7
check assignment node, if the right vavlue is a method_add_arg node with message "new", then remember the left value as new variable.
[ { "docid": "1eead8295c3cf696e550044a32735a89", "score": "0.7178915", "text": "def remember_new_variable(node)\n right_value = node.right_value\n if right_value.sexp_type == :method_add_arg && right_value.message.to_s == 'new'\n @new_variables << node.left_value.to_s\n end\n...
[ { "docid": "8a49a8bf108d9bf1a146c160c515375e", "score": "0.7120311", "text": "def assign(node)\n left_value = node.left_value\n right_value = node.right_value\n return unless left_value.sexp_type == :field && right_value.sexp_type == :call\n\n aref_node = right_value.grep_nod...
7b5adeadc9c11a6d54610194c24fa51f
Updates translation of the given project
[ { "docid": "db1d90b7e7cab21bca1943881095c6bb", "score": "0.7495254", "text": "def update_translation(project_id, translation_id, params)\n c_r Lokalise::Resources::Translation, :update, [project_id, translation_id], params\n end", "title": "" } ]
[ { "docid": "b31a6aef3b01f8a0694486560efe3129", "score": "0.7186058", "text": "def update\n # translators cannot modify approved copy\n return head(:forbidden) if @translation.approved? && current_user.role == 'translator'\n\n mediator = TranslationUpdateMediator.new(@translation, current_user, ...
8e4510c0786c383161a18c3fabafc59b
Call Brush::Pipelinesys or Brush::Pipelinepipeline and wait two seconds before barfing. It keeps the tests moving if something gets stuck due to pipes not getting closed, though if triggered it may leave unattached processes that need to be killed manually if the unclosed pipe is in the same process waiting for it to b...
[ { "docid": "d3e8435c232cf0c7479b666271680f09", "score": "0.0", "text": "def sys_to (*args)\n Timeout.timeout(2) { sys(*args) }\n end", "title": "" } ]
[ { "docid": "3da37adb0441f782249bb34db8251962", "score": "0.6049684", "text": "def close_pipes; end", "title": "" }, { "docid": "15e37a9b64bef85cd3dbfa0240aeb719", "score": "0.5916155", "text": "def smoke_pipe(pipe)\n debug { \"#{name} smoking pipe (#{ts})\" }\n pipe.read_no...
e93a8458c9ef8380cab0873eb9035b27
This is a convenience method returning the reflection defined on the bond.
[ { "docid": "e5d1f5ad80c830964c44f78568dd2381", "score": "0.8696355", "text": "def reflection\n bond.reflection\n end", "title": "" } ]
[ { "docid": "701359444c3bc529044a50b60481e991", "score": "0.65968215", "text": "def reflection; end", "title": "" }, { "docid": "701359444c3bc529044a50b60481e991", "score": "0.65968215", "text": "def reflection; end", "title": "" }, { "docid": "823a4ab201133f3a32c337005478...
8da9acf3d2153a212e9077d36e793d15
POST /indices POST /indices.json
[ { "docid": "952652c85a92fa469102c3e54849ad50", "score": "0.556742", "text": "def create\n @stock_index = StockIndex.new(stock_index_params)\n\n respond_to do |format|\n if @stock_index.save\n format.html { redirect_to @stock_index, notice: 'Index was successfully created.' }\n f...
[ { "docid": "ffbfa9664c3981a868045bf8943ba17f", "score": "0.6799173", "text": "def prepare_index\n create_index = http_post(\"/#{es_index_name}\")\n create_index.body = {\n index: {\n number_of_shards: 1,\n number_of_replicas: 0,\n refresh_interval: -1\n ...
b2320e0c9923e505e2a55617d8b5e6ac
todo hash cononicalizing first
[ { "docid": "1b91a96c19b2785bcda99a8e5d41d38d", "score": "0.0", "text": "def fp_format\n form_class\n end", "title": "" } ]
[ { "docid": "15ab111544bfee6d598c82c6a202f376", "score": "0.7613431", "text": "def hashfunc; end", "title": "" }, { "docid": "b78a8c3fbbda0dc6b3ed59f810316f24", "score": "0.75531495", "text": "def hash(*) end", "title": "" }, { "docid": "55481f97eb0ef93fcebc191faf81107c", ...
9679b86f1e6f5a1a074b26b6c1d752d5
CONVERT JSON TO CSV
[ { "docid": "90629ccae4f02a89671c7323e31f7320", "score": "0.60333526", "text": "def convert_json_to_csv\n start = Time.now\n\n json = JSON.parse(File.read(@all_cars_file_with_years_overview_styles_specs))\n\n if json.nil?\n puts \"ERROR - could not find json file\"\n exit\n end\n\n rows = []\n...
[ { "docid": "7768f017ac87aa0e33ddfd8fe42b2396", "score": "0.7729465", "text": "def convert_json_to_csv(parsed_json)\r\n\t\t\traise ParserError, \"The JSON to parse is empty.\" if parsed_json.length <= 0\r\n\r\n\t\t\tcsv_string = CSV.generate do |csv|\r\n\t\t\t\tcsv << parsed_json[0].keys\r\n\t\t \t\tpar...
1ed2f040ee08afd040a2719719aad099
GET /rentals or /rentals.json
[ { "docid": "2cca4197b905be6a9430f66c6a991c25", "score": "0.0", "text": "def index\n @rentals = Rental.order('created_at desc')\n end", "title": "" } ]
[ { "docid": "39c349a8a511b95756f91294ff5e51c9", "score": "0.7313266", "text": "def index\n @rentals = Rental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rentals }\n end\n end", "title": "" }, { "docid": "25f540a469bd0a28660e0...
87f118e0d1b1c63026496c2eb486860c
puts value = big_shoe_rebounds returns the player that scored the most points
[ { "docid": "10bdb97775b743cb85d90faf3572cffd", "score": "0.7011213", "text": "def most_points_scored\n points = 0\n player = ''\n game_hash.each do |location, team_info |\n team_info[:players].each do | key, data |\n if data[:points] > points\n points = data[:points]\n player = ...
[ { "docid": "b2526949f45579ccaa53b9d4f470242c", "score": "0.84136534", "text": "def big_shoe_rebounds\n max_shoe_stats = nil # statistic hash\n max_shoe = nil # integer of maximum shoe size\n \n game_hash.each do |location, team|\n team[:players].each do |player_name, stats|\n if max_shoe_sta...
b9ef76b255e535b09cb62f0959620e5d
Generate a menu of sections and tags and allow user selection
[ { "docid": "8e672f3b71f4eecbb94d8f16c89e5cbb", "score": "0.62756157", "text": "def choose_section_tag\n options = @content.section_titles.sort\n options.concat(@content.all_tags.sort.map { |t| \"@#{t}\" })\n choice = Prompt.choose_from(options, prompt: 'Choose a section or tag > ', fzf_ar...
[ { "docid": "8c8b6d0309fc7a3f139f9ad25b0f60ce", "score": "0.7113813", "text": "def menuSections\n sections = [\"Frame\", \"Album\",\"Camera\"]\n end", "title": "" }, { "docid": "92c9d0ec99d878f4bedbe6fd2585ff88", "score": "0.6685318", "text": "def single_sitedoc_menu\n# prepare di...
ce1d69c6938f3ad8558e7859200715ab
utilise uniquement pour l'affichage, pas dans les calculs
[ { "docid": "e49fd34e053de043e0ed35d0791a042c", "score": "0.0", "text": "def get_cout_ha\n return (self.cout_ha_passage)\n end", "title": "" } ]
[ { "docid": "86ea2042d598839a1c78d6c89ffa6ef1", "score": "0.6085482", "text": "def calcule\n mInd = MontantCotisation.new\n mFam = MontantCotisation.new\n mInd.asIndividu(self.famille)\n mFam.asFamille(self.famille)\n familiale = mFam.net() < mInd.net()\n mc = familiale ? mFam : mInd\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0744e4bf66c96d2ea8ca18baba108097", "score": "0.0", "text": "def admin_founder_params\n params.fetch(:admin_founder, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496729", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958585", "text": "def strong_params\n params.require(:request).permit(param_white...
817527f0fbb1444bf0bd6412088f1d03
Helper methods used to add and return the array of migrated records.
[ { "docid": "10bb6b2add41e0e40928c79f2ce67965", "score": "0.0", "text": "def add_version(version); GuidesGenerator::Migrator::migrated_versions.push(version); version end", "title": "" } ]
[ { "docid": "18a15a425922c4d277204d533ab67941", "score": "0.60048103", "text": "def extend(records)\n @records += records\n end", "title": "" }, { "docid": "bd6cd90377e2e7d691714d86b7afb9b2", "score": "0.572416", "text": "def addRecords(recs); recs.each { |r| addRecord r } end...
150d9700f6c58bee4eb44677c03426f8
The changes are params that changed from what is set in the default
[ { "docid": "0138e9540e4a3a9b100f6c3045c4d96f", "score": "0.6624711", "text": "def get_changes\n @opts.inject({}) do |seed, (k, v)|\n\n value = get_param(k) || get_default(k)\n\n seed.merge!(k => value) if _keep_value?(k)\n\n seed\n end\n end", "title": "...
[ { "docid": "2a0821d741fee099f7720fffbec4562b", "score": "0.7022813", "text": "def change(params); end", "title": "" }, { "docid": "a6677334ccae9620e69fb9676704f18a", "score": "0.66615856", "text": "def update_params\n raise 'Sovrascrivi in figli'\n end", "title": "" ...
f9556d0351c666326d8a290865184111
Pull the HDP version out of the repository file.
[ { "docid": "ffadad0fd0e4edcb2f609efd4772611b", "score": "0.69003755", "text": "def findVersion(profile)\n if (profile[:os] == \"centos6\")\n path = 'files/repos/centos6.hdp.repo.%s' % profile[:hdp_short_version]\n elsif (profile[:os] == \"centos7\")\n path = 'files/repos/centos7.hdp.repo.%s' % p...
[ { "docid": "c68727b001178d556c3d49f94eaccd78", "score": "0.7273366", "text": "def findVersion()\n fileObj = File.new('files/repos/hdp.repo', 'r')\n match = /^#VERSION_NUMBER=(?<ver>[-0-9.]*)/.match(fileObj.gets)\n fileObj.close()\n result = match['ver']\n puts \"HDP Version = %s\\n\" % result\n re...
03a89e1d68cd392651efa1dd8d3cef43
Initializes a Plane3D object from a point and an outward normal
[ { "docid": "2056ba92425ccbffdcc629699dd2a73c", "score": "0.8414832", "text": "def initialize(point, normal)\n raise \"Incorrect point argument for Plane3D, expected Point3D but got #{point.class}\" unless point.is_a?(Topolys::Point3D)\n raise \"Incorrect normal argument for Plane3D, expected V...
[ { "docid": "df9dd0ceab840f6b438899b4f7d83850", "score": "0.7616442", "text": "def initialize(p1, p2, p3)\n v1 = p1.vector_to(p2)\n v2 = p1.vector_to(p3)\n normal = v1.cross_product(v2)\n\n @point = p1\n @normal = normal\n\n # keep around an arbitrary vector on the plane for convenience...
81289859b4b2166b11af05a8125df3dc
Write a method sum that accepts an unlimited number of integer arguments, and adds all of them together. The method should reject any arguments that are not integers, and sum the remaining integers.
[ { "docid": "015dc0776e3b54fbc3a74c8b19426dcc", "score": "0.7986284", "text": "def sum(*num)\n num.select {|x| x.is_a?(Integer)}.inject(&:+)\nend", "title": "" } ]
[ { "docid": "9949b66e5581006bb7642365659b9839", "score": "0.8761919", "text": "def sum(*args)\n # Select the integer args and sum\n args.select { |x| x.is_a?(Integer) }.reduce(:+)\nend", "title": "" }, { "docid": "79c701eecbf6728287ad20710fc619d6", "score": "0.8046571", "text": "def...
b724ca343c6b7c4c4a8206661d6dab70
GET /posts GET /posts.json
[ { "docid": "54506ff8674e8bea17332bb266975349", "score": "0.0", "text": "def index\n @posts = Post.paginate(page: params[:page], per_page: 5)\n end", "title": "" } ]
[ { "docid": "915c0178f9e4347098d8a463c2cbe6b0", "score": "0.7866808", "text": "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "title": "" }, { "docid": "9e4bfaa87507d05255fbaeadc1ecb1d6", "score": "0.7496935", "text": "def index\n @posts = Post.all\...
49105bbea4d79274eddce6f13936cadf
add a Child Node to the Node
[ { "docid": "992ffe0e285683c3382c58c658f4c481", "score": "0.639152", "text": "def child(node, type=\"a\")\n\t return \"Error. node's can only be of type Node\" unless node.is_a? Node\n\t self.child_a = node if type === \"a\"\n\t self.child_b = node if type === \"b\"\n\tend", "title": "" } ]
[ { "docid": "48d70ed0cef6f29a0876897e9162bf71", "score": "0.824819", "text": "def add_child(node)\n node.build\n nodes << node\n end", "title": "" }, { "docid": "aa3696bde1e97ee2f85672609123b425", "score": "0.8174014", "text": "def add_child(child_node)\n self.ch...
464c4e0a501d9cc1a38b71db6d7863af
Write a method that returns the number of Friday the 13ths in the year given by an argument. You may assume that the year is greater than 1752 (when the United Kingdom adopted the modern Gregorian Calendar) and that it will remain in use for the foreseeable future.
[ { "docid": "70c30bd50c18bdee48bf92abda697fd2", "score": "0.8670568", "text": "def friday_13th(year)\n d = Date.new(year)\n count = 0\n 365.times do\n count += 1 if d.friday? && d.day == 13\n d = d.next_day\n end\n count\nend", "title": "" } ]
[ { "docid": "eae951e2336ef314986aae1fc3d58931", "score": "0.86071676", "text": "def friday_13th(year)\n num_of_13 = 0\n\n 1.upto(12) do |month|\n t = Time.new(year, month, 13)\n num_of_13 += 1 if t.friday?\n end\n num_of_13\nend", "title": "" }, { "docid": "46f527ab3eefc8e9358bd621d...