query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
8f68dd5d2aca822a49e233b7e8f30d23
TODO: change to use Logger class
[ { "docid": "03bce281e5ca52dff10fca53895453f8", "score": "0.0", "text": "def output_log(log)\n puts \"\\e[32m#{log}\\e[m\\s\"\nend", "title": "" } ]
[ { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", "score": "0.7754214", "text": "def logger; end", "title": "" }, { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", "score": "0.7754214", "text": "def logger; end", "title": "" }, { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", ...
6fbeab6276a339939de962fa32fe902a
GET /author_notes/1 GET /author_notes/1.xml
[ { "docid": "61e1e2afd1bebb8e91fe513ab7c297cf", "score": "0.72058105", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author_note }\n end\n end", "title": "" } ]
[ { "docid": "7a7cd8047a1249884186c69f0824a21d", "score": "0.7253011", "text": "def index\n @author_notes = AuthorNote.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @author_notes }\n end\n end", "title": "" }, { "docid": "087ae02...
ff8289816a88c93e5015806a27f90769
Returns true if the number of allocated rows is zero. ==== Example(s) t = Tabulation.new t.rows.empty? => true
[ { "docid": "7d7ad3b5e8efae0bd76c40bb11814df3", "score": "0.83910275", "text": "def empty?\n @data.rows_count <= 0\n end", "title": "" } ]
[ { "docid": "07c2b08e7feef59c0dde69fcb300619a", "score": "0.8328304", "text": "def empty?\n @table.size == 0\n end", "title": "" }, { "docid": "99e9e326539ecec020a613ffec7264a8", "score": "0.8312804", "text": "def empty?\n @row >= @data.rows_count\n end", "title": "" ...
f4950e695ffb7c2140f618c46b2562c7
Write a method that returns the factors of a number
[ { "docid": "8a455c7e233510959fcc4538bf2807b1", "score": "0.0", "text": "def factors(num)\n arr=[]\n i = 1\n while i < (num)\n arr << i if num % i == 0\n i+=1\n end\n arr << num\n arr\nend", "title": "" } ]
[ { "docid": "aeaa92e920adfc1bdfdb8456bf23f5f2", "score": "0.9134774", "text": "def factors(num)\nend", "title": "" }, { "docid": "aeaa92e920adfc1bdfdb8456bf23f5f2", "score": "0.9134774", "text": "def factors(num)\nend", "title": "" }, { "docid": "aeaa92e920adfc1bdfdb8456bf...
9a56ba1d99145149e86d9a4f0c147faf
Gives a nice pretty string version of the grid
[ { "docid": "6b3bf1e67d1354f36895ecd21d6927c5", "score": "0.73868424", "text": "def print\n lines = []\n\n @grid.each do |row|\n lines.push(row.join(COLUMN_SEPARATOR))\n end\n\n lines.join(ROW_SEPARATOR)\n end", "title": "" } ]
[ { "docid": "a08799599d052b7562a99a05ace01f1f", "score": "0.8290591", "text": "def to_s()\n\t\tr = \" \"\n\n\t\t# print columns numbers\n\t\t0.upto(@columns - 1) do |i|\n\t\t\tr += i.to_s\n\t\tend\n\t\tr += \"\\n\"\n\n\t\t# print each line\n\t\t@grid.each_index do |j|\n\t\t\t# add the line number\n\t\t\...
1f723c45e3c8c0c303745fc96aa90e40
returns true if someone should be notified when this object is created
[ { "docid": "02f848336b6e1936e4d9732d987b66b7", "score": "0.69724035", "text": "def notify?\n true\n end", "title": "" } ]
[ { "docid": "290759f54dfb1212316c9a1fa830efe4", "score": "0.74938047", "text": "def on_create_called?\n !!@on_create_called\n end", "title": "" }, { "docid": "cd33b44183e520a885575fd373548fc0", "score": "0.72723943", "text": "def should_notify?\n self.created_at == self...
7a1f4a9f2731590026af5bdff3cfd6f1
DELETE /el_sockets/1 DELETE /el_sockets/1.json
[ { "docid": "f158dbfb4165d021fd8548df69802b70", "score": "0.74470687", "text": "def destroy\n @el_socket.destroy\n respond_to do |format|\n format.html { redirect_to el_sockets_url, notice: 'El socket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "5221d73955e3bf4207f4917ca1b4b8d4", "score": "0.70462966", "text": "def destroy\n @socket_load.destroy\n respond_to do |format|\n format.html { redirect_to socket_loads_url, notice: 'Socket load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"...
da8f95b9c96c22737a488b0436fc47aa
Attempt to parse an enum key and return the corresponding value. === Parameters [k] The key string to parse. Returns the corresponding value or nil.
[ { "docid": "158af1f5b2637a83d9414d64f5b98f8a", "score": "0.8305955", "text": "def parse(k)\n k = k.to_s.upcase\n each do |key, enum|\n return enum.value if key.to_s.upcase == k\n end\n nil\n end", "title": "" } ]
[ { "docid": "977dfc186fe6d276cc8b76f22003dae0", "score": "0.72753084", "text": "def value(k)\n enum = @_enum_hash[k]\n enum.value if enum\n end", "title": "" }, { "docid": "977dfc186fe6d276cc8b76f22003dae0", "score": "0.72753084", "text": "def value(k)\n enum...
c21817bb05f0714453fe9f61d7e16389
Provides caller line number starting 1 level above caller of this method. Example: lib/example.rb line 1 puts "Print out __caller_line_number__" line 2 puts __caller_line_number__ line 3 prints out `3`
[ { "docid": "6a2b8e29d26a449e33fb9c3088616159", "score": "0.8372205", "text": "def __caller_line_number__(caller_depth=0)\n caller[caller_depth][PutsDebuggerer::STACK_TRACE_CALL_LINE_NUMBER_REGEX, 1].to_i\nend", "title": "" } ]
[ { "docid": "7f88bc2bfadfb52966d6d453b9d07583", "score": "0.8658227", "text": "def lineNum()\n caller_infos = caller.first.split(\":\")\n # Note caller_infos[0] is file name\n # caller_infos[1]\n return \"Line no. #{caller_infos[1]}\"\nend", "title": "" }, { "docid": "fb7890a671337c7f0924...
884ba2245948ebbd69615b8af049e81e
FunctionType = (FieldType | "void")
[ { "docid": "cc3b18f90b53dc209357dee35b9b3aea", "score": "0.81612986", "text": "def _FunctionType\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_FieldType)\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"void\")\n break if _tmp\n self.pos = _sav...
[ { "docid": "23de8e8263b7c8e728ac234e8c84db6e", "score": "0.6708527", "text": "def fstype=(_arg0); end", "title": "" }, { "docid": "cee9e9cc96c2c05db85a95b08360b24a", "score": "0.6702532", "text": "def void\n\tVOID\nend", "title": "" }, { "docid": "a87a00913e14252ec68f2b52...
9a6b756dc35e8df6c69ffd6ef60611d7
Modified. Added question. Don't care.
[ { "docid": "6dad118b8abd8a59f057fe0868c58e54", "score": "0.0", "text": "def test_procins\n doc = Nokogiri::Hpricot.HTML(\"<?php print('hello') ?>\\n<?xml blah='blah'?>\")\n assert_equal \"php\", doc.children[1].target\n assert_equal \"blah='blah'?\", doc.children[2].content #\"# quote added so ...
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.6695349", "text": "def desired; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.62924397", "text": "def anchored; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
c21f043fb9d3fcd50dcb582d0a201549
Specifies where the map/reduce output is to be stored. Please see MongoDB documentation for supported map reduce options.
[ { "docid": "8674417e719d0c13bda1aee829e8dbb5", "score": "0.52481407", "text": "def out(location)\n normalized = location.dup\n normalized.transform_values! do |value|\n value.is_a?(::Symbol) ? value.to_s : value\n end\n @map_reduce = @map_reduce.out(normalized)\n ...
[ { "docid": "9f2ffc0614c58f95d71adb90f505734e", "score": "0.5972462", "text": "def output_folder\n @options.fetch(:output_dir, \"#{root}/data/output\")\n end", "title": "" }, { "docid": "e1baeea38505f07ffa49087de7be5e47", "score": "0.55313766", "text": "def output_dir\n ...
83a22f62b378bc268001a9142f53a7e6
POST /order_items POST /order_items.json
[ { "docid": "e8edba8038f088f1d891a81019aba6aa", "score": "0.6481145", "text": "def create\n @order_item = OrderItem.new(order_item_params)\n\n @item_splits = order_item_params[:people]\n @item_splits.delete(\"\")\n @item_splits.each do |person|\n @item = ItemSplit.new\n @item.person...
[ { "docid": "32a76c8ccd7788a14d51ed9b0bbb03a5", "score": "0.7354532", "text": "def create\n @item = Item.find(params[:item_id])\n\n @order = @item.orders.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to item_order_path(@item, @order), notice...
e6110f392d3243ac02046ed02a217766
Pick the longest domain on the theory that it's the least ambiguous
[ { "docid": "e5d004f87e6b6bd2f4d75d58e4d41655", "score": "0.0", "text": "def convention_domain(event_id)\n all_domains = connection[:virtual_sites].where(event_id: event_id).map(:domain)\n all_domains.sort_by { |domain| [domain.length, domain] }.last\n end", "title": "" } ]
[ { "docid": "3b880ff2d1dc85131a5613cd103e694a", "score": "0.66925645", "text": "def find_most_restricted_variable()\n\n\t# Set min value to a value larger than any domain list\n\tmin = $N + 1\n\tmin_list = []\n\n\t# For each variable in the domain grid, check if its len is <= min and add \n\t# to the min...
c3edba9999e46b50e92ed4511353b8c1
GET /books/1 GET /books/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a613f6e6f0318023e97fa4ad7cee0b91", "score": "0.763825", "text": "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(goo...
a1cd5374c8f646000462c7ce64a11941
Create explicit Values from the shorthand syntax
[ { "docid": "21acc68cd0d207ae13c4acbf6a69123c", "score": "0.48916662", "text": "def parse_value x\n case x\n when Value, NilClass\n x\n when Array\n x1, x2, = x\n if x1.is_a? Symbol and x2 == nil\n # [reg]\n RegisterMemory.new x1\n elsif x1.is_a? Symbol and x2.i...
[ { "docid": "f2031fb445589744466da0f201a8fded", "score": "0.5605023", "text": "def values_to_preset; end", "title": "" }, { "docid": "f302ce24bfba650bf0b66f941c20dcd6", "score": "0.5347695", "text": "def build_literals(hsh)\n hsh.each_with_object({}) do |(key, value), output|\n ...
d28edd8e15612b6da2983d5bb95908e8
PUT /encounter_events/1 PUT /encounter_events/1.xml
[ { "docid": "095c7805a854c01224cf547b9560fadb", "score": "0.719676", "text": "def update\n @encounter_event = EncounterEvent.find(params[:id])\n\n respond_to do |format|\n if @encounter_event.update_attributes(params[:encounter_event])\n format.html { redirect_to(@encounter_event, :noti...
[ { "docid": "22348ebd79d657994d5e45c8477d9ee6", "score": "0.6363058", "text": "def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string),...
040aae54c27dd019aa3294556e5481ff
Returns the value of attribute pid. source://childprocess4.1.0/lib/childprocess/unix/process.rb:4
[ { "docid": "2adb22b9e370adca9ed0a329599b68b4", "score": "0.63222283", "text": "def pid; end", "title": "" } ]
[ { "docid": "33239cc6f6e288b3066ecd4acc780dd8", "score": "0.78583837", "text": "def pid\n value = 0\n if running?\n File.open(pid_file, 'r') do |f|\n value = f.gets\n end\n end\n value\n end", "title": "" }, { "docid": "db80d8d0735b3bb2ba807bb11148b823", "sco...
60b0cbfb092c7dda56b229e9ac887bbb
PUT /quest_trees/1 PUT /quest_trees/1.json
[ { "docid": "dcfeff8a4305a78df4c040594e47316c", "score": "0.72055954", "text": "def update\n @quest_tree = QuestTree.find(params[:id])\n\n respond_to do |format|\n if @quest_tree.update_attributes(params[:quest_tree])\n format.html { redirect_to @quest_tree, notice: 'Quest tree was succ...
[ { "docid": "0502950144da1536ab25331d1d512d4d", "score": "0.6112445", "text": "def create\n @quest_tree = QuestTree.new(params[:quest_tree])\n\n respond_to do |format|\n if @quest_tree.save\n format.html { redirect_to @quest_tree, notice: 'Quest tree was successfully created.' }\n ...
cadd2be9ce3e4261c9ffae3d23c76a96
Stubs out multiple methods. You shouldn't be calling this yourself and if you do you should be able to understand the code yourself, right?
[ { "docid": "21686b8ea8980f7e58fdbbaf258dbda0", "score": "0.0", "text": "def stub_out(object, stubs = {})\n return if stubs.nil?\n stubs.each do |method, value|\n if value\n object.stub!(method).and_return(value)\n else\n object.stub!(method)\n end\n ...
[ { "docid": "6153b89dfd052a4eabe636ea1c0a31a6", "score": "0.74841523", "text": "def stubba_methods; end", "title": "" }, { "docid": "79678293371fbbb5b7a6b70fde2448b3", "score": "0.73981357", "text": "def stubba_methods=(_arg0); end", "title": "" }, { "docid": "a2f6da6aea75...
f0cb90a4aaf155c6315cb7d8eca7f402
Creates an AWS session and returns the credentails object.
[ { "docid": "fef7110188a662c018e0dd7359ee5679", "score": "0.6051814", "text": "def create_aws_session(profile:, mfa_code:)\n sts = Aws::STS::Client.new\n sts.get_session_token(\n serial_number: load_config_value(profile: profile, key: 'mfa_serial'),\n token_code: mfa_code\n )...
[ { "docid": "4a3f3f1258db013b0408dbd47acadd77", "score": "0.6429363", "text": "def aws_session(duration = 30)\n @aws_session ||= begin\n sts = ::Fog::AWS::STS.new(aws_credentials)\n\n # Request a token for the user that has permissions masked to a single S3 bucket and only lasts ...
3270ab415b669c46b98a254a063ff300
Carrega os TODOS salvos no arquivo csv_filepath (todos.csv)
[ { "docid": "08abb6945d5c07ffc55d2900e4481232", "score": "0.0", "text": "def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend", "title": "" } ]
[ { "docid": "6d3da2358dcfd50f10c67af85cabd7bd", "score": "0.64455444", "text": "def save_csv\n CSV.open(@csv_file_path, \"wb\") do |csv|\n csv << [\"name\", \"description\", \"rating\", \"prep_time\", \"done\"]\n @recipes.each do |recipe|\n csv << [recipe.name, recipe.description, rec...
0faf454affa9a439733dba5758747836
Creates a temp notepad.exe to inject payload in to given the payload Returns process PID
[ { "docid": "167ddeaceaedea11254c185ff8fd3a6a", "score": "0.75467616", "text": "def create_temp_proc()\r\n\t\twindir = client.fs.file.expand_path(\"%windir%\")\r\n\t\t# Select path of executable to run depending the architecture\r\n\t\tif @payload_arch.first== \"x86\" and client.platform =~ /x86/\r\n\t\t...
[ { "docid": "eb9b416813de1fa020d4227aa84a7ce3", "score": "0.7373231", "text": "def create_temp_proc()\n target_ppid = session.sys.process[datastore['PPID_NAME']] || datastore['PPID']\n cmd = get_notepad_pathname(client.arch, client.sys.config.getenv('windir'), client.arch)\n\n print_status(\"Spa...
5a1764d726455ceafe37610abc61a107
GET /unit_lists GET /unit_lists.json
[ { "docid": "fcb8785ce99e68a91f69688fdaf4387f", "score": "0.77978027", "text": "def index\n @unit_lists = UnitList.all\n end", "title": "" } ]
[ { "docid": "c2c6c7fb0c49180e9474b8eff2409fd5", "score": "0.75443727", "text": "def lists\n\tget('/lists.json')\nend", "title": "" }, { "docid": "7381460eeda20a88e15927d72a7f62bb", "score": "0.7104173", "text": "def index\n @units = Unit.order(:id)\n\n respond_to do |format|\n ...
77b61fd5d4f1c67c239ca8dbbb75f767
Fetch data, get content of specified URL.
[ { "docid": "212924f263ae3a9ca70f71b645ff6fa2", "score": "0.0", "text": "def get(endpoint_base, endpoint_path, headers = {})\n headers = API::DEFAULT_HEADERS.merge(headers)\n httpclient.get(endpoint_base + endpoint_path, headers)\n end", "title": "" } ]
[ { "docid": "1d7c56447e39af8cd61c4e89a2700e30", "score": "0.88290113", "text": "def fetch\n get_data(url)\n end", "title": "" }, { "docid": "f346e3ee6df654e2233bd350430d0fd8", "score": "0.8110975", "text": "def fetch(url)\n\t\tresponse = self.request('GET', url)\n\t\treturn re...
5febd3a09b0fb8ea8f5c20a22d62b245
character_range?() returns true if the supplied rule_spec contains only a single character range string_pattern
[ { "docid": "954ea8233c7fb5af2200b1baed901792", "score": "0.91638315", "text": "def character_range?( rule_spec )\n return false unless string_pattern?(rule_spec)\n return Grammar.node_has_type?(rule_spec.expression.string_pattern, \"character_set\")\n end", "title": "" } ]
[ { "docid": "a456c572e57327b6ac532585518c913d", "score": "0.6964725", "text": "def matched_by_basic_range?(range)\n if range.kind_of?(Composition)\n s = range.composition\n elsif range.respond_to?(:to_str)\n s = range.to_str.downcase\n return true if s == WILDCARD...
0c70444c1663d7943538f598f9be8235
POST /ordenations POST /ordenations.json
[ { "docid": "59403be08a55d7a75bc4c335fbad5e70", "score": "0.69149715", "text": "def create\n @ordenation = @configuration.ordenations.build(ordenation_params)\n\n respond_to do |format|\n if @ordenation.save\n format.html { redirect_to [@configuration, @ordenation], notice: 'Ordenation ...
[ { "docid": "04fcda5fdf2d67b2f25ea0c79013dc2d", "score": "0.6790309", "text": "def create\n @orden = Orden.new(params[:orden])\n\n respond_to do |format|\n if @orden.save\n format.html { redirect_to @orden, notice: 'Orden was successfully created.' }\n format.json { render json: ...
590e68c4689f6f64559959347621672f
returns "Guten Tag Herr Dr. Meier" or simply "Guten Tag" if there is no name
[ { "docid": "e063cad45a99842958d3f6580542aafd", "score": "0.0", "text": "def mailer_salutation_and_title_and_last_name\n self.to_person.name.blank? ? \"Guten Tag\" : \"Guten Tag #{self.to_person.salutation_and_title_and_last_name}\"\n end", "title": "" } ]
[ { "docid": "ba908c84f7cc21c3460aac2f8b08d20b", "score": "0.71386117", "text": "def name_with_tag_name\n tag = Tag.find_by_id(tag_id)\n \"#{name} (#{tag.name})\"\n end", "title": "" }, { "docid": "3a97c1d0824d4db2e1f527ba362b215a", "score": "0.7123835", "text": "def best_name\n...
b4e99459fe552233ed8f6dc42617c727
given a nokogiri xml doc, print it out in a style like Go does, facilitating diffs
[ { "docid": "fb61d367820691a1d03b3314956caf8e", "score": "0.61376464", "text": "def to_go_xml(xml_doc)\n out = xml_doc.to_xml({:encoding => 'utf-8', :indent => 2})\n out.gsub(/\\/>/,\" />\") # make the xml more like how go writes it\n out\n end", "title": "" } ]
[ { "docid": "c223711ea57b9bbc072837116efdf465", "score": "0.6992121", "text": "def print\n require 'rexml/document'\n rexml_doc = REXML::Document.new(doc.to_xml)\n formatter = REXML::Formatters::Pretty.new\n formatter.compact = true\n formatter.write(rexml_doc, $stdout)\n $s...
55e1a46057961d2d7ab54b70d3a02ca5
become a subkey, i.e. a key of prefix ::
[ { "docid": "0e9cd7aa52b9f8488f93dd953107526b", "score": "0.64261264", "text": "def subkey(__name, __type)\n\t\t\tself.send(:define_method, __name) do\n\t\t\t\tkey = kify(self.class.name, self.guid, __name)\n\t\t\t\t__type.new(key)\n\t\t\tend\n\t\tend", "title": "" } ]
[ { "docid": "23c1f7db4b8a86ceaa1a0ff1b065f85d", "score": "0.70655614", "text": "def subkey(child)\n sanitize_key \"#{self.key}:#{child}\"\n end", "title": "" }, { "docid": "63fcb51ec027478554bf1b1d55b92adb", "score": "0.69124854", "text": "def subkey\n to_s.split(/:/, 2).la...
8230c99f01d8f752a9dd4c12a45d6150
DELETE /glosentries/1 DELETE /glosentries/1.json
[ { "docid": "7ce19ef192fb59137162dca4a07409a5", "score": "0.72654986", "text": "def destroy\n @glosentry = Glosentry.find(params[:id])\n @glosentry.destroy\n\n respond_to do |format|\n format.html { redirect_to glosentries_url }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "feb05fa712cede2232b7a79bf0cdeb56", "score": "0.6987642", "text": "def delete\n render json: Entry.delete(params[\"id\"])\n end", "title": "" }, { "docid": "15c3d58d4c6de89cb93b5fcfa3676239", "score": "0.69607246", "text": "def destroy\n @glosentry = Glosentry.find(...
c63504b67a03a5c7992717184645f393
POST /api/v1/shapes POST /api/v1/shapes.json
[ { "docid": "4bb1b68f54373dd06150d34ead8a48ea", "score": "0.74414945", "text": "def create\n @api_v1_shape = Api::V1::Shape.new(api_v1_shape_params)\n\n respond_to do |format|\n if @api_v1_shape.save\n format.html do\n redirect_to @api_v1_shape, notice: 'Shape was successfully ...
[ { "docid": "b2435b6f5cebce4516e83183ee62099a", "score": "0.7197313", "text": "def create\n logger.info \"==== creating ======\"\n unless params[:shape].nil?\n logger.info \"shape is nil.\"\n logger.info params[:shape][:name] unless params[:shape][:name].nil?\n @existingShape = Shape...
7aedf606a3d76405357d49af0f7c0284
PATCH/PUT /brite_rt_barabasis/1 PATCH/PUT /brite_rt_barabasis/1.json
[ { "docid": "a2c058ab3cf8044f2b9420a63cc1728c", "score": "0.7577716", "text": "def update\n respond_to do |format|\n if @brite_rt_barabasis.update(brite_rt_barabasis_params)\n format.html { redirect_to @brite_rt_barabasis, notice: 'Brite rt barabasi was successfully updated.' }\n fo...
[ { "docid": "24b15deff937eeed98617dfe8de9c47d", "score": "0.7149154", "text": "def update\n respond_to do |format|\n if @brite_as_barabasis.update(brite_as_barabasis_params)\n format.html { redirect_to @brite_as_barabasis, notice: 'Brite as barabasi was successfully updated.' }\n fo...
23458faa9d7052743f89e622ff40796b
PATCH/PUT /resume PATCH/PUT /resume.json
[ { "docid": "638e199518ae0f7feff2331896906244", "score": "0.759652", "text": "def update\n respond_to do |format|\n if @resume.update(resume_params)\n format.html { redirect_to resume_path, flash: { success: 'Resume was successfully updated.' } }\n format.json { render :show, status...
[ { "docid": "991f70f8be904983076637f18a53a466", "score": "0.7661238", "text": "def update\n @resume = Resume.find(params[:id])\n\n respond_to do |format|\n if @resume.update_attributes(params[:resume])\n format.html { redirect_to @resume, notice: 'Task was successfully updated.' }\n ...
701242739d9c15996b9407c5829f5405
The HTTP proxy password source://mechanize//lib/mechanize.rb698
[ { "docid": "bacd7e87fa5482f3e348497c64889c8b", "score": "0.64777046", "text": "def proxy_pass; end", "title": "" } ]
[ { "docid": "1518b07f3ac0433b890db508c796fe45", "score": "0.61912847", "text": "def proxyuserpwd=(value)\n Curl.set_option(:proxyuserpwd, value_for(value, :string), handle)\n end", "title": "" }, { "docid": "762632f2c73b0c5f0c3f3666b09b59a2", "score": "0.60843307", "text":...
4e584f265ae91ee4643d8e443d4a832f
To use the Flickr API you need an api key (see and the flickr client object shuld be initialized with this. You'll also need a shared secret code if you want to use authentication (e.g. to get a user's private photos) There are two ways to initialize the Flickr client. The preferred way is with a hash of params, e.g. '...
[ { "docid": "9df9e8bc76bd1196e722cbeebfb29aba", "score": "0.60586375", "text": "def initialize(api_key_or_params=nil, email=nil, password=nil, shared_secret=nil)\n @host = HOST_URL\n @api = API_PATH\n if api_key_or_params.is_a?(Hash)\n @api_key = api_key_or_params['api_key']\n @shared_...
[ { "docid": "438fd2064dab02b7a496f4bc11c60625", "score": "0.7469214", "text": "def initialize(api_key='86e18ef2a064ff2255845e029208d7f4', email=nil, password=nil)\n @api_key = api_key\n @host = 'http://flickr.com'\n @api = '/services/rest'\n login(email, password) if email and password\n end...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.7717158", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "a95dfe28d6b386aafc5fb53749e84258", "score": "0.75098217", "text": "def user\...
d5047876d627daca06a91c5412bb7817
create a new REXML CIB document
[ { "docid": "06d93b96f5b2ba94afb1136fb05d739b", "score": "0.75134176", "text": "def cib\n return @cib if @cib\n @cib = REXML::Document.new(raw_cib)\n end", "title": "" } ]
[ { "docid": "b477fb2a3198fb94816aa1b236a870f9", "score": "0.6534239", "text": "def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://sche...
8e02ab18f2e223ff3894de578933b9ca
Checks whether we should send environment info, and if so, returns the snapshot from the local environment. Generating the EnvironmentReport has the potential to trigger require calls in Rails environments, so this method should only be called synchronously from on the main thread.
[ { "docid": "8ab67ca4f5db0c505ca78d83e2f2c97e", "score": "0.6022737", "text": "def environment_for_connect\n ::TingYun::Agent.config[:send_environment_info] ? TingYun::EnvironmentReport.new.data : {}\n end", "title": "" } ]
[ { "docid": "d750b7edaf5d2fa1dc84a2932e1d5c0b", "score": "0.5951139", "text": "def environment_for_connect\n @environment_report ||= Agent.config[:send_environment_info] ? Array(EnvironmentReport.new) : []\n end", "title": "" }, { "docid": "8e7447013de44645bb5da0b728941ca2", ...
ce86eed889efd605f9f1d3ee4a5d480c
GET /items/1 GET /items/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "41699dd17c12d7e8d1afd1406f087302", "score": "0.80987954", "text": "def item(id)\n get(\"/item/#{id}.json\")\n end", "title": "" }, { "docid": "eb354ffc8205e277e16c339add996ccd", "score": "0.74948645", "text": "def show\n item = Item.find(params[:id])\n render js...
7b8039204b8e328eca43d1cb1d23d50d
How would you return an array of all of the pokemon's names?
[ { "docid": "e93c8b80e73673fd9f44350fa59d7d59", "score": "0.7871555", "text": "def all_names(pokemon_array)\n pokemon_name = []\n pokemon_array.each do |monster_hash|\n pokemon_name << monster_hash[:name]\n end\n pokemon_name\nend", "title": "" } ]
[ { "docid": "094f3f099d437a23fdba53d315649444", "score": "0.8358689", "text": "def pokemon_names(pokemon)\n pokemon.collect{|poke_profile|\n poke_profile[:name]\n }\nend", "title": "" }, { "docid": "c2a42bc66a432ab3b7b0d4642bec9a9a", "score": "0.7738005", "text": "def lis...
006e032f14846e95b4a50e0a90e8a507
This method determines if the inspected file is not in lib/ or isn't a gemspec file.
[ { "docid": "0e63d0db4b5223936825d89a6604df07", "score": "0.88412654", "text": "def inspected_file_is_not_in_lib_or_gemspec?; end", "title": "" } ]
[ { "docid": "74e74e22856fef719a9c158c24c1744f", "score": "0.86876047", "text": "def inspected_file_is_not_in_lib_or_gemspec?\n !inspected_file_falls_in_lib? && !inspected_file_is_gemspec?\n end", "title": "" }, { "docid": "c608048cb509cda6ffa1ec1645c7c1d8", "score": "0.8090632...
6d8cbc3c41301774df3a880c1bd293ec
Updates the quantity dispensed of the drug_order and adjusts the auto_expiry_date if necessary
[ { "docid": "f8acac79029f49f121eadbd6b607c379", "score": "0.83381873", "text": "def update_quantity_dispensed(drug_order, quantity)\n drug_order.quantity ||= 0\n drug_order.quantity += quantity.to_f\n\n order = drug_order.order\n # We assume patient start taking drugs on same day he/s...
[ { "docid": "56bd96030e61040fbcfca9dbf02c0eee", "score": "0.66266745", "text": "def update_quantity(new_quantity)\n\n if extra = ::Yito::Model::Booking::BookingExtra.get(self.extra_id)\n booking_deposit = SystemConfiguration::Variable.get_value('booking.deposit', 0).to_i\n old_quant...
538430c30b1b82295f0d3c09047dfb0e
Topdown approach recursive solution
[ { "docid": "61b4ce15e57a212b8e2c9c31a9e80ee4", "score": "0.0", "text": "def recursive_min_sum(head)\n current = head\n current.sum = current.value.to_i\n current.path = [current.value]\n\n unless current.left && current.right\n current.sum = current.value.to_i\n current.path = [current.value]\...
[ { "docid": "de76bcc464d7faf4d87154622495557a", "score": "0.68112713", "text": "def recursive => nil", "title": "" }, { "docid": "67b72fe76979b001314d367b8c596bb2", "score": "0.64413995", "text": "def explore_upwards(node)\n node = node.parent until node.parent.nil? || node.parent.le...
2687d63220d1162b712b73c4b6526032
Deletes a hosted zone. Expects a zone_id in input Be careful
[ { "docid": "320f68ae59d8a458da1a3dce67596956", "score": "0.7711563", "text": "def delete_zone(zone_id)\n sleep 1\n client = Aws::Route53::Client.new\n client.delete_hosted_zone(\n id: zone_id\n )\nend", "title": "" } ]
[ { "docid": "c2e4384c526fee85d6c342b4be9d8ec2", "score": "0.8599224", "text": "def delete(zone_id)\n call('domain.zone.delete', zone_id)\n end", "title": "" }, { "docid": "06d48feeaf875191aed3b8aea1459a66", "score": "0.8521841", "text": "def delete_hosted_zone(zone_id)...
91db2418d5ec9b7ad7b6981329642c9c
Get the numeric component of an alphanumumeric coordinate
[ { "docid": "fcd294b94d25af182cab5496ae953797", "score": "0.7355706", "text": "def numeric_component(alphanum)\n mtch = alphanum.match(/\\d+/)\n return mtch[0].to_i if mtch\n end", "title": "" } ]
[ { "docid": "7d6acf56de66986f894fb90f20785e31", "score": "0.703086", "text": "def an_numeric_component\n @record.eds_accession_number.split('.').last\n end", "title": "" }, { "docid": "242ac4ad7c47051e03f16f3479e30b3d", "score": "0.6588341", "text": "def parse_coord_digits coordst...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "3316004c19010eb1bd3373e0644408de", "score": "0.0", "text": "def update!(**args)\n @fixed = args[:fixed] if args.key?(:fixed)\n @percent = args[:percent] if args.key?(:percent)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
90784bc9d122f44cebee83dc352a1f5b
Returns the Salesforce ID of the contact if they exist or nil if not
[ { "docid": "ebc504a2b3a9dd50edeac31482a71d02", "score": "0.63272005", "text": "def exists_in_salesforce(email)\n client = get_client\n # Note: this doesn't work if there is a + in the email. I can escape it and call the REST API like this in the workbench:\n # /services/data/v22.0/query?...
[ { "docid": "836145390c1aef9e0974a1dcc185fff0", "score": "0.76489776", "text": "def contact_id\n attributes[:contact] && attributes[:contact][:contact_id]\n end", "title": "" }, { "docid": "115893b082122193d2078cb0b44a5b6d", "score": "0.76345634", "text": "def contact_...
76a7056df1f70b905007a02ba2e395bf
POST /ordes POST /ordes.json
[ { "docid": "bb58d71ccace3de7019e2a843630948a", "score": "0.0", "text": "def create\n @order = @user.orders.build(params[:order])\n respond_to do |format|\n if @order.save\n format.html { redirect_to customer_or_admin_orders_path, notice: 'Order was successfully created.' }\n for...
[ { "docid": "04fcda5fdf2d67b2f25ea0c79013dc2d", "score": "0.6690343", "text": "def create\n @orden = Orden.new(params[:orden])\n\n respond_to do |format|\n if @orden.save\n format.html { redirect_to @orden, notice: 'Orden was successfully created.' }\n format.json { render json: ...
c59f5c4d28640a88a4a0114dac767bd9
Parses results for a search by ABN
[ { "docid": "420e431202be361e13eb61270c59ffd8", "score": "0.7361982", "text": "def parse_search_result(result)\n result = {\n acn: (result[:asic_number] rescue \"\"),\n abn: (result[:abn][:identifier_value] rescue \"\"),\n entity_type: result[:...
[ { "docid": "035daf1898136db63d03eda91c7135dd", "score": "0.7271986", "text": "def parse_results results_page, query\n model = query.model\n case model.to_s\n when 'LCPAL::Person'\n # just give back the person searched for, if he exists\n if results_page.body=~/Reco...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "9fd696ea38a59d30d5e57c68d1dcf83f", "score": "0.0", "text": "def update!(**args)\n @use_in_app_default = args[:use_in_app_default] if args.key?(:use_in_app_default)\n @value = args[:value] if args.key?(:value)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
41783db2b4380240f30bacf1cbc9f849
Extracts the website domain from the item
[ { "docid": "36734b37f058349e9338b01e62730de1", "score": "0.8201913", "text": "def org_website(item:)\n return nil unless item.present? && item.fetch('links', [])&.any?\n return nil if item['links'].first.blank?\n\n # A website was found, so extract just the domain without the www\n ...
[ { "docid": "90c689940ae6befa4a87d232d95024e7", "score": "0.82955825", "text": "def org_website(item:)\n return nil unless item.present? && item.fetch('links', [])&.any?\n return nil if item['links'].first.blank?\n\n # A website was found, so extract just the domain without the...
bcab8d9bed7e4bdf6d0ee156c22c84f7
Question 5...actually 6 because my solution ended up being what 6 asks for Write a method that takes one argument, a string, and returns a new string with the words in reverse order.
[ { "docid": "a7aa27b7c4a4ff8c431d3a3d648b1703", "score": "0.0", "text": "def q5_reverse(str)\n str.split('').reverse.join('')\nend", "title": "" } ]
[ { "docid": "ce8fa95fa0db0df9cb400d8822d64c9c", "score": "0.84731376", "text": "def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend", "title": "" }, { "docid": "ce8fa95fa0db0df9cb400d8822d64c9c", "score": "0.84731376", "text": "def reverse_words(stri...
0969c335fb19994ff36a316e3f307cea
One of the Pearson skewness measures of this sample.
[ { "docid": "800ce4011f9a49382914f00bd0a777b0", "score": "0.71659666", "text": "def pearson_skewness2(array)\n\t 3 * (mean(array) - median(array)) / stddev(array)\n end", "title": "" } ]
[ { "docid": "9988a4ea30882863a45716c6c341958f", "score": "0.7878964", "text": "def skewness\n\t\tfail \"Buggy\"\n\t\treturn 0.0 if count < 2\n\t\tm = mean\n\t\ts = inject(0) { |sum,xi| sum+(xi-m)**3 }\n\t\ts.to_f/(count*variance**(3/2))\n\tend", "title": "" }, { "docid": "4b95f613dc4621cbdde5...
6dc551b9dc949b876b88f04f5ae732ba
Overwritten with the extension of the file.
[ { "docid": "8ecba0baf2cf82f0eeff4fae110c35a5", "score": "0.0", "text": "def extension\n 'unused'\n end", "title": "" } ]
[ { "docid": "2663dc68d977c25309d6fb6d5fa34a15", "score": "0.786456", "text": "def change_extension(file, new_extension)\n file.sub(/\\.[a-zA-Z0-9]+\\z/, new_extension)\n end", "title": "" }, { "docid": "faefe8e70230c57be0682bc114a02af9", "score": "0.78228754", "text": "def extensi...
da753c8cd3e348df7a9226012945d321
Sets the model representing the users of the application. The default is User. Normally this is done by setting the constant UserModel to the correct model in your test class. However, if for some reason that is not feasible, you may use this setter. The constant definition takes presence over the attribute. Example: c...
[ { "docid": "e8df0145d43caefc17822ecee7be3f57", "score": "0.78202", "text": "def user_model=(new_value)\n @user_model = new_value unless const_defined?(:UserModel)\n @users_fixture_loaded = false\n load_users_fixture\n end", "title": "" } ]
[ { "docid": "ebfa790ae162a30b0409be2f75f3a294", "score": "0.7305272", "text": "def user_model(*args)\n if args.blank?\n const_defined?(:UserModel) ? const_get(:UserModel) : (@user_model || User)\n else\n self.user_model = args.first\n end\n end", "title": "" }, { ...
318ee058e7a33b8f9fc1c889bf41529e
GET /meetings GET /meetings.json
[ { "docid": "8c9dfd127f7310b024cbd14f8cb2d871", "score": "0.67505383", "text": "def index\n if params[:search]\n @meetings = Meeting.search(params[:search]).order(\"created_at DESC\")\n else\n @meetings = Meeting.all.order(\"created_at DESC\")\n end\n end", "title": "" } ]
[ { "docid": "7d204db3b1a4fb78c533887322446d1a", "score": "0.82931644", "text": "def index\n @meetings = Meeting.all\n\n render json: @meetings\n end", "title": "" }, { "docid": "02df1852dd6db37e99132d09308ab5e6", "score": "0.8124982", "text": "def index\n @meetings = Meeting...
3fdf98430bc1825bcfc835c630baf296
get data elements tobe monitored with Bloom Filter.
[ { "docid": "b74fcdfa3764551ff8c46093d88b1c53", "score": "0.0", "text": "def watch_targets\n wallet.db.get_keys(self).map { |key| Bitcoin.hash160(key) }\n end", "title": "" } ]
[ { "docid": "5cfa86772738d8cfec057892573f19fc", "score": "0.55350447", "text": "def get_all\n @data\n end", "title": "" }, { "docid": "ad57f9edbcbb36c36cb10475cb72b33a", "score": "0.5442644", "text": "def gets_buffer_data(*a)\n @device.buffer.map { |msg| msg[:data] }\n end...
67fca34a7c99638dba2ee067659f3a3f
GET /key_auths/1 GET /key_auths/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "98f6f699e83987a5cfef82b0b9a11d19", "score": "0.67982495", "text": "def api_authenticate\n key = \"1e8bb9ef2387e59b133\"\n head(:unauthorized) unless key == params[:key]\n end", "title": "" }, { "docid": "a0a2dd986017ce81f3260373f608cc4a", "score": "0.66906077", "te...
a44b2224567cdca9e666d0fc5c16d04d
POST /option_shifts POST /option_shifts.json
[ { "docid": "e8a1239b362b86463e6da9f6e501133c", "score": "0.71679044", "text": "def create\n @option_shift = OptionShift.new(option_shift_params)\n\n respond_to do |format|\n if @option_shift.save\n format.html { redirect_to @option_shift, notice: 'Option shift was successfully created....
[ { "docid": "735a6d4d74a081d9dd3bb2003f22ef44", "score": "0.67049176", "text": "def create\n @shift = @store.shifts.new(params[:shift])\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to store_url(@store), notice: 'Shift was successfully created.' }\n format....
d162dff3eeb4b666d1bec070d86b04d7
helper method for simple queries
[ { "docid": "94a30702b53b427ba2c173e2254dc503", "score": "0.0", "text": "def query command\n self.write(command).read\n end", "title": "" } ]
[ { "docid": "27c0120f4c85a642d3efebdaa72a864b", "score": "0.77911913", "text": "def _query; end", "title": "" }, { "docid": "921bab78fba869c9ff213b07e59908d2", "score": "0.77675533", "text": "def query; end", "title": "" }, { "docid": "921bab78fba869c9ff213b07e59908d2", ...
14c6e06061343bde5d55b47f5be0e937
Set the value of the Collection input for this Choreo.
[ { "docid": "4d1d0060672c64babab661644a3d2efb", "score": "0.81241876", "text": "def set_Collection(value)\n set_input(\"Collection\", value)\n end", "title": "" } ]
[ { "docid": "7237d6c5c4383b449570c66d039cdf85", "score": "0.8129475", "text": "def set_Collection(value)\n set_input(\"Collection\", value)\n end", "title": "" }, { "docid": "7237d6c5c4383b449570c66d039cdf85", "score": "0.8129475", "text": "def set_Collection(v...
7165e30c712644a9b8be7261d3aec931
params: n = client_payment.id
[ { "docid": "709f6b1819edffac7d18a8674fb7dcca", "score": "0.0", "text": "def perform(*args)\n n = args[0]\n return false unless n > 0\n\n pm = Payment.find(n)\n pr = pm.pay_result\n pr.notify_times = 0 unless pr.notify_times\n return false unless pm && pr && pr.notify_times < 100\n\n ...
[ { "docid": "887e41a6a93f426447decd86cc386973", "score": "0.67982155", "text": "def item_id\n params['m_payment_id']\n end", "title": "" }, { "docid": "ecd518b33cf48c47fddf94a575644197", "score": "0.6739064", "text": "def transaction_id\n params['pf_paym...
8f7e80a9f771f6ebbb9ffcde2e31afff
Below code is used to covert notes to task.
[ { "docid": "6a382abe65d0c6e66b3b6e75f511c6dd", "score": "0.0", "text": "def update \n data=params\n employee = Employee.find(params[:id])\n if update_lawyer_preferences(employee)\n flash[:notice] = \"Lawyer preferences updated successfully\"\n redirect_to :back\n return true\n...
[ { "docid": "f3a4c84ffc4fb0678a62686c0ab183bf", "score": "0.6265846", "text": "def description\n \"This task simply attaches a note entity to the current entity.\"\nend", "title": "" }, { "docid": "b90cc9b5d73f0652f0d6bdbb69bfbe24", "score": "0.6215131", "text": "def create\n note...
94edb409e0195b522c569a97aa3a7a25
Invokes the exception by calling the associated proc.
[ { "docid": "1da5a401d4e6bf3346761c985e4c0585", "score": "0.63875794", "text": "def invoke\n @proc.call\n end", "title": "" } ]
[ { "docid": "8a48d57b2eb9336a27dd33522e8f7ff9", "score": "0.62665", "text": "def handle_perform_error(_e); end", "title": "" }, { "docid": "0118aa034718dbc8df61eb1be9e5377b", "score": "0.62477607", "text": "def invoke(proc)\n ret = instance_exec(&proc)\n [ret, @out_args, @de...
01cb61323f193118cd8594e07012e053
1. Base.v6_categories 2. Base.wapi_categories 3. Base.get_client_id
[ { "docid": "14abd0de06b4e0fd71e34b0d3ae59c9e", "score": "0.0", "text": "def method_missing(name, *args)\n\t\t\t\tif name =~ /^v6_[\\w]+/\n\t\t\t\t\tname = name.to_s.gsub(\"v6_\", \"\")\n\t\t\t\t\t# puts name\n\t\t\t\t\tmedia_url + name.to_s.gsub('_',\"/\")\n\n\t\t\t\t\t# puts base_url + '/v6/media/' + n...
[ { "docid": "6c63c9f0ce96f9e6b2421565d54c953c", "score": "0.69180787", "text": "def client_id; end", "title": "" }, { "docid": "6c63c9f0ce96f9e6b2421565d54c953c", "score": "0.69180787", "text": "def client_id; end", "title": "" }, { "docid": "6c63c9f0ce96f9e6b2421565d54c95...
38d5158d74024e46708cf9245bd7435d
DELETE /xmt/sites/1 DELETE /xmt/sites/1.json
[ { "docid": "3d0d6d570da8e2c4421c72e899f5a0a6", "score": "0.6596396", "text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to xmt_press_sites_url, notice: '站点删除成功.' }\n format.json { head :no_content }\n end\n end", "title"...
[ { "docid": "34264605c47edda6ffe32df87c7a7266", "score": "0.70036274", "text": "def delete\n delete_from_server single_url\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.6891176", "text": "def delete\n client.delete(\"/#{id}\")\n end"...
33c6473c67f87de01ae4d0511c0cb0e2
Get an user input choice
[ { "docid": "905148b4f16fa99f127bfce0a74850ea", "score": "0.7420482", "text": "def user_choice (text)\n\tputs text\n\tresponse = gets.strip.to_i\n\treturn response\nend", "title": "" } ]
[ { "docid": "35c7fb8b3aee54c86dbb46f248f0871a", "score": "0.8299022", "text": "def get_user_choice\n @user_choice = gets.chomp\n end", "title": "" }, { "docid": "e7a721937190b8b1c9b85d5bd411b130", "score": "0.79850847", "text": "def pt;z.gets 'Your choice:'; end", "title": "" ...
05365a0f30e487b6f14c6d14c1a575fc
Redirect to the URI stored by the most recent store_location call or to the passed default.
[ { "docid": "1c88ee0f0277574f1367d758600b7000", "score": "0.72024363", "text": "def redirect_back_or_default(default)\r\n session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)\r\n session[:return_to] = nil\r\n end", "title": "" } ]
[ { "docid": "993ce0ea710c59825a6da40341dad385", "score": "0.81678534", "text": "def sl_redirect_to_stored_or_default(default)\r\n if session['sl-return-to'].nil?\r\n redirect_to default\r\n else\r\n redirect_to_url session['sl-return-to']\r\n session['sl-return-to'] = nil\r...
74f65ec62db482e0c8f85e8580e3f975
p lucas_sequence(0) => [] p lucas_sequence(1) => [2] p lucas_sequence(2) => [2, 1] p lucas_sequence(3) => [2, 1, 3] p lucas_sequence(6) => [2, 1, 3, 4, 7, 11] p lucas_sequence(8) => [2, 1, 3, 4, 7, 11, 18, 29]
[ { "docid": "9ce9fe6beb571fc1fa7a1ee7a19703b7", "score": "0.0", "text": "def prime_factorization(num)\n primes = []\n return [num] if prime?(num)\n\n (2...num).each do |i|\n if prime?(i) && num % i == 0\n return (primes << [i, prime_factorization(num/i)]).flatten\n end\n...
[ { "docid": "35028d83cbf8233e9bf7d5aa01a9c2ae", "score": "0.83841735", "text": "def lucas_sequence(length)\n if length == 0\n return []\n elsif length == 1\n return [2]\n elsif length == 2\n return [2,1]\n end\n\n lucas_sequence(length-1) + [lucas_sequence(length-1)[-1] + lucas_sequence(len...
7c2cb504d6817068f648751a5d02a278
The patient's formatted full name
[ { "docid": "3aa21d0ed6894034ba6491d3a736d393", "score": "0.0", "text": "def formatted_name\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end", "title": "" } ]
[ { "docid": "3b7fcd2966c3a987a10fcbeefeddacf8", "score": "0.86349475", "text": "def full_name(patient)\n [patient.given_name,\n patient.middle_name,\n patient.family_name,\n patient.family_name2,\n patient.partner_name].join(' ').squish\n end", "title": "" }, { "docid": "1...
66943b69102083f5c532730c99917b3f
POST /endpoints POST /endpoints.json
[ { "docid": "6dfdcb47b6e8c5ec391b105ee1c2348c", "score": "0.61107606", "text": "def create\n respond_to do |format|\n @endpoint = current_user.endpoints.build(endpoint_params)\n\n # auto-trigger refresh\n @endpoint.last_refresh_request_at = Time.now\n\n if @endpoint.save\n R...
[ { "docid": "3a3de860ec699a3aede3bcc9ed7f01cf", "score": "0.6817098", "text": "def list_endpoints\n render json: @endpoints, status: 200\n end", "title": "" }, { "docid": "1e5f1c7a9b985ea763fc244940b49c55", "score": "0.6711644", "text": "def endpoints_list\n get \"endpoints\"...
8f70ff8510bf0b5fc8fafc43d23ff0e2
This tests Coloma > Virginia City
[ { "docid": "de7d06969078e96bf73cc5598496e882", "score": "0.70396143", "text": "def test_coloma_to_virginia_city\n\t\texpected_location = \"Virginia City\"\n\t\t@test_sim.stub(:random_num, 1) do\n\t\t\tassert_equal expected_location, @test_sim.next_location(\"Coloma\")\n\t\tend\n\tend", "title": "" ...
[ { "docid": "242ace1f76d84321fe039b09f11543aa", "score": "0.7777051", "text": "def test_virginia_city_to_midas_eldorado_coloma_angelscamp\n test_map = Map.new\n test_city = test_map.get_city('Virginia City')\n test_connections = ['Angels Camp', 'Coloma', 'Midas', 'El Dorado Canyon']\n assert_...
a26e0db289c603550086e7352d04ee08
This method is called by BaseModelconnect to do the OSspecific connection logic.
[ { "docid": "5e49cfe5a64b2a453c4de4f56a1a1154", "score": "0.0", "text": "def simple_connect(network_name, password = nil)\n command = \"networksetup -setairportnetwork #{wifi_hardware_port} \" + \"#{Shellwords.shellescape(network_name)}\"\n if password\n command << ' ' << Shellwords.shellescap...
[ { "docid": "e9a57edca042364336105152fcde8e08", "score": "0.6493958", "text": "def process_connect\n super\n end", "title": "" }, { "docid": "11243e7d3b673db6115c51746d5298e9", "score": "0.6281658", "text": "def connect\n # Implement in subclass\n end", "ti...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "05f15606022031cbe7f23bb33aa93779", "score": "0.0", "text": "def set_prompt\n @prompt = Prompt.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;...
f4e1d7d26887aee57b8bd738e9401eed
Create back reference to LNode in which this tile is a payload.
[ { "docid": "a0a9e33aff8a3758dd13ead5e8747e62", "score": "0.0", "text": "def connect(lnode)\n @lnode = lnode\n end", "title": "" } ]
[ { "docid": "5eb0ea33a031797195af2f54c96db611", "score": "0.61723304", "text": "def new_leaf(payload, **kwargs)\n factory.leaf_node(payload, **kwargs)\n end", "title": "" }, { "docid": "924d001f599b7e9eccf617e99ce831ff", "score": "0.57945585", "text": "def create_payload(paylo...
e6a69191bc48583eb9538bb55c5db173
sends a MIDI message comprised of a String of hex digits
[ { "docid": "53a365f4f555cc60385387bbbc6afe67", "score": "0.0", "text": "def puts_s(data)\r\n data = data.dup\r\n\t output = []\r\n until (str = data.slice!(0,2)).eql?(\"\")\r\n \toutput << str.hex\r\n end\r\n puts_bytes(*output)\r\n end", "title": "" } ]
[ { "docid": "38ffd175fa8f345fa986c96671c0d3dd", "score": "0.6536699", "text": "def send_message msg\n send_data \"\\x00#{msg}\\xff\"\n end", "title": "" }, { "docid": "0314e298c35184c42764d2078f5bfa30", "score": "0.64362806", "text": "def send_inquiry\n send_midi(0xF0, ...
5f8ce9b7760b7b6974f39940547b8fe2
Any sequence of six characters should be replaced with a single character, i.e. AAAAAA becomes A
[ { "docid": "1d64d3197935f07ca009bbf9ac381eaa", "score": "0.0", "text": "def rule2(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if (newstr[index..index+5].uniq.length==1)\n newstr[index..index+5] = newstr[index]\n end\n end\n newstr.join(''...
[ { "docid": "8c44b4096657e2f2814f65defcd3f218", "score": "0.69758904", "text": "def replacecharacters\n str = String.new(self)\n String::CHAR_MAPPING.each {|ascii,nonascii|\n packed = nonascii.pack('U*')\n rxp = Regexp.new(\"[#{packed}]\", nil)\n str.gsub!(rxp, ascii)\n }\n str...
de779409f3b8306332e4b8a39aa51b6a
POST /news POST /news.xml
[ { "docid": "4d59bedc38429a52f058f30e0d907f00", "score": "0.0", "text": "def create\n parent_id = params[:news][:parent_id]\n params[:news].delete :parent_id\n @news = News.new(params[:news])\n @news.user = current_user\n @news.parent_id = parent_id\n @title = @news.parent_id ? t('label...
[ { "docid": "0bc04fc9143579889639224ba02b0f88", "score": "0.71184844", "text": "def create\n @news = News.new(params[:news])\n\n respond_to do |format|\n if @news.save\n format.html { redirect_to(@news, :notice => 'News was successfully created.') }\n format.xml { render :xml =>...
6bf115fe764588a257aa390f24ac189e
Set the value of the ClientID input for this Choreo.
[ { "docid": "e1a1894d59f1da4a22ebe4e7554023b5", "score": "0.0", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" } ]
[ { "docid": "79945fc348ead54cb4e355166bfd6206", "score": "0.7315469", "text": "def client_id=(client_id)\n if client_id.nil?\n fail ArgumentError, 'client_id cannot be nil'\n end\n\n if client_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"client_id\", the char...
66cb6a6783f31714a269ad40884438f5
The convex hull of a geometry represents the minimum closed geometry that encloses all geometries within the set. It is usually used with MULTI and Geometry Collections. Although it is not an aggregate you can use it in conjunction with ST_Collect to get the convex hull of a set of points. ST_ConvexHull(ST_Collect(some...
[ { "docid": "a30d6d5617f90d3fa0674b559bd59aaf", "score": "0.6783602", "text": "def convex_hull\n postgis_calculate(:convexhull, self)\n end", "title": "" } ]
[ { "docid": "322930eb9f0a328824695e2dce693f27", "score": "0.6007765", "text": "def construct_convex_hull(points)\n require File.expand_path(File.join(File.dirname(__FILE__), \"../shared_libraries/convex_hull\"))\n \n list = List.init_double_linked_list\n @points.each do |point|\n List.push_front(l...
7186ddf63f8d5db12240abcf76185b0f
returns the count of assets of the given type. If no type is selected it returns the total number of assets
[ { "docid": "cc980b65fc6f4d6ec008fccf8ef8f38a", "score": "0.6363622", "text": "def asset_count(conditions = [], values = [])\n conditions.empty? ? assets.count : assets.where(conditions.join(' AND '), *values).count\n end", "title": "" } ]
[ { "docid": "f5dbf9421d0b854b23c997fda5a159fd", "score": "0.83694667", "text": "def asset_count(asset_type = nil) \n 0\n end", "title": "" }, { "docid": "4fe7557394ae6dfe948852dbcd07381a", "score": "0.71539277", "text": "def asset_type_counts(active_only=true)\n if active_only\...
aa4910b6c927b47a1f829845110e7bfa
number 2 will not alter the caller's input argument, the buffer argument will alter the caller before buffer is returned Q7 what is wrong with the limit variable? the limit variable is local, and is not scoped in the method, add limit as an additional argument limit = 15
[ { "docid": "145b275c69367d8ee0c7ae3335b3d200", "score": "0.0", "text": "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "title": "" } ]
[ { "docid": "2877898944666f62c86ff76799c3d922", "score": "0.66143304", "text": "def bufete_limit\n 1\n end", "title": "" }, { "docid": "46d7acb0d3534642150f9fbb55546336", "score": "0.64767236", "text": "def limit=(_arg0); end", "title": "" }, { "docid": "46d7acb0...
f281cf9a8535a7bf1160386dcda114e8
Iteration Tic Tac Toe Current Player
[ { "docid": "9f4a23cf888c59b63776a1b1896856d3", "score": "0.0", "text": "def turn_count(board)\n count = 0\n\n board.each_with_index do |location, index|\n if position_taken?(board, index)\n count = count + 1\n end\n end\n\n count\nend", "title": "" } ]
[ { "docid": "e5bd953720d219c58623802fa081b687", "score": "0.7584048", "text": "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n end", "title": "" }, { "docid": "a7296640db7336edcdd97d087dc6b577", "score": "0.756787", "text": "def current_player(board)\n ...
d46a871796623f61c3fc34fcbcd60e2e
add a new key to the right node
[ { "docid": "9e355b9ef225c71feb26c62eeccc37df", "score": "0.7560958", "text": "def addKey(key) \n if(key > @lastNode)\n nodeKeys = @keysTable[@firstNode]\n nodeKeys.push(key)\n else\n for i in key .. @lastNode\n if( (@keysTable[i] != nil) && (...
[ { "docid": "634721ef8431a1c61f897bf54082c922", "score": "0.73391235", "text": "def []=(full_key, node); end", "title": "" }, { "docid": "e92b4e047f3ad243e647da57b970f8f9", "score": "0.7301414", "text": "def add key, value = nil\n if key.class == Node\n new_node = key\...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7a9c88984c3f33838a3d8c6c4052b3c2", "score": "0.0", "text": "def set_coordinator\n @coordinator = Coordinator.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...
864cea540ef248fbfabc99c68d8c9742
Returns an xml representation of the data object to_xml(:root => true)
[ { "docid": "f5057978a7d1950bacca5b31352dec43", "score": "0.705057", "text": "def to_xml(options = {})\n options = {\n :root => (include_root = Rabl.configuration.include_xml_root),\n :child_root => include_root && Rabl.configuration.include_child_root\n }.merge(options)\n\n...
[ { "docid": "e9f76bfcb55041d8ae80accde4668185", "score": "0.8038712", "text": "def to_xml\n end", "title": "" }, { "docid": "af0a4f7cb10069dc9b67c18d03f75b08", "score": "0.8034733", "text": "def to_xml\n\t\tend", "title": "" }, { "docid": "d3325da99dbd3a2c2874e647aeea30...
43464fee474888d265ed35934690735c
DELETE /tags/1 DELETE /tags/1.json
[ { "docid": "17d5e3f2c0f05c384280d24377dd3748", "score": "0.0", "text": "def destroy\n @tag = Tag.find(params[:id])\n logger.info \"タグ #{@tag.id} を削除します。\"\n result = @tag.destroy\n if result\n logger.info \"タグ #{@tag.id} を削除しました。\"\n msg = get_resource 'success'\n else\n lo...
[ { "docid": "d67c29208071bc07677edfe1b1e5ef52", "score": "0.81822556", "text": "def tagDelete(tag)\n http, req = initReq(\"tags/#{tag}\", \"DELETE\")\n http.request(req).body\nend", "title": "" }, { "docid": "d67c29208071bc07677edfe1b1e5ef52", "score": "0.81822556", "text": "def tag...
85b914323935de81c4dce48c0dcdb85c
Sets the additional attributes for 'snake' and 'ladder' squares
[ { "docid": "6fdee3ef1c8e808e0838cc01ab36ac9b", "score": "0.0", "text": "def snakeorladder(type, destination)\n @type = type\n @destination = destination\n end", "title": "" } ]
[ { "docid": "5328923f5ea52b0314ac057ddbdface4", "score": "0.5514842", "text": "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "title": "" }, { "docid": "38cd78e0052...
a48b6088dbe030919ebaf5a02aeaef19
Mark all assignments which are referenced in the same loop as referenced by ignoring AST order since they would be referenced in next iteration.
[ { "docid": "9405546c0210bfce5b102dc46f0bd67e", "score": "0.82933605", "text": "def mark_assignments_as_referenced_in_loop(node); end", "title": "" } ]
[ { "docid": "d6f05868845b8be132e9665ad55223bc", "score": "0.60232353", "text": "def assign_referenced_expressions; end", "title": "" }, { "docid": "d6f05868845b8be132e9665ad55223bc", "score": "0.60232353", "text": "def assign_referenced_expressions; end", "title": "" }, { ...
9d75c92f349970ae8fca7f86fc43f1f1
In order for active admin to recognize the display name/label...
[ { "docid": "ce8d17694de4cd50d9b1d5b6fb0b4aa6", "score": "0.0", "text": "def display_name\n class_name\n end", "title": "" } ]
[ { "docid": "c6d74394f4386b5fb78615548c55d6e5", "score": "0.77037513", "text": "def admin_display_name\n \"#{course.organization.abbreviation} #{term.slug} #{course.number} (#{label})\"\n end", "title": "" }, { "docid": "ee977f73867138d7fdb802f5db19eccf", "score": "0.7313959", "te...
64581806158654ddb160a5e92096f73b
Return true if threshold not exceeded
[ { "docid": "a7bebe38bac03b9b5c1b91b81e6a277d", "score": "0.6886371", "text": "def evaluate wrong_amt\n self.threshold.to_i > wrong_amt.to_i\n end", "title": "" } ]
[ { "docid": "77cab7e87bd8c3bd85566c57157704f6", "score": "0.76120335", "text": "def below_threshold?\n threshold > largest_mass\n end", "title": "" }, { "docid": "4cab6d80389ef2846360cfe2353aff2c", "score": "0.749777", "text": "def in_threshold?(p)\n (p - target).norm...
ab8d1dbc4bdffeb1e72e05103877cbe0
Create a 'fabric.PcOperation' resource.
[ { "docid": "20ea769b3980edef3034c5f0aa162839", "score": "0.65930736", "text": "def create_fabric_pc_operation(fabric_pc_operation, opts = {})\n data, _status_code, _headers = create_fabric_pc_operation_with_http_info(fabric_pc_operation, opts)\n data\n end", "title": "" } ]
[ { "docid": "5570c0e41c6036f68544babdec9a6b9d", "score": "0.6989801", "text": "def create_fabric_pc_operation_with_http_info(fabric_pc_operation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FabricApi.create_fabric_pc_operation ...'\n end\n...
cc1658ae9ab6807ed583eb84ae235e01
Forgets a persistent session.
[ { "docid": "95d0a50509ac08cc01adba29f55427bc", "score": "0.0", "text": "def forget_applicant(applicant)\n #applicant.forget_applicant\n cookies.delete(:applicant_id)\n cookies.delete(:remember_token)\n end", "title": "" } ]
[ { "docid": "ea39da54d38ac74f35fbbc9ef5cebfd7", "score": "0.7237907", "text": "def do_not_set_cookie\n reset_session\n end", "title": "" }, { "docid": "8ac578271c7ec479678e14b7d6aff6f8", "score": "0.68063825", "text": "def turn_off\n self.class._end_session\n end",...
957d6372031f6f13cdf238b0770c47d0
creating temp file name
[ { "docid": "8788d46930d237eb0526e651493aa474", "score": "0.0", "text": "def tmp_filename\n extension = File.extname(uri.path)\n File.basename(uri.path,extension) + extension\n end", "title": "" } ]
[ { "docid": "df0b9dbd19f70064605507422bedfde5", "score": "0.8744778", "text": "def create_temp_file() end", "title": "" }, { "docid": "df0b9dbd19f70064605507422bedfde5", "score": "0.8744778", "text": "def create_temp_file() end", "title": "" }, { "docid": "053eae90d6d31795...
ecaba1a9ea6bbf5b5fdb6a75bff4793e
Return the AR instance class name
[ { "docid": "2f35413991440160afb3bbaeb182e933", "score": "0.7653342", "text": "def instance_class\n instance.class.name.to_s\n end", "title": "" } ]
[ { "docid": "b61f12e25ab2f5c3d2c30b8c8d692af0", "score": "0.77125776", "text": "def class_name\n @record.class.name\n end", "title": "" }, { "docid": "54d861539fb3fd8f638cd5976996a0ec", "score": "0.7627703", "text": "def class_name\n @class_name\n end", "title"...
402100ae7a31ae0c4b49bc43f23d3ea2
Finds the index number in the word for correctly guessed letter
[ { "docid": "dd773f841602da21fc4decfd85baa00d", "score": "0.7342013", "text": "def check_guesses(guess, word)\n\tguess = guess.downcase\n\tletter_index = []\n\tword = word.split('')\n\t# saves index number to display letter in view\n\tword.each_with_index do |x, i|\n\t\tletter_index.push(i) if x == guess...
[ { "docid": "8c0f7f26afa718a27c200c51857f4ce7", "score": "0.80105335", "text": "def include_letter?\n @guess_ind = (0 ... @word.length).find_all { |i| @word[i,1] == @used_guesses[-1]}\n return @guess_ind\n end", "title": "" }, { "docid": "303c5119161ecf4bfe5155371630be4c", "score":...
e1dc950ee72e4c78cb208bc98b9b1626
POST /radioshows POST /radioshows.json
[ { "docid": "61b3b60dc9ab01dfb419a8e1b7f7ebd9", "score": "0.696911", "text": "def create\n @radioshow = Radioshow.new(radioshow_params)\n\n respond_to do |format|\n if @radioshow.save\n format.html { redirect_to music_path, notice: 'Radioshow was successfully created.' }\n format...
[ { "docid": "a36f85d5db62a90db8b6374123468928", "score": "0.6972846", "text": "def radioshow_params\n params.require(:radioshow).permit(:title, :episode, :description, :image_url, :listen_url)\n end", "title": "" }, { "docid": "22abb83038003fede79a8380a3e6e04a", "score": "0.687571...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f513e40305115de45ceb2af7ea7df986", "score": "0.0", "text": "def page_params\n params.require(:page).permit(:sequence_id, :pageable_id, :pageable_type, :subject_id)\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...
a2746801294677f3459722b239bd45cb
GET /worker_items/new GET /worker_items/new.json
[ { "docid": "dcc28e5c84c2b6797410be9aae894169", "score": "0.83488", "text": "def new\n if !params[:worker].nil?\n @worker = Worker.find(params[:worker])\n end\n @breadcrumb = 'create'\n @worker_item = WorkerItem.new\n\n respond_to do |format|\n format.html # new.htm...
[ { "docid": "ead3be826010ca6cab5a73f7d102a20d", "score": "0.76542497", "text": "def create\n @breadcrumb = 'create'\n @worker_item = WorkerItem.new(params[:worker_item])\n @worker_item.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @worker_it...