query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
47af60ab8a35e3d1c57809ecca60c2a3
Makes sure that this is a readonly model.
[ { "docid": "5d3ee6cecd1c765e336bc2b13417d21d", "score": "0.0", "text": "def readonly?\n return true\n end", "title": "" } ]
[ { "docid": "1a553dbd96f74cdc1909b119e5e3ed45", "score": "0.7799007", "text": "def readonly!\n @readonly = true\n end", "title": "" }, { "docid": "1a553dbd96f74cdc1909b119e5e3ed45", "score": "0.7799007", "text": "def readonly!\n @readonly = true\n end", "ti...
0b14aa70a0b44222be5aa9c807a1e869
turn_away_from_player Turn away from the player. (pixel movement)
[ { "docid": "99a527ba06dde9b47bd750b7057ee621", "score": "0.83495545", "text": "def turn_away_from_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines wh...
[ { "docid": "18fe35f0e63095a3508726f26aed5829", "score": "0.8043047", "text": "def move_away_from_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines whe...
87d1212000a566266e156c0593fa2262
What will the following code print? Why? Don't run it until you've attempted to answer.
[ { "docid": "4d612dc5299e18bafcec50703d8e5386", "score": "0.0", "text": "def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend", "title": "" } ]
[ { "docid": "bcef7f0ac195deef4e41ef18b6eee9bf", "score": "0.72896916", "text": "def what_was_that?\n puts \"-\" * 70\n puts \"***** I didn't catch that *****\"\n puts \"\"\n puts \"Would you please try a different answer?\"\n puts \"-\" * 70\n end", "title": "" }, { "docid":...
1bb31dfd431d1eee02966ced429be31f
cancel a merchant id restriction group Cancel a merchant id restriction group from the system.
[ { "docid": "8cc9557e824761823ff72a2fcc15c149", "score": "0.0", "text": "def delete_merchant_id_restriction_groups(id, opts = {})\n data, _status_code, _headers = delete_merchant_id_restriction_groups_with_http_info(id, opts)\n data\n end", "title": "" } ]
[ { "docid": "4b3a14a25f89535a3dc77386658485fd", "score": "0.6339113", "text": "def cancel\n\t\tclient = GocardlessPro.new(self.customer.client.organisation)\n\t\tclient.cancel_payment(self.gc_id)\n\tend", "title": "" }, { "docid": "05deed705dea5bbf2a0536a82b0839f2", "score": "0.62366164",...
61b2f3ee36c15cf5740e3c8f54aaa2c6
Tests that mine(5) returns [2, 1]
[ { "docid": "8442c75b084c348569de59080747222e", "score": "0.68702376", "text": "def test_mine_5\n map = Map.new(1234)\n assert map.mine(5) == [2, 1]\n end", "title": "" } ]
[ { "docid": "a74487d5ae7fa1a7a52ab40430bd5189", "score": "0.69089943", "text": "def test_mine_0\n map = Map.new(1234)\n assert map.mine(0) == [1, 1]\n end", "title": "" }, { "docid": "d57e2852d7971242312d2bc7a926bec2", "score": "0.6869736", "text": "def test_mine_6\n map = M...
8f4a9bb64ac306b895cbf12525e2a984
Add the description of the 'hbase_shell' to the banner
[ { "docid": "f22e88fbbdaaa0959efc6fd3ce711193", "score": "0.6198404", "text": "def hbase_shell_option(opts = {})\n @parser.new do |opt|\n opt.banner += \" Extra options passed to the hbase shell.\\n\" \\\n \" e.g. HBASE_SHELL_OPTS=-Xmx2g\\n\\n\"\n ...
[ { "docid": "67748c465ca8e4459df2609a08bd3f91", "score": "0.7472904", "text": "def shell_banner\n Command::ShellBannerBuilder\n end", "title": "" }, { "docid": "4b5d381e5f6304089a1f4bf115e0ff9f", "score": "0.73030233", "text": "def command_banner\n ''\n end", "title": ...
564d1dd41a05a22f6ab8e8bf6bf797d8
POST /libraries POST /libraries.json
[ { "docid": "7b5d381eb5f8010e1f8af65b2c932436", "score": "0.59925544", "text": "def create\n @library = Library.new(library_params)\n @library.user = current_user\n\n respond_to do |format|\n if @library.save\n flash.notice = 'Library was successfully created.'\n format.html {...
[ { "docid": "7e060cf2def651ce633f642e0814a996", "score": "0.7408837", "text": "def create\n @library = current_user.libraries.create(library_params)\n render json: @library\n end", "title": "" }, { "docid": "f2368a215dcb1363d4855e0634b46dd6", "score": "0.72551876", "text": "def...
d0dc006631dacc60cf24aa9f4bdc66a5
============================================================================== authen_method=() ============================================================================== ===Synopsis Set the 'authen_method' field. 1byte. ===Arguments bytepacked String, or an Integer ===Returns nil
[ { "docid": "1d4cd07553f7ad0b5cf58f255cca08af", "score": "0.8357951", "text": "def authen_method=(val)\n if (val.kind_of?(Integer))\n @authen_method = val & 0xff\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value must be 1-byte, but was #{val.length}.\" if (v...
[ { "docid": "a421b74118e03a9d9053544fad04cd08", "score": "0.730273", "text": "def authen_method_rcmd!()\n @authen_method = TAC_PLUS_AUTHEN_METH_RCMD\n end", "title": "" }, { "docid": "18653fff94b213b2e102884c233b2bf1", "score": "0.6714655", "text": "def authen_method_krb5!()...
4c7ef31d2b5829b9420109f163e93b21
def after_sign_out_path_for(resource_or_scope) root_path end
[ { "docid": "342fe3b6d8f5af17dba1ade823addc86", "score": "0.0", "text": "def set_menu\n @footer_menus ||= Contact.where(:home_page => true).order(:order)\n \t@menus ||= Category.all\n \t@headers ||= Category.where(:is_menu => true)\n @budget ||=Item.where(:is_discounted => true)\n @hotdeal ||=...
[ { "docid": "a2fa04e162adae5b52a02eac2367aed1", "score": "0.9865414", "text": "def after_sign_out_path_for(_resource_or_scope)\n root_path\n end", "title": "" }, { "docid": "a2fa04e162adae5b52a02eac2367aed1", "score": "0.9865414", "text": "def after_sign_out_path_for(_resource_or_...
a3c49e2fe6d1dbf218f90258db8e7268
Returns whether or not the OS has the ability to set elevated token information. Returns true on Windows Vista or later, otherwise false
[ { "docid": "0763dff2b49d7023b48a251f12f0a52f", "score": "0.7345706", "text": "def supports_elevated_security?\n windows_major_version >= 6\n end", "title": "" } ]
[ { "docid": "aeb23e177aa8402cdcf7f8b467545c19", "score": "0.7631254", "text": "def elevated_security?\n # default / pre-Vista\n elevated = false\n handle = nil\n\n begin\n handle = get_current_process\n open_process_token(handle, TOKEN_QUERY) do |token_handle|\n get_token_inf...
b28711dc4b4a1d8700961bb245bbf859
pin = text_pin_to_user(params[:user][:phone]) if pin u = User.new(phone: params[:user][:phone], pin: pin, email: params[:user][:email]) if u.save flash[:notice] = "account created. check your phone for your PIN." redirect_to new_session_path else flash[:notice] = "invalid phone number. try again." redirect_to new_user_...
[ { "docid": "9501ea9674c949a90c9d5955bdd2b228", "score": "0.0", "text": "def forgot\n\n\n\t\t#if user already exists,\n\t\t#attempt to send txt to user\n\t\t#and redirect to session controller to ask user to sign in w pin\n\tend", "title": "" } ]
[ { "docid": "ecbe883a875c406d0a182155c2060c80", "score": "0.7563064", "text": "def create\n number = params[:user][:number]\n number = number.gsub(\" \", \"\")\n number = number.gsub(\"(\", \"\")\n number = number.gsub(\")\", \"\")\n number = number.gsub(\"+\", \"\")\n number = number.g...
1b98cfacd1320f8a90913883c328e5ed
GET /arrendamientossoportes/new GET /arrendamientossoportes/new.xml
[ { "docid": "771ab9f6cd00d428b59503ac042d738a", "score": "0.7374733", "text": "def new\n @arrendamientossoporte = Arrendamientossoporte.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arrendamientossoporte }\n end\n end", "title": "" }...
[ { "docid": "2ebebea6740cc061a1f955e86667c2f9", "score": "0.7214483", "text": "def new\n @revista = Revista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revista }\n end\n end", "title": "" }, { "docid": "8e51be99b417aa15f5ad56...
77f2c90f5d01e51fbf742f780ca2df44
The password for the user that should be used when making requests via a HTTP proxy
[ { "docid": "f466e0590ccd4132df028056c79358db", "score": "0.8195726", "text": "def proxy_password=(_arg0); end", "title": "" } ]
[ { "docid": "4c88055e2b627052a7a66bfb0706fc69", "score": "0.83985937", "text": "def proxy_password; end", "title": "" }, { "docid": "17d717968c373fe69bd0341c2737968c", "score": "0.7545729", "text": "def password\n @password ||= parsed_opt(\"password\") || parsed_uri.password\...
664d1a6b948d3e547a27c57616ebb25a
Shortcut functions to tighten up security further
[ { "docid": "5139b9a1ef1c09ec671acc78c0da4481", "score": "0.0", "text": "def accept_no_params(opts={})\n accept_params(opts) {}\n end", "title": "" } ]
[ { "docid": "4925934827492bfd695ef1baa9c9f33d", "score": "0.6641832", "text": "def safe; end", "title": "" }, { "docid": "517ea033009d387f5d2c5255ead7d0a2", "score": "0.6617904", "text": "def access_control\n \n end", "title": "" }, { "docid": "fd6607ac42d5f5f89a39ffd9...
c88683f45798b2cfe19d218427852770
GET /comments/1 GET /comments/1.xml
[ { "docid": "3456d9c65de252df211f21a417f74634", "score": "0.6020232", "text": "def show\n @comment = Comment.find(params[:id])\n @user = User.find_by_id(@comment.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end"...
[ { "docid": "db20166192f49f573bb8746e971d1bf0", "score": "0.7356179", "text": "def comments\n client.get(\"/#{id}/comments\")\n end", "title": "" }, { "docid": "6336af7657aec205ca8f72d2be345546", "score": "0.693498", "text": "def index\n @comments = @commentable.comments\n\...
d19c1b6113cda29ae8bd98da452d9724
ensure that there are no line items referencing this item
[ { "docid": "8b3a1ced9d88415754f9eed457bea9b9", "score": "0.8148278", "text": "def ensure_not_referenced_by_any_line_item\n \tif line_items.count.zero?\n \t\treturn true\n \telse\n \t\terrors.add(:base, 'Line Items present')\n \t\treturn false\n \tend\n end", "title": "" } ]
[ { "docid": "bd20b1b96fe648dac8d28f07cdca8843", "score": "0.8556947", "text": "def ensure_not_referenced_by_line_item\n\t\tunless line_items.empty?\n\t\terrors.add(:base, 'Line Items present')\n\t\tthrow :abort\n end\n end", "title": "" }, { "docid": "23ba254ae18b60b7b6f267761b8fce2...
2350c361ab05aaebed0d5f8768dba503
Package has been signed by a known key Package signed by unknown key
[ { "docid": "ca807a4ff7eee9475d55ed0d24755a4c", "score": "0.0", "text": "def check_package(pkg)\n a = `rpm -K #{pkg}`\n puts a.split('#')[-1].gsub!(')', \"\")\nend", "title": "" } ]
[ { "docid": "d18636bfe2e5f568de442ab75af06b50", "score": "0.6392729", "text": "def validate_package(this_package)\n resp = show do\n title 'Validate kit package'\n note \"Scan in the ID of package #{this_package} which you've retrieved.\"\n default = AUTOFILL ? this_package : ''\n ...
3e5d0a1c2e29d8a904e30822edd74d85
Unread notifications yet to be sent out, belonging to be a particular group:
[ { "docid": "7f8140c43e82a9875c9fe458e29e83b0", "score": "0.81442046", "text": "def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end", "title": "" } ]
[ { "docid": "7be791f10b9a0de253401fb91ca8c175", "score": "0.66430664", "text": "def unopened_group_member_notifier_count\n group_members.unopened_only\n .where(notifier_type: notifier_type)\n .where(:notifier_id.ne => notifier_id)\n ...
01b0bc396fc76bfd6a2f6917379f73b3
GET /instrument_registrations/1 GET /instrument_registrations/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "fb4214f9188d1d7369359196431a36d5", "score": "0.72705775", "text": "def index\n @instrument_registrations = InstrumentRegistration.all\n end", "title": "" }, { "docid": "68a8bcea60b5dd6657c925d839b28303", "score": "0.65449226", "text": "def get_registration\n path =...
01657f74e15789fe46ea5280c04f5fe5
PUT /orders/1 PUT /orders/1.xml
[ { "docid": "d9123ef1c0597f73dde989c4c7e6563b", "score": "0.6236625", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }\n ...
[ { "docid": "46ac3c734888a79b625b71c4c703f8e5", "score": "0.65634364", "text": "def update\n @order = resource\n respond_to do |format|\n if @order.update_attributes(params[:order])\n flash[:notice] = 'Order was successfully updated.'\n format.html { redirect_to(@order) }\n ...
44cb4f7e2ef9b49bb253bf68fd87fcb2
Render the standard set of table actions for any given model
[ { "docid": "5df8908acd002308ace3c901c0cd6c2b", "score": "0.8132287", "text": "def table_actions model, records\n capture do\n if model == Article\n concat table_action human_model_name(Category, :plural), model_icon_key(Category), admin_categories_path if policy(Category).index?\n el...
[ { "docid": "bb1a62e09cf37f899ed3da22a288b5f3", "score": "0.72272044", "text": "def table_actions object, *args\n show = args.include?('show')\n edit = args.include?('edit')\n remote_edit = args.include?('remote-edit')\n delete = args.include?('delete')\n remote_delete ...
aab147118193bedd07821306ba20e379
Return the list of user dependencies for a given target.
[ { "docid": "49ff96843241be30448dc929940284ee", "score": "0.8317397", "text": "def get_user_deps(target)\n @user_deps[target]\n end", "title": "" } ]
[ { "docid": "4d14b168da17a1a8d26b60477a79b0c2", "score": "0.69180775", "text": "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "title": "" }, { "docid": "cc820b384e1defd16588abe9cb43ce7f", "score": "0.68532413", "text": "def depends(target, *user_deps)\n ...
e9f44f769f623c3c8fdf59f12043103a
Returns a new Provider instance based on information from oEmbed discovery performed on the given url. The options Hash recognizes the following keys: :format:: If given only discover endpoints for the given format. If not format is given, use the first available format found. :timeout:: specifies the timeout (in secon...
[ { "docid": "1ff61a32b5125a7e1f350e3cb132b38e", "score": "0.7742812", "text": "def discover_provider(url, options = {})\n uri = URI.parse(url)\n\n res = http_get(uri, options)\n format = options[:format]\n\n if format.nil? || format == :json\n provider_endpoint ||= /<link[^>]*h...
[ { "docid": "2e2b7abfef5a3c94cc256a63a20e957d", "score": "0.5416511", "text": "def initialize(url, format = COMPACT_FORMAT)\n @request_struct = RETS4R::Client::Requester.new\n @format = format\n @urls = RETS4R::Client::Links.from_login_url(url)\n\n @request_method = DEFAULT_METH...
e432e498692bd88109e06eb5d9721890
Set a key's time to live in milliseconds.
[ { "docid": "a5d224dc7e76f6d325e37aa55e7447d7", "score": "0.59824276", "text": "def pexpire(key, milliseconds, **kwarg)\n node_for(key).pexpire(key, milliseconds, **kwarg)\n end", "title": "" } ]
[ { "docid": "d17b136a41a20eb34ca89cf49d3edb33", "score": "0.73353523", "text": "def set_timer(key, time)\n transaction.timers[key] = time\n end", "title": "" }, { "docid": "2e2eac07e354a18d0e7f7f5f2ea228c0", "score": "0.72217196", "text": "def set(key, value, options = {})\n ...
c7e20494e7ef79410cec99d211383a62
Convert all keys in this hash (nested) to symbols for uniform retrieval
[ { "docid": "a1bb78bbb1f2403f18b192658059a84e", "score": "0.0", "text": "def recursive_hash_normalize_keys val\n if val.is_a? Hash\n deep_hash_normalize val\n else\n val\n end\n end", "title": "" } ]
[ { "docid": "7db1837092688928ef41d6003243c85e", "score": "0.79758257", "text": "def keys_to_symbols()\n self.deep_convert_keys { |k| k.to_s.to_sym }\n end", "title": "" }, { "docid": "65ebdbb1c483ce310d89478586832836", "score": "0.76420784", "text": "def deep_symbolize_keys\n ...
684be902be4e009f5ce5290c5ce65f2e
Upgrade PE based upon global host configuration and global options
[ { "docid": "722ad82dded4dddc6ece47e33fbc71cd", "score": "0.70417994", "text": "def upgrade_pe path=nil\n upgrade_pe_on(hosts, options, path)\n end", "title": "" } ]
[ { "docid": "69d57f8a4b3cfc40b9bcaf789fe9e8de", "score": "0.6611409", "text": "def install_pe\n install_pe_on(hosts, options)\n end", "title": "" }, { "docid": "306e7a72356a9f6fb7cfd36e2f630fdf", "score": "0.6392694", "text": "def get_pe(pe_install_suffix)\n if PESTAT...
48165e18298919d8408e47cb133b2ec2
Write an entry to the list in redis
[ { "docid": "27f12c81afdd20777cc3f1480768b3f8", "score": "0.7830318", "text": "def write(entry)\n data = entry_as_json(entry)\n json = MultiJson.dump(data)\n redis.multi do |transaction|\n transaction.lpush(name, json)\n transaction.ltrim(name, 0, limit - 1)\n transact...
[ { "docid": "21a929c1b0302e896ec97ecaf849cfe2", "score": "0.7232485", "text": "def add_to_list\n return if exists?\n @redis.lpush list, @data\n sadd\n end", "title": "" }, { "docid": "6644dc2e50b37266d4ae44b5bb3274ea", "score": "0.7061557", "text": "def write(chunk)\...
cb49b8e4886a5b47185cd8a147d17839
Read file in chunks.
[ { "docid": "9d5a56b022306f27cef5f944b62e3c79", "score": "0.619586", "text": "def read_stream(chunksize_hint, &block) \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n http.use_ssl = (@uri.scheme == 'https' || @uri.port == 443)\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE...
[ { "docid": "472073b627223aae2c32ede2be7d476c", "score": "0.82856935", "text": "def read_chunks\n if file.to_io.respond_to?(:each_chunk) # Down::ChunkedIO\n file.to_io.each_chunk { |chunk| yield chunk }\n else\n yield file.read(16*1024) until file.eof?\n e...
6d7ae1d4a9f5549009a5eb9cbfcfdd1f
Returns the PSC activity identifier for the first participant scheduled activity matching the given activity_name
[ { "docid": "bef3d3a19faa501380b40d2143e7ba07", "score": "0.79998845", "text": "def get_scheduled_activity_identifier(participant, activity_name)\n scheduled_activity_identifier = nil\n scheduled_activities(participant).each do |activity|\n if activity_name =~ Regexp.new(activity.activity_name...
[ { "docid": "17516cc7b0c976f36e530d3eab1c1c3b", "score": "0.59712726", "text": "def activity_name\n config_hash['activity_name']\n end", "title": "" }, { "docid": "eef624ef8af47f8f8b950876a3a1e999", "score": "0.580464", "text": "def findActivityTypeId(name)\n name.strip!\n ...
20e44a63bfc87cd69b70565a79b2a345
GET /decks GET /decks.json
[ { "docid": "e1160ee3188b8f9e00d3a66db34f602f", "score": "0.72567314", "text": "def index\n @decks = Deck.all\n end", "title": "" } ]
[ { "docid": "c80279156df3658d510554c04700c62e", "score": "0.7789911", "text": "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "title": "" }, { "docid": "c80279156df3658d510554c0470...
fa66ab7a3fde26bb9609ff0b79d45067
Used for the 'fromscratch' mode
[ { "docid": "5f375ee42707f30faa4f359f0f321adf", "score": "0.0", "text": "def convert project\n @@log.info(\"-------------------------------------------------\")\n @@log.info(\"| Converting #{project.project_id}\")\n @@log.info(\"-------------------------------------------------\")\n u...
[ { "docid": "608761bba904e71bab16dff4a7eee1d5", "score": "0.66848016", "text": "def use_scratch?(params)\n params[:use_scratch] && params[:use_scratch] == 'true'\n end", "title": "" }, { "docid": "8f859c398dc413a28bb077b6c61ca1c8", "score": "0.62717164", "text": "def scratch_b...
e0b20dc644bcdc6d0dfe9ebb2aa0b839
Search for a venue by venue name.
[ { "docid": "56f2104731a5b22629c7c1ccac0d2a53", "score": "0.70253414", "text": "def search( params )\n LastFM.get( \"venue.search\", params )\n end", "title": "" } ]
[ { "docid": "5cf91517a1e3946caaa48e51677aff45", "score": "0.7601788", "text": "def search_venue\n puts \"-- Enter Venue Name, or 'all' for current list of venues:\".colorize(:blue)\n venue_input = gets.chomp\n if venue_input.downcase == \"all\"\n self.venue_by_number\n elsif\n ...
ffd6c6c7495d8b714026ecd9eca3c05b
error caracteristics generation array_details:: error details array arr_index:: index of error
[ { "docid": "8c6d6c275ed8043698cb11509662cb72", "score": "0.7588615", "text": "def generate_error_caracteristics(array_details, arr_index)\n error_failure_type = array_details[arr_index][0].split(/\\)/)[1].split(/:/)[0] unless array_details[arr_index][0].nil? or array_details[arr_index][0].split(/\\)/...
[ { "docid": "0229c470c551dde927310366eb76d81d", "score": "0.6073547", "text": "def split_array_errors(array)\n array.each_with_index do |_e, i|\n verify_type array[i]\n end\n end", "title": "" }, { "docid": "0f978f681aa45c8ea8dadb18c5dd3771", "score": "0.6015466", ...
a6f7f36cffb33a8b228dc7756b150eba
Clicks an element if the element exists. If the element is not found, it logs a warning but proceeds how element type (i.e. xpath, id etc) what element identifier timeout time to wait for the element to appear msg Optional logging message
[ { "docid": "710c2cbdb16facf852209ecc1de57f06", "score": "0.77175695", "text": "def click_element_if_exists(*args)\r\n begin\r\n how = args[0]\r\n what =args[1]\r\n timeout = args[2]\r\n msg=\"\"\r\n if (how.is_a? String)\r\n nLookup = get_element_from_navigation2(how,w...
[ { "docid": "9d3aeb68f43325ec4796324802ac8e16", "score": "0.7779173", "text": "def wait_for_element(*args)\r\n begin\r\n how = args[0]\r\n what =args[1]\r\n msg=\"\"\r\n timeout = 60\r\n if (how.is_a? String)\r\n nLookup = get_element_from_navigation2(how,what)\r\n ...
2b3c75c61ef322189fd76e506a15d5b1
get a message of data from the socket
[ { "docid": "8d4932c04b8f188e0e3ea752b91f3639", "score": "0.6519874", "text": "def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n ...
[ { "docid": "0aadb594f0eddf981625e214c9c3b2ab", "score": "0.76631504", "text": "def read_message(socket)\n unless (buffer = socket.read(4)) && (buffer.size == 4)\n raise InvalidResponse, 'unexpected EOF'\n end\n\n length = buffer.unpack1('N')\n begin\n str = ...
4048fb4cfcd4e22839c3070006eb12a5
funion que devuelve el indice de referencia de las grasas saturadas
[ { "docid": "e78da4b90fe9c8a7ac7864eaabbbe7de", "score": "0.0", "text": "def irgrasassaturadas\n vag=(cgrasassa * 100) / 70\n vag.round(2)\n end", "title": "" } ]
[ { "docid": "c9278fded88d52eedb186173246e8a2f", "score": "0.5467617", "text": "def geturl (reg)\n\n case reg.clase\n when 0\n return concepto_path(reg.elemento)\n when 1\n return conceptospersonales_path\n when 2\n return departamentos_path\n when 3\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "06d79a16d0dc61ff7ad6b4119d578957", "score": "0.0", "text": "def driver_params\n params.require(:driver).permit(:cpf, :nome, :fantasia, :inscricao_estadual, :instricao_municipal, :endereco, :numero, :complemento,\n :bairro, :cidade, :estado, :cep, :rg, :data_emissao_rg, :orgao_exp...
[ { "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...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "e208e4624edaa60a6676cf85a1cd3f44", "score": "0.0", "text": "def exam_params\r\n params.require(:exam).permit(\r\n :title, :time, :category_id,\r\n questions_attributes: [\r\n :id, :title, :score, :_destroy,\r\n options_attributes: [:id, :content, :is_corr...
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
5df47f35e4e3d52ec4b759e421596fb5
on service completion, process discount
[ { "docid": "0d9702c85bd0aaf82cdc881227ba055b", "score": "0.0", "text": "def get_discounted_value bill\n # this function needs to be called only once to initialize rules\n return 0 if bill.nil?\n bill_amount = bill.amount\n if discount = validate_discount(bill)\n if discount.operation.e...
[ { "docid": "f89c366d10e9114d590ed751706c87d7", "score": "0.69609046", "text": "def update_current_discount_to_service\n service = self.service\n if service\n #get spots already taken\n availabilities = service.availabilities\n spots_taken = service.reservations.get_unarchived.not_ca...
73a311a14884eb75b4ce6286cb04cb4b
could also say: render layout: "three_column" in a specific method or use ONLY/EXCEPT
[ { "docid": "4d8ce1b2ae41649f66bc954982588b34", "score": "0.0", "text": "def index\n\t\t# will automatically go into views/posts and look for 'index' file to render\n\t\t@all_posts = Post.all\n\t\t@all_users = User.all\n\t\t# @all_posts.each do |post|\n\t\t# \tp post.user.first_name, post.user.last_name\...
[ { "docid": "45a67a17e3826a80850f642cf1ff6fc9", "score": "0.6131073", "text": "def modul_a_1\n render layout: 'narrow1'\n end", "title": "" }, { "docid": "5c0e7fec991fee3500913b8850901b97", "score": "0.5956892", "text": "def show\n render layout:\"layouts/twoColumn\"\n end", ...
415dd6a32665ab95e333f668f249f4b0
Remove a piece from the board
[ { "docid": "bc6f19cf4a62f9694f4f8cbca51bb475", "score": "0.79016584", "text": "def removePiece(piece)\n if piece.instance_of?(Piece) && piece.location != nil\n piece.location.removePiece\n piece.location = nil\n end\n end", "title": "" } ]
[ { "docid": "66b4957ca01887f62d1fc38fa84d154d", "score": "0.83444023", "text": "def remove_piece(arr)\n @board[arr[0]][arr[1]][:piece] = nil\n end", "title": "" }, { "docid": "80cad4c67d794f5a59e12917aaa1d9ab", "score": "0.81771857", "text": "def remove_piece(pos)\n i, j = pos\...
7682d0ea18f1dc89b7847cdafa96bc91
The method called by the engine for each incoming workitem.
[ { "docid": "68b62304f688199e9d91668dfed34c5c", "score": "0.5912618", "text": "def consume (workitem)\n\n FileUtils.mkdir_p(@workdir) unless File.exist?(@workdir)\n\n file_name = @workdir + determine_file_name(workitem)\n\n dump_to_file(file_name, workitem)\n\n reply_to_engine(workite...
[ { "docid": "7b65ce6642adea5411664899a8d32ab7", "score": "0.6613737", "text": "def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end", "title": "" }, { "docid": "4201b2cb80281d99db3309797ee52361", "score": "0.6578521", ...
17d58211949ac41702eb381de32ef011
TODO: Finish assignment of user roles
[ { "docid": "150e86e24d0cbbc647793ec4cd0a1670", "score": "0.0", "text": "def initialize(user)\n user ||= User.new\n\n if user.role? :parent\n can :manage, User, :id => user.id\n\n can :create, Event \n can [:read, :update, :destroy], Event do |target_event|\n user.events...
[ { "docid": "ef92e22f016d23bcd079f281556ec92d", "score": "0.79190296", "text": "def set_roles\n roles << Role.user unless has_role?(\"user\")\n as_seller! if @registration_as_seller.to_i == 1\n end", "title": "" }, { "docid": "94b56b74507719cbb689b80053e45899", "score": "0.7798229"...
2f0d31983bb43692e6182244325e23d3
POST /project_infos POST /project_infos.json
[ { "docid": "b8690c78b324da3d22db14af2facfe66", "score": "0.0", "text": "def create\n project_info = ProjectInfo.create_me(params[:combi], current_user)\n project_info.save\n if ProjectInfo.find_by_name(project_info.name)\n is_neu = \"\"\n else\n is_neu = \"neues \"\n end\n\n ...
[ { "docid": "5b64ba9f9faea58bb5af65892c2ea3db", "score": "0.6902531", "text": "def post_new_project\n self.class.params\n options = {:body =>{:project=>\n {:title => @@params[\"title\"],\n :description => @@params[\"description\"]}}}\n self.class.post(\"/projects.json\", opti...
d4f70ef80440db1461ee7262ec0da0db
POST /events POST /events.xml
[ { "docid": "7d741c7340f5ec9b54d7008567606703", "score": "0.644994", "text": "def create\n setup_variables\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(admin_ev...
[ { "docid": "b017821afcf02eb5bf3310a314f7428d", "score": "0.6938859", "text": "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "title": "" }, { "docid": "d70601f4de46b4b99300c06b1751c4f2", "score": "0.6832928", "text": "def create_event ...
b147611ea88390fbd581858831e360af
Instantiates a new relatedContact and sets the default values.
[ { "docid": "7ef81c87eb67a10f03b6ac27e68651f1", "score": "0.0", "text": "def initialize()\n @additional_data = Hash.new\n end", "title": "" } ]
[ { "docid": "fd25c33edb1dc3ff9cab5e94f3dd68a2", "score": "0.6624647", "text": "def new_contact\n @contact=Contact.new()\n end", "title": "" }, { "docid": "aa6179f387359da7d4c7491a88430de3", "score": "0.65874594", "text": "def create_contact()\n Contact.new(id: rand(2000)).tap...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "03d95095cc4431f52e4bc3fb251558b5", "score": "0.0", "text": "def set_location_draw_returns\n load_route\n load_draw_returns\n @zero_draw_reason_codes = ZeroDrawReasonCode.all\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...
b3e257e995434bf3a74fd1c2678dc5cf
True if the ball is in the donor's court to send the book.
[ { "docid": "832a5cc85d1e1a2e093681b4f9e098d9", "score": "0.0", "text": "def needs_sending?\n !sent? && !flagged?\n end", "title": "" } ]
[ { "docid": "73889855593eefbece484650835b285b", "score": "0.6535631", "text": "def plays_in_concert?(concert)\n concert.lineups.each do |lineup|\n return true if self.lineups.include? (lineup)\n end\n false\n end", "title": "" }, { "docid": "5a1955ed40ec1d912bc95f79a70eb88d", ...
587ec6bd778090b220c902addb311543
Connect the variable to an other variable in the value table
[ { "docid": "a00b5022381c11a074e0e1d1c244d471", "score": "0.0", "text": "def interpolate(value, xref = nil)\n Entry::Interpolator.new(value, nil, xref)\n end", "title": "" } ]
[ { "docid": "88138340ab926ade1721548610fd91fc", "score": "0.6072862", "text": "def add_equivalence x, y\n @var_to_var[x] = y\n end", "title": "" }, { "docid": "844d6d283872d2a2419589df184ce010", "score": "0.58850133", "text": "def add_value(p0, p1, p2) end", "title": "" ...
06a9315871c39483f978d3bd01fcf818
ip h show the usage
[ { "docid": "d829d42bc9e72c47f12d3d40b3799698", "score": "0.69814783", "text": "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts '...
[ { "docid": "9710b466b70c217aa23905c1415dd231", "score": "0.784439", "text": "def print_usage; end", "title": "" }, { "docid": "1b2edfa86778257f786eaa24cc4b3c14", "score": "0.7552291", "text": "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "title": "" }, { "doci...
ca394e3504fa334351be74d6f9fc8b4d
Gets the success rate of a Seller's Sales.
[ { "docid": "3b656561a2bbb49f05818d054bce1f7b", "score": "0.8080012", "text": "def sale_success_rate\n self.get_successful_sales.count.to_f / self.sales.count\n end", "title": "" } ]
[ { "docid": "5ee61494ce13b5b62e17cff4aa9386cc", "score": "0.6246103", "text": "def success_rate\n return 0 if self.reported_results.nil?\n return self.count_passing.to_f / self.product_test.measure_ids.size\n end", "title": "" }, { "docid": "83bf926be3c4ff1f37f87ee9c6b61bdd", "scor...
52ff108e5f10e230af5855d132b82c2d
return array of games in specified round
[ { "docid": "4500314356a137834e5afe238f4f0b88", "score": "0.80200464", "text": "def games_in_round(round_name)\n self.games.where(:round => round_name).to_a\n end", "title": "" } ]
[ { "docid": "a0c3851fd7f8642df17975c4b1807227", "score": "0.7855983", "text": "def games_in_round(round)\n return @teams.size / 2 ** round\n end", "title": "" }, { "docid": "f700ec222fc7b37bdf0cc413a4a9ca0c", "score": "0.7638765", "text": "def round_and_game(overall_game)\n 1.u...
6e107c90460a403dd83907aaadfd2429
method to deactivate record
[ { "docid": "e56fa405b75a1c12a3c6e6310c8f8e25", "score": "0.6553784", "text": "def deactivate\n if deactivated?\n errors.add(:base, I18n.translate('errors.cannot_method_msg', :method => 'deactivate', :msg => I18n.translate('error_messages.is_deactivated') ) )\n errors.add(:deacti...
[ { "docid": "4d230d837eef1a232bdec75f66ea3c3c", "score": "0.7958766", "text": "def deactivate\n self.active = false\n save\n end", "title": "" }, { "docid": "aa41abd73c8a792dca4a0f830d9b2129", "score": "0.7615121", "text": "def deactivate\n copy self.class.deactiva...
670758d37ce0fff7f8d162ba181039ba
When a user hovers over a button draw a border
[ { "docid": "f2152cbbc16dd547041fa684d1ad6905", "score": "0.7579696", "text": "def draw_border(x1, y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::...
[ { "docid": "801543d2d9047528a2770fc435053517", "score": "0.7456075", "text": "def draw_border(x1, y, mouse_x, mouse_y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y...
fb7eed7569f15efe576eb1a19922fecd
Check for valid request token and return user
[ { "docid": "70f45d2ba6161d48522c76792ab31148", "score": "0.0", "text": "def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end", "title": "" } ]
[ { "docid": "8bf957931123983d9bf02755afab191f", "score": "0.8631779", "text": "def valid_token\n @user = User.find_by authentication_token: request.headers[\"AUTH-TOKEN\"]\n if @user\n return @user\n else\n json_response \"Invalid token\", false, {}, :failure\n end\n end", "tit...
18f59957c60d9359d9b1d325d93e031e
Unwrap value from right
[ { "docid": "93ff14a25d53c3741464ec3c4dc67072", "score": "0.6253878", "text": "def from_right\n value\n end", "title": "" } ]
[ { "docid": "ed38ca36997448269b24071e903dc91a", "score": "0.7161775", "text": "def right(x, _); x end", "title": "" }, { "docid": "ab71438557677e5398ad5074bc1a80c7", "score": "0.69270384", "text": "def unwrap\n @value\n end", "title": "" }, { "docid": "ab71438557677e53...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "bc4574d5a4b18de997150a7114d58732", "score": "0.0", "text": "def set_exhibitor_information\n @exhibitor_information = ExhibitorInformation.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...
6646bbcde671d117d93adb28cb488282
Returns the \host for this request, such as "example.com".
[ { "docid": "7a0b3e671127c59e6a6b185764736c5d", "score": "0.0", "text": "def raw_host_with_port\n @host + ':' + @port.to_s\n end", "title": "" } ]
[ { "docid": "b8a1372653da5aa33c30c3ceb9775a05", "score": "0.87424695", "text": "def host\n params['HTTP_HOST'].split(\":\")[0]\n end", "title": "" }, { "docid": "8d364e96c2f6abcb934e5e53098c2493", "score": "0.8597823", "text": "def get_host\n return request.headers['HTT...
7c18ee47589cdaa090650e53d0674f15
Version v1 of insights source://twilioruby//lib/twilioruby/rest/insights.rb27
[ { "docid": "e642b665042c15da97deb6769be5db79", "score": "0.0", "text": "def v1; end", "title": "" } ]
[ { "docid": "7c06de1282100c3880b08216aa36136a", "score": "0.6540328", "text": "def insights; end", "title": "" }, { "docid": "e507ddbdaccc519f2e6c0ca9c5ce6662", "score": "0.62021345", "text": "def to_s\n '<Twilio::REST::Insights::V1>'\n end", "title": "" }, { ...
aebf29a65d6108800f4747def137f8a1
Read a &39;appliance.GroupStatus&39; resource.
[ { "docid": "fe16e46b3ea6a9d1bd3901a45e541719", "score": "0.50420815", "text": "def get_appliance_group_status_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplianceApi.get_appliance_group_status_list ...'\n end\n a...
[ { "docid": "c62d8a7a7ff34b7b822f928a9fd5514f", "score": "0.63422865", "text": "def status_groups\n url = \"#{@url}reference/status-groups\"\n make_request(url)\n end", "title": "" }, { "docid": "925e2199813ed00e24a84d48d8a17124", "score": "0.60916203", "text": "def group_statu...
a80f4eaa08f88847b308d92cc4640e8b
Create S4 description object with _name_ as the name of the method, _s4_class_ as the method's class, _args_ as its arguments, and _filename_ as the name of the file in which the method definition was found.
[ { "docid": "5f9f6b52a37b7a39a8bec9fb7b0fc6a5", "score": "0.6927045", "text": "def initialize name, s4_class, args, filename\n if name == 'func_'\n raise ArgumentError,\n \"name cannot be 'func_' (#{s4_class}, #{args}, #{filename})\"\n end\n @name, @s4_class = name.sub(/^`([^`]+)`$...
[ { "docid": "6679ec9ebc1618c6e28eafafd6955ee1", "score": "0.56122375", "text": "def construct str, filename\n found = match str.to_s\n raise ArgumentError, str.to_s unless found\n if found[:name] == 'func_'\n placeholders = @@placeholders[@@func_index += 1]\n if placeholders....
7148c9d3fd826df51d23ee047df07617
The workflow phase is indicated by the variant type of the subclass.
[ { "docid": "ca341446e3308c2355a10ae7bb832b24", "score": "0.55397075", "text": "def workflow_phase\n self.class.workflow_phase\n end", "title": "" } ]
[ { "docid": "e1cebde27e047bf83b8f95a278d13853", "score": "0.59921455", "text": "def inherited(subclass); end", "title": "" }, { "docid": "ed2e030ac91de0f80377b5a2ff9c707a", "score": "0.5974281", "text": "def variant_type\n self.class.variant_type\n end", "title": "" }, { ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f831b4e003603c0e4f871db2c48c72a6", "score": "0.0", "text": "def connection_params\n params.require(:connection).permit(:user_id, :contact_id, :is_pending, :id_user, :is_rejected, :is_removed, :nickname, :return_to)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980384", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782743", "text": "def strong_params\n params.requi...
a145f6f414fe535f5cc45acee9cbe1bc
escape = (number_escapes | escapes)
[ { "docid": "a0ee0ba525584fe55f23ed8ec0bbcc53", "score": "0.78366524", "text": "def _escape\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_number_escapes)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_escapes)\n break if _tmp\n self.pos = _save\n ...
[ { "docid": "2f779115ce7db1f904dfb8ff63a89ab4", "score": "0.7985924", "text": "def _escape\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_number_escapes)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_escapes)\n break if _tmp\n self.pos = _save\n break\n en...
10a56f20d999725646b950f637e8ba1e
Select Children Entity of File Entity
[ { "docid": "029d66721c0d73ba14739eccfd68aba2", "score": "0.0", "text": "def test_cases(email_id = nil, root_folder = nil)\n file_selector(root_folder).email_id(email_id)\n .map(&:test_cases).reject(&:empty?).flatten.unwrap\n end", "title": "" } ]
[ { "docid": "5102cce2f9a27ec8e061829c6c1d176f", "score": "0.65462726", "text": "def children\n c = file_log.children(file_node)\n c.map do |x|\n VersionedFile.new(@repo, @path, :file_id => x, :file_log => file_log)\n end \n end", "title": "" }, { "docid": "...
ec05d2198c084029a97f49000c14d86a
Determine if the given vagrant environment contains a chef_client provisioner
[ { "docid": "20289e4bf60ad092736784d72e25e3bb", "score": "0.8271418", "text": "def chef_client?(env)\n provisioners(:chef_client, env).any?\n end", "title": "" } ]
[ { "docid": "d35000e976cea6c83ee0297be0955afb", "score": "0.7520248", "text": "def chef_client?\n chef_client.present?\n end", "title": "" }, { "docid": "00e4cb0ff82f67e53aa135178736cf80", "score": "0.7425709", "text": "def chef_solo?(env)\n provisioners(:chef_solo, env...
59b20c14ad940d716707205f1aa735a0
Returns an array of regexs to match dir/file names.
[ { "docid": "e5395c039802f4a22a44bc22516f537d", "score": "0.0", "text": "def file_patterns(type)\n FILE_PATTERNS[type] or raise\n end", "title": "" } ]
[ { "docid": "d36f6a5ac9269cf322e5a72a4070798a", "score": "0.6875492", "text": "def find_all_files(re)\n entries.map do |pn|\n if pn.directory?\n if pn.basename =~ /^\\.\\.?$/\n []\n else\n pn.find_all_files(re)\n end\n elsif pn.file?\n ...
3df69f3376f91ac32839f5b19e75221f
Correlations between of words responded and values
[ { "docid": "7505b70eeb11aabdd092d99a9994cdf1", "score": "0.0", "text": "def wordcount(str)\n str&.split(/[\\s,\\/]/)&.length.to_i\nend", "title": "" } ]
[ { "docid": "9892c1f26cfc3ff5f3500e2556d585b0", "score": "0.65390587", "text": "def calculate_correlation_for(ngram)\n words = ngram.split(' ')\n \n if any_word_is_below_the_threshold?(words)\n 0\n else\n Math.log(@ngrams.probability_of(ngram) / product_of_probabilities_for(words))\...
4a398c715afcbcab9a9a98815f29669d
GET /academic_works/1 GET /academic_works/1.json
[ { "docid": "2a695ce99dd517e0556fde5ad61fedef", "score": "0.78373665", "text": "def show\r\n @academic_work = AcademicWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @academic_work }\r\n end\r\n end", "title": ""...
[ { "docid": "cedfa36ce1dd69f8755c2379e4eb0870", "score": "0.7209039", "text": "def new\r\n @academic_work = AcademicWork.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @academic_work }\r\n end\r\n end", "title": "" }, { "do...
ace67f66ad47f93b16beaffbf20b77cb
Translate a Hash of url parameters to a query string
[ { "docid": "4c2c6b8f1062ec8f79e771e70a08994a", "score": "0.6143249", "text": "def build_url_parameters(parameters)\n sorted_params = parameters.to_a.sort_by{|x| x[0]}\n query_string = sorted_params.map do |key, value|\n if value.is_a? Array\n value.map{|subvalue| \"#{key}[]=#{s...
[ { "docid": "2106102ab615a3f04fe66497de160e91", "score": "0.80568165", "text": "def querinize(hash)\n \"?\" + hash.map { |k, v| \"#{k}=#{URI.encode(v.to_s)}\" }.join(\"&\")\n end", "title": "" }, { "docid": "94e1c8762b59df2aed852d12bb51eea6", "score": "0.7623622", "text": "def...
894ef48435e6a4ddc7e5fb4e6fd9f701
Adds +object+ in the list of permanent tasks. Permanent tasks are tasks that are not to be subject to the plan's garbage collection mechanism (i.e. they will not be removed even though they are not directly linked to a mission). object is at the same time added in the plan, meaning that all the tasks and events related...
[ { "docid": "2820fb1fbf76ff7bdc2bb3c04bf84277", "score": "0.82675934", "text": "def add_permanent(object)\n if object.respond_to?(:as_plan)\n object = object.as_plan\n end\n\n if object.respond_to?(:to_task)\n task = object.to_task\n ...
[ { "docid": "aa1a84f7eec3caa6f7a3e45dbc66cbeb", "score": "0.6368939", "text": "def permanent?(object)\n if object.respond_to?(:to_task)\n @permanent_tasks.include?(object.to_task) \n elsif object.respond_to?(:to_event)\n @permanent_events.include?(objec...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c65d470a6900d87958b3a28ca0a3d4b5", "score": "0.0", "text": "def set_brave_burst\n @brave_burst = BraveBurst.friendly.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;...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "578f0973ca5c3d166e985caadc669428", "score": "0.0", "text": "def question_params\n params.require(:question).permit(:message, :required)\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...
738c2e3c4d85067825b9beece8e1fa2f
Overriding to string method.
[ { "docid": "3a8a10e5622e9af58356a77865496bc9", "score": "0.0", "text": "def to_s\n \"#{@name}\"\n end", "title": "" } ]
[ { "docid": "487e69a2c421444cc7ad7514821909b8", "score": "0.8788473", "text": "def to_str() end", "title": "" }, { "docid": "487e69a2c421444cc7ad7514821909b8", "score": "0.8788473", "text": "def to_str() end", "title": "" }, { "docid": "ffd5f041d0373e45648edf13d531703d", ...
032f6b006dcfae65c950975a11c46714
Write a method that capitalizes each word in a string like a book title Do not capitalize words like 'a', 'and', 'of', 'over' or 'the'
[ { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.0", "text": "def titleize(title)\nend", "title": "" } ]
[ { "docid": "b32a1ca56cf4dafabcf3bcb1f2c6fdcf", "score": "0.83154404", "text": "def capitalize_all_words\n string.downcase.split.map(&:capitalize).join(' ')\n end", "title": "" }, { "docid": "af1e52202fede70fa9ec1523e19859ee", "score": "0.82921034", "text": "def capitalizer(st...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f8f6666809be67edb45201a641eb5ff6", "score": "0.0", "text": "def form_params\n params.require(:task).permit(:name,:description,:ownership,{ :group_ids => [] },:form_id,{ :required_field_ids => [] },{ :editable_field_ids => [] },{ :viewable_field_ids => [] })\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...
10218efe713bd2de00cf2a092ab6a41f
Opening a long transaction with rabbitmq and is ending closing transaction, so delete exclusive queue
[ { "docid": "1b7bd4a265fad0ab942a31853e87639b", "score": "0.0", "text": "def connect\n rabbit.transaction_short do\n choose_queue\n create_handle if @handle.eql?(0)\n yield\n end\n handle\n end", "title": "" } ]
[ { "docid": "c76fb277ec9349d33a47c15f1dd63dfc", "score": "0.6723113", "text": "def purge\n @queue.purge\n end", "title": "" }, { "docid": "b3f5134eede92a32e0065212d9f76fc1", "score": "0.6637195", "text": "def purge_queue\n client.purge_queue({queue_url: queue_url})\n end",...
51fcfae5664e357a9803b69ff1e15ae8
date selector as a text field with jQuery datepicker
[ { "docid": "b7900c44df505882935e420f5be3823b", "score": "0.7554526", "text": "def date_select(method, options = {})\n options.merge!({ :size => 10, :class => 'datepicker' })\n text_field(method, options)\n end", "title": "" } ]
[ { "docid": "278b17bd200d1a669e53e541cdac95c9", "score": "0.7763896", "text": "def text_field_date(date = Date.current, options = {}, html_options = {})\n DateTimeSelector.new(date, options, html_options).text_field_date\n end", "title": "" }, { "docid": "06c491d374cad1e0638e32ccf...
d7714ea6b8e5ef1c83c416ce188b63d3
Produces a random vehicle style.
[ { "docid": "954166fe6a211575fb95d6ffb621c864", "score": "0.0", "text": "def style; end", "title": "" } ]
[ { "docid": "c78cf53ba05a279cb173243901a14415", "score": "0.6459586", "text": "def style\n fetch('vehicle.styles')\n end", "title": "" }, { "docid": "ffcff6dc3a338eff7244de943104ee4b", "score": "0.6073273", "text": "def generate_random_color\n COLORS[rand(6)]\n end", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9dd444bb2239149efc9aaad525139ddf", "score": "0.0", "text": "def set_fiction\n @fiction = Fiction.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...
e4fc5241de908abb492c3e5e49191280
Used to create an IP address ==== Returns >> AWS.addresses.create The IP address can be retrieved by running AWS.addresses.get("test"). See get method below.
[ { "docid": "ca921148e31c4b4d0f6a7d4ef6cf9c6f", "score": "0.0", "text": "def initialize(attributes)\n self.filters ||= {}\n super\n end", "title": "" } ]
[ { "docid": "1c5fa34fbf596720acaf45cb7f685155", "score": "0.73535746", "text": "def provision_elastic_ip_address\n address = fog_compute.addresses.create\n address.public_ip\n end", "title": "" }, { "docid": "f8e6e28f80d7d15df8a03997bd7701db", "score": "0.72375685", ...
480ee09dddbea30e672d0d2db4584dc4
Extracts the timestamps from the file and inserts them into the technical metadata.
[ { "docid": "1ccc3fefdbe1b9b1848fab7174c52c5a", "score": "0.6447431", "text": "def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end", "title": "" } ]
[ { "docid": "3e8c6b70e54050eb7c8e63a9592e502a", "score": "0.64430684", "text": "def load_timestamp(fname)\n stamps = []\n File.open(fname).read().each_line do |line|\n parsed = line.strip().split() \n stamps << [parsed[2].to_f, parsed[3].to_f, parsed[4].to_f, parsed[5].to_f, parsed[6].to_f]\n en...
a1c3900521fcefd366043f9fe584eadf
Send activation email on rquestet
[ { "docid": "9a2a8ecae521b17636d846d0b4815fbd", "score": "0.6943369", "text": "def send_activation_email\n @admin = BusinessAdmin.find(params[:id])\n if @admin.active\n flash_error \"flash.error.admin.send_activation_mail_active\" \n else \n UserMailer.admin_activation_email(@admin).de...
[ { "docid": "d250035ea796bf3f7c87b4dacb6a757a", "score": "0.8177097", "text": "def send_activation_or_reset_mail\n end", "title": "" }, { "docid": "dd9324746de59bd44c55a066f041a7e1", "score": "0.81538904", "text": "def activation_needed_email(user)\n @user = user\n @url = \"ht...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4dd171ad6da4b7a7971864d7b47df0f0", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:email, :sub, :tier)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69795185", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782116", "text": "def strong_params\n params.requ...
3f921dd09479b3314f2789debe0ea6ff
DELETE /institutes/1 DELETE /institutes/1.json
[ { "docid": "9b609c7df40ce6aa52f7a612eab2bb56", "score": "0.7284938", "text": "def destroy\n @institute.destroy\n respond_to do |format|\n format.html { redirect_to institutes_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "1b214e87aa665864287c831ae6cec609", "score": "0.70293045", "text": "def destroy\n @institute.destroy\n respond_to do |format|\n format.html { redirect_to institutes_url, notice: 'Institute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
46aac36c32836e10a450b35218e559d2
The Add method should throw an exception when called with an input containing multiple errors.
[ { "docid": "8adb22c444332a3a9d69e22aa259ac6e", "score": "0.6551204", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainsMultipleErrorsWithCustomSeparatorDeclaration18\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-3-2|2-1'\n @errorMessage = \"Negatives not al...
[ { "docid": "25761fdecd3a41a72de34bdddfa58316", "score": "0.7584456", "text": "def add(error)\n @errors << error\n end", "title": "" }, { "docid": "7bbc248ecf3e1f07b2d2e2de945989e4", "score": "0.73206687", "text": "def addError(e)\n @errors.pop if @errors.length == @maxErrors...
e5993b09d4ce8942d43eac0288a12a80
TODO: Logic to model
[ { "docid": "cb0d06994d999832b21ae6ab10182847", "score": "0.0", "text": "def show_convert\n @data_source = DataSource.find(params[:id])\n @no_right_col = true\n\n if !@data_source.dataset\n flash[:notice] = \"You need to attach a file to before you can convert this data source.\"\n red...
[ { "docid": "803076b99c758496ae749f905901eb40", "score": "0.5833757", "text": "def to_model; end", "title": "" }, { "docid": "803076b99c758496ae749f905901eb40", "score": "0.5833757", "text": "def to_model; end", "title": "" }, { "docid": "4630914589e6280941cd1c15baa44fd5",...
be9b8c3da85e08979243903dd7f7da15
GET /cupons/1 GET /cupons/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8424196e74075a52df7d02e174d53263", "score": "0.68730587", "text": "def index\n @cupons = Cupon.all\n end", "title": "" }, { "docid": "2bdf9bc9e23a44f3ca97397d40dc7ffe", "score": "0.6579666", "text": "def index\n @councils = Council.all\n\n respond_to do |format|...
84ffdad02a581e4a0c348770e1dcb8f6
DELETE /tasks/1 DELETE /tasks/1.xml
[ { "docid": "1cfb58b29d56df5e034ba1ceb2241960", "score": "0.0", "text": "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n render :update do |page|\n page.remove \"tr_#{@task.id}\"\n end\n\n end", "title": "" } ]
[ { "docid": "1b2f6f2a72d8409facdb4921322f2feb", "score": "0.7385405", "text": "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n ...
a522ca17be9bc6c929a6939f0254cb75
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model
[ { "docid": "7d2f5bee4db1266d2d204f96c5a04547", "score": "0.0", "text": "def cama_external_menu_on_active(plugin)\n end", "title": "" } ]
[ { "docid": "ea0bf024573d32eba392a9439b3660ef", "score": "0.70241666", "text": "def execute()\n\n end", "title": "" }, { "docid": "ea0bf024573d32eba392a9439b3660ef", "score": "0.70241666", "text": "def execute()\n\n end", "title": "" }, { "docid": "6410ac41f744e9baf5bf69...
ae223d7748d4c9ddee5d364a5d36cc2f
PATCH/PUT /resource_groups/1 PATCH/PUT /resource_groups/1.json
[ { "docid": "6efa86d0a2159c26df3d7e05fbcda112", "score": "0.7504471", "text": "def update\n respond_to do |format|\n if @resource_group.update(resource_group_params)\n format.html { redirect_to @resource_group, notice: 'Resource group was successfully updated.' }\n format.json { ren...
[ { "docid": "bc07532f1f27eb69006d34b15668626a", "score": "0.6857014", "text": "def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end", "title": "" }, { "docid": "f9c8de2078908a6ff810abe52a191928", "score": "0...
dc4e2829004d9f17bec59d4aaaeee716
Remove product from an configuration
[ { "docid": "289a890c00b0ae28ad7d0fbec7a3feec", "score": "0.76775026", "text": "def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete...
[ { "docid": "868fc2ea114c38c9f51289a30c5972c4", "score": "0.7210953", "text": "def remove_product(product)\n products.delete(product)\n # save\n end", "title": "" }, { "docid": "5b5abc6388a919fd97c4c68b76a8047d", "score": "0.7129385", "text": "def remove_product(product_name)\n...
4144457230253af23b6e2c747d98a833
Runtime: 32 ms, faster than 100.00% of Ruby online submissions for Reverse String II. Memory Usage: 14.7 MB, less than 100.00% of Ruby online submissions for Reverse String II.
[ { "docid": "c5fb2c18779c4ebbc03143dec36f4403", "score": "0.0", "text": "def reverse_str(s, k)\n return s.reverse if k >= s.length\n i, reverse = 0, 1\n\n while i < s.length do\n if reverse == 1\n if i + k > s.length - 1\n newstr = s[i..s.length - 1].reverse\n ...
[ { "docid": "1de12e1c2eb50a620ba8413ccddd8318", "score": "0.8245289", "text": "def string_reverse(my_string)\r\n last_index = my_string.length - 1 # lines 3- 6 O(1)\r\n first_index = 0\r\n temp = \"\"\r\n split_num = my_string.length / 2\r\n split_num.times do # O(n/2)\r\n temp = my_string[first_...
3eabae71d668b76ea4f721bf2c8aa9b6
Only save a path history entry if the path has been changed and the page has been published at least once.
[ { "docid": "474b42510f3ad3392d311d49691ff9e3", "score": "0.78152436", "text": "def should_save_path_history?(old_path, current_path)\n (old_path != current_path) && !never_published?\n end", "title": "" } ]
[ { "docid": "590c3028caaa9317b838b6537f9eee9d", "score": "0.68372893", "text": "def save_path_history(old_path, current_path, revision)\n update_path_history(old_path, revision) if should_save_path_history?(old_path, current_path)\n end", "title": "" }, { "docid": "533ddbef59276e8e19f...
f243a8878373ff457c276641c35b1070
Write a method that takes a string, and returns a new string in which every character is doubled. Examples: =begin Input: string Output: string Rules: double every character as is, return new string Problem: use map to transform each character into a string of its double, connect back together as a new string object DS...
[ { "docid": "87a4785a914062a553161ec9e4fa5919", "score": "0.7266946", "text": "def repeater(str)\n str.chars.map {|char| char * 2}.join\nend", "title": "" } ]
[ { "docid": "7404e8b023f0341ade47566058aedeb7", "score": "0.7642515", "text": "def repeater(string)\n double_char = string.chars.map do |char|\n char * 2\n end\n double_char.join('')\nend", "title": "" }, { "docid": "3094112579187ab73d07d47ca30571bd", "score": "0.75643617", "tex...
6ffca5a5c7765092c169cf612ad7926f
Helper method to unpause an alert as passing paused: false is not as intuitive
[ { "docid": "be5917a6f2515cc899ec03cf23b1b4e1", "score": "0.7815391", "text": "def unpause_alert(id:)\n pause_alert(id: id, paused: false)\n end", "title": "" } ]
[ { "docid": "2e4d4fa667821770bb5aea6a683caf30", "score": "0.7309693", "text": "def unpause\n @paused -= 1\n end", "title": "" }, { "docid": "50585c1d6a1a691ff645379c972626d8", "score": "0.7072053", "text": "def pause_alert(id:, paused: true)\n post(\"/api/alerts/#{id}/pause...
0cc2fe3c54729d788dafc2f7ed7b5481
DELETE /feed_apis/1 DELETE /feed_apis/1.xml
[ { "docid": "98cd894f6fd26d77199b8e91d0446a75", "score": "0.7888126", "text": "def destroy\n @feed_api = FeedApi.find(params[:id])\n @feed_api.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_apis_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
[ { "docid": "c3578260df3e5b3e8ee7139de90596a4", "score": "0.73069996", "text": "def destroy\n @feed = Feed.find(params[:id])\n current_user.feeds.delete @feed\n current_user.save!\n\n respond_to do |format|\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n end...
7af1c0b33da23cb841bdcc68e6885ee3
PATCH/PUT /tasks/1 or /tasks/1.json
[ { "docid": "1910af0ddbaf2919b4fc03d614feb566", "score": "0.68708277", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ta...
[ { "docid": "8626542611c0376934f5646142b41bf4", "score": "0.75214595", "text": "def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n ...
a6a40057c4ff20203d86d82277aa3abe
Generate the command entry for the ssh key to be written into the authorized keys file
[ { "docid": "b74fff2ddbb8055064e0874f5d1ea91e", "score": "0.70493", "text": "def get_ssh_key_cmd_entry(key, key_type, comment)\n key_type = \"ssh-rsa\" if key_type.to_s.strip.length == 0\n cloud_name = \"OPENSHIFT\"\n ssh_comment = \"#{cloud_name}-#{@uuid}-#{comment}\"\n ...
[ { "docid": "96e40f4184c7e725a111a751b8ec47fa", "score": "0.7401572", "text": "def ssh_keygen\n ssh_cmd = \"ssh-keygen -t rsa -C '#{@email}' -f '#{@ssh_file}' -N ''\"\n system(ssh_cmd)\n if $? != 0 then\n raise 'There was an error in generating ssh key.'\n end\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5fb70758c82708781cc1ab4b9f5c4b55", "score": "0.0", "text": "def usuario_params\n params.require(:usuario).permit(:rut, :nombre, :apellido_paterno, :apellido_materno, :correo, :rol, :estado)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496729", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958585", "text": "def strong_params\n params.require(:request).permit(param_white...