query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
6dc392d5f43f5a3605de302243689bbd | Generic method which requests information for a given supplier. | [
{
"docid": "9d40eb8a4fb9af594eb7b09f48b643f4",
"score": "0.73396814",
"text": "def info_for_supplier(supplier, supplier_part_number, manufacturer_part_number=nil, quantity=nil)\n send(\"info_for_#{supplier.downcase}\", supplier_part_number, manufacturer_part_number, quantity)\nend",
"title": ""
}... | [
{
"docid": "289c1b2079d3434196d2b8d254baf997",
"score": "0.6823176",
"text": "def supplier\n supplier = Supplier.find(@supplier_id)\n return supplier\n end",
"title": ""
},
{
"docid": "995fef91e868ba545b66c66a94e5a8f4",
"score": "0.6658311",
"text": "def supplier_for(host)\n ... |
d868c641967b46c7d9d5dc8139a3a5e6 | Get the combined lift total of every lifter has a membership to that gym | [
{
"docid": "7f69176b28e7b7278aa530365fbf7e12",
"score": "0.79482645",
"text": "def lifter_combined_weight \n self.gym_lifters.map {|lifters| lifters.lift_total}.sum\n end",
"title": ""
}
] | [
{
"docid": "d8bbca1d89b52f16ef90e75aa6ea5fcb",
"score": "0.8562755",
"text": "def lift_total_sum\n lifters.map { |lifter| lifter.lift_total }.sum\n total = 0\n # memberships.each { |gym| total += gym.lifter.l ift_total } total\n end",
"title": ""
},
{
"docid": "078bc61e03571cd01c7e... |
79dfc3eabec816c77b8b2dd2448cfbeb | execute only if instance is unsaved or after_save block is already executing the below method will also raise after_save callback, so need to skip it | [
{
"docid": "ba94205d80f404d080ccdcd9b7af3de0",
"score": "0.0",
"text": "def after_save\n return if @skip_after_save\n @skip_after_save = true\n \n move!\n create_link! \n update_cached_attrs! #if @argument_type_changed # update cached_attrs only after argument type change\n \... | [
{
"docid": "57d3bce0c86f4aeca14f73ff192cc864",
"score": "0.74400884",
"text": "def before_save\n return super unless @instance_hooks\n # SEQUEL5: Remove commit/rollback\n if ar = @instance_hooks[:after_rollback]\n db.after_rollback{ar.each(&:call)}\n end\n ... |
291a05bd9d021714f252e2c58c9f0222 | Generate javascript source tags for the specified files javascripts('test') > | [
{
"docid": "a5d32d843564061facc067ff1303c86a",
"score": "0.7386583",
"text": "def javascripts(*files)\n relative_path = current_page_relative_path\n\n output = \"\"\n files.each do |file|\n file_str = file.to_s\n src = file_str.match(%r{^((\\.\\.?)?/|https?://)}) ? file_str ... | [
{
"docid": "a8ef4498b3e1249ab24f1d759d3c06d5",
"score": "0.7454433",
"text": "def javascripts(*files)\n options = (files.last.is_a? Hash) ? files.pop : {}\n \n options[:language] = 'javascript'\n options[:type] = 'text/javascript'\n \n src_files = @staticmatic.s... |
c751d935a5e478847a3d3459970500a7 | GET /apps/1 GET /apps/1.xml | [
{
"docid": "dfb73b919838546ced78e7252a8260cc",
"score": "0.0",
"text": "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html do # show.html.erb\n if request.xhr?\n render :partial => 'app', :locals => {:app => @app}\n end\n end\n fo... | [
{
"docid": "43033beeebd7ce728080297ddfb3d206",
"score": "0.7012511",
"text": "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend",
"title": ""
},
{
"docid": "43033beeebd7ce728080297ddfb3d206",
"score": "0.7012511",
"text": "def... |
ad0cfed6b83b7a081701059860d0e0ec | JSON MANIPULATIONS filter options | [
{
"docid": "0231ea44f39d9f11fe5d0757418bf1d5",
"score": "0.0",
"text": "def as_json(options = nil)\n super(options || \n {include: :friends, except: [:created_at, :updated_at, :id]})\nend",
"title": ""
}
] | [
{
"docid": "bac67e707eb605e9a6ee33cba9a284bd",
"score": "0.65715563",
"text": "def filtered_for_json\n self\n end",
"title": ""
},
{
"docid": "fde9d93312a4dac25441dc4b55971b8d",
"score": "0.65322757",
"text": "def available_filters_as_json\n json = {}\n available_filters.ea... |
3485e4bb018c59d2cfa005deb1ce2da8 | POST /publicidads POST /publicidads.json | [
{
"docid": "41e581b56e45bbcbc2ef8a4e763095e5",
"score": "0.54172885",
"text": "def create\n @publicidad = Publicidad.new(params[:publicidad])\n\n respond_to do |format|\n if @publicidad.save\n format.html { redirect_to @publicidad, notice: 'Publicidad was successfully created.' }\n ... | [
{
"docid": "1393a140123941bd53aed8ca6ab3ee37",
"score": "0.6541537",
"text": "def create\n @ad = Ad.new(ad_params)\n\n if @ad.save\n render :show, status: :created, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{... |
4e3f35492513e3732f369037ac9ad28c | get shipment cost based on store_product_shipping_rates table | [
{
"docid": "4d9704aa10dca57dd52a8be38d7071bd",
"score": "0.7639648",
"text": "def calculate_shipping_cost\n rates = {} # hash of shipping_code : number_of_items\n cost = 0.00\n\n items.each do |i|\n code = i.product.shipping_code\n raise \"Shipping code not set for #{i.product.item_nu... | [
{
"docid": "5e94c53a6554885958fa21c03e4d4b1f",
"score": "0.7389734",
"text": "def calculate_seller_shipping_fee\n cost = 0.00\n\n items.each do |i|\n sr = ProductShippingRate.find_by!(product_id: i.order_item.product_id, destination_country_code: recipient_country, ship_method: :standard)\n ... |
2c9b0abeb3b055e8ebf3e241d46eec1b | Turn the options hash into a concatenated string for use in the lookup. | [
{
"docid": "afba7944278f86b1d5734453272fed4f",
"score": "0.75353533",
"text": "def options_string(options)\n return nil if Hash(options).size.zero?\n\n options.map do |k, v|\n [k.to_s, v.to_s].join\n end.join.gsub(/[^A-Za-z0-9\\-_]/, '')\n end",
"title": ""
}
] | [
{
"docid": "137a6ba38e6c344937d2adc160f53a29",
"score": "0.70580524",
"text": "def inline_options(options = {})\n return '' if options.empty?\n (options.stringify_keys.to_a.collect { |a, b| \"#{a}=\\\"#{b}\\\"\" }).join(' ')\n end",
"title": ""
},
{
"docid": "2... |
dc86285e48c6c52b16ec7934f72c151c | Makes sleep instance comparable with another object of its type and integer | [
{
"docid": "fd47a9aedbe9f8c40005b19bb69a128e",
"score": "0.5274854",
"text": "def <=>(other)\n if other.kind_of? self.class\n self.duration <=> other.duration\n elsif other.kind_of? Integer\n self.duration <=> other\n end\n end",
"title": ""
}
] | [
{
"docid": "39d97ffe086b07ad583635a878d11c73",
"score": "0.5795433",
"text": "def eql?(obj)\n return false unless obj.is_a?(TimeWait)\n return false unless @delay.eql?(obj.delay)\n return true\n end",
"title": ""
},
{
"docid": "c5689a69ef650d1680a05df6... |
ab68da3f1d89eb25cb741eec204f39ca | GET /simple_votes/1 GET /simple_votes/1.json | [
{
"docid": "5fddc57afb5136c34d24e4e215ebe59a",
"score": "0.77079284",
"text": "def show\n @simple_vote = SimpleVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @simple_vote }\n end\n end",
"title": ""
}
] | [
{
"docid": "80acc37e3474460757c0a5623f4ab5e1",
"score": "0.74419266",
"text": "def uri\n \"http://api:3000/votes.json\"\n end",
"title": ""
},
{
"docid": "8d012bed5d453c999b919cd55317dc9f",
"score": "0.71496594",
"text": "def index\n @votes = @item.votes.all\n\n respond_to ... |
9843ddfbf498aff6f72be46944cd9c4e | I worked on this challenge by myself. Your Solution Below | [
{
"docid": "c74d0d8a82ed50bbb0de2c804e1d8dcb",
"score": "0.0",
"text": "def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"title": ""
}
] | [
{
"docid": "b9960478999684c2b536f76e22f6fc63",
"score": "0.66693175",
"text": "def solution4(input)\n end",
"title": ""
},
{
"docid": "f712d49ec6c615538b2e2aa846391fda",
"score": "0.65808177",
"text": "def challenge; end",
"title": ""
},
{
"docid": "eabdd32fa3a69c5639179... |
8db1ad83f8358462f35c86381107c205 | Returns the value of attribute comment. source://rbs//lib/rbs/ast/members.rb369 | [
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.0",
"text": "def comment; end",
"title": ""
}
] | [
{
"docid": "4ed12a1f3af32548d8bd9cc5b8670232",
"score": "0.6720582",
"text": "def comment\n decode_string_member(:comment)\n end",
"title": ""
},
{
"docid": "6476bb04f2e3f3ac45f5d2eef2b3944e",
"score": "0.6518629",
"text": "def comment\n @attributes[:comment]\n en... |
a49011d5f6b53a61997dec2b6fca3667 | POST /employees POST /employees.json | [
{
"docid": "babcfc7266f98431287947fee9477487",
"score": "0.0",
"text": "def create\n @employee = current_user.employees.new(employee_params)\n respond_to do |format|\n if @employee.save\n if params[:show_level].to_i == 0\n @employee.level_id = nil\n @employee.group_id... | [
{
"docid": "c3ca308d3816fd81fe0e2e8e4283cabf",
"score": "0.7005552",
"text": "def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.js... |
af630984682f1a0b5a68e6092af0d102 | Update properties of this object | [
{
"docid": "e27c1148f02e2343444db0c3b3663552",
"score": "0.0",
"text": "def update!(**args)\n @blob = args[:blob] if args.key?(:blob)\n @cover_image = args[:cover_image] if args.key?(:cover_image)\n @id = args[:id] if args.key?(:id)\n @metadata = args[:metadata] if ar... | [
{
"docid": "184b1b1ed771473d3eb9f338c0734c38",
"score": "0.7307693",
"text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end",
"title": ""
},
{
"docid": "5076c5a88404ae72986f958710f5687a",
"score": "0.72636455",
"text": "def update(... |
391de86b5eb950a0b4bcb6b23225689c | GET /holders/1 GET /holders/1.json | [
{
"docid": "1f84bea2c70a55c5a69f9942ae7f3ccc",
"score": "0.74241346",
"text": "def show\n @holder = Holder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holder }\n end\n end",
"title": ""
}
] | [
{
"docid": "b3cd9f5d0474faba71560768bdfe6650",
"score": "0.74129975",
"text": "def index\n @holders = Holder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holders }\n end\n end",
"title": ""
},
{
"docid": "d4df996839a482a44183... |
4b71576f76a1fbe8d4e18972c8a7f41e | Returns the string value which needs to be attached to HTTP request header in order to be authorized. | [
{
"docid": "1dc840d8c8cb73f237d15af13cd4c22e",
"score": "0.69125336",
"text": "def get_authentication_header\n acquire_token if token_expired\n \"#{token_type} #{token}\"\n end",
"title": ""
}
] | [
{
"docid": "5849a6bf7aa31fb97f0a2e79cb4c8e49",
"score": "0.7354969",
"text": "def request_authorization_header\n return if request.headers['Authorization'].blank?\n\n request.headers['Authorization'].split.last\n end",
"title": ""
},
{
"docid": "573765696bb5ec75ef2819b1f97... |
8b45b2460ff50ec4853cfdf6b08e986c | Get On Calls Gets current oncall participants of a specific schedule | [
{
"docid": "e502748fd2a0a7d7be2b31d1ad175e62",
"score": "0.6163781",
"text": "def get_on_calls_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WhoIsOnCallApi.get_on_calls ...\"\n end\n # verify the required pa... | [
{
"docid": "eeba51841794ddfaa7eba32c8f1631fb",
"score": "0.6638515",
"text": "def list_on_calls_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WhoIsOnCallApi.list_on_calls ...\"\n end\n # resource path\n local_var_p... |
14ca49f32f66d47eb08ff246221f9746 | TODO Need to track types > handle this in parser. | [
{
"docid": "bc142f7c3f8c67fcdf894602b7135094",
"score": "0.0",
"text": "def java_parameters\n\t\t\tif @args.nil? || @args.size < 1 then\n\t\t\t\treturn []\n\t\t\tend\n\t\t\t\n\t\t\toutput = []\n\t\t\t@args.each do |arg|\n\t\t\t\ttemp = @args.split OPERATOR_REGEX\n\t\t\t\tif !temp.nil? && temp.size > 1 t... | [
{
"docid": "6ad9956f17b7f169934040cbdc58daf8",
"score": "0.7338061",
"text": "def validated_parser_type(type); end",
"title": ""
},
{
"docid": "f35a829e821b6fc3c8d2bfb9a1e9a435",
"score": "0.68957794",
"text": "def types; end",
"title": ""
},
{
"docid": "f35a829e821b6fc3c... |
51c8987c269d2f2e526843d37ce8e30f | PATCH/PUT /creations/1 PATCH/PUT /creations/1.json | [
{
"docid": "67a9238d904cb8593c7db9264c46db7a",
"score": "0.64823985",
"text": "def update\n respond_to do |format|\n if @creation.update(creation_params)\n format.html { redirect_to @creation, notice: 'Creation was successfully updated.' }\n format.json { head :no_content }\n ... | [
{
"docid": "377aa3bc97202f3690b1885daa6f516e",
"score": "0.64266753",
"text": "def update\n @creation = Creation.find(params[:id])\n\n respond_to do |format|\n if @creation.update_attributes(params[:creation])\n format.html { redirect_to @creation, notice: 'Creation was successfully up... |
2af45cf68ed7bfd968ba4d92983c13c4 | status mapping with control id to decide the final state of the control | [
{
"docid": "916d4157c578ff3b7385ab5129db443b",
"score": "0.6602781",
"text": "def set_status_mapping(control_id, status)\n @status_mapping[control_id] = [] if @status_mapping[control_id].nil?\n @status_mapping[control_id].push(status)\n rescue StandardError => e\n raise \"Exception in ... | [
{
"docid": "12cab46e08e8c1e5bb433be0f21ecd9a",
"score": "0.672343",
"text": "def map_status\n end",
"title": ""
},
{
"docid": "9fba60c778bcd24be8ac47b92f13342e",
"score": "0.6596853",
"text": "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end",
... |
3ee141ed8072b96c1c435321e1252e3b | GET /legal_people/1 GET /legal_people/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "dc5549fa6a62fc3c865028a017d690e4",
"score": "0.6977741",
"text": "def show\n @people = People.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @people }\n end\n end",
"title": ""
},
{
"docid": "2ed8048... |
c2c3f0aa8c48699a4b8f901e30b3eb5c | Logged in user route. | [
{
"docid": "30e665507afd902bea2b375ab8c275a3",
"score": "0.0",
"text": "def logged_in_user\n\t\tunless logged_in_user?\n\t\t\tstore_location\n\t\t\tflash[:error] = [AlertMessage.new(message: \"Oops Please log in.\")]\n\t\t\tredirect_to sign_in_path\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "28cea1debc939b2e716ec45ea299894a",
"score": "0.7552019",
"text": "def logged_in_user\n unless logged_in?\n puts \"=================================================Inside logged_in_user()==========================================================\"\n redirect_to root_path\n end... |
4f82aef2480a54f4e17362b06d0dcfdb | Create all address hash key value pairs so that it still works if only provided with one or two of them. Also include Email in address Hash from options Hash. | [
{
"docid": "8524dbfc1f068d788a9ab73fb5b17907",
"score": "0.7687781",
"text": "def setup_address_hash!(options)\n options[:billing_address] = options[:billing_address] || options[:address] || {}\n options[:shipping_address] = options[:shipping_address] || {}\n options[:billing... | [
{
"docid": "3ae684ed998f07f9998cbaeb14a46238",
"score": "0.7730896",
"text": "def setup_address_hash!(options)\n options[:billing_address] = options[:billing_address] || options[:address] || {}\n options[:shipping_address] = options[:shipping_address] || {}\n # Include Email in addr... |
81c573b5f29a9d2615c892784e9dbdda | Max gold for Nevada City is 5. Return value shall be in range of 0 ... 5 | [
{
"docid": "03cf01a4e563f5f5c3ce805acf9d7b5f",
"score": "0.0",
"text": "def test_get_gold_nevada_city\n\t\tcurrent_city = \"Nevada City\"\n\t\tassert_operator 5, :>=, @test_sim.get_gold(current_city)\n\tend",
"title": ""
}
] | [
{
"docid": "d8e5bdd729fdcb05ddd84e1f97dbd6a0",
"score": "0.7460115",
"text": "def max_gold\r\n return 99999999\r\n end",
"title": ""
},
{
"docid": "9acc766bd5878b64a735e696ec01dc0b",
"score": "0.6908697",
"text": "def population_max\n [Cfg.player_max_population, population_cap... |
2d80142bb3fec2d42b608497caff1aa9 | GET /lectivos/1 GET /lectivos/1.json | [
{
"docid": "a5f66210768a85a46ce7d453ed2475cb",
"score": "0.74654895",
"text": "def show\n @lectivo = Lectivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lectivo }\n end\n end",
"title": ""
}
] | [
{
"docid": "ad8c55913bcdd2f0f0e87d543dc5ce41",
"score": "0.6699622",
"text": "def new\n @lectivo = Lectivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lectivo }\n end\n end",
"title": ""
},
{
"docid": "25577b46adf33964d25a0ec4... |
716cb100cfa64645f010ea2c4e1ed09e | Get path to products.json, read the file into a string, and transform the string into a usable hash | [
{
"docid": "100b5676e812cf3df2acf1e84dc46aab",
"score": "0.6528131",
"text": "def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"../report.txt\", \"w+\")\nend",
"titl... | [
{
"docid": "45eb9419129e859b792b9be719236f3c",
"score": "0.65104127",
"text": "def setup_files\n path = File.join(File.dirname(__FILE__), '../data/products.json')\n file = File.read(path)\n $products_hash = JSON.parse(file)\n $report_file = File.new(\"report.txt\", \"w+\")\nend",
"title"... |
b553219b899f78710ec7eb59b60e2273 | necessary after we have replaced page elements with facebox links that have not been there when the page was loaded. Provide a dom id to selectively rebind rel tags only within that element, and avoid double binding. | [
{
"docid": "85639a380b756ae2a6ac2f309f9dd449",
"score": "0.52314526",
"text": "def rebind_facebox_javascript(id)\n id = id.first == \"'\" ? id : \"'#{id}'\"\n <<-JS\n#{facebox_instance_javascript}.watchClickEvents(#{id});\n JS\n end",
"title": ""
}
] | [
{
"docid": "0aa95c41d749f378f6338c60fa1f4f95",
"score": "0.56775737",
"text": "def rebindNodesLinksById()\n @nodeList.each{|node|\n node.rebindLinksById(self) ;\n }\n @linkList.each{|link|\n link.rebindNodesById(self) ;\n }\n self ;\n end",
"title": ""
},
{
"docid":... |
5bb7b6747fee8c47971c3725fc876fd3 | PATCH/PUT /reservable_instances/1 PATCH/PUT /reservable_instances/1.json | [
{
"docid": "333baa32a8d5c89cdba20b0ce4336e50",
"score": "0.6703248",
"text": "def update\n respond_to do |format|\n if @reservable_instance.update(reservable_instance_params)\n format.html { redirect_to @reservable_instance, notice: 'Reservable instance was successfully updated.' }\n ... | [
{
"docid": "57546096e65765413e2ea833b2eee0f2",
"score": "0.6433234",
"text": "def rebuild\n EngineyardAPI::API.put(\"#{@path}/update_instances\",{:body => \"\"})\n end",
"title": ""
},
{
"docid": "67c32d31d644126b7f224414d4858f3e",
"score": "0.631102",
"text": "def renew_put\... |
5d0c41c29ece72cd278f2a34defd8e80 | Renders holding page if it exists, if member is NOT logged in, and the root request path is used. /loggedout should render the homepage, but not the holding page | [
{
"docid": "c89baf4736a03c4b84a3477ae65c6e56",
"score": "0.8022832",
"text": "def render_holding_page_if_exists\n if view_exists?(HOLDING_VIEW) && !@logged_in_member && request.path == '/'\n render(:template => HOLDING_VIEW, :layout => false) and return\n end\n end",
"title": ""
}
] | [
{
"docid": "395adfa04181183543c907fcd59e6565",
"score": "0.64634496",
"text": "def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end",
"title": ""
},
{
"docid": "051ac240a64d407a40f5b3142cce620c",
"score": "0.6334306",
"text": "de... |
179eace91c01ca063aafacb821fc8b0e | If HEAD is a tag, return the tag. Otherwise return the sha of HEAD. | [
{
"docid": "3c1e901937a16fcce02ad6ca7a9d6cd1",
"score": "0.6425279",
"text": "def sha_or_tag(length = 40)\n if ref_type == 'tag'\n describe\n else\n sha(length)\n end\n end",
"title": ""
}
] | [
{
"docid": "791afc040be8f73f47e98a809eac73cf",
"score": "0.8023372",
"text": "def head_sha\n @g.object('HEAD').sha\n end",
"title": ""
},
{
"docid": "f072ce49d656cca5151146bd4f07e6f3",
"score": "0.7776436",
"text": "def head_sha\n open\n @git.object('HEAD').sha\n end",... |
ebc6262e16cd81778d8efeb18b81ba13 | Runs short quick queries matching string partials from the client side application, returning a list of cities with their matching states for displaying in a dropdown element to a selection can be made. | [
{
"docid": "e25f972bd21e27992f9206110aa2b221",
"score": "0.5911497",
"text": "def get_city_state\n city_states = State.select(\"concat(cities.city,', ',states.ab) as city_state\")\n .joins(:cities)\n .where(\"LOWER(cities.city) LIKE LOWER(?) \", \"#{params[:city_name]}%\")\n .order(:st... | [
{
"docid": "94f419b6732c8f9e931b0bf7dc84daf2",
"score": "0.6673472",
"text": "def auto_complete_for_city_global_location_city\n\n condition = get_city_search_condition( params )\n\n @cities = CityGlobalLocation.find(:all, \n :conditions => condition, \n :limit => 100)\n render :partia... |
0f1bf8247e15b7c6c02d8205186f7c50 | Uses a value or a block to evaluate whether a match is found. | [
{
"docid": "d0ce5ddfe78cd607e71e412a254b30fa",
"score": "0.0",
"text": "def find_indexes(val=nil, &block)\n block = lambda{|e| e == val} if val\n (0...self.size).inject([]) do |list, i|\n list << i if block.call(self[i])\n list\n end\n end",
"title": ""
}
] | [
{
"docid": "20bc56a3436b4b7c2ef029eb79898a6e",
"score": "0.6747445",
"text": "def matches?(value, context); end",
"title": ""
},
{
"docid": "7851a42fb3dceeaec73066f446c68d03",
"score": "0.64594895",
"text": "def matches?(value, context = T.unsafe(nil)); end",
"title": ""
},
{... |
e15fe077cbb680ca4da2dbdb1608ffa3 | Optional Method Time Complexity: Space Complexity: | [
{
"docid": "ffb35a2b1876cbadffc46c1db334f3d9",
"score": "0.0",
"text": "def bfs\n raise NotImplementedError\n end",
"title": ""
}
] | [
{
"docid": "5d7317c8a047bda2b765fd7f842d1cbb",
"score": "0.59275955",
"text": "def optimizable?\n right_nil? || right_none?\n end",
"title": ""
},
{
"docid": "1da1a27ac7f96bb6ad678b54d11badc4",
"score": "0.5707122",
"text": "def optional; end",
"title": ""... |
49e44ab142954a75b03887f17bb2c796 | DSL method for building the `filter` part of the query definition | [
{
"docid": "4394390c77611f70b871a98c7077a3ff",
"score": "0.0",
"text": "def filter(*args, &block)\n @filter = block ? Filter.new(*args, &block) : args.first\n self\n end",
"title": ""
}
] | [
{
"docid": "da4d5d163349158b4cc47c87fccb80fd",
"score": "0.75234044",
"text": "def build_filter\n if @filter && !@filter.empty?\n filters = @filter.map { |key, value| construct_es_query_term key, value }\n if filters.length == 1\n @es_query[\"query\"] = filters.first\n else\n ... |
f04b38417be51513526f00f52982b102 | JUDGE TODO: how to model judges? Judge registration, rsvp | [
{
"docid": "9ecf87b68e3f37a0ef08543ad2422152",
"score": "0.46569526",
"text": "def as_judge\n Judge.where(user_id: self.id).first || Judge.create_judge(self)\n end",
"title": ""
}
] | [
{
"docid": "ce46da49d7111c948363f498f3b7d7be",
"score": "0.6162834",
"text": "def jaeger_quest; end",
"title": ""
},
{
"docid": "a71e6f291a2bfc1206f78783f58947df",
"score": "0.56551677",
"text": "def all_judge\n #defensive check for rappers in the stage\n unless self.stage.is_f... |
c14ca9d3eb61916d0229e8f353db9496 | Find all elements exactly matching class and attribute value. | [
{
"docid": "b3ab3dbcd6c24fbceaa401ef9d851346",
"score": "0.68348473",
"text": "def find_eles_by_attr class_name, attr, value\n @driver.find_elements :xpath, string_attr_exact(class_name, attr, value)\n end",
"title": ""
}
] | [
{
"docid": "a47940ebf2c639c81da71e2fd3225bd7",
"score": "0.7007269",
"text": "def complex_finds_exact(class_name, value)\n find_elements :xpath, string_visible_exact_xpath(class_name, value)\n end",
"title": ""
},
{
"docid": "cdc96fa2dd0e6be01d22c7ee55511d18",
"score": "0... |
5f8512afab677dfa254db9e64e4d1e46 | If you need to show the same tiny_display_map twice on the one page, give different prefixes | [
{
"docid": "518a5853b94dc9c8107861623c8dccdb",
"score": "0.66404086",
"text": "def tiny_display_map(object, geometry_url, prefix, &block)\n dom_id = dom_id(object, prefix)\n core_map(dom_id) do |map, page|\n page << map.add_layer(MapLayers::OPENCYCLEMAP)\n add_formats(page)\n centre... | [
{
"docid": "b18fd658844d17b9991230f1a8c0c1f4",
"score": "0.60864145",
"text": "def show_map\n # Example\n # {\n # /RTC (S\\d\\dE\\d\\d)/ => \"rtc\",\n # /RTC(\\d\\d\\d)/ => \"rtc\",\n # /RTN(\\d\\d\\d)/ => \"rtn\",\n # /RTC PP E(\\d\\d)/ => \"pp\"\n # }\n ... |
4dc180a29e858d9fc7ffd6434892d3e2 | note: from,to is Date, inclusive | [
{
"docid": "937afac3b26579eaf98f18b49cf83f21",
"score": "0.0",
"text": "def balance(range,include_subendpoint=true)\n # this is slightly slow maybe, but speed is not matter in this case\n return income(range,include_subendpoint)-expense(range,include_subendpoint)\n end",
"title": ""
}
] | [
{
"docid": "b6406b3258af66e5b13f000a832f4fc4",
"score": "0.73577654",
"text": "def append_date(date)\n if date < from\n self.from = date\n elsif date > to\n self.to = date\n end\n end",
"title": ""
},
{
"docid": "b6406b3258af66e5b13f000a832f4fc4",
"score": "0.73577654... |
41e169afe829981f7dc20eda5196f69f | Binds the indicated ruby method into the Lua runtime. To support optional arguments, a Lua "wrapper" function is created. So the call chain looks like: (arg1, arg2, ...) invokes __ __ => bound to Ruby block This allows us to use Lua's ability to ignore omitted arguments. Since our Ruby block must always be passed the r... | [
{
"docid": "75d07a5ba91af59f1534fefc7d0bf399",
"score": "0.66925675",
"text": "def setup_func_binding(target, lua_name, ruby_name, argument_count, view, lua_post_func)\n ruby_bound_name = \"#{lua_name}_r_\"\n\n if argument_count > MAX_ARGUMENTS\n raise \"Ack! Too many arguments to helpe... | [
{
"docid": "07def20109ea447e077dfce7819de7ad",
"score": "0.69082725",
"text": "def setup_func_binding(target, lua_name, ruby_name, argument_count, state, view, lua_post_func)\n ruby_bound_name = \"#{lua_name}_r_\"\n \n if !@wrap_exceptions\n case argument_count\n when 0\n ... |
56df08703b5627070a77eff1bfae2cd0 | A function that, given a 4digit number, performs the "descending digits" operation. This operation returns a number with the same 4 digits sorted in descending order. | [
{
"docid": "6e9f4ba0238c14ece5ced40fcf683e2b",
"score": "0.66199464",
"text": "def desc_digits(input)\n\t\tcreate_array(input).sort.join.to_i\n\tend",
"title": ""
}
] | [
{
"docid": "e8b191c99ad4e2c610a432c267ab97d4",
"score": "0.7975107",
"text": "def descending_order(n)\n n.digits.sort().reverse.join.to_i\nend",
"title": ""
},
{
"docid": "fc1e059bf6818b242b170854e7c36eb5",
"score": "0.79196316",
"text": "def descending_order(n)\n n.digits.sort.rev... |
52c51e5da6c524b884142e1664f6e835 | Set the changed state of this object. Notifications will be sent only if the changed +state+ is +true+. | [
{
"docid": "0633f678ad0f0628cad397a982e3374b",
"score": "0.7818851",
"text": "def mark_changed(state=true)\n @eventful_observer_state = state\n end",
"title": ""
}
] | [
{
"docid": "3f98e5f875b26bc5adb418e99b994651",
"score": "0.7832446",
"text": "def state=(state)\n @state = state\n notify\n end",
"title": ""
},
{
"docid": "2f4f88ce9b6eea7db8062d8f776815af",
"score": "0.7694756",
"text": "def update(state)\n changed\n @state = state\n ... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "9ec56a9ae9aed5ab44678fcd13051c30",
"score": "0.0",
"text": "def event_params\n params.require(:event).permit(:title, :start_date, :end_date, :start_time, :end_time, :description, :event_thumbnail, :event_type)\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... |
3746342c964c7f066074ad1e6bb38045 | Created 09/17/2019 by Sri Ramya Dandu updates the signal for the computer | [
{
"docid": "5f45ef50eee814ea066b31da5e5b8b4d",
"score": "0.0",
"text": "def update?\n play?\n end",
"title": ""
}
] | [
{
"docid": "09ba49c4c2fa7a5c6f11fb71d7b8a0a0",
"score": "0.68553925",
"text": "def signal\n end",
"title": ""
},
{
"docid": "450d505641f1b6763c300f46103e2a08",
"score": "0.66189057",
"text": "def update!(**args)\n @signal = args[:signal] if args.key?(:signal)\n @si... |
5b18fc2f539d186cc6922742e7bd1fad | PUT /units/1 PUT /units/1.json | [
{
"docid": "288a535182439061114b620baeaaa281",
"score": "0.666636",
"text": "def update\n @unit = Unit.find(params[:id])\n @item = Item.find(@unit.item_id)\n respond_to do |format|\n if @unit.update_attributes(params[:unit])\n format.html { redirect_to @item, notice: 'Unit was succe... | [
{
"docid": "d144603e6f3c737c7e1cee9b2167ad48",
"score": "0.829252",
"text": "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"title": ""
},
{
"docid": "39fa38e0d4ccde163ebb6d5413a4a724",
"score": "0... |
775c7fafa4fea1b8cb96105552ccf648 | Flag to check if descriptions should show | [
{
"docid": "a31100f0456c776557a1d7fd1e2f01d7",
"score": "0.7597701",
"text": "def has_descriptions\n options[:descriptions]\n end",
"title": ""
}
] | [
{
"docid": "a43f684ec8ca37126c84dbcf97a96c3f",
"score": "0.81963813",
"text": "def has_description?\n true\n end",
"title": ""
},
{
"docid": "efb234a233aa00e96e444f40a481ff4a",
"score": "0.7980967",
"text": "def includes_description?\n !long_desc.empty? || !d... |
faf39e9d6eae35f45193a89be3938db4 | DELETE /line_items/1 DELETE /line_items/1.xml | [
{
"docid": "7b6438de4bcefb499673c3f3ddd46e14",
"score": "0.63625056",
"text": "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(@line_item.user, :notice => 'Game removed') }\n format.xml { head :ok }\n ... | [
{
"docid": "6cac3e370a29d642f4a7667e3a33415f",
"score": "0.727172",
"text": "def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(line_items_url) }\n format.xml { head :ok }\n end\n end",
"title": ""... |
b351b268e04ff14490dbeb7153228a23 | Test that the correct sentence is chosen, given the input | [
{
"docid": "06d9f3542e7c7c1491bf9f58e3a58abb",
"score": "0.7837858",
"text": "def test_sentence_choice\n assert_equal('This is a great test', \n WordPlay.best_sentence(['This is a test', 'This is another test', 'This is a great test'], %w{test great this}))\n assert_equal('This ... | [
{
"docid": "0a74c4f32c8c8832f6459a8d617b4998",
"score": "0.78975534",
"text": "def test_sentence_choice\n assert_equal(\"This is a great sentence\", Wordplay.best_sentence([\"This is a sentence\",\n \"This is another sentence\", \"This is a great sentence\"], %w{test great this}))\n end",
"t... |
7528ca82cc981f03619c3685696408d6 | Take an Array in the form of [d1, d2, ..., DOT, d1, d2, ...] | [
{
"docid": "2f8a03aee09b378058e19cbca3c8fd08",
"score": "0.0",
"text": "def parse_array(value, base)\n value = value.dup\n\n if value.first == '-'\n neg = true\n value.shift\n else\n neg = false\n end\n\n value = base_decode(value)\n\n ## raise an error... | [
{
"docid": "1313f71ab40773b1b77c4f2740e6a2dd",
"score": "0.59969044",
"text": "def join_domain( arr )\n arr.map {|i|\n if /\\A\\[.*\\]\\z/ === i\n i\n else\n quote_atom(i)\n end\n }.join('.')\n end",
"title": ""
},
{
"docid": "426... |
7161417164f5bb3dd2992874bce6c5aa | Registers the default attributes with the specified block in Configurable::DEFAULT_ATTRIBUTES. | [
{
"docid": "539732fea3f68165d993d03aa02d5d02",
"score": "0.74621266",
"text": "def register(attributes={}, &block)\n DEFAULT_ATTRIBUTES[block] = attributes\n block\n end",
"title": ""
}
] | [
{
"docid": "31abc5f4e5efbf97e00fca1df1d9be2d",
"score": "0.7635584",
"text": "def attributes(block)\n DEFAULT_ATTRIBUTES[block] || {}\n end",
"title": ""
},
{
"docid": "ebcf59098525d839a0f81c0685a5a5e0",
"score": "0.69531596",
"text": "def define_default_attributes\n def... |
32f3dd815a1844d967c20dd125990570 | Applies the given function to every data value in the list | [
{
"docid": "4a92b6b3ba1eaabe5bd90f609115dcde",
"score": "0.5865909",
"text": "def map(func)\n\t\tif (!@head) then return end\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\tcurrent.alter(func)\n\t\t\tcurrent = current.get_next()\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "37478831e406b3f86548941827ba03c2",
"score": "0.6640862",
"text": "def map(list, &function)\n list.reduce([]) do |acc, val|\n acc.push function.call(val)\n end\nend",
"title": ""
},
{
"docid": "859e1467195c73c817dba698e4e9d187",
"score": "0.63947695",
"text": "def app... |
31c06f2146853b67cd9007045f7d33c9 | Returns 'true' if the session is open | [
{
"docid": "bc0f570f69068eb97bb9dfc973ec2721",
"score": "0.0",
"text": "def is_open?\n !self.id.nil?\n end",
"title": ""
}
] | [
{
"docid": "25552bcd9313624c093d91d6373b5c0f",
"score": "0.89013976",
"text": "def open?\n @http_session && @http_session.started?\n end",
"title": ""
},
{
"docid": "02b88ea2a9df98460f0dedab93ab3a63",
"score": "0.88719505",
"text": "def open?\n @http_session&.started?\n ... |
4e991188b66b752dab0c8935e156b858 | DELETE /voice_notes/1 DELETE /voice_notes/1.json | [
{
"docid": "3124f3a4851417d3ada0c5e79981a981",
"score": "0.7666023",
"text": "def destroy\n @voice_note.destroy\n respond_to do |format|\n format.html { redirect_to voice_notes_url, notice: 'Voice note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
... | [
{
"docid": "024587af249b01f48cb965875c915f0a",
"score": "0.72541744",
"text": "def destroy\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f75152e46aaf944941b577... |
4d810ab8d11df67a88e9cd8aef5aa71e | Author: Omar Hossam Description: As a gamer, I could post my score on my facebook timeline by pressing on the facebook share score button. Parameters: score: a variable that saves gamer's score recieved from view. Success: Gamer presses the facebook share score button, and his score is shared on facebook and confirmed ... | [
{
"docid": "594f5ab7a280533fadd0aeb18cd9c5ec",
"score": "0.83115554",
"text": "def post_score_facebook\n score = params[:score]\n if current_gamer\n if !Authentication.is_connected_to_facebook(current_gamer.id)\n @message = t(:connect_your_account) \n @redirect = \"/gamers/edit\... | [
{
"docid": "475d8d190276b38de3c99202e45fa593",
"score": "0.84723616",
"text": "def post_score_facebook\n if current_gamer != nil\n if !current_gamer.is_connected_to_facebook \n redirect_to \"/gamers/edit\",\n flash: {notice: t(:connect_your_account)}\n else\n begin\n ... |
7d9d353500bac27e1848ccd0902db26e | Return an ActiveRecord::Association of SpeciesList's that User created or that are attached to a Project that the User is a member of. | [
{
"docid": "0ea0aea020f66bd1c4c8be9405afe2f2",
"score": "0.59920514",
"text": "def all_editable_species_lists\n @all_editable_species_lists ||=\n if projects_member.any?\n SpeciesList.\n where(SpeciesList[:user_id].eq(id).\n or(SpeciesList[:id].in(species_lists_in_users_... | [
{
"docid": "e8a7ebecc0d72f75249e332a9ba664d5",
"score": "0.6121124",
"text": "def memberships_in_projects\n self.memberships.includes(:user, project: [:languages,\n :difficulty,\n :project_languages,\n ... |
9cec779f77e795d588ed4a461f36c485 | Returns recommended default settings when creating a new experience | [
{
"docid": "9f36c28bd9b87672d13529f6dcc8f7dd",
"score": "0.0",
"text": "def get(organization, incoming={})\n HttpClient::Preconditions.assert_class('organization', organization, String)\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :regi... | [
{
"docid": "1004e33be4555120bfe6dc45fee898df",
"score": "0.7197425",
"text": "def default_settings\n end",
"title": ""
},
{
"docid": "9ef4b8e70edb5677c9b8d5db5ceacc3e",
"score": "0.70458573",
"text": "def default_settings\n {}\n end",
"title": ""
},
{
"docid": "42faa... |
4737e0bd3035d9d6c5d82d9441bdbe1d | def trash run_callbacks :destroy do update_column :deleted_at, Time.now end end | [
{
"docid": "31320169393e757e6cd2349444c7c61e",
"score": "0.0",
"text": "def recover\n # update_column not appropriate here as it uses the default scope\n update_attribute :trashed, nil\n #add to elasticsearch\n end",
"title": ""
}
] | [
{
"docid": "5fb010d1fd637ac13a3a8c922e332689",
"score": "0.79077035",
"text": "def destroy\n if can_be_deleted?\n super\n else\n update_column :deleted_at, Time.now\n end\n end",
"title": ""
},
{
"docid": "5fb010d1fd637ac13a3a8c922e332689",
"score": "0.79077035",
... |
aca257c156bad8d4d27c3670d21688dd | handles end or rerun | [
{
"docid": "36870cbb4495f5cd844a15dfe34832e1",
"score": "0.0",
"text": "def input_2\n input = gets.chomp\n if \n input == \"list\"\n Character.all.clear\n call\n elsif\n input == \"exit\"\n clear\n puts \"Goodbye!\".c... | [
{
"docid": "dd5adae500038131354f3bd42f179c77",
"score": "0.77882564",
"text": "def end() end",
"title": ""
},
{
"docid": "281e9a43f3408650bd69047a8fabab55",
"score": "0.71434754",
"text": "def end; end",
"title": ""
},
{
"docid": "281e9a43f3408650bd69047a8fabab55",
"s... |
e7c53aff3cce157161163f89989558aa | Convert the file to a different format === Parameters [f (String)] the format for the file format (jpeg, png) [opts (Hash)] options to be passed to converting function (ie, :interlace => true for png) | [
{
"docid": "7511207212081baf5c7bdb4452239803",
"score": "0.7817086",
"text": "def convert(f, opts = {})\n opts = opts.dup\n f = f.to_s.downcase\n allowed = cwv_config.allowed_formats\n raise ArgumentError, \"Format must be one of: #{allowed.join(',')}\" unless allowed.include?(f)\n ... | [
{
"docid": "6a46e8f16af98c0ba9f11d0c6d5c06a7",
"score": "0.8025281",
"text": "def convert(f, opts = {})\n f = f.to_s.downcase\n allowed = %w(jpeg png)\n raise ArgumentError, \"Format must be one of: #{allowed.join(',')}\" unless allowed.include?(f)\n @_format = f\n @_format_opts... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "6ece4c75ce2f6ef920c263a9d5ac99e4",
"score": "0.0",
"text": "def set_video_style\n @video_style = VideoStyle.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60310596",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6014974",
"text": "de... |
ec741ae5e636bc991a693b1629404b4b | express integer as an english phrase | [
{
"docid": "3db3e6b282a703b8e3c911be5d99e353",
"score": "0.62784046",
"text": "def speak\n case\n when self <20\n [\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\",\n \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen... | [
{
"docid": "88fbb4326384669b30b46c74a96bf6b9",
"score": "0.69794124",
"text": "def hundreds_english(n)\n\t# 0 < n < 1000\n\treturn \"invalid\" if n < 1 || n > 999\n\tn_english = \"\"\n\tdigit_words = [\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\",\n\t\t\t\t\t\"eight\", \"... |
0ef84d774ba5250795e2e31f98837877 | local_campaigns array of campaigns fetched from database remote_campaigns array of campaigns fetched via API call | [
{
"docid": "3343a69d1372f3b2950ae73160586e04",
"score": "0.6690727",
"text": "def initialize\n @local_campaigns = Campaign.all\n @remote_campaigns = Campaign.get_remote_campaigns\n @missing_remote_campaigns = []\n @changed_campaigns = []\n end",
"title": ""
}
] | [
{
"docid": "2298b9d22072717bfa8e6bed716943c9",
"score": "0.6995936",
"text": "def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"title": ""
},
{
"docid": "ed74d3031382f6fdf7304ddee7a86fcc",
"score": "0.6913586",
"text": "def... |
3537bd67eb889c35b33eb634be7fec61 | Returns an existing chat corresponding to a known basic group. | [
{
"docid": "ea7ae80b5f3e834136aa5263935a7ca3",
"score": "0.6283079",
"text": "def create_basic_group_chat(basic_group_id, force = false)\n broadcast('@type' => 'createBasicGroupChat',\n 'basic_group_id' => basic_group_id,\n 'force' => force)\n end",
"t... | [
{
"docid": "b0ca474aaac60c2651c2aa11d988f333",
"score": "0.6496951",
"text": "def new_group_chat_message(to)\n self.new_message(to, Jabber::Protocol::Message::GROUPCHAT)\n end",
"title": ""
},
{
"docid": "0f4e408468d26418071026ee2f08064b",
"score": "0.63680995",
"text": "def ... |
ff01fff45d37fd85b430ec5e5489cda9 | List of all change points. | [
{
"docid": "c2775ae6ce4e588afffda42b2ca9e1da",
"score": "0.67768246",
"text": "def change_points\n @change_points ||= apply_heuristics(adapter.change_points)\n end",
"title": ""
}
] | [
{
"docid": "f32b0b034ef9b697d8c7e70af5a2a15b",
"score": "0.6510408",
"text": "def index\n @points_changed_records = PointsChangedRecord.all\n end",
"title": ""
},
{
"docid": "03250d398ff55b6eabb1a8a46cf2d330",
"score": "0.6415402",
"text": "def changes\n @changes\n ... |
8760da65dc870cf375d80f2678b87d9d | Because ScraperWiki.scrape just uses Net::HTTP.get under the hood and because that doesn't support redirects... | [
{
"docid": "8f85e2e218d786d9af4193aecc600d2a",
"score": "0.6583344",
"text": "def scrape_with_redirect(url, limit = 10)\n # You should choose better exception.\n raise ArgumentError, 'HTTP redirect too deep' if limit == 0\n\n parsed_url = URI.parse(url)\n response = Net::HTTP.get_response(parsed_url... | [
{
"docid": "95ca31e321f81abe142151ae58f8d0f1",
"score": "0.75880235",
"text": "def fetch_wiki(url)\n #puts url\n \n @http = Net::HTTP.new(url.host, url.port)\n wikiRequest = Net::HTTP::Get.new(url)\n wikiResponse = @http.request(wikiRequest)\n \n #In case that Wikipedia will redirec... |
dd9ad47831520c2c404fad44cf6ec75c | Iterators: True for None? | [
{
"docid": "bc6b0810f7d940c00d8b0344d90e98a3",
"score": "0.0",
"text": "def none?(arr, &block)\n !any?(arr, &block)\nend",
"title": ""
}
] | [
{
"docid": "b9db22c29390faed468864669a081e50",
"score": "0.7603654",
"text": "def none?(collection)\n collection.each { |element| return false if yield(element) }\n true\nend",
"title": ""
},
{
"docid": "03b9436a127e9768da0239d77c1e3d10",
"score": "0.7439124",
"text": "def none?(co... |
900747eb945a1a22c2ad4ce23dfbdd6e | Tries to find constants under known apps lib / models folders or registered paths that are not under registered apps namespace. | [
{
"docid": "5b3887ee7339a0bc84041de920a1ddc0",
"score": "0.60985035",
"text": "def load_constant_from_known_paths(context, constant)\n suffix = suffix_for(context, constant)\n\n application_paths = Harbor.registered_applications.map(&:root).map(&:to_s).join(',')\n registered_p... | [
{
"docid": "5a125e67ca76772da2c4a22b480ac399",
"score": "0.62575",
"text": "def scan(constant)\n @glob_cache ||= directories.empty? ? [] : glob_ruby_files\n\n unless constant_paths_cached?(constant)\n build_constant_paths_cache(constant)\n end\n\n return @constant_paths_cache[... |
645eedd5b3ff1e12021bacf58ecbc518 | called to log and redirect a user to an external link | [
{
"docid": "0d408d69d575f8d86511110dffdfd95e",
"score": "0.7482179",
"text": "def external_link\n\n url = params[:url]\n if url.nil?\n render :nothing => true\n return\n end\n\n ExternalLinkLog.log url, request, current_user\n\n redirect_to url\n\n end",
"title": ""
}
] | [
{
"docid": "ef58981942e66b89cce0bb0b88b9ac86",
"score": "0.73735505",
"text": "def login_redirect(user, url)\n auto_login(user)\n redirect_to url\n end",
"title": ""
},
{
"docid": "84ebcac419183d014f4e2fb4e47d797c",
"score": "0.710835",
"text": "def redirect(url); en... |
feb6c7ba2e4559b9a9cb8d3ba966c743 | Generates a short in a paragraph with the validation error of a specific attribute. Generates something like Can't be blank | [
{
"docid": "32ffebf9eb3efc5ebcdc1aeec26a7193",
"score": "0.67760915",
"text": "def error_message(attribute)\n unless @object.errors.on(attribute).blank?\n content_tag(:p, :class => 'notice') do\n concat ERB::Util.html_escape(@object.errors.on(attribute).mb_chars.capitalize)\n ... | [
{
"docid": "da08c39f6c9a516bd169bc8e72a69189",
"score": "0.6874177",
"text": "def validation_tag(model, attribute, options = {})\n return if model.blank? or model.errors.blank? \n unless model.errors[attribute].blank?\n # generate error markup\n return content_tag :span, [model.errors... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "7f542d918573a0ec852cd49ececaa1d5",
"score": "0.0",
"text": "def set_comment\n @comment = Comment.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60322535",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6012846",
"text": "de... |
2bd788d3fa367009556c91aca5119aeb | process images from second level, e.g,, fields_for save uploaded file info to Doc | [
{
"docid": "a8fa4cbc25cb9271d3bf5a416326c005",
"score": "0.55837923",
"text": "def get_image1(key, key1, params)\n doc = Jinda::Doc.create(\n :name=> \"#{key}_#{key1}\",\n :xmain=> @xmain.id,\n :runseq=> @runseq.id,\n :filename=> params.original_filename,\n :content_type => p... | [
{
"docid": "248547b071a0c4f69698056f430dc7c5",
"score": "0.65187585",
"text": "def process_image\n\n end",
"title": ""
},
{
"docid": "2e40b1a0e01f3d40c958b1e0e17c7e02",
"score": "0.64686567",
"text": "def images_and_imageboxes(doc)\n doc.xpath('//image').each do |node|\n ... |
ff61b922ae93fcf12fd1bad2af42653c | Configure ScribdFu for this particular environment | [
{
"docid": "d075e8d1aa68ee04b6f569c03fe1e7dc",
"score": "0.0",
"text": "def check_environment\n load_rscribd\n check_config\n check_fields\n end",
"title": ""
}
] | [
{
"docid": "9ec9e8be938cc4a2f839952195c243ca",
"score": "0.63438386",
"text": "def configure; end",
"title": ""
},
{
"docid": "b3d1904db6025102a064c0f4a89ec932",
"score": "0.63149434",
"text": "def setup_config\n # To be Extended\n end",
"title": ""
},
{
"docid": ... |
7b6ebdaa129633afacb03b5856e35a56 | searches for users not already members in the given group | [
{
"docid": "88d04e7c0c7cafe3d816255beb4a7036",
"score": "0.62787354",
"text": "def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |us... | [
{
"docid": "7d6b453c783e62df304b879a13a7023c",
"score": "0.6971726",
"text": "def filter_nonproject_groups(group, users, prohibited_groups)\n # weed out groups which have fewer than two users\n return false if users.length < 2\n # weed out groups which failed name resolution (so we get th... |
67cb00f44118985b9427495e4d733f81 | GET /workers GET /workers.json | [
{
"docid": "40c52f0a8d385783fdc287f7b6ee446d",
"score": "0.6943173",
"text": "def index\n @workers = Worker.all\n end",
"title": ""
}
] | [
{
"docid": "1db92a66b49f4294361e8c91da3438d6",
"score": "0.70790184",
"text": "def show\n @worker = Worker.find(params[:id])\n\n render json: @worker\n end",
"title": ""
},
{
"docid": "c8a9c66fbfea325c5cb6e1a2c33e1dcf",
"score": "0.69593865",
"text": "def workers_all\n ... |
c77b0fc73a15528550ccc81faa85c453 | POST /responsibilities POST /responsibilities.json | [
{
"docid": "b1cb8ba179b8a4efee5675c7760eb2c4",
"score": "0.5443015",
"text": "def create\n @responsibility = Responsibility.new(params[:responsibility])\n\n respond_to do |format|\n if @responsibility.save\n format.html { redirect_to @responsibility, notice: 'Responsibility was success... | [
{
"docid": "5bbaf26029c337e0e4f88355ba111e88",
"score": "0.63463",
"text": "def index\n @responsibilities = Responsibility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responsibilities }\n end\n end",
"title": ""
},
{
"docid"... |
c04f1a31dddc881906352dacbbed77c1 | PUT /box_choices/1 PUT /box_choices/1.xml | [
{
"docid": "0aec0458559c9b140e4647003c5c7918",
"score": "0.7283684",
"text": "def update\n @box_choice = BoxChoice.find(params[:id])\n\n respond_to do |format|\n if @box_choice.update_attributes(params[:box_choice])\n format.html { redirect_to(@box_choice, :notice => 'Box choice was su... | [
{
"docid": "ca989049fced91b747e7b2e51025de49",
"score": "0.65067756",
"text": "def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n flash[:notice] = 'Box was successfully updated.'\n format.html { redirect_to(@box) }\n ... |
dce2a9e7f6d3d5041c17c8df56f34356 | TODO? same question as above | [
{
"docid": "5aa47fe525e53e8e3aa84d5dc36a3355",
"score": "0.0",
"text": "def userid\n userids&.first\n end",
"title": ""
}
] | [
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.7663667",
"text": "def private; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.6767548",
"text": "def probers; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
... |
dcb8274c578c13380fcd1b8bd3f1b6d6 | Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/proxy/v1/service/phone_number.rb136 | [
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.0",
"text": "def to_s; end",
"title": ""
}
] | [
{
"docid": "f3ae24c2d6f140c75a2dd01d85a75108",
"score": "0.7729516",
"text": "def phonestr\n ActiveSupport::NumberHelper.number_to_phone(phone, area_code: :true)\n end",
"title": ""
},
{
"docid": "8afe253c7e1ce5c8be54876258e045aa",
"score": "0.7710376",
"text": "def phone_number\... |
943c651c3be3a698e8a19a73a6be8237 | Get all sets by prefix | [
{
"docid": "0bb1ccf9f7033566d9fb63e1d71b1a1e",
"score": "0.0",
"text": "def impression_keys\n @adapter.find_sets_by_prefix(\"#{SplitIoClient.configuration.redis_namespace}/*/impressions.*\")\n rescue StandardError => e\n SplitIoClient.configuration.logger.error(\"Exception... | [
{
"docid": "6acfbef85e3e26e9acb616841335cc98",
"score": "0.67742926",
"text": "def prefixes(list = :short)\n Set.new(@config.dig(:prefixes, list) || []).freeze\n end",
"title": ""
},
{
"docid": "4b04e2cff282e4bb2b941e65ed258f4d",
"score": "0.6756701",
"text": "def keys_for_pr... |
826162744e9c3bc1a217a095ff0040e1 | GET /issues GET /issues.json | [
{
"docid": "ac9dc6bb0b85bba79f4797e2f5f60a72",
"score": "0.6963905",
"text": "def index\n github = Github.new\n #@repo = github.repos.get(:user => \"rails\", :repo => \"rails\")\n @page = (params[:page].nil?) ? 1 : params[:page]\n @issues = github.issues.list(:user => 'rails', :repo => 'rail... | [
{
"docid": "3c854ffa99d5abfce38a113f56e19185",
"score": "0.7999591",
"text": "def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end",
"title": ""
},
{
"docid": "73d8e98a54ed9686e63eb931ab1b58c0",
"score": "0.79415... |
f6b96ce7b7982451368248d3a192a5fc | DELETE /assignments/1 DELETE /assignments/1.json | [
{
"docid": "721373c0a5314cddfd29c7cd7fb62e44",
"score": "0.0",
"text": "def destroy\n if current_user.has_role?(:instructor) || current_user.has_role?(:professor)\n set_assignment\n @assignment.destroy\n\n respond_to do |format|\n flash[:notice] = 'Assignment was successfully de... | [
{
"docid": "fe1cbaed70821d2bc0e2a02730b20ed0",
"score": "0.7656301",
"text": "def destroy\n @assignment = @user.assignments.find(params[:id])\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to user_assignments_url(@user) }\n format.json { head :no_content }\n... |
6dcb23adc1ae8276a896dbba67dabcb7 | Set the value of the Country input for this Choreo. | [
{
"docid": "7363c9fb4a8656e468209deb2999d409",
"score": "0.7033817",
"text": "def set_Country(value)\n set_input(\"Country\", value)\n end",
"title": ""
}
] | [
{
"docid": "7ee9664c43a76e76e0b1e4dd0a2d5454",
"score": "0.7315457",
"text": "def set_Country(value)\n set_input(\"Country\", value)\n end",
"title": ""
},
{
"docid": "7ee9664c43a76e76e0b1e4dd0a2d5454",
"score": "0.7315457",
"text": "def set_Country(value)\n set_in... |
f31276b5c2f8b2905e601d09bda6e850 | overwrite this if you want to restrict access to only a few actions or if you want to check if the user has the correct rights example: only allow nonbobs def authorize?(user) user.login != "bob" end | [
{
"docid": "a480dbcef81d58198d70c41ded4573c0",
"score": "0.0",
"text": "def authorize?(user)\n controller = (@template && @template.controller && @template.controller.controller_name) || @params['controller'] || 'invalidcon'\n action = @params['action'] || 'invalidact'\n mlkey = \"#{controller}... | [
{
"docid": "40a01b2fea8a223c6a55875cc2e85770",
"score": "0.79855096",
"text": "def authorize?(user)\n user.admin? or user.invited?\n end",
"title": ""
},
{
"docid": "d4db6255f01563b76d071f93118c0129",
"score": "0.7911245",
"text": "def authorize?(user)\n user && user.admin?\n... |
d5b6d2794b2e389c296b5fddc85fe489 | Make a Client Credentials grant request to obtain an access token. | [
{
"docid": "e1e19273795c629188d39eb7732fd5f1",
"score": "0.7722555",
"text": "def client_credentials_grant(client_id, client_secret, scope)\n body = {\n \"client_id\" => client_id,\n \"client_secret\" => client_secret,\n \"grant_type\" => \"client_credentials\",\n \"scop... | [
{
"docid": "b23884a40bbd0ebbf7c622d933fc590c",
"score": "0.83088684",
"text": "def client_credentials_grant(scope = nil)\n request_token(grant_type: 'client_credentials', scope: scope)\n end",
"title": ""
},
{
"docid": "4b8c8a9472d2fa369bfe729bdf6343bd",
"score": "0.7895502",
"te... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "5bca70c20734071dee0476b3ad3273b1",
"score": "0.0",
"text": "def trainee_params(my_params)\n my_params.blank? ? params.require(:trainee).permit(:training_id, :person_id, :status, :pre_training_score, :post_training_score, :trainer_feedback, :training_interest) : my_params.permit(:traini... | [
{
"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... |
95f444055cfe35babbdbc80f1725c7f5 | Public: returns if the current request includes the given OAuth scope | [
{
"docid": "0be41824a741fe9b16b3a6c70db68f24",
"score": "0.78863275",
"text": "def has_scope?(scope)\n access_token && access_token.scopes.include?(scope)\n end",
"title": ""
}
] | [
{
"docid": "7498885698f17193805fb02097f748fb",
"score": "0.7785969",
"text": "def in_scope?(request_scope)\n [*request_scope].all?(&scopes.method(:include?))\n end",
"title": ""
},
{
"docid": "f4aeda08a0000ec7d16da2b02b049e17",
"score": "0.7457464",
"text": "def includes_scope? r... |
0f399f50bb2ade7fbd1a6fe57f497ca2 | GET /remisions/1 GET /remisions/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "faf81518c8f5c1a8d653a2419e8e8611",
"score": "0.7004238",
"text": "def index\n @remisions = Remision.all\n end",
"title": ""
},
{
"docid": "ff4fc24cba778b009075c08e2fe557a3",
"score": "0.63436747",
"text": "def set_remision\n @remision = Remision.find(params[:id])... |
5f94953617fab8d9d1c92abd7c0093c9 | reduce 17 omitted reduce 18 omitted | [
{
"docid": "772b1b57c23dca5dad967b11253bc032",
"score": "0.0",
"text": "def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend",
"title": ""
}
] | [
{
"docid": "bcc77ea412992f9c87aad138efd40a40",
"score": "0.70433253",
"text": "def _reduce_236(val, _values, result)\n result = nil\n \n result\nend",
"title": ""
},
{
"docid": "3e53162208440e20ae543d5a023d2b42",
"score": "0.6952264",
"text"... |
294c8714ad6a3c468cbb52b466b0e6f5 | make a single request, get a response and close the connection | [
{
"docid": "cd672deefee08b5eafd033189d77107d",
"score": "0.0",
"text": "def request(socket, message)\n socket.write(message.to_json+\"\\n\")\n\n result = nil\n begin\n Timeout::timeout(RESPONSE_TIMEOUT) do\n result = parse_response(socket)\n end\n rescue Timeou... | [
{
"docid": "cfd17ea011616a19de006ae75e79ff22",
"score": "0.7486378",
"text": "def call(request)\n\t\t\t\t\t\traise ::Protocol::HTTP2::Error, \"Connection closed!\" if self.closed?\n\t\t\t\t\t\t\n\t\t\t\t\t\t@count += 1\n\t\t\t\t\t\t\n\t\t\t\t\t\tresponse = create_response\n\t\t\t\t\t\tresponse.send_requ... |
489969d1671f41378a3c17de7708cf88 | DELETE /professionals/1 DELETE /professionals/1.json | [
{
"docid": "b2091ed4f708f45167dedfff9b1ad309",
"score": "0.68707293",
"text": "def destroy\n @professional.destroy\n respond_to do |format|\n format.html { redirect_to professionals_url, notice: 'Professional was successfully destroyed.' }\n format.json { head :no_content }\n end\n e... | [
{
"docid": "477576e56e7ed83229e03104b364d446",
"score": "0.73861164",
"text": "def destroy\n @confession = Confession.find(params[:id])\n @confession.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"ti... |
3e391122355ca3424fd0d3ad404be730 | Generate and write out/index.html. | [
{
"docid": "3628dff9bda4ca6d08c24b57123ea43b",
"score": "0.7350881",
"text": "def run\n File.write('%s/index.html' % [out_dir], TEMPLATES[:index].run({\n title: 'OpenSSL Speed Test Results',\n hosts: @html[:hosts],\n\n # intro links\n links: LINKS.map... | [
{
"docid": "5d08431a23ef0a07d00160f7838e993e",
"score": "0.88428766",
"text": "def write_index_html\n index_html = File.join(dir, INDEX_HTML)\n \n File.open(index_html, 'w') { |html|\n generate(html)\n }\n puts \"Generated #{index_html}\"\n end",
"title": ""
},
{
"doci... |
b14fd8d1fc38816ba649118816314471 | GET /items GET /items.json | [
{
"docid": "6ea74218c4b09e143b522a3b38ac04fb",
"score": "0.0",
"text": "def index\n sort_by = params[:sort]\n if sort_by.nil?\n sort_by = \"create_date DESC\"\n end\n @items = Item.page(params[:page]).order(sort_by)\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
{
"docid": "d57502db186679bf451e04276f7c18d6",
"score": "0.8122018",
"text": "def items\n get_request configure_payload('/items')\n end",
"title": ""
},
{
"docid": "005225439f5ef107aba338963dfc8a47",
"score": "0.7835984",
"text": "def get_items\n render json: { items: @lis... |
b4a9d5f8be5a2005b1b4f1fc646cd707 | GET /detention_reasons GET /detention_reasons.xml | [
{
"docid": "2a695bd26494c69b1133196e6409b825",
"score": "0.63105506",
"text": "def index\n @detention_reasons = DetentionReason.paginate :page => params[:page],\n :per_page => 5,\n :order => sort_order('description')\n\n respond_to do |format|\n format.html # index.html.erb\n f... | [
{
"docid": "235dc9b2e5a21d2e17a486486809c0cb",
"score": "0.72440165",
"text": "def void_reasons\n get('descriptions/void_reasons.xml')\n end",
"title": ""
},
{
"docid": "6222f488afd8c63083bae11e1e6d6435",
"score": "0.68467563",
"text": "def list_notice_reasons(options={}) ... |
ac8966c68b971f3289e404d298e81e66 | DELETE /tagging_histories/1 DELETE /tagging_histories/1.json | [
{
"docid": "950ab58829399a9b025bf3884d35d55a",
"score": "0.7583923",
"text": "def destroy\n @tagging_history.destroy\n respond_to do |format|\n format.html { redirect_to tagging_histories_url, notice: 'Tagging history was successfully destroyed.' }\n format.json { head :no_content }\n ... | [
{
"docid": "eb2c8e3df3441948788283ef26994b17",
"score": "0.7329485",
"text": "def destroy\n tagging = Tagging.find(params[:id])\n Tagging.deleteOne(tagging.name, tagging.bmark_id, current_user.id)\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :... |
69117b401698fc1f45f80a7311e34563 | Caches the file by downloading it from the given URL, using downloader. === Parameters [url (String)] The URL where the remote file is stored [remote_headers (Hash)] Request headers | [
{
"docid": "84c9f1f3ed59835cf0e1c9def89ae043",
"score": "0.79119456",
"text": "def download!(uri, remote_headers = {})\n file = downloader.new(self).download(uri, remote_headers)\n cache!(file)\n end",
"title": ""
}
] | [
{
"docid": "28a7a6a2088d3bde1a8d7287298b230b",
"score": "0.7251018",
"text": "def download(url, remote_headers = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "914b2cc0e785e13f77af81b9ee0c5a28",
"score": "0.7132658",
"text": "def download_from_url!(uri, headers)\n processed_uri ... |
a02f8518193e2488104d96f346d4c60f | Warning: this is an "approximation", months are 30 days and years are 365 days, ... | [
{
"docid": "10031e34ade22c51a9899de5d50bca8f",
"score": "0.0",
"text": "def to_sec\n\n KEYS.inject(0) { |s, (k, a)| v = @h[k]; next s unless v; s += v * a[:s] }\n end",
"title": ""
}
] | [
{
"docid": "146abefda819480ea48f3b606466ce7e",
"score": "0.7058638",
"text": "def duration_in_months(years)\n years * 12\nend",
"title": ""
},
{
"docid": "b16d4f0f2a57ee174a1d49e949ffb00e",
"score": "0.7040641",
"text": "def span_years; end",
"title": ""
},
{
"docid": "7... |
591540fc8139c3a4740e669be82dfafe | Puts all the dashboard's widgets information | [
{
"docid": "659c5bbca39084f7062ec3adf61b5af2",
"score": "0.5919861",
"text": "def get_info\n widgets.find_each do |widget|\n widget.get_info\n end\n end",
"title": ""
}
] | [
{
"docid": "b72cfd17795dccedf6e8647b3abfd520",
"score": "0.67783546",
"text": "def create\n if widgets\n if @widget = widgets.create(format_attrs(['widget_category','metadata']))\n MnoEnterprise::EventLogger.info('widget_create', current_user.id, 'Widget Creation', nil, @widget)\n ... |
af4187b4f17151523c1328e19bde5fe5 | Generate a recombined sequence of tikis | [
{
"docid": "45686fcd396493e24189a115b2a82e75",
"score": "0.52990377",
"text": "def generate(passes=5, n=:unigrams)\n unigramsOn = (n == :unigrams)\n index = rand(@sentences.length)\n tikis = @sentences[index]\n used = [index] # Sentences we've already used\n verbatim = [tikis] #... | [
{
"docid": "346a0cbb67ac80845e8c234c2701ddc8",
"score": "0.5277724",
"text": "def tarjan\n @t_index = 0\n @t_stack = []\n @tg_index = {}\n @tg_lowlink = {}\n @t_result = []\n \n @t_pstack = []\n @t_forindex = Hash.new(0)\n @t_onstack = Hash.new(false)\n @g... |
8016d9d7dacb62ef82948231e1bf96fb | Send Encrypted Packet method | [
{
"docid": "a74a0a45353b925f3793ec32854bd07e",
"score": "0.6525588",
"text": "def send()\n\n\t#Determine flag based on argument\n\tcase ARGV[0]\n\twhen \"-c\" \n\t\t$flag=\"c\"\n\twhen \"-f\"\n\t\t$flag=\"f\"\n\telse\n\t\tputs \"Error: No option was chosen.\\n-------\\nInput -c for a command option or i... | [
{
"docid": "82a6909fe03693a9a464251ec5715a68",
"score": "0.7034557",
"text": "def write_packet(packet)\n Supernova.logger.info { \"#{packet.data}\" }\n new_packet = encryption_provider.encrypt(packet)\n\n socket.write new_packet\n socket.flush\n\n new_packet\... |
86d8583c7df1f38bab9454db43cf6c7f | a different way to do the above but reusing code though it doesn't make sense to in this case | [
{
"docid": "e6d8a68fcc6bc3ee65fb99f1161026fe",
"score": "0.0",
"text": "def add_and_remove_code_reuse(pet_shop, difference)\n pet_shop[:admin][:total_cash] = total_cash(pet_shop) + difference\nend",
"title": ""
}
] | [
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.59695905",
"text": "def desired; end",
"title": ""
},
{
"docid": "22cedc7bf6749c5a730c17ddb7c38970",
"score": "0.5925368",
"text": "def used_by=(_arg0); end",
"title": ""
},
{
"docid": "794a198d95cf296afde54486d8c... |