query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f5a94d1f8ac6ef1bc6f4ebb5469ec16b
Clear the entire cached keys column at the end of the run. You almost certainly don't want to do this in a real script.
[ { "docid": "71544e3c5aa33d555bc08ce695588c1b", "score": "0.6391009", "text": "def after_stream\n $stderr.puts 'Clearing conditional_output_key cache...'\n @key_cache.clear_column_family!(conditional_output_key_column)\n end", "title": "" } ]
[ { "docid": "72322b300618b8e12859483b25ce9e15", "score": "0.7030081", "text": "def clear\n invalid_keys = all_keys.select { |key| key.include?(@scope.table_name.downcase) }\n invalid_keys.each { |key| Rails.cache.delete(key) }\n\n Rails.cache.write(list_key, all_keys - invalid_keys)\n e...
7c02ed5498772ddba0348ca9f1ef60e6
TODO: Need to consider and support programming groups
[ { "docid": "1a6024d50c7382930b298d293b187499", "score": "0.0", "text": "def ranged_user_data(interval = 'year', from = DateTime.new(0), to = DateTime.now)\n [\n {\n key: 'active',\n name: t('statistics.entries.users.active'),\n data: ExternalUser.joins(:submissions)\n ...
[ { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.65521574", "text": "def probers; end", "title": "" }, { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.64999837", "text": "def private; end", "title": "" }, { "docid": "6fe4e6885430bb587c75f184976eeb09",...
08b16608ea0ce652be770d7067656fa4
Disable the query cache within the block if Active Record is configured.
[ { "docid": "0230831635294d16c8b2f7093853a682", "score": "0.71803015", "text": "def uncached(&block)\n if ActiveRecord::Base.configurations.blank?\n yield\n else\n connection.uncached(&block)\n end\n end", "title": "" } ]
[ { "docid": "9df704354060c69778e8482fed07cece", "score": "0.7129483", "text": "def uncached\n old, @query_cache_enabled = @query_cache_enabled, false\n yield\n ensure\n @query_cache_enabled = old\n end", "title": "" }, { "docid": "9df704354060c69778e8482fed07cec...
eafdd8e261974124b44f670051a325a0
Get an ORY Access Control Policy
[ { "docid": "2ee501b14865e878b5ad8ee551e0eb62", "score": "0.6131555", "text": "def get_ory_access_control_policy(flavor, id, opts = {})\n data, _status_code, _headers = get_ory_access_control_policy_with_http_info(flavor, id, opts)\n data\n end", "title": "" } ]
[ { "docid": "d54520fb1b55e049f41cec049df6aa6b", "score": "0.67224336", "text": "def policy\n self.permissions['policy'].to_sym\n end", "title": "" }, { "docid": "836b9b7e4096ec8f55fde9ba6b1dc614", "score": "0.6636606", "text": "def policy\n @policy ||= init_policy\n en...
f8ea146543b1cb7ab5a376f52f190690
Draw object in the map
[ { "docid": "0f4aa288f18094b2bb14f4c842dc4aa2", "score": "0.748134", "text": "def draw_map_obj\n MapCellWall.destroy_all\n MapCellGen.destroy_all\n HPBar.destroy_all\n clear_towers\n $map.occupied_spaces.each do |cell|\n x = cell.x\n y = cell.y\n case cell.object\n when...
[ { "docid": "972c0363abe6a81d1fcb3a25026fecdb", "score": "0.8260149", "text": "def draw\n @map.draw\n end", "title": "" }, { "docid": "e122c0bdd93bc4d6ac08e6a45db9d261", "score": "0.7673017", "text": "def draw_map\n draw_map_cells($map.x, $map.y)\n end", "title": "" }, ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4bde8a30e717f2ec020aa7f115cc67fa", "score": "0.0", "text": "def client_phone_params\n params.require(:client_phone).permit(:client_id, :phone)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74959", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957448", "text": "def strong_params\n params.require(:request).permit(param_whiteli...
f6e7afca9b42105a48b06a4187bfc53d
GET /task_tagships/new GET /task_tagships/new.json
[ { "docid": "8d2a50fa5dfbf1616e946a127cb97c42", "score": "0.7482543", "text": "def new\n @task_tagship = TaskTagship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_tagship }\n end\n end", "title": "" } ]
[ { "docid": "33271b5d487018309e32f31ec25ca08a", "score": "0.74148095", "text": "def create\n @task_tagship = TaskTagship.new(params[:task_tagship])\n\n respond_to do |format|\n if @task_tagship.save\n format.html { redirect_to @task_tagship, notice: 'Task tagship was successfully create...
d5c15e74f6b577d9f3e213bda44c1775
Get the previous instance, based on the index of this instance
[ { "docid": "0db40aaf358b569046428192ba740ba0", "score": "0.7366129", "text": "def prev\n ret = nil\n # If we're not the first valid value, look for the previous one\n if (@index && (@index > 0))\n # Check the cache first for the predecessor\n if (@@STEAK_CACHE[@index - 1])\n ret = @@STEAK_...
[ { "docid": "b1fd606b1ccd0a27c312b42205e3f082", "score": "0.81460464", "text": "def previous\n at(position - 1)\n end", "title": "" }, { "docid": "44258891829aef576e1773f5a69edac2", "score": "0.80166745", "text": "def prev\n\t\t\t\t@index -= 1\n\t\t\t\tself._update\n\t\t\t...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "49f23d508405f3c3d376fdb05dc28278", "score": "0.0", "text": "def video_params\n params.require(:video).permit(:youtube_id, :thumbnail, :artist, :title_korean, :title_english, :youtube_user_id, :description, :hotness, :cheesiness, :english_percentage, :english_subtitle, :official, :youtube_...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981269", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783559", "text": "def strong_params\n params.requi...
5b8a7b436af845d632af3d22dbc9686d
Main loop: displays the main menu and waits for the user's input before calling the corresponding option. It also waits for input after the option has been executed, in case any results from the latter are displayed.
[ { "docid": "055378e91e9e5d12f8a176de6aa42dce", "score": "0.76810485", "text": "def main_menu\n input = 0\n until input.to_i == @@main_ops.length - 1 \n print \"\\e[H\\e[2J\" #clears the screen\n puts @name \n print_menu(@@main_ops)\n print \"Choose an option by enteri...
[ { "docid": "ff4e311cc87976062840533c7184dcf3", "score": "0.8687894", "text": "def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end", "title": "" }, { "docid": "2997af97c8a6877bae1e4213713b7921", "sco...
d40730b4a23c6e67b70cb0d6417caa52
POST /quiz_states POST /quiz_states.json
[ { "docid": "8680a2adfd963d133813525ac88a8941", "score": "0.7336486", "text": "def create\n @quiz_state = QuizState.new(params[:quiz_state])\n\n respond_to do |format|\n if @quiz_state.save\n format.html { redirect_to @quiz_state, notice: 'Quiz state was successfully created.' }\n ...
[ { "docid": "cd14cd600d28bcde92e2979e3b12070c", "score": "0.6562292", "text": "def state\n @json = GameData.all.first_or_create(:dict => '{}', :state => '{}')[:state]\n @post_url = request.url\n\n if request.format == 'json'\n render json: @json\n end\n end", "title": "" }, { ...
e07042f646979091598d22377cbfef9a
Create a new button.
[ { "docid": "0acd8461ebad444650c9c5f7ca165a1d", "score": "0.7658489", "text": "def button txt, style={}, &blk\n\n #create the button, don't forget to hook up that signal!\n b = Qt::PushButton.new txt do\n connect(SIGNAL :clicked) { blk.call } if blk\n end\n\n #add it to our wid...
[ { "docid": "8b8c360544000bd53de4cb31ed02ee3b", "score": "0.7534513", "text": "def create_button(name, title)\n return '<input type=\"button\" name=\"' + name + '\" value=\"' + name + '\" title=\"' + title + '\">'\n end", "title": "" }, { "docid": "1501926b8cb9ab400fdf9442382ab811", "...
5e089b9b4f74fc8ac4b7ad33b18bf309
can exec for global, or cd to a dir and run local installation
[ { "docid": "c19955c4e71208cd282b26e37b6e9a7b", "score": "0.0", "text": "def npm_exec(args)\n options = symbolizehash(@resource[:install_options] || {})\n scope = (options[:global] == false) ? \"local\" : \"global\"\n cwd = options[:cwd] ? \"cd #{options[:cwd]}&&\" : \"\"\n\n command = \"#{cw...
[ { "docid": "7387e52ec7bb7354c53426b873a8c8c9", "score": "0.6845621", "text": "def execdir(command)\n end", "title": "" }, { "docid": "d0c32dcbbd9152f782facc30b855dd62", "score": "0.6591611", "text": "def run\n cd File.dirname(__FILE__) do\n # Set these values to what you wan...
914d3b9e8e10cf90c5968a6f06195c95
Defines a full name helper for the user model.
[ { "docid": "753e229fb5135e969c315fa0f19b8e3f", "score": "0.79821235", "text": "def full_name(user)\n user.first_name + \" \" + user.last_name\n end", "title": "" } ]
[ { "docid": "99931fdf0c335a741d0cd6c3f2a7323c", "score": "0.8205831", "text": "def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end", "title": "" }, { "docid": "9ef0b61899e0d936838e13ce2fd0355d", "score": "0.81892395", "text": "def full_name...
55a83ed63bd9b2a005c0ade8342428eb
An update sent to Super Peer to make note of its directory changes.
[ { "docid": "51d149364f00870123189da0a75f1b66", "score": "0.0", "text": "def update_file_on_index op, file_path\n begin \n HTTParty.post(\n \"#{@index_server_host}/update_index\", {\n body: {\n peer_id: @peer_id, \n file_path: file_path,\n op: op\n }\n ...
[ { "docid": "da2b7128ae41259b3d7eafa995746483", "score": "0.65973765", "text": "def update_dir(local, remote)\n @actions << {:action => :updatedir, :local => local, :remote => remote}\n end", "title": "" }, { "docid": "1612856abd5839c241676730e19f2249", "score": "0.632908", "text"...
aa38e53d3259cf62082f7dd764c8b9ab
find hba given the physical nic
[ { "docid": "403e227ec5d8aeb8257e87eb578f5d4e", "score": "0.8354833", "text": "def hba\n hba_arr = host.configManager.storageSystem.storageDeviceInfo.hostBusAdapter.grep(RbVmomi::VIM::HostFibreChannelOverEthernetHba)\n hba_arr.each do |hba|\n hba_nic = hba.underlyingNic\n if hba_nic == re...
[ { "docid": "f6ba0f1de6fb23f54ee940e59f136031", "score": "0.63952976", "text": "def get_bridged_vbox_nic()\n message = \"Checking:\\tBridged interfaces\"\n command = \"VBoxManage list bridgedifs\"\n nic_list = execute_command(message,command)\n nic_name = \"\"\n if !nic_list.match(/[A-z]/)\n ni...
892b246410373605b828ae7074d7e7de
Reset all the column widths so that each column is just wide enough to accommodate its header text as well as the formatted content of each its cells for the entire collection, together with a single character of padding on either side of the column, without any wrapping. Note that calling this method will cause the en...
[ { "docid": "7dc0d65c3b8ca795f240fc066f00ed8f", "score": "0.56771547", "text": "def pack(max_table_width: :auto)\n return self if column_registry.none?\n columns = column_registry.values\n\n columns.each { |column| column.width = wrapped_width(column.header) }\n\n @sources.each do |so...
[ { "docid": "d261509b9e1527cf32f243b6b390d3c2", "score": "0.6807963", "text": "def set_column_widths\ncolumn_widths.each_with_index do |w, col_num|\ncolumn(col_num).width = w\nend\nend", "title": "" }, { "docid": "aac8d7578036ce1517c12df0209e551c", "score": "0.678602", "text": "def se...
af784df906ac5500fb7bb2a720b95585
dependency registration can be done through extreme metaprogramming one of the most common types is conventionbased registration rails makes use of this, where it scans folder names and matches the underlying namespaces and folder structures to match the ruby to its loading. that's not the purpose of this exercise, so ...
[ { "docid": "7d026540f303f4fd42585fc8358ea5f0", "score": "0.0", "text": "def start\n build_dependency_trees\n end", "title": "" } ]
[ { "docid": "1ed3324bf75341dc6b9cf59d60be0430", "score": "0.6386329", "text": "def load_needed_dependencies!; end", "title": "" }, { "docid": "1ed3324bf75341dc6b9cf59d60be0430", "score": "0.6386329", "text": "def load_needed_dependencies!; end", "title": "" }, { "docid": "...
6851485519b353d04e4a8aa3060b6167
Fetch the instance details from the server. Clear current data and save the results.
[ { "docid": "a5fd41e0d70642ff351d4639c089916b", "score": "0.5475428", "text": "def refresh\n @data.replace(details)\n self\n end", "title": "" } ]
[ { "docid": "9f63788fcbb6a1581fc3b5062efa4ff6", "score": "0.6505708", "text": "def populate\n response = @connection.dbreq(\"GET\", @dbmgmthost, \"#{@dbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\", @dbmgmtport, @dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.c...
b9113605c2dbb96962e13e1690c696ad
Determines if the last stored running config sets a ManagementEthernet address statically
[ { "docid": "2db76c2e7b6e272ad266f7b6cde540ee", "score": "0.7281031", "text": "def management_ip_static_configured?\n !!running_config.match(%r{interface ManagementEthernet \\d+/\\d+.*?\\s+ip address\\s+\\d+.\\d+.\\d+.\\d+\\/\\d+})\n end", "title": "" } ]
[ { "docid": "37f8c98b81d222766311a89ec5a63b48", "score": "0.70865905", "text": "def management_ip_configured?\n !!running_config.match(/interface ManagementEthernet.*?!/m)\n end", "title": "" }, { "docid": "7e5d6c9ea36d7ead08b6c07b00b3c1ba", "score": "0.69951546", "text": ...
4ed2d0d5dadba11bed002ceee3b17986
Before saving the record to database we will crypt the password using SHA1. We never store the actual password in the DB.
[ { "docid": "1de93b255286377d491ab5756a9fd1dc", "score": "0.83648425", "text": "def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end", "title": "" } ]
[ { "docid": "ca382a41a5d2c978cb3ccb4cd7b5e239", "score": "0.84053093", "text": "def crypt_password\n\t\twrite_attribute \"password\", self.class.sha1(password)\n end", "title": "" }, { "docid": "ea833849e1b63bdb73f128a1a9413465", "score": "0.8308237", "text": "def crypt_password\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a43d8b7a112bf4c9df1db87cdb3f07af", "score": "0.0", "text": "def set_race\n @race = Race.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;...
126646fe00386dfaf2e2161f40feecfb
Class constructor, setup using a given path
[ { "docid": "bd4e50db1f763b84baaadb5f6167d5f4", "score": "0.0", "text": "def initialize(file = DEFAULT_FILE_LOC)\n @file = file\n @animals = []\n end", "title": "" } ]
[ { "docid": "604dfcbe7fca45eae15afa1411652f44", "score": "0.8187807", "text": "def initialize(path)\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "2d0a477ac79bba53dd658b7c6e7ebba5", "score": "0.8155321", "text": "def initialize(path)\n @path = File.expa...
2d47f3f2340a6952d9f6d246d7ee2d7c
def method to get all openmrs patient id from anc
[ { "docid": "5f5bb17ee1e08a90e1a129cc2d12baab", "score": "0.7298317", "text": "def all_anc_in_openmrs\n result = ActiveRecord::Base.connection.select_all <<~SQL\n SELECT art_patient_id FROM #{@database}.patient_migration_mapping\n SQL\n @openmrs = result.map { |variale| variale['art...
[ { "docid": "9d86475e5695836736d2f44a40f2cb0c", "score": "0.7013059", "text": "def get_patient_list patient_ids\n map = {}\n $omrs.patient_set_service.getPatients(patient_ids.collect {|id| java.lang.Integer.new(id) }).each do |pt|\n map[pt.patient_id] = pt\n end\n patient_ids.collect {|id| map[id]...
997f44c5d13a1b155c68bc2cc53c510d
See Jim Weirich's comment on builder (plus all the test frameworks seem to call nil? on objects being tested
[ { "docid": "f158038077bca0224c04bda2352b2543", "score": "0.0", "text": "def nil?\n false\n end", "title": "" } ]
[ { "docid": "2d17bbcafdde6a081ffaa5d4c4912037", "score": "0.6282432", "text": "def builder; end", "title": "" }, { "docid": "46a6d4ad367504fac8eb4fd0b6d5f520", "score": "0.6132117", "text": "def test_view_builder_parent\nnames = %w{string int float none array}\ntypes = [String,Integer...
2a6b77e3837b79156cbf56f0bb32772b
get list of current available books
[ { "docid": "f3d97d23cc6b6d405baa7f02787159e4", "score": "0.8305527", "text": "def available_books\n\t\tputs \"Available Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"available\" }\n\tend", "title": "" } ]
[ { "docid": "718dbe4406161d40ee0f466ee03404d0", "score": "0.821038", "text": "def available_books\n @books.each do |book|\n if book.status == \"available\"\n puts \"#{book.title} by #{book.author} is available.\"\n end\n end\n end", "title": "" }, { "docid": "e4110a623...
ea17605cb229c9f175af3459b521ef18
Method to update the quantity of an item
[ { "docid": "06057e2e70098ce26a22888b293c2a62", "score": "0.0", "text": "def update_item_quantity(list, updateitem, new_qty, print=true)\n\t# input: list, item name (string), new quantity (int or string)\n\t# output: updated list\n\n\tmatch_index = find_item(list, updateitem)\n\tif not match_index\n\t\t#...
[ { "docid": "00220631c0081c97ea4c5988d06a91f1", "score": "0.8362159", "text": "def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend", "title": "" }, { "docid": "79c49291ff47b154eebf7bf0be01c8d0", "score": "0.82921195", "text": "def update_qty(shopping_list,...
43e9df4ec80939ea4aededa982d26485
Return the sum of the durations of the elements
[ { "docid": "ae079dd3e8a5071f8445e81041089772", "score": "0.69074124", "text": "def total_duration\n\t\tinject(0) {|memo, song| memo + song.duration }\n\tend", "title": "" } ]
[ { "docid": "89eb2a4bd972a26a97ace57a1e865e6d", "score": "0.8505428", "text": "def duration\n @elements.map(&:duration).sum\n end", "title": "" }, { "docid": "5dd89fb78d401a08ff3d5dff57eec7b2", "score": "0.8131413", "text": "def duration\n map(&:duration).sum\n end", ...
ffd1c0ab7de429ba92fef134c122393f
Create a content migration
[ { "docid": "46917c9e8cdc9bfb053640443391c23e", "score": "0.6034472", "text": "def create_content_migration_courses(course_id,migration_type,pre_attachment__name__,settings__file_url__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :migration_type,\n ...
[ { "docid": "46abe6800eac6fc35247d5e01849a2ce", "score": "0.7178129", "text": "def migration\n migration_template 'migration.rb', 'db/migrate/create_seo_landing_pages.rb'\n end", "title": "" }, { "docid": "7e52ec8eb4417750e3c432099b339e75", "score": "0.7046662", "text": "def migra...
a0249c435343e01071d5eb78d5bd6de9
Queue a packet of data to be sent to the Deploy server
[ { "docid": "45e7058088a8df8224ee717b11046107", "score": "0.654662", "text": "def send_packet(data)\n @tx_buffer << [data.bytesize+2, data].pack('na*')\n @nio_monitor.interests = :rw\n end", "title": "" } ]
[ { "docid": "4e057779b57d40a9a275e8037e31f806", "score": "0.7284123", "text": "def queue_packet(packet)\n log(Logger::DEBUG,\n \"Queueing command: #{packet.command.to_s} | Correlation Id: #{packet.correlation_id.bytes.to_s}\")\n\n @writer_queue.push([packet.size].pack('V') + packet.byt...
a8178e0ae876ead8c20d1cc74b06d3a9
Checks if a character is alphabetic
[ { "docid": "4026e2453408974040b10438471ed3e6", "score": "0.8311976", "text": "def is_alpha(char)\n char.match?(/[a-zA-Z]/)\n end", "title": "" } ]
[ { "docid": "aa47f77def970d301dcea4f019f2f64b", "score": "0.8514513", "text": "def charIsAlpha\n c = getChar\n return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))\n end", "title": "" }, { "docid": "95bf3d4a5b2422bf3f8d93b61d72b79a", "score": "0.82957745", ...
c000ba0b5f646fe5821c87caa3553279
Get user id by login
[ { "docid": "87334d22a373d31c844229471a6a2e08", "score": "0.8265807", "text": "def get_user_id_by_login(login)\n @user = User.find(:first ,:select=>\"id\",:conditions=>[\"login='#{login}'\"])\n if !@user.nil?\n return @user.id\n else\n return 0\n end\n end", "title": "" } ]
[ { "docid": "739b76071671166608344510c938cf4c", "score": "0.8128973", "text": "def user_login_to_id(login)\n user = user_from_login(login)\n return user[\"id\"]\n end", "title": "" }, { "docid": "b2475c4829834197283541f819386eeb", "score": "0.78972405", "text": "def user_...
d4c4aebffa6a4485cff8745961390190
Returns an hash that will return a string (:status) indicating if user should be fasting or if user should be eating. Also, hash has date string (:date_until) that indicates the date time at which the current window will end.
[ { "docid": "6de1e557ec560c9c12af1a8f4d2a9351", "score": "0.66984916", "text": "def current_status\n \n full_current_obj = DateTime.now.change({:offset => \"+0000\"})\n \n s_d = self.start_date.to_s.split(\"-\").map { |n| n.to_i } \n\n s_t = self.start_time.to_s.split(\...
[ { "docid": "60dfa6feb398198fbb9cc5d22e301728", "score": "0.6215762", "text": "def please_wait_status\n obj = {}\n\n obj['path'] = welcome_path\n\n # Note: temp_volunteer and volunteer are old obsolete values. Keeping them there just in case.\n if current_user.applicant_type == 'leadership_co...
c032d58aea21c3f031d3304f9c173a35
Laddar ner zip/rarfilen och sparar till disk
[ { "docid": "a6a2eb570f6625bc0184aabc2345d9ee", "score": "0.0", "text": "def download_and_save_to_disk(filename, subtitle)\n data = RestClient.get subtitle.url\n\n file = File.new(\"/tmp/#{filename}\", 'w')\n file.write(data)\n file.close\n end", "title": "" } ]
[ { "docid": "460885c30e42ac010f1e04e97886c87f", "score": "0.7161972", "text": "def zipfile; end", "title": "" }, { "docid": "aac6ab32560323aebcc2674c1f8475db", "score": "0.6746304", "text": "def archive stuff\n io = Zip::OutputStream::write_buffer do |zip|\n stuff.each { |x|\n...
99102c5957bcb68829ce8512c5a8c956
Create a new Comment object.
[ { "docid": "6639af44c39436848c5a404362d0d372", "score": "0.0", "text": "def comment(c,time:0,duration:10)\n return Comment.new(c,time:time,duration:duration)\nend", "title": "" } ]
[ { "docid": "1db50125062938f07a9feea82facdfb1", "score": "0.8042097", "text": "def new\n @comment = Comment.new\n\n assert(@comment.kind_of?(Comment))\n\n return @comment\n end", "title": "" }, { "docid": "332435240508aa8010aef132925fc377", "score": "0.802717", "text": "def ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3c74230df563f40c923c695e8f9d86a2", "score": "0.0", "text": "def note_params\n type = if params[:checklist_note]\n :checklist_note\n elsif params[:survey_note]\n :survey_note\n elsif params[:case_note]\n :case_note\n elsif p...
[ { "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...
90754a5b1e291c01fd68952203a4dbcd
Maps the query parameters names to their encoded names for the URI template parsing.
[ { "docid": "0537e82e0cb748fc1f8cc7f2b16a053d", "score": "0.0", "text": "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n ...
[ { "docid": "ff05daef879d96ea8e3a8c379ba03651", "score": "0.60919255", "text": "def map_params(query)\n params = {\n bandName: query[:name] || \"\",\n exactBandMatch: (query[:exact] ? 1 : 0),\n genre: query[:genre] || \"\",\n yearCreationFrom: query[:year]&.begi...
e282d471a66edbdfcbfc7db35996f3cc
method to insert a new node with specific data value, assuming the linked list is sorted in ascending order
[ { "docid": "b464cf5c88baff8fc00fdd1683a7a115", "score": "0.0", "text": "def insert_ascending(value)\r\n raise NotImplementedError\r\n end", "title": "" } ]
[ { "docid": "f4c55745fa639fd7a114dadb8973a4c9", "score": "0.8128885", "text": "def insert(data)\n @head = Node.new(data, @head)\n end", "title": "" }, { "docid": "244fec2dbbf3475fe99bb5d535b56169", "score": "0.79773563", "text": "def insert(data)\n @head = Node.new(data, head...
51ec9f227a1a505b30bb5cd789edc989
PATCH/PUT /reservations/1 PATCH/PUT /reservations/1.json
[ { "docid": "b0be6090348785cceca41e0e4b85332c", "score": "0.0", "text": "def update\n @reservation.reservation_rooms.each do |reservation|\n my_room=Room.find(reservation.room_id)\n #si tiene reservaciones pendientes\n if my_room.reservation_rooms.where.not(\"reservation_id = ?\",@reser...
[ { "docid": "69b34af08c0d10a3aafec87affd34647", "score": "0.7111349", "text": "def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid...
335bc7826914c60a9f6b8a676e4a40e3
set cookie Author: Dhananjay Date: 01/06/2019 Reviewed By:
[ { "docid": "3757fcb362b02ac2213453465e50e072", "score": "0.6304368", "text": "def set_cookie_value\n\n manager_validation_hash_rsp = CacheManagement::ManagerValidationHash.new([@manager_validation_hash_id]).fetch[@manager_validation_hash_id]\n\n @sda_cookie_output_value = ManagerValidationHash...
[ { "docid": "a2129a5ce70812816b5e67dd57b15e69", "score": "0.7545874", "text": "def set_cookie\n cookies[:user_name] = \"Surendra\"\n cookies[:user_email] = \"suren.dura@yahoo.com\"\n end", "title": "" }, { "docid": "389333e9a6bd93c91d4b7bf35cb56b0f", "score": "0.7271921", "text...
b6028be2827de377a5fb4187af309000
Step 2: Choose a citation. This step is skipped if the file contains citation information.
[ { "docid": "57eef58e219fd9891861a5117c43ea5b", "score": "0.5845842", "text": "def choose_global_citation\n if !session[:csvpath]\n # Blank submission--no file was chosen. We should never get here unless\n # the user directly enters the URL for this action without having\n # uplo...
[ { "docid": "ec95a3f6446ab7ee5e27916acc1fe12e", "score": "0.56194437", "text": "def url(argv)\n arg = argv[11..-1]\n find = BibDesk.search({:for => arg})\n unless find == []\n BibDesk.activate\n find[0].select # does not work if pub is not listed (because of a search/keyword filter etc) not sur...
c09123139b499df8d204e223a28fd507
Check if a specific object is included in the filter Parameters:: iObjectName (_String_): The object to check Return:: _Boolean_: Is the object included in the filter ?
[ { "docid": "9246ee4108b933f43052622f80e48f42", "score": "0.7660264", "text": "def is_object_included?(iObjectName)\n rIncluded = false\n\n if (@LstObjects.empty?)\n rIncluded = true\n else\n rIncluded = @LstObjects.include?(iObjectName)\n end\n\n return rIncluded\n...
[ { "docid": "74b7e4b16abfb68501eac50bc395ae63", "score": "0.66521084", "text": "def additive_object_param?(name); end", "title": "" }, { "docid": "2501769e0e9cf813c4140eb69557f0b3", "score": "0.6621226", "text": "def include?(object)\n return self.has_key?(object.name)\n ...
2f22cac0f61b206e5ee997723fcfdb04
Run `rspec /spec/username_spec.rb` to get started.
[ { "docid": "226273b1f7d325a9ea79abefffe22ea7", "score": "0.0", "text": "def format_name(first, last)\n if first.length == 0\n p nil\n elsif last.length == 0\n p nil\n else\n first_name = first.delete(\" \")\n last_name = last.delete(\" \")\n first_init = first_name[0]\n name_temp = ...
[ { "docid": "b4a98850984f25f23a7d71410505be77", "score": "0.6115575", "text": "def test_check_user_name\n user = User.named(\"HansliCaramell\")\n\n assert(!user.name.nil? ,\"No User Name\")\n assert_equal(\"HansliCaramell\", user.name, \"Wrong User name\")\n end", "title": "" }, { "...
0cca8f1069086ac4e1ee48d0f6f3db14
Delete messages (bulk) Delete outbound messages by the given ID(s) or delete all outbound messages.
[ { "docid": "27199aa7997e377a55ccd196b422dbca", "score": "0.74304473", "text": "def delete_outbound_messages_bulk(delete_outbound_messages_bulk_input_object, opts = {})\n delete_outbound_messages_bulk_with_http_info(delete_outbound_messages_bulk_input_object, opts)\n nil\n end", "title":...
[ { "docid": "72904922877b9d4ff3a8fd697dacfe33", "score": "0.71329904", "text": "def bulk_delete(token, channel_id, messages = [])\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/bulk_delete\",\n { messages: messages }.to_json,\n Authorization:...
3599cc67dab7fcecb44714dfdbcc4326
Reload the resource state when something changes
[ { "docid": "dd890ea9c281dfb7071348e35222f964", "score": "0.0", "text": "def load_new_resource_state\n if @new_resource.created.nil?\n @new_resource.created(@current_resource.created)\n end\n if @new_resource.running.nil?\n @new_resource.running(@current_resource.running)\n end\n e...
[ { "docid": "43c08e2822bee9efbb319f4377c0feb7", "score": "0.7476932", "text": "def refresh\n load if changed?\n end", "title": "" }, { "docid": "ba65b9f07e6a6865671aadca1b6ab044", "score": "0.73989356", "text": "def refresh!\n load if changed?\n end", "title": "" }, ...
51d01b3e187efa6adc7cad7977712f18
basically a copy of assert_difference, but without any explicit comparison as it is simply stating that something will change (designed for updated_at)
[ { "docid": "869d0bd474e0edaeb3f16017f6281a8d", "score": "0.6371739", "text": "def assert_changes(expression, message = nil, &block)\n\t\t\tb = block.send(:binding)\n\t\t\texps = Array.wrap(expression)\n\t\t\tbefore = exps.map { |e| eval(e, b) }\n\t\t\tyield\n\t\t\texps.each_with_index do |e, i|\n\t\t\t\...
[ { "docid": "5b174d16935021b595699ac107269cb5", "score": "0.7049545", "text": "def assert_no_difference(objects, method, &block)\n assert_difference objects, method, 0, &block\n end", "title": "" }, { "docid": "29a4fba8bdd5cfa8b62a278e6eaa9b43", "score": "0.6936532", "text": "def ...
f87763fc38dca8863866dcb4086f9ba4
GET /questions GET /questions.xml
[ { "docid": "58d47a3dc866616f4279b9a06273a4d5", "score": "0.731576", "text": "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end", "title": "" } ]
[ { "docid": "f21bdf5068d061850a35a8ce3e340eba", "score": "0.7777713", "text": "def questions\n self.class.get('/2.2/questions', @options)\n end", "title": "" }, { "docid": "4d0208e7b8e4c89bad251ec25f7b5f03", "score": "0.7430585", "text": "def show\n @questions = @test.questions...
af7c45e839814485728fc43ca2be4a1f
checks if empty then splits a single name input into two or three parts.
[ { "docid": "953bb0acea93bc4ead59325159f13c8f", "score": "0.6641413", "text": "def check_and_split_name(object, name, required)\n if object[name].blank?\n if required == true\n flash[:notice] << [\"#{name} is required.<br />\"]\n end\n else\n split_name = object[name].sp...
[ { "docid": "09de2ce4dd6acf853286750b1c6617f5", "score": "0.7878675", "text": "def split_name(name)\n if name =~ /(.+)\\s([^\\s]+)/\n first_name = $1\n last_name = $2\n else\n first_name = name\n last_name = \"\"\n end\n \n [first_name, last_name]\n end", "title": ...
898e976e915379c5d92fcc32687a6bd6
Partner up and take a stab at writing a ruby method, `is_valid_zip`, that validates a usersubmitted ZIP Code, keeping in mind that ZIP codes can be 5 digits, as in 20008, or 5 digits followed by a dash and four more digits, as in 902100876. Anything else is invalid, and should result in the method returning false.
[ { "docid": "367fa3446220ef4a26e1181f48202ec5", "score": "0.852314", "text": "def is_valid_zip(zip)\n\n pattern = /\\A[0-9]{5}(-[0-9]{4})?/\n return !pattern.match(zip).nil?\n\nend", "title": "" } ]
[ { "docid": "f0c2c0f626ff0255d5eb91c9b3c62997", "score": "0.83643013", "text": "def zip_valid?(zip)\n zip.match( /^\\d{5}$/ )\n end", "title": "" }, { "docid": "865ec400219b72b2c82818e869dd43fa", "score": "0.8234372", "text": "def validation_of_zip_code(code)\n if !/\\A\\d+\\...
ddea4d6de634adac234501bda271d632
Register as a new user. Upon successful registration, the user will be sent to "/user/login" to enter their details.
[ { "docid": "03e99ccfd43ad1d5e838c730016be942", "score": "0.0", "text": "def register\n @user = User.new\n @profile = Profile.new\n render layout: \"standard-layout\"\n end", "title": "" } ]
[ { "docid": "4cf07156ab385797dac8834fec0bfbdf", "score": "0.79454815", "text": "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Thank you for registering!\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", ...
e121126ef8d6222869a8eb4cfc182ce7
Returns true if the current user is the depositor of the specified work
[ { "docid": "f6a936cff458749b76be5d658dec0b76", "score": "0.6868177", "text": "def user_is_depositor?(document_id)\n doc = Hyrax::SolrService.search_by_id(document_id, fl: 'depositor_ssim')\n current_user.user_key == doc['depositor_ssim']&.first\n end", "title": "" } ]
[ { "docid": "8f725ea1ceed68e4827924291ed59406", "score": "0.6801482", "text": "def proxy_or_depositor(work)\n work.on_behalf_of.presence || work.depositor\n end", "title": "" }, { "docid": "8f725ea1ceed68e4827924291ed59406", "score": "0.6801482", "text": "def proxy_or_deposito...
50176974ec6df3de780e1a35510a19bd
Add an entry to the data stack. Parameters: datum The data to be added to the data stack.
[ { "docid": "941c55cb2d0c5ed1ba45ea8dd007c86c", "score": "0.801568", "text": "def push(datum)\r\n @data_stack << datum\r\n end", "title": "" } ]
[ { "docid": "276955442dd742324478c17bf5da8f92", "score": "0.73297554", "text": "def pushm(datum)\r\n @data_stack += datum\r\n end", "title": "" }, { "docid": "b80546cad09807759b88698a9fe85712", "score": "0.7284286", "text": "def push(d)\r\n @data_stack << d\r\n end", ...
82a4e78b9cdd4367e6c698c729f4a274
Set the value of the FileID input for this Choreo.
[ { "docid": "c0813754f55c394456cf2daccb23a77b", "score": "0.72324103", "text": "def set_FileID(value)\n set_input(\"FileID\", value)\n end", "title": "" } ]
[ { "docid": "087709dd1183b0ec6133f9471dff9720", "score": "0.76009196", "text": "def set_FileID(value)\n set_input(\"FileID\", value)\n end", "title": "" }, { "docid": "087709dd1183b0ec6133f9471dff9720", "score": "0.76009196", "text": "def set_FileID(value)\n set_inp...
8a9a9376985b51dba6fb872869ac068b
++ get input value by name in hash. return:: result value
[ { "docid": "a05dc2817c80a5031469fc02995636d8", "score": "0.0", "text": "def getInput(_name)\n return getInputTable()[_name] ;\n end", "title": "" } ]
[ { "docid": "818ddad7d19e32ff2ecc816273b04167", "score": "0.80325824", "text": "def get_hash_val(name)\n\t\tfetch(name) if has_key?(name)\n\tend", "title": "" }, { "docid": "a1d5b624aee1058e493744a63d3d9f4b", "score": "0.7237811", "text": "def get_value name\n get name\n end",...
822d2e3ed5dd3dd6ca8bde6f89eadffb
This method is used to defined a name that can be used to represent a value, a single cell or a range of cells in a workbook. workbook.define_name('Exchange_rate', '=0.96') workbook.define_name('Sales', '=Sheet1!$G$1:$H$10') workbook.define_name('Sheet2!Sales', '=Sheet2!$G$1:$G$10') See the defined_name.rb program in t...
[ { "docid": "7aa51a89f04f1a8b01ebf3d77e2a1b04", "score": "0.6822525", "text": "def define_name(name, formula, encoding = 0)\n sheet_index = 0\n full_name = name.downcase\n\n if name =~ /^(.*)!(.*)$/\n sheetname = $1\n name = $2\n sheet_index = 1 + @parser.get_sheet_inde...
[ { "docid": "7aa92dcd6541dcc97c3c3e9673a91a66", "score": "0.71203357", "text": "def define_name(name, formula)\n sheet_index = nil\n sheetname = ''\n\n # Local defined names are formatted like \"Sheet1!name\".\n if name =~ /^(.*)!(.*)$/\n sheetname = $1\n name ...
5e1d1302bb3860be6f924233a7bdadb2
DELETE /extmaps/1 DELETE /extmaps/1.json
[ { "docid": "963b9a257ac0e1a37886929971d77fcb", "score": "0.7850625", "text": "def destroy\n @extmap.destroy\n respond_to do |format|\n format.html { redirect_to extmaps_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "47f2d1d407bfdf28056760c2b0d051df", "score": "0.7015376", "text": "def destroy\n @addonmap.destroy\n respond_to do |format|\n format.html { redirect_to addonmaps_url, notice: 'Addonmap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "tit...
1745c61f5653b1a2cd221e341fcc72ce
Get ACL of a user key Deprecated: Please us `client.get_api_key` instead.
[ { "docid": "c75a12764e6e4a91c3b74ce4a9281fca", "score": "0.562826", "text": "def get_api_key(key, request_options = {})\n client.get(Protocol.index_key_uri(name, key), :read, request_options)\n end", "title": "" } ]
[ { "docid": "a6ffecd3f7ddd24dbb34843d5f7f8270", "score": "0.6506371", "text": "def get_acl(bucket, key, headers={})\n return GetResponse.new(make_request('GET', bucket, CGI::escape(key), {'acl' => nil}, headers))\n end", "title": "" }, { "docid": "6b9204fda85aab202a1ec6bc062da606", ...
bbd7c3f126e099dd21b36bfb668d0593
GET /schedulers/1 GET /schedulers/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3d0c8da0754492149bc15a6a49b85413", "score": "0.84581256", "text": "def schedulers(params = {})\n scope 'default'\n get('schedule/schedulers/', params)\n end", "title": "" }, { "docid": "988387d6d9038400da752262801a869f", "score": "0.74514127", "text": "def sc...
26960470aeef9b9ab87fd22b33565ad2
temporarily ignore this until connectivity with ccms is working :nocov:
[ { "docid": "8bf6e270c8fea2d34895d3aa427d9987", "score": "0.0", "text": "def soap_client\n @soap_client ||= Savon.client(\n headers: { \"x-api-key\" => config.aws_gateway_api_key },\n env_namespace: :soap,\n wsdl: wsdl_location,\n namespaces:,\n pretty_...
[ { "docid": "8c551d7dfc3706c756cd2f2843a0d7b2", "score": "0.645195", "text": "def ignore_unrecognized_cops; end", "title": "" }, { "docid": "60503a80992b1d92869f8bbda3182e9f", "score": "0.58836097", "text": "def test_setup_socket_ncacn_np_nil_socket_first_connect_refused\n\n\tend", ...
00b9032d9311c9f7ac33debc46c7f193
Reconstruct the instance data via Marshal.load
[ { "docid": "d1f87056769f9715d8bdafbfecc6ffe9", "score": "0.5567327", "text": "def marshal_load(contents)\n @tokens, @count, @index, @pairs = contents\n end", "title": "" } ]
[ { "docid": "80a3d17d915283e92aa133e2cfb7b66b", "score": "0.74441504", "text": "def marshal_load(data)\n self.data = data\n end", "title": "" }, { "docid": "fa8d3ee5633ae6e00d9435609859cbee", "score": "0.7282692", "text": "def marshal_load(data)\n version, vars, values,...
f8b53bc956c4acd78eaa4f3202ae83bf
[fixme] move model logic into model
[ { "docid": "ef1a8e3641421d28ca8a5ac777e83ed8", "score": "0.0", "text": "def country_total\n @totals = {}\n (@start_date..@end_date).each do |date|\n key_pattern = params[:country].present? ? \"Country:#{date}:#{params[:country]}*\" : \"Country:#{date}*\"\n keys = REDIS.keys key_pattern\n...
[ { "docid": "e9fbfac1e1418479ae1de8d4843276a8", "score": "0.7906882", "text": "def make_and_model; end", "title": "" }, { "docid": "afc4151049de4a403982da492f69b399", "score": "0.7042086", "text": "def model; end", "title": "" }, { "docid": "afc4151049de4a403982da492f69b39...
a06b0c83da374b179d7280b098555549
GET /pager_duty_reports/1 GET /pager_duty_reports/1.json
[ { "docid": "18b333e632d5eeaebd648073f8949844", "score": "0.0", "text": "def show; end", "title": "" } ]
[ { "docid": "27a728566bccf5c6fe60ee838bed5b80", "score": "0.7282874", "text": "def index\n @pager_duty_reports = PagerDutyReport.all\n @pager_duty_incidents = PagerDutyIncident.order(created_on: :desc).limit(10)\n end", "title": "" }, { "docid": "e398a90c5e795be555f2f324a3940882", ...
8fa66e89892ab15d03d384a416c8ef59
API for registering a user's device for pushing :access_token :device_token
[ { "docid": "6405740b0b829690d9251337b497234f", "score": "0.7456796", "text": "def registerpush\n response = {:success => \"false\"}\n @current_user = User.find_by_access_token(params[:access_token].to_s)\n if @current_user.nil?\n response = {:success => \"false\"}\n else\n @current...
[ { "docid": "161876c7ad5e584c6a34631f5ec76fa1", "score": "0.8025783", "text": "def register_device\n user = User.find(params[:user_id])\n\n user.devices.find_or_create_by(token: params[:token], os: params[:os])\n\n head :ok\n end", "title": "" }, { "docid": "3392ff51d40c61cba0d8b576...
f2d45c0b538a62fba64d5879f132b9fa
GET /venta/1 GET /venta/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f2b422705bc08ab65b01a3d67511a33c", "score": "0.7116821", "text": "def show\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end", "title": "" }, { "docid": "e5ddad27be49c1...
92622bcc6412f1fc1d5d090de0cadcd0
PUT /citys/1 PUT /citys/1.json
[ { "docid": "970f5688fec62e54b1b1ed333e6e5893", "score": "0.6363391", "text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to citys_url}\n # format.html { redirect_to @city, notice: '更...
[ { "docid": "ee1c3d59282af74636a4e34d30fbabfb", "score": "0.7169676", "text": "def update\n @api_city = Api::City.find(params[:id])\n\n if @api_city.update(api_city_params)\n head :no_content\n else\n render json: @api_city.errors, status: :unprocessable_entity\n end\n end", "t...
dd60fac00692cda72739b8885e90ce2a
Creates a Watir::Browser instance.
[ { "docid": "c04fe8fa814cf29ac8d234008b66efad", "score": "0.5583828", "text": "def initialize(browser = :chrome, *args)\n @capabilities = browser.is_a?(Capabilities) ? browser : Capabilities.new(browser, *args)\n @driver = browser.is_a?(Selenium::WebDriver::Driver) ? browser : Selenium::WebDriv...
[ { "docid": "2a0522bc3b53120d17ed08f2b733a59a", "score": "0.7684393", "text": "def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end", "ti...
61dcd6e114b38bc5a740bf6b45e96acd
sanitizing the notes received from user
[ { "docid": "bad3ec6e430cb43fce5c0f15f45f2cbc", "score": "0.75840145", "text": "def sanitize_notes(notes)\n if notes.length <= 50 and /\\w/.match(notes) and /[a-zA-Z]/.match(notes)\n return {is_acceptable: true, user_entry: notes}\n else\n return {is_acceptable: false, error: \"Note canno...
[ { "docid": "c82a4c5dc6245c77680a6b497a6edb51", "score": "0.82960474", "text": "def sanitize_notes\n self.notes = sanitize_text_editor(self.notes)\n end", "title": "" }, { "docid": "2a551e1e67af334418a5070100a51ff0", "score": "0.70647115", "text": "def check_note(note)...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "7e30a3e3754e90004119dcb1bcdeb371", "score": "0.0", "text": "def update\n\t@user = User.find(params[:id])\n\tuploaded_io = params[:user][:avatar]\n\tlev = 2\n\tdel = params[:del_photo]\n\torg_name = @user.photo\n\tif uploaded_io\n\t\tfile_name=SecureRandom.hex\n\t\tprint \"file_name\"\n\t\tFi...
[ { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.7243395", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n ...
f65e02d6091b82a5087001b46aa63a97
instead of deleting, indicate the user requested a delete & timestamp it
[ { "docid": "181c516b44c7c97e1dc345279bae4d0c", "score": "0.6582087", "text": "def soft_delete\n # assuming you have deleted_at column added already\n update_attribute(:deleted_at, Time.current)\n end", "title": "" } ]
[ { "docid": "e8dea55334a0b3caee6471a8c8ca1c5f", "score": "0.743785", "text": "def deleted?; end", "title": "" }, { "docid": "e8dea55334a0b3caee6471a8c8ca1c5f", "score": "0.743785", "text": "def deleted?; end", "title": "" }, { "docid": "4a1e226a0d3a90e2e5e648065e10cf75", ...
b12c3d6ae75edd623fef4f60b2da6702
Resend the unlock instructions if the user is locked.
[ { "docid": "7540d44648adba8dad3c5dc901d5aee9", "score": "0.8603969", "text": "def resend_unlock_instructions\n if_access_locked { send_unlock_instructions }\n end", "title": "" } ]
[ { "docid": "c8b9a55e3f5c1c11685754b3deee83c2", "score": "0.8020303", "text": "def resend_unlock_instructions; end", "title": "" }, { "docid": "a9d890cc8842362b49d247c8dd9823fb", "score": "0.70900774", "text": "def send_unlock_instructions; end", "title": "" }, { "docid": ...
f6dd9455f684a67353d89fe3fd138521
Retrieve server BYE response.
[ { "docid": "703aa240778e948f96ae515fa69f0ef5", "score": "0.7518974", "text": "def bye_response\n unless @responses[\"BYE\"].nil?\n @responses[\"BYE\"].first.text\n end\n end", "title": "" } ]
[ { "docid": "82c96589999132c6e7a83102594bb819", "score": "0.68830544", "text": "def response\n resp = @response\n @response = nil\n debug \"<<< #{resp}\"\n resp\n end", "title": "" }, { "docid": "78719255e993a36e43ccccd8e1...
f2ed3b64f7d80f7ba15a5bf0ad1d9e60
missing milestone is empty string
[ { "docid": "51f43d18e661570db6bbf30f689a98b6", "score": "0.80228925", "text": "def test_missing_milestone_is_empty_string\n assert_equal( '', @incomplete[ :milestone ] )\n end", "title": "" } ]
[ { "docid": "1a30c4580f809cc4bd72afb9aa2909ab", "score": "0.74921274", "text": "def milestone_name\n milestone ? milestone.name : 'None'\n end", "title": "" }, { "docid": "038cb78abeb68b4b0b50aea2e82a9c29", "score": "0.6537842", "text": "def milestone?\n self.milestones.collect...
e78f3b20abe948bff4c0aa844c9d74c9
set balance by user id from session
[ { "docid": "8bd33404abe83f3f908a70776233b661", "score": "0.6876886", "text": "def set_balance2\n user, credits_from_param = get_user2\n if user.present?\n dt = credits_from_param - user.credits\n new_score_history user, dt\n\n user.credits = credits_from_param\n if user.save!\n...
[ { "docid": "8836dbd100cc472b8a30df3569c5cf73", "score": "0.81550264", "text": "def set_user_balance\n @user_balance = UserBalance.find(params[:id])\n end", "title": "" }, { "docid": "e04fdecaace6056e55b66c1786438a90", "score": "0.78983146", "text": "def set_balance\n @ba...
9c605e810e5687f4537bcc9d3eacd8a0
Nonremote tests: these use the stub version of Rightscale::HTTPConnection
[ { "docid": "d6220dbe640c0b5f96845088b4e060b8", "score": "0.0", "text": "def test_101_create_bucket\n Rightscale::HttpConnection.push(409, 'The named bucket you tried to create already exists')\n Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')\n Right...
[ { "docid": "3e4812c11afab7bea4147ea1179c91c8", "score": "0.67251104", "text": "def connection # TODO: testme\n @connection ||= Net::HTTP.new(@host, @port)\n end", "title": "" }, { "docid": "42c6ac30f6fe69580e268f72d0628e5d", "score": "0.6566779", "text": "def connect!\n @conne...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1b6165bd93671124782aba8287004a2f", "score": "0.0", "text": "def set_post\n @post = Post.friendly.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...
67ebb0e3cd3570efaaad689dc5e768ec
Disable dtach usage for rspec examples
[ { "docid": "1bfab7616d451a333b4f1f0a7f3e1772", "score": "0.0", "text": "def dtach_installed?\n false\n end", "title": "" } ]
[ { "docid": "e2a146225847cd29be20e1d61d7ad7ad", "score": "0.6212406", "text": "def ignore_tests\n nil\n end", "title": "" }, { "docid": "331a5549daa72292fa36b1ca7823e31a", "score": "0.6179029", "text": "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "title": "" }, { ...
9c965f7849d2491aabbb1112f2e47de4
PATCH/PUT /workpackages/1 PATCH/PUT /workpackages/1.json
[ { "docid": "26c1a1fe85e591ed62fc53c03ae1c880", "score": "0.6675227", "text": "def update\n respond_to do |format|\n if @workpackage.update(workpackage_params)\n format.html { redirect_to @workpackage, notice: 'Workpackage wurde erfolgreich aktualisiert' }\n format.json { render :sh...
[ { "docid": "c36f0cae1bc6aece4f802697e114a14f", "score": "0.6923194", "text": "def update\n respond_to do |format|\n if @work_package.update(work_package_params)\n format.html { redirect_to @work_package, notice: 'Work package was successfully updated.' }\n format.json { render :sho...
0768d41518228c5c02382abeca995b87
insert_at that inserts the node at the given index
[ { "docid": "bc41bd950f6a0bece2a456943e9d0643", "score": "0.82686794", "text": "def insert_at(index, value)\n return nil if index > size\n return prepend(value) if index == 0\n node = Node.new(value)\n current = at(index-1)\n node.next_node = current.next_node\n ...
[ { "docid": "b5f18dac84a51d31d8a63294f951f21d", "score": "0.84140444", "text": "def insert_at(value, index)\n new_node = Node.new(value)\n @ary.insert(index, new_node)\n\n update_nodes\n end", "title": "" }, { "docid": "b66cdde2158e556f28efe512972e7cfe", "score": "0.84036005", ...
ea0066ef6a00250ea6d01c4ebeb4784f
Realiza cuestionario de frustraciones
[ { "docid": "c5172081ce4a5de5992109e153fed054", "score": "0.57768995", "text": "def realizar_cuestionario\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario Tipo Frustraciones\"\n end", "title": "" } ]
[ { "docid": "600d2325705d390ec64b56188e7fcd11", "score": "0.64574206", "text": "def factions\n \n end", "title": "" }, { "docid": "4718ee95152d41d12b587506e2110df8", "score": "0.5698195", "text": "def update_fusion\n end", "title": "" }, { "docid": "ad244bd0c45d5d9274...
b717edb4ad1f90af0cabe33cfe856aad
Space Complexity: O(1) there are no additional data structures or recursive calls to add to space complexity
[ { "docid": "2558a902fb2131c2e5eb9d39e429fe29", "score": "0.0", "text": "def max_sub_array(array)\n return nil if array.empty?\n return array.first if array.length == 1\n \n max_so_far = array[0]\n max_ending_here = array[0]\n\n (1..array.length - 1).each do |i|\n max_ending_here = [array[i], ma...
[ { "docid": "83415dea3d7100c1aaecd6d3d6b40414", "score": "0.6036524", "text": "def largest_contiguous_subsum(list) #O(n^2)\n sub_arrs = [] #O(1)\n num = list.first #O(1)\n (0...list.length).each do |i| #O(n)\n (i...list.le...
be80fbc1bed4bdb347047627c5ae630e
Creates a ruby hash from objects returned by Savon
[ { "docid": "d4e18c14084b1ca30ed910e050a4b7a9", "score": "0.0", "text": "def initialize(response)\n @document = response.to_hash\n end", "title": "" } ]
[ { "docid": "92f4be54ba2e59902d7680f49b4b57c2", "score": "0.65514535", "text": "def to_hash\n hash = {}\n __getobj__.each_key { |key| hash[key] = self[key] }\n hash\n end", "title": "" }, { "docid": "8aa9bac7b58240f1ad8ae671bb7760a7", "score": "0.65327275", "text": "...
c8b383fe3f0488a6e9508344c50e7a51
prints the basic calulator menu prompt a/s/m/d
[ { "docid": "8847211e862eed85d093c87f11da8331", "score": "0.0", "text": "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n return gets.chomp.downcase\nend", "title": "" } ]
[ { "docid": "5f30602f410f4c5e378cf16e6700501f", "score": "0.777658", "text": "def main_menu\n puts \"Options:\"\n puts \" 'h' for expression history\"\n puts \" 'r' for past results\"\n puts \" 'c' to clear\"\n puts \" 'q' to exit\"\n calc_menu\n end", "title": "" }, { ...
e667d20542f3fed915a22890acbae2cb
The number of unprocessed/remaining requests in the list (not the total number actually held)
[ { "docid": "0158c432738eb7c156298ef4188b0e77", "score": "0.69971305", "text": "def size_remaining\n @count\n end", "title": "" } ]
[ { "docid": "372a671232af540dd410bb9f92085d42", "score": "0.8211594", "text": "def outstanding\n return @requests.length\n end", "title": "" }, { "docid": "f979b9f155361f5b3111ead0a1e08f59", "score": "0.80851746", "text": "def request_count\n requests.length\n end", "t...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ebfafdd65dc38e7929ba8ecb1fce63a4", "score": "0.0", "text": "def set_sivic_notaaluno\r\n @sivic_notaaluno = SivicNotaaluno.find(params[:id])\r\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...
5fa92dd77ea762ac0162597d049fa452
=begin townhalll_email = " def get_the_email_of_a_townhal_from_its_webpage(townhalll_email) page = Nokogiri::HTML(open(townhalll_email)) email = page.xpath("/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]") puts email end get_the_email_of_a_townhal_from_its_webpage(townhalll_email) townhalll_urls = " def get...
[ { "docid": "980b19f897e7fdcb2bff728fc6c028ca", "score": "0.7001614", "text": "def get_the_email_of_a_townhall_from_its_webpage(townhall_url)\n contact = {}\n page = Nokogiri::HTML(open(townhall_url))\n contact[:name] = page.xpath(\"/html/body/div/main/section[1]/div/div/div/p[1]/strong[1]/a\").text\n...
[ { "docid": "4cf7fbe715031a1ad940804df9e7abb3", "score": "0.7354067", "text": "def get_email_townhall_from_webpage(url_townhall)\n email_townhall = \"\"\n page_townhall = Nokogiri::HTML(open(url_townhall))\n\n # get email\n page_townhall.xpath(\"//p[@class=\\\"Style22\\\"]\").each do |node|\n node...
8d8b8cdaa1afcdb39f9e68865fb2636e
Increases and decreases the intentation counter. We increase the counter when we are on nested contexts like nested context block.
[ { "docid": "766f8bc818ffc2099af54fcc27155adb", "score": "0.7346587", "text": "def increase_intent\n @intend += 1\n end", "title": "" } ]
[ { "docid": "70c76a99c601fbacfc0d9b7fd4db03c8", "score": "0.63548326", "text": "def increase_impatiance\n self.impatiance += 1\n end", "title": "" }, { "docid": "5686682ebdf7b100cd6d2b583b3c2e7a", "score": "0.5851342", "text": "def update_emotion_counter\n emotive.updat...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "36e59d9316d2cbc63123f44eba7c95d9", "score": "0.0", "text": "def referent_params\n params.require(:referent).permit(:first_name, :last_name, :title, :phone_c, :phone_b, :fax, :email, :preference_fax,\n :preference_courriel, :preference_papier, :disab...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74964964", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957765", "text": "def strong_params\n params.require(:request).permit(param_whit...
e0075040d636a8863e4f23c99b66a309
[RIDER] nerima email kalo dia di reject driver
[ { "docid": "a7844eab5be85ad0b3be3c08831c29ce", "score": "0.65428907", "text": "def reject_join(driver, post, rider)\n @rider = rider\n @driver = driver\n @post = post\n mail(to: @rider.email, subject: driver.username + ' has rejected you to join their ride')\n end", "title": "" } ]
[ { "docid": "0c98491b3205ffcb0a48a0050e46c1cb", "score": "0.705531", "text": "def reject\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "title": "" }, { "docid": "bc327b0c8051a8d65726a88aacb7c83a", "score": "0.69337046", "text": "def mailer; end", "title": "" ...
d548fcbb2eafd7ca1ebb3cfbf0beb321
Sets the fingerprintBlocked property value. Indicates whether use of the fingerprint reader is allowed in place of a pin if PinRequired is set to True.
[ { "docid": "d8716eb1295d143d711e5859ae291b72", "score": "0.81558114", "text": "def fingerprint_blocked=(value)\n @fingerprint_blocked = value\n end", "title": "" } ]
[ { "docid": "e31402f20079feae4955fe569545dfe3", "score": "0.6654926", "text": "def bluetooth_blocked=(value)\n @bluetooth_blocked = value\n end", "title": "" }, { "docid": "e31402f20079feae4955fe569545dfe3", "score": "0.6654926", "text": "def bluetooth_blocke...
52d10e20f60021e950c2e96a1fa68068
validates_presence_of :user TODO remove this on next release
[ { "docid": "e5cb78af0a5485efad5cf52b3ea30149", "score": "0.0", "text": "def organization\n if organization_id\n organization_enum\n else\n OrganizationEnum.default\n end\n end", "title": "" } ]
[ { "docid": "891342cd45f1a378d57a56540a9e2f28", "score": "0.77800244", "text": "def validate_user\n errors.add(:user_id, 'User not presence') if User.find_by_id( self[:user_id] ) == nil\n end", "title": "" }, { "docid": "fa763065832d83b161b6f06c1b731dcd", "score": "0.7726877", "te...
4c00ded7bbef0e3911d66482ebe13ba9
Handles opening the file and calling helper functions to process it.
[ { "docid": "b38c4541e00c66a81490a4b1fa1ff5c9", "score": "0.0", "text": "def process_file(path)\n File.open(path, \"r\") do |f|\n file_iterator = f.each_line\n make_num_edges(file_iterator)\n make_adjacency_list(file_iterator)\n make_operations(file_iterator)\n end\n end", ...
[ { "docid": "162dbf523a000e0230a71d0a2229e30b", "score": "0.7869616", "text": "def parse_file\n f = open_file\n puts \"INFO: opened file-handle to #{filename}\"\n begin\n process_file f\n ensure\n puts \"INFO: closed file-handle to #{filename}\"\n f.close\n e...
828728cb4af4293a809822387ed1b89e
Generate the USClub Form PDF and save to Google Drive
[ { "docid": "bdc652b045a76e32a75b5e0f61d05a16", "score": "0.7698379", "text": "def generate_pdf(pp, google_session)\n pdf_file_name = PlayerPortalsController.generate_file_name(pp, 'USClub.pdf')\n folder = PlayerPortalsController.usclub_assets_path(google_session, pp)\n local_path = PlayerPortalsContr...
[ { "docid": "5fc3832dcfecaf75b8d6768c47933d2e", "score": "0.6999201", "text": "def download\n @form = Form.last\n #@pdf stores the pdf generated with necessary details found in form\n @pdf = render_to_string pdf: \"onlineAppForm.pdf\",\n template: 'forms/final', #Template HTML f...
e86d4fe5a491fc8d5d5a118b97654c46
Creates a new empty ContentID field and inserts it in the correct order into the Header. The ContentIdField object will automatically generate a unique content ID if you try and encode it or output it to_s without specifying a content id. It will preserve the content ID you specify if you do. source://mail//lib/mail/pa...
[ { "docid": "ca7865e39af14b1e6289976b7b30169f", "score": "0.6524563", "text": "def add_content_id(content_id_val = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "49c496a2d75e56c85bfadbd07ee2a669", "score": "0.6227326", "text": "def content_id(string)\n @settings[:content_id] = string\n self\n end", "title": "" }, { "docid": "e8e46652f77f2e8c403106be03595362", "score": "0.61554945", "text": "def set_ContentID(value)\n ...
75462a9d5eafe68c521783e4f1131b2b
GET /mesasredondas/new GET /mesasredondas/new.json
[ { "docid": "801d08d9adf68a21fdf710f5a7d234c0", "score": "0.8018923", "text": "def new\n authorize! :new, @mesasredonda\n @mesasredonda = Mesasredonda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "title":...
[ { "docid": "0e561040658b5af5a3dd2b89e06e9fd2", "score": "0.7598191", "text": "def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end", "title": "" }, { "docid": "37c246cb013f377398...
80a453750b198f6391fbe3db0e95c6a8
not beautiful but works
[ { "docid": "6eae24deab89985084532269241a4502", "score": "0.0", "text": "def traverse(root, dst_root, path)\n\tpath.children.each do |p|\n\t\tif p.directory?\n\t\t\ttraverse(root, dst_root, p)\n\t\telse\n\t\t\trel = p.relative_path_from(root)\n\t\t\tsrc = root + rel\n\t\t\tdst = dst_root + rel\n\t\t\t# m...
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6038126", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6038126", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
800ddaafc94046e6185513ca3be72aa5
devstatus: in work, but works
[ { "docid": "b95f8941913b05e56b58e26c8999eb18", "score": "0.0", "text": "def fullInit\n# \t\tp 'JabberClient.fullInit'\n\t\tsetIncomingMessagesCallback\n\t\tsetRoster\n\t\tsetPresenceCallback\n\t\tsetStatus(:xa,\"test_status\",60)\t#!!!!!!!!!!!!!!!!!!!!!!!!!11\n\t\t#setUpdateCallback\n\tend", "title"...
[ { "docid": "f2a554f77033c2076c5471ec304f860c", "score": "0.6670004", "text": "def status\n run_cmd('status -uno')\n end", "title": "" }, { "docid": "76c6d6a17cc300d5ef56f0a72419135a", "score": "0.6570339", "text": "def statuscmd\n end", "title": "" }, { "docid": "e10...
5ae8346d71385b764a39afd48ad8c3e1
Returns a new collection of objects filtered by a field and value pair.
[ { "docid": "1b23bd81b04668b6b1726ec366ea7680", "score": "0.5305184", "text": "def where(field, value)\n # FIXME\n end", "title": "" } ]
[ { "docid": "7e352193294d133e6fb2b245ef357a6a", "score": "0.68994015", "text": "def all_by_field(field, value)\n data_model.all_by_field(field, value).map{|a| new(a) }\n end", "title": "" }, { "docid": "9df0cc90c52811a65e56fac812875ca0", "score": "0.5993901", "text": "...
f3a91e5034df673d049d52718dec625e
Detect Text from the document image Author: Pankaj Date: 07/06/2018 Reviewed By:
[ { "docid": "c0798bab001edc1670583f9210b300e0", "score": "0.71729606", "text": "def detect_text(document_file)\n\n req_params = {\n image: {\n s3_object: {\n bucket: GlobalConstant::Aws::Common.kyc_bucket,\n name: document_file,\n ...
[ { "docid": "85b40f2081b9613e4588d7d19588c70f", "score": "0.7935375", "text": "def detect_text(image_path)\n\n image_object = client.image image_path\n\n start_time = current_time_in_milli\n begin\n resp_object = image_object.document\n\n text_paragraph = resp_object.text\n\n...
4fcaa19660ed06eca5fc19c3761c95c7
Convert a Date or datelike value to a longform localized date string
[ { "docid": "260f9aa7376f87e4eed218d20b7342f1", "score": "0.6613091", "text": "def i18n_long_format(date)\n if date.respond_to?(:to_date)\n # i18n-tasks-use t('date.formats.long')\n I18n.l(date.to_date, format: :long)\n end\n end", "title": "" } ]
[ { "docid": "89bc1e0abdd2e4cb375efc2d29b28bda", "score": "0.74423075", "text": "def long_date(val, options)\n val ? val.to_date.to_s(:long) : val\n end", "title": "" }, { "docid": "92f0617b1bc7532e1d4185572c7dfcd5", "score": "0.7359849", "text": "def str_date\n date_date = ...
0fb7b621849aa3711ec8762d629bb653
required items of configuration ctoken:: consumer token csecret:: consumer secret atoken:: access token asecret:: access secret
[ { "docid": "c9d439b6abc2f4079a2e3f83be73e3e9", "score": "0.6328862", "text": "def required_items_of_configuration\n @required_items_of_configuration ||= %w(ctoken csecret atoken asecret).sort\n end", "title": "" } ]
[ { "docid": "c433fd1f08499835dc698155b0c8c979", "score": "0.69009864", "text": "def client_params\n { \n :consumer_key => config[:consumer_key],\n :consumer_secret => config[:consumer_secret],\n :access_token => config[:access_token],\n :access_token_secret => config[:acc...