query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
cc98ff4cb6b386c3726e2114f74cd10a
Determine if unit should be run based on conditional fields
[ { "docid": "ff2573bb19f6a09c04d13b3ab4eda004", "score": "0.66063404", "text": "def unit_runnable?(unit)\n result = true\n conditionals = Smash[\n [:only_if, :not_if].map do |conditional_key|\n stdout = process_manager.create_io_tmp(Carnivore.uuid, 'stdout')\n ...
[ { "docid": "862955f1e5a166b8b017d3d9033e9c28", "score": "0.68081915", "text": "def requires_unit_of_measure?\n requires_volume? || requires_lift_data? || requires_service_hours?\n end", "title": "" }, { "docid": "297874931fcfcc3a8e00ad2217d01f62", "score": "0.6540817", "t...
315ca7634baa146fdfeccd402430b85c
Samnang's implementation from Issue 2.4
[ { "docid": "4b8abfd9e17ce00f1c90d9662361da31", "score": "0.0", "text": "def reduce(arg=nil) \n return reduce {|s, e| s.send(arg, e)} if arg.is_a?(Symbol)\n\n result = arg\n each { |e| result = result ? yield(result, e) : e }\n\n result\n end", "title": "" } ]
[ { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.6359218", "text": "def anchored; end", "title": "" }, { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.6160871", "text": "def private; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
402808b7e3d7af6875664957f5c1df24
Displays the ontology node with appropriate indentation, as well as optional edit and remove icons, and the number of assays associated with the node.
[ { "docid": "a9b5df31a448cba58cf889322900611a", "score": "0.0", "text": "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n ...
[ { "docid": "040bfcab9cea288cbf6d3823c0684983", "score": "0.6209464", "text": "def ontology_editor_display type, root_id=nil, selected_id=nil\n\n # login users can edit new defined assay/technology types\n # only admin can edit/delete new defined assay/technology types\n show_e...
fa9adc35adea03f5a21487d35d3fff9b
Defines how much time will the 'select' call wait for before returning nil nil is returned if no object from the ones passed to select is ready to be read after the timeout Since the server_cron executes every 100ms, timeout will be at most 100ms
[ { "docid": "8e659386c59974df1d4afd409159d5be", "score": "0.60657597", "text": "def select_timeout\n if @time_events.any?\n nearest = nearest_time_event\n now = (Time.now.to_f * 1000).truncate\n if nearest.process_at < now\n 0\n else\n (nearest.process_a...
[ { "docid": "8ccc122403f8acfcd77afaa69f5f3704", "score": "0.6812942", "text": "def max_select_wait_time; end", "title": "" }, { "docid": "d6110806bbe0505854d82a07e5932016", "score": "0.65145457", "text": "def select(timeout) # timeout in seconds\r\n SocketError.check if (ret = Wins...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "96f6948ee2c4a4bbfcd13a92b56bf0c1", "score": "0.0", "text": "def set_client_source\n @client_source = ClientSource.find_by_id(params[:id])\n if @client_source\n else\n \trender json: { valid: false}, status: 404\n end\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...
014f80b76bcd34fb420d956453c8522a
TODO Remove this method.
[ { "docid": "fbdf42f8c974e229a9894db1c49cdd28", "score": "0.0", "text": "def github_api(user = current_user)\n @github_api ||= GithubApi.new(github_token, user)\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.8026605", "text": "def private; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", "score": "0.6746819", "text": "def schubert; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", ...
3ad3844c85450cf17621c6dc386f257b
Applies x and y to start and returns the resulting position return nil if off board
[ { "docid": "816adad075a62a5f0a4c393cb3b8918d", "score": "0.0", "text": "def apply_delta(rows, cols, pos, x, y)\n puts \"applying delta (#{x}, #{y}) to pos #{pos} which is at \" \\\n \"#{column_of(rows, cols, pos)}, #{row_of(rows, cols, pos)}\" if @debug\n\n unless xy_on_board?(rows, ...
[ { "docid": "1530a2a61d9da0da6786e8f6147f6d17", "score": "0.69125307", "text": "def start_at(x, y = 0)\n from.coord x, y\n end", "title": "" }, { "docid": "812a755c19905906ab80a8cbb81dd068", "score": "0.6853893", "text": "def coords_to_pos(point)\n (point.y - 1) * board_siz...
3aa0c433507d30753509179dd5e0f746
Create the initial directory structure
[ { "docid": "3a2ae768074e63c6e4178abe19ef160e", "score": "0.0", "text": "def setup!(delete=true)\n FileUtils.rm_rf(@root_dir) if File.exist?(@root_dir) and delete\n FileUtils.mkdir_p(@root_dir)\n FileUtils.mkdir_p(@files_dir)\n FileUtils.mkdir_p(@queues_dir)\n FileUtils.mkdir_p(@logs_dir)\...
[ { "docid": "b527f5e07d720a1497e76dfb8f343b48", "score": "0.7772237", "text": "def create\n create_directories\n end", "title": "" }, { "docid": "81e6b361978a7908fc4f38bb102cb756", "score": "0.7616159", "text": "def create_directories\n directory '.', './'\n end", "tit...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "5630b7237991926bab29bc3eb2d5a130", "score": "0.0", "text": "def update!(**args)\n @partial_name_options = args[:partial_name_options] if args.key?(:partial_name_options)\n @verbatim_full_name = args[:verbatim_full_name] if args.key?(:verbatim_full_name)\n end", "...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
ec0242ae20efb30478d1fa7111b17ba0
there's probably a shorter way of doing this
[ { "docid": "b183c2c36eb490095a1bd4b6dc794a34", "score": "0.0", "text": "def find_room_with_spaces\n available_rooms = Array.new()\n available_rooms = @rooms\n .find_all { |room| room.is_full == false}\n .map { |room| room.name }\n return available_rooms\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.5983677", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.58577096", "text": "def probers; end", "title": "" }, { "docid": "d88aeca0eb7d8aa34789deeabc5063cf", ...
bd66cf508b848519e529b8acd37dcb0e
11) Given a list of businesses and their ratings, return the median. (The business with the median rating)
[ { "docid": "446aec26bd63bb49b5a4b4f3012ba889", "score": "0.72407895", "text": "def find_median(arr)\n mid = arr.length / 2\n\n arr.sort_by { |obj| obj[:rating] }[mid][:name]\nend", "title": "" } ]
[ { "docid": "a1e1b6c5bf2e901a9ca9ce5cf2ee8572", "score": "0.74602", "text": "def median_budget(movies)\n movie_budgets = movies.collect {|cost| cost[:budget]}\n movie_budgets.sort!\n if movie_budgets.length % 2 != 0\n movie_budgets[movie_budgets.length / 2]\n else\n ((movie_budgets[(movie_budge...
4a27c6744966be08dbe9e13e47f2f198
set a options of selectbox
[ { "docid": "a028fe321af60dbb29f15c6c6556004f", "score": "0.8156102", "text": "def set_selectbox_options\n set_kind_option\n set_scheduled_times_option\n set_user_option\n end", "title": "" } ]
[ { "docid": "aef42efbd054bec77236ffb4583d3f46", "score": "0.656933", "text": "def fill_select_option\n @search_by_values = QcLaboratory.get_search_values\n end", "title": "" }, { "docid": "63e4990cbea0ae0cbb789de05655ab36", "score": "0.62997895", "text": "def set option_value\n ...
7293f6fbed951335e03939c68375e805
Objective of this funciton is guess what port to connect if not p[port] parameter was not provided.
[ { "docid": "02098f8546d3123e2c9da54b10d55b7f", "score": "0.6357175", "text": "def ScanningPort(host, ports)\n# puts \"Scanning... #{host}\"\n ports.each do |port|\n# puts \"Scanning Port #{port}\"\n begin\n socket = TCPSocket.open(h...
[ { "docid": "7c655da00b6162ee991a848ea5dda912", "score": "0.75469804", "text": "def connect_port(port)\n connect_host_port(\"localhost\", port)\n end", "title": "" }, { "docid": "e77bd712ca2bb43ceac35eb02baaa71e", "score": "0.7293353", "text": "def port(port, host = ...
565136a5175b569aa3986b159bdf824f
POST /foods POST /foods.json
[ { "docid": "4d331e7017db5a122959a8038a8e7c74", "score": "0.64657855", "text": "def create\n @food = Food.new(food_params)\n respond_to do |format|\n if @food.save\n format.html { redirect_to @food, notice: 'Food was successfully created.' }\n format.json { render :show, status: ...
[ { "docid": "93da9a0671b5faab8c5064421ab66cca", "score": "0.685693", "text": "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "title": "" }, { "docid": "2c807e567d014376f1c13d546b9121b3", "score": "0.6643145",...
3f78255101f4428c08a978930b6090bc
Creates and returns the subset route corresponding to 'path' if 'path' is a subset resource, otherwise returns 'nil'
[ { "docid": "cb598edb411c377966396103c9cf91f7", "score": "0.7636553", "text": "def create_subset_route(path)\n SUBSET_ROUTE_REGEX.each do |regex|\n if regex.match(path)\n subset_id = get_hash(get_machines)\n path.gsub(regex) do |s|\n api_version = Regexp.last_matc...
[ { "docid": "582e22e544bbba27fd15ce7d6691fab8", "score": "0.62212646", "text": "def [] path\n @subroutes[path]\n end", "title": "" }, { "docid": "7c436e728f8cd7c75a08857e0e8addd8", "score": "0.5824857", "text": "def get_subresource(partial_path)\n\t\t\tpartial_path = parti...
0ce683af4a6000e88619863fe612f25c
Sets the log level.
[ { "docid": "df969e025b2a57f05d6db0101a4e11ac", "score": "0.81120086", "text": "def log_level=(log_level)\n @log_level = log_level\n end", "title": "" } ]
[ { "docid": "dc86f9ad27b2c01683515a7fb9665f62", "score": "0.8611964", "text": "def level=(level)\n @log.level = level\n end", "title": "" }, { "docid": "75f4ace7f668fa832d3b6f98198ccb43", "score": "0.8458513", "text": "def set_log_level(level)\n @log_level = level\n ...
316cff541807837c57da1f22434c1d31
Returns information about the currently authenticated user
[ { "docid": "a95dfe28d6b386aafc5fb53749e84258", "score": "0.0", "text": "def user\n get(ROBINHOOD_USER_ROUTE, return_as_json: true)\n end", "title": "" } ]
[ { "docid": "ba46c33eaa6033eeddbbdddd3ad3411f", "score": "0.85596085", "text": "def user_info\n get(api_get.body.identity).body\n end", "title": "" }, { "docid": "47642ed6d71ec5320d5f48bc9a28759f", "score": "0.83695626", "text": "def get_user_information\n if loggedin...
defe661c50e0aaed1687572de7bfc5c2
GET /apparels/1/remove_reported GET /apparels/1/remove_reported.json
[ { "docid": "007a68ce6f50e189de306f45fc8e6014", "score": "0.7171266", "text": "def remove_reported\n if @apparel.apparel_reports.where(number: params[:token]).count > 0\n @apparel.destroy\n head :no_content\n else\n render :nothing => true, status: :unauthorized\n end\n end", ...
[ { "docid": "3f1eada2391d4c83b55ab61f410e5c75", "score": "0.63165784", "text": "def unignore_reports\n post(\"/api/unignore_reports\", id: fullname)\n end", "title": "" }, { "docid": "734c264db004ecbdf30cafa63120c8e5", "score": "0.62076235", "text": "def destroy\n @...
2ca458daf710089de93f4798bd79ea67
Disegna il titolo della finestra
[ { "docid": "9777f4b161cf9e9a5b02db7b12e57884", "score": "0.0", "text": "def draw_title\n change_color(system_color)\n draw_text(0,0,contents_width,line_height, Vocab.synth_req)\n end", "title": "" } ]
[ { "docid": "7ff52555f6901ef6466a50e44de001c6", "score": "0.6954772", "text": "def finestra\n\t\treturn @finestra\n\tend", "title": "" }, { "docid": "37dd51a636bd4f92c4c4bdb82296b191", "score": "0.60798025", "text": "def frizz_pharmacolite_triaconter()\n end", "title": "" }, ...
2faf460a2fb2375aa9c8f126408778bf
p find_sub_arrays([1,2,3]) == [[1], [1, 2], [1, 2, 3], [2], [2, 3], [3]]
[ { "docid": "21979546cdff277945bb2bf1d56116ed", "score": "0.0", "text": "def minSubLength(arr, i)\n subs = find_sub_arrays(arr)\n correct = subs.select { |array| array.sum >= i }.min_by { |x| x.length }\n p correct\n correct == nil ? 0 : correct.size\nend", "title": "" } ]
[ { "docid": "d8b28bacc68359381d10ffb228b83654", "score": "0.7876341", "text": "def find_subarrays(nums_ary)\n subarrays = []\n last_index = nums_ary.size - 1\n 0.upto(last_index) do |start_index|\n start_index.upto(last_index) do |end_index|\n subarrays << nums_ary[start_index..end_index]\n ...
40336d84cf9c8c4842a9010fb3698d0e
A revised sieve which skips calculations by stepping every 2n for each n^2 until the square root of the limit
[ { "docid": "d4c8dc0a9ac81fbc992bc9ffe79c6c14", "score": "0.793021", "text": "def revised_sieve(limit)\r\n\t# Create boolean array from 0 to limit\r\n\tcrosslimit = Math.sqrt(limit)\r\n\tsieve = Array.new(limit,false)\r\n\tstart = Time.now\r\n\r\n\t# Set all even numbers to true (not prime)\r\n\t(4..limi...
[ { "docid": "4227cbfc5e14408122de5f11dd504ec7", "score": "0.773755", "text": "def sieve(limit)\n primes = (0..limit).to_a\n primes[0..1] = nil, nil\n\n (2..Math.sqrt(limit)).each do |i|\n\n if primes[i]\n (0..limit).each do |j|\n # start enum from i**2 because 0, 1 are nil and 2, 3 are ...
f466fb35b29edc60a74878af1affc3c0
GET /source_keywords/1 GET /source_keywords/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "500e54e8cf0e65eec790d5d6eac6bd1a", "score": "0.74924976", "text": "def index\n @source_keywords = SourceKeyword.all\n end", "title": "" }, { "docid": "18865e5b8a5f86dcb1135a339245dee4", "score": "0.67796284", "text": "def get_keyword(id)\n @client.raw('get', \"/con...
13f6cbf805da1861f8c27812ab42d7bf
If a variable is passed in, it returns the numerical value
[ { "docid": "9e951043dd64b9b62194cf181d1151c8", "score": "0.0", "text": "def test_check_var_sym\n @process.let('A', [5])\n assert_equal 5, @process.replace('A')\n end", "title": "" } ]
[ { "docid": "f71532664748868f53204a04256c5713", "score": "0.71623975", "text": "def get_numeric_variable(var)\n ActiveRecord::Base.connection.execute(\"SELECT GET_NUMERIC_VARIABLE('#{var}') as numeric_variable\").first[\"numeric_variable\"].to_f\n end", "title": "" }, { "docid": "2d37...
69f6a48edc30cd2e742cedbeb5eca27f
GET /customers GET /customers.json
[ { "docid": "e25a3706197bc03974b1ee9b9dbcf1a2", "score": "0.69828904", "text": "def index\n @customers = Customer.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", ...
[ { "docid": "44d5c99d89ab374d2baf04ebcdda12b5", "score": "0.81343365", "text": "def getcustsjson\n render :json => @customers\n end", "title": "" }, { "docid": "e9c7651d1891953067719cb341ff5ccb", "score": "0.8005925", "text": "def index\n @customers = Customer.all\n\n render...
a964752034ba7623a62a3be9261ca551
Mark as read once Conversation has been opened.
[ { "docid": "a4a33649c1b5054a7faee63d5a3e40d2", "score": "0.6386458", "text": "def conversation\n mailbox.conversations.find(params[:id]).receipts_for(current_user).mark_as_read\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bc4a78480756196b4a4ec31b092ac79b", "score": "0.8197817", "text": "def mark_as_read\n client.post('/api/mod/conversations/read', conversationIds: [read_attribute(:id)])\n end", "title": "" }, { "docid": "dce628adefd11a6bcf23d0aa51d7ae5e", "score": "0.77653384", ...
30776a1b1acc5b5ce54fbca5ff70a453
Search for Pulses including the query in their datafields
[ { "docid": "cd7f3d191e70bb2b878e4dc376c8fa18", "score": "0.0", "text": "def search(query, limit = 10, page = 1, sort = :created)\n uri = '/api/v1/search/users'\n\n if sort == :modified || sort == :subscriber_count\n sort_by = sort.to_s\n else\n sort_by = 'created'\n end...
[ { "docid": "0fce5519c243853804de0343c3c73904", "score": "0.69989985", "text": "def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n ...
7ad64e8bf3b64685d90c174b249a3387
removes node (actualy it does not delete node, it deletes link to it, node deletes only then it have not income links and garbage collector delete it). Example: GB::Conn.rm 'toys', 'tank'
[ { "docid": "a16d328d9ed8f77bc46c3608976a39af", "score": "0.702705", "text": "def rm node, key\n get node_name(node) + action(:rm, :key => key)\n end", "title": "" } ]
[ { "docid": "6ce311d98b025e0387f6321b02f4d8c2", "score": "0.7291471", "text": "def remove_node( node )\n\t\t@nodes.delete( node.object_id )\n\tend", "title": "" }, { "docid": "67fcdcfdac8ff87ea5e4677bb276a8c5", "score": "0.71755016", "text": "def delete node\n end", "title": "" ...
d6655ea476b6625d821dfc88f2b3a38c
write contents to file
[ { "docid": "ca72d65c582dd414645f9c559d500bf0", "score": "0.0", "text": "def write_file(file_name, text)\n File.open(file_name, 'w') do |file|\n file.puts text\n end\n disp_msg(INFO_MSGS['file_saved'])\n end", "title": "" } ]
[ { "docid": "28289cfccef8336103f57b09ae11852a", "score": "0.81730396", "text": "def write\n File.open(@path, \"w+b\") do |f|\n f << @content\n end\n end", "title": "" }, { "docid": "8dc7f00d3e90b15c97097a80361819ad", "score": "0.80180174", "text": "def write(content)\n ...
f7130c53e9e3b67448aa916ea75ed7df
DELETE /laporan_penyuluh_agama_katolik/1 DELETE /laporan_penyuluh_agama_katolik/1.json
[ { "docid": "0f2a92f9af943833f480814846a2c6b6", "score": "0.7631023", "text": "def destroy\n @laporan_penyuluh_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to laporan_penyuluh_agama_katolik_index_url, notice: 'Laporan penyuluh agama katolik telah berhasil dihapus.' }...
[ { "docid": "767e3302f0dfa99f607a5b6910b53a24", "score": "0.76909465", "text": "def destroy\n @laporan_penyuluh_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to laporan_penyuluh_agama_katolik_index_url, notice: 'Laporan penyuluh agama katolik was successfully destroye...
18b06aa7a3464ea4fbfb21b927650feb
Square root of a decimal number
[ { "docid": "bca429fbbfe755853931ebd17df21dc5", "score": "0.66033685", "text": "def sqrt(x)\n _convert(x).sqrt(self)\n end", "title": "" } ]
[ { "docid": "d727a6906da3558e7a7f2858104b2465", "score": "0.7620231", "text": "def square_root_of(number)\n\tMath.sqrt(number)\nend", "title": "" }, { "docid": "b1ae19adc3794dd2578f79dee1ba1911", "score": "0.7586025", "text": "def square_root_of(number)\n return Math.sqrt(number)\nen...
1d143f2941bc73fb0e425dea6c36041b
GET /templates GET /templates.json
[ { "docid": "8d2892977ada6bf9df634e7127a535ef", "score": "0.74293804", "text": "def index\n @templates = Template.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end", "title": "" } ]
[ { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.8019614", "text": "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.8019614", "text": "def...
ebd0fefe51b32751f757398d5b3aea66
The models number of documents to return by default when performing pagination. Returns 25 unless explicitly overridden via paginates_per
[ { "docid": "1ac31896a7e063d7009a84b06de2659a", "score": "0.74238974", "text": "def default_per_page\n @_default_per_page || 25\n end", "title": "" } ]
[ { "docid": "f9d3384a24985a128d12e8293397bd12", "score": "0.7905529", "text": "def records_per_page\n 100\n end", "title": "" }, { "docid": "a8226301df2f2623a699a01b2f8f4f33", "score": "0.78258365", "text": "def default_per_page\r\n 400\r\n end", "title": "" }, ...
9e86e4b80b179a0ac4c29c2072b09b0c
Returns an array of the cookies belonging to the response.
[ { "docid": "8ad0b682d8956ad67aad1a51fc0f57af", "score": "0.73188317", "text": "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "title": "" } ]
[ { "docid": "2560cf9a64d33d28b597eaefa2664da2", "score": "0.85635465", "text": "def cookies\n (@response.get_fields('Set-Cookie') || [])\n end", "title": "" }, { "docid": "e9a3836fc07adec4741abc3905d67e00", "score": "0.82248485", "text": "def get_cookies(response)\n all_coo...
9ebd62a4604cc0abc6f1fa2c16f68648
iterative implementation of binary search in Ruby
[ { "docid": "533d8a80708ac30258250b405278cb8f", "score": "0.7587112", "text": "def binary_search(an_array, item)\n first = 0\n last = an_array.length - 1\n\n while first <= last\n i = (first + last) / 2\n\n if an_array[i] == item\n return \"#{item} found at position #{i}\"\n elsif an_arr...
[ { "docid": "5d52fcd6883444f4028c03b39ff3e72e", "score": "0.80624956", "text": "def binary_search(arr, target)\n\nend", "title": "" }, { "docid": "e4d7bfad37a8556eb7a2659dcc4867cc", "score": "0.8030021", "text": "def binary_search(from_index, to_index, element)\n end", "title": "...
370e7f5b4f4aac95a2a9cbd054ac963c
find maximum layer_id for specified network
[ { "docid": "b2fb32173a121606cae04b04e9bd4e72", "score": "0.8759221", "text": "def find_max_layer_id_by_network_id (network_id)\r\n self.find_by_sql(\"SELECT MAX(layer_id) FROM aln_terminations WHERE network_id=#{network_id}\").first.attributes[\"MAX(layer_id)\"].to_i\r\n end", "title": "" ...
[ { "docid": "3fec38c7d0118ccaacbe0b2605f5b875", "score": "0.6444632", "text": "def max_node_id\n (elem_1_id = Network.maximum(\"protein_1_id\")) > (elem_2_id = Network.maximum(\"protein_2_id\")) ? elem_1_id : elem_2_id\n end", "title": "" }, { "docid": "c7dda6a5a61c8890a03aaace9a70ffbd", ...
7c7976273a8b2942fc08eb29a665820c
If a tree consists only of tree/, tree.content and tree.attributes without children, tree.content can be moved to tree ("collapsing").
[ { "docid": "8333eaa2bb74f2ff7c0463d5b5d0077f", "score": "0.69289356", "text": "def collapse_empty_tree(path)\n if !path.blank? && work_tree[path].empty? && work_tree[path + CONTENT_EXT]\n work_tree.move(path + CONTENT_EXT, path)\n end\n end", "title": "" } ]
[ { "docid": "040f9dd689b2e2965d85336591fdafb9", "score": "0.69878525", "text": "def collapse_empty_tree(path)\n if !path.blank? && @git.root[path].empty? && @git.root[path + CONTENT_EXT]\n @git.root.move(path + CONTENT_EXT, path)\n end\n end", "title": "" }, { "docid": "091b72718b...
0323da02ed474229d10ca815ddecf62a
Call the given block for each element which is yield by +each+. Return true if one block value is true. Otherwise return false. If no block is given and +self+ is true object return true. ISO 15.3.2.2.2
[ { "docid": "877acc98690a2b10e09fda6fb81c5697", "score": "0.6590598", "text": "def any?(&block)\n if block\n self.each{|*val| return true if block.call(*val)}\n else\n self.each{|*val| return true if val.__svalue}\n end\n false\n end", "title": "" } ]
[ { "docid": "0bf748798facc3e9b36bab13445987c7", "score": "0.7677846", "text": "def my_any?\n if block_given?\n self.my_each{|item| return true if yield(item)}\n # return false unless one is true\n false\n else\n # if no block given return true\n true\n end\n end", ...
ac272210d2dec656332785ea08574a63
See Session.open for initialization options.
[ { "docid": "fc31322c0562da5f101814c742f0d04a", "score": "0.0", "text": "def initialize(options = {})\n ole_object = WIN32OLE.new(\"QBFC6.QBSessionManager\")\n \n ole_object.OpenConnection2(options[:app_id].to_s,\n (options[:app_name] || \"Ruby QBFC Application...
[ { "docid": "d7ce05dbc6ba556302c740bad53259a3", "score": "0.8418219", "text": "def open_session; end", "title": "" }, { "docid": "071b583c5e29b745bada81458f18f00c", "score": "0.7323961", "text": "def start_session; end", "title": "" }, { "docid": "071b583c5e29b745bada81458...
24d2a60676ee6e008ccae9d5577ec344
Return the machine options to use.
[ { "docid": "12cf4049ab19e8edc5edb6e4e80aa195", "score": "0.7431399", "text": "def machine_options\n opts = {\n convergence_options: {\n bootstrap_proxy: @bootstrap_proxy,\n chef_config: @chef_config,\n chef_version: @chef_version,\n install_sh_...
[ { "docid": "a0f553b6d982847e4505ff2cb97b8982", "score": "0.70975405", "text": "def get_options\n @options\n end", "title": "" }, { "docid": "7a3aa1a7906899fc7cb3c5114e15090c", "score": "0.6860445", "text": "def options\n Properties[self.class] ||= {}\n return Properties...
26085f24ebcdf24620d99de047eb199b
Check on if user has at least admin privileges. Otherwise, redirect to where they came from.
[ { "docid": "f7c754e2c99349ae4d9b3d34fba1dabf", "score": "0.0", "text": "def require_admin\n\t\t\tredirect_to :back, notice: \"Is not an admin\" unless @current_user.is_admin?\n\t\t\trescue ActionController::RedirectBackError\n\t\t\t\tlacks_back\n\t\tend", "title": "" } ]
[ { "docid": "3613b4d32bd1ac01fcd002d93d6dd063", "score": "0.8263653", "text": "def admin_user\n redirect_to(root_url) unless current_user.admin? || correct_user || current_user.super_admin?\n end", "title": "" }, { "docid": "9ef126a9b0a178e9811c9e9d6d795f2c", "score": "0.8254455...
84a6be467ddf80cc7956d9f488d10960
Sets the selector property value. The service selector.
[ { "docid": "07e5d0dcba7239a3b08176552919c0ab", "score": "0.8245585", "text": "def selector=(value)\n @selector = value\n end", "title": "" } ]
[ { "docid": "e46874c1512cd74af3736b81b2428d80", "score": "0.7374124", "text": "def selector(s)\n @selector = s\n end", "title": "" }, { "docid": "e46874c1512cd74af3736b81b2428d80", "score": "0.7374124", "text": "def selector(s)\n @selector = s\n end", "title": "" ...
cf1c13f218d30661baf08fb4ac1af8ca
Constructs a Valkyrie::Persistence::CustomQueryContainer using this query service
[ { "docid": "a3a1fe4f1df42cdfa1ee86c14ca10148", "score": "0.80844355", "text": "def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end", "title": "" } ]
[ { "docid": "0343b68e7e12a56fab80b3753f734574", "score": "0.80706453", "text": "def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end", "title": "" }, { "docid": "0343b68e7e12a56fab80b3753f734574", "score": "0.807...
f0a0a2cf9dd0f4e70b25a8fcb4beb03c
PATCH/PUT /recordingstations/1 PATCH/PUT /recordingstations/1.json
[ { "docid": "b78245e7284898d452c1ceeb18e230fb", "score": "0.69036704", "text": "def update\n respond_to do |format|\n if @recordingstation.update(recordingstation_params)\n format.html { redirect_to @recordingstation, notice: 'Recordingstation was successfully updated.' }\n format.j...
[ { "docid": "64c7de436cc2d0aff0b2fbf45c280b93", "score": "0.677492", "text": "def update\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n if @recording.update_attributes(params[:recording])\n format.json { head :no_content }\n else\n format.html { rend...
b27feff9ee7d858bf5b8a5fdd2c2d61b
Sets the display name of a room
[ { "docid": "5533f12a7e0df372535e0debac7c5702", "score": "0.71519405", "text": "def set_room_name(room_id, name, **params)\n content = {\n name: name\n }\n send_state_event(room_id, 'm.room.name', content, **params)\n end", "title": "" } ]
[ { "docid": "eda4a2c8f217469d520baffff939ad26", "score": "0.75863403", "text": "def room_name=(value)\n @room_name = value\n end", "title": "" }, { "docid": "50ff0e1b35d6226df292d64f916cdfe5", "score": "0.68584996", "text": "def display_name=( str )\n @d...
088fde57400509229b15fb54b8969a23
calcola il livello richiesto
[ { "docid": "5e581c469b235fba5ff3001ccdbcda23", "score": "0.0", "text": "def default_level\n return 0 unless (self.is_a?(RPG::Weapon) or self.is_a?(RPG::Armor))\n carica_cache_personale_class unless @tier\n (@tier - 1) * 10 + 5\n end", "title": "" } ]
[ { "docid": "c512d3086c54cb450c944eacc9c75f27", "score": "0.64809966", "text": "def busca_conta\n\n end", "title": "" }, { "docid": "1d3f89244d8879e46d0688468f064d0f", "score": "0.64405406", "text": "def alta_vista\n \n end", "title": "" }, { "docid": "1d3dd80ebcf...
2f9f80c8fd1f1f74b8d6b3a37e5d13a5
Googled and found out how to add optional parameter to adder block. It's default stays at 1
[ { "docid": "d347f403c09cb1fb225d8c9a709a6a57", "score": "0.62436056", "text": "def adder(num=1, &block)\n yield + num\nend", "title": "" } ]
[ { "docid": "dcf32c19237297ab9cf97bcdafab4479", "score": "0.6504036", "text": "def adder(n = 1,&block)\n block.call + n\nend", "title": "" }, { "docid": "e285205b1396a46479eb40b43a5d1e88", "score": "0.6461692", "text": "def adder(num = 1, &block)\n\tblock.call + num\nend", "title...
d39ddc7ad37d8528755a6c3fc4eec15f
GET /admin_devices/1 GET /admin_devices/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3ea6e1f687701eb9adcb9d0b4b75faae", "score": "0.73513633", "text": "def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devices = User.get_all_user_devices(current_user[:id])\n render json: @devices\n end", "titl...
c8b0c6b6b3d9f7de5ea0f12006a88b46
d. i. Create a method that adds a new key at the top level of the school hash, given a key and a value. ii. Then use it to add a "Ranking" key with the value 1.
[ { "docid": "c173f818573efeebe71de63588c4be05", "score": "0.6714821", "text": "def new_key_value_pair_at_top_level_of_school_hash(new_key, new_value, school)\n new_pair = {new_key.downcase.to_sym => new_value}\n ap new_pair.merge!(school)\nend", "title": "" } ]
[ { "docid": "6d7a70e1f5c93477a172408367259193", "score": "0.8381773", "text": "def add_new_key(school, ranking, value)\n\tschool[ranking] = value\nend", "title": "" }, { "docid": "5043c071f9d2dd02fc7a5f2d155fde3d", "score": "0.7061124", "text": "def new_top_level(school, key, value)\n...
bf5fd670a745ebb1b2a34b011d142a5e
PATCH/PUT /collection_schedules/1 PATCH/PUT /collection_schedules/1.json
[ { "docid": "e74241a6df512bb0f50a827b56c0acec", "score": "0.75416386", "text": "def update\n respond_to do |format|\n if @collection_schedule.update(collection_schedule_params)\n format.html { redirect_to @collection_schedule, notice: 'Collection schedule was successfully updated.' }\n ...
[ { "docid": "63e253886df21516071565017e0d6a46", "score": "0.71842074", "text": "def update\n if @schedule.update(schedule_params)\n render json: @schedule\n else\n render json: @schedule.errors\n end\n end", "title": "" }, { "docid": "21cf7d35d4734dc60ab0deffd38e...
6f6becac7362a68219571688403c7b4d
GET /metrics/new GET /metrics/new.xml
[ { "docid": "475dd39dc42daacf9a5a38ab8a2fe3a0", "score": "0.7933774", "text": "def new\n logger.debug \"New metric\"\n @metric = Metric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @metric }\n end\n end", "title": "" } ]
[ { "docid": "ed79ecc93ecacd032cd5bb33ecc21cbb", "score": "0.71899337", "text": "def new\n @metric = Metric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metric }\n end\n end", "title": "" }, { "docid": "ed79ecc93ecacd032cd5bb33ec...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fab6058c3ccbc790b59ea2a984166e36", "score": "0.0", "text": "def set_geo_datum\n @geo_datum = GeoDatum.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163927", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6046165", "text": "def action_hook;...
8305d4397e5ecfacdc021e15107f1774
Return a hash of students and their average score. TIP: To convert an array like [[:indiana, 90], [:nevada, 80]] to a hash, use .to_h. Also look at Hashtransform_values.
[ { "docid": "a7ad5fea57956690d1bba16386ced4be", "score": "0.70635855", "text": "def averages(grade_hash)\n averages = grade_hash.map do |key, value|\n totals = value.reduce do |total, x|\n total += x\n end\n [key, totals / value.length]\n end\n averages.to_h\nend"...
[ { "docid": "6a0f4c66d3f0a865cf4a8e5a90e1d492", "score": "0.792133", "text": "def averages(grade_hash)\n grade_hash.map do |students, scores|\n [student, scores.sum/ scores.length]\n\nend\n return array.to_h\n\nend", "title": "" }, { "docid": "4a247de8e22f7bb38bd0708960d25df7", "scor...
a0d7bc6f26bacf8bf7ddbf2417b3a244
Query for all the posts of the user GET /topics/:topic_id/posts
[ { "docid": "46c8cc8601a58e904632a7b4c6a23037", "score": "0.7121429", "text": "def all_posts\n posts = Topic.find(params[:topic_id]).posts\n render :json => posts.order(:created_at => :desc), :include => {:topics => {}, :user => {}}, :methods => [:comment_size]\n end", "title": "" } ]
[ { "docid": "c4cd35ab6eec2ac4a0a091966d0fbce8", "score": "0.78061604", "text": "def topics\n\t\t\t# Magically make arrays from string Wooooo!\n\t\t\tuid = params[\"uid\"].split(\",\")\n\t\t\ttid = params[\"tid\"].split(\",\")\n\n\t\t\t#request post from usrs AND specific topics ahhhhhhh!\n\t\t\tposts = P...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "053e7b9ac5ef793a315f66feb136a1eb", "score": "0.0", "text": "def game_params\n params[:game]\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
056723625770dbba4aa2741316557ada
POST /distributor_product_lists POST /distributor_product_lists.json
[ { "docid": "b312a08541cf34976e9c17ca7793a5f4", "score": "0.7754879", "text": "def create\n @distributor_product_list = DistributorProductList.new(distributor_product_list_params)\n\n respond_to do |format|\n if @distributor_product_list.save\n format.html { redirect_to distributor_prod...
[ { "docid": "751148ecb1dd0673c13941def637c8ae", "score": "0.723471", "text": "def distributor_product_list_params\n params.require(:distributor_product_list).permit(:product_list_id, :name, :sort_order)\n end", "title": "" }, { "docid": "d2e3173fb8b6865ae62bb182912839b4", "score":...
9aec99f7676df973d5341f2e5f810ab8
Parsing the CSV file and setting the headers to true (the first line of the CSV file), then converting those headers to symbols
[ { "docid": "8c6282108b4ed73bc528327163bdc809", "score": "0.5831276", "text": "def formatted_recipes\n recipes = CSV.parse(File.read(\"recipes.csv\"), headers: true, :header_converters => :symbol, :converters => :all)\n\n return formatted_recipes = recipes.map do |row|\n row.to_h\n end\ne...
[ { "docid": "0c5560d1da1bf5bb1f8c3aa7f467c5e1", "score": "0.68615323", "text": "def parse_header(row)\n @header = row.map(&:downcase)\n end", "title": "" }, { "docid": "96c6250c6cc09a54e40cb087121a5e27", "score": "0.6623904", "text": "def parse_logger_csv_header(csv_file)\n c...
ed46c2a7b5896bf40a064398233ae2fd
Response while saving 300036 Required variables are missing 300037 Unknown error while posting info to DB 000000 Success
[ { "docid": "31bc5c85d34ab8cf4e849509e61952db", "score": "0.0", "text": "def save!\n if self.event_id.blank?\n #changeevent\n return false unless validates_required_attr\n new_save(\"createevent\")\n else\n #createevent\n new_save(\"changeevent\")\n end\n...
[ { "docid": "f93d0c2a98275a7f5660df536fd29b42", "score": "0.6380885", "text": "def post_data\n message=\"\"\n sampling_site_params = { :id => params[:id],:code => params[:code],:name => params[:name],:altitude_types_id => params[:altitude_types_id],:catchment_areas_id => params[:catchment_areas_id]...
7201ada1ab2b5a113155b30fa1a6150b
Obtains a specific entity as defined by the API URL.
[ { "docid": "af09d98aad198d159b39a3ffe700a093", "score": "0.0", "text": "def api_contacts_id_get(id, opts = {})\n api_contacts_id_get_with_http_info(id, opts)\n nil\n end", "title": "" } ]
[ { "docid": "9cf5f277909e5a072b2047469e4fde3a", "score": "0.7781567", "text": "def retrieve_entity(entity_id)\n start.uri('/api/entity')\n .url_segment(entity_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "4bb486766a8961b68a0e5dfa8cabda64", "sco...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "ec7955fddc2e67e8ec92cd20c11390b4", "score": "0.0", "text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @spam_ratio = args[:spam_ratio] if args.key?(:spam_ratio)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.730762", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.7263234", "text": "def update(pr...
1f8f74841c3cf32d46a960933e5c9963
GET /friends/new GET /friends/new.xml
[ { "docid": "649c93bddf41e8c09fe89b971aa2bb60", "score": "0.7616655", "text": "def new\n @friend = Friend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @friend }\n end\n end", "title": "" } ]
[ { "docid": "10ecfd0ba4a4245179616bdd76ac5539", "score": "0.75777817", "text": "def new\n @my_friend = MyFriend.new\n @friends = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_friend }\n end\n end", "title": "" }, { "...
887302df68747b3a370f588a2c565b20
Same function in authentications
[ { "docid": "765e077c2ac07ad885d748dcb64801b4", "score": "0.0", "text": "def authorise\n\t\tif current_user.nil? && current_invite.nil?\n\t\t\treset_session\n\t\t\tredirect_to root_path, alert: \"Authentication failed, please try again.\"\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "989bf074e827af4f9d941d16abb182ff", "score": "0.79389393", "text": "def authenticate; end", "title": "" }, { "docid": "04e65379635e1f61d3b229b5726ee84f", "score": "0.78199625", "text": "def auth; end", "title": "" }, { "docid": "0434a09494de6f3fc1887081409aaadf...
867ab7748ef9cbbfd09dd2f8bd79c285
What words are used (across all roles) for disambiguating the references to this player? If more than one set of adjectives was used, this player must have been subject to loose binding. This method is used to decide when subscripts aren't needed.
[ { "docid": "830b5771e520d0d34a1b2362117f7e91", "score": "0.58570814", "text": "def role_adjuncts matching\n if matching == :loose\n adjuncts = []\n else\n adjuncts = @role_refs.map{|rr|\n [\n rr.leading_adjective,\n match...
[ { "docid": "aa2558697c2bbddca3d65d4c079ebbc4", "score": "0.6442053", "text": "def phraseable_words\n words - COMMON_WORDS\n end", "title": "" }, { "docid": "8339f4738879be047f88128b64001665", "score": "0.5952055", "text": "def word_filter\n [\n { part_of_speech: :noun...
1f18317e7965e7cf76bb2f0a97fcdead
Whether there is Havdala today. This would be Sat. night (except for a Yom Tov night), or Motzei Yom Tov (except for Fri. night).
[ { "docid": "bf623b8ecd9afcba8e0ffd06f4fd36cc", "score": "0.80546016", "text": "def havdala_day?\n # if today is a candlelighting day, then there is no havdala\n return false if candle_lighting_day?\n\n # if today is Sat. night, return true unless it is Yom Tov\n if self.day == 7\n ...
[ { "docid": "a7a13f94efbd1c3553836f7aeb6be20c", "score": "0.7321437", "text": "def first_day_yom_tov?\n # only second day Yom Tov in Israel is Rosh Hashana\n if @israeli\n return @hebrew_month == 7 && @hebrew_date == 1\n end\n case @hebrew_month\n when 7\n # Ros...
0ddd9b42724e698513fd436d76a9ba52
Return a link to this subject with the name
[ { "docid": "64338787b05de456591c3610106b13e3", "score": "0.8113483", "text": "def link_name(subject, options = {})\n link_to subject.name, subject, options\n end", "title": "" } ]
[ { "docid": "33e6965dff813eb0213a261a62b0490d", "score": "0.70980245", "text": "def name_link\n link_to contact_me.name, contact_me\n end", "title": "" }, { "docid": "0efc22c62351da7afbd484ed0aff4d1c", "score": "0.67018265", "text": "def link_name\n name\n end", "title": "...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4991be8643665581a6d2fe9461d12811", "score": "0.0", "text": "def shift_params\n params.require(:shift).permit(:start_time, :end_time, :duration, :notes, :status, :client_id, :caregiver_id)\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...
00abf4cf74d7743d2a9f4a2b2ad2c631
GET /subscriptions/1 GET /subscriptions/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "dc4b430ed038339ec1451d864d71b48a", "score": "0.792047", "text": "def get_subscription(subscription_id)\n request :get,\n \"/v3/subscriptions/#{subscription_id}.json\"\n end", "title": "" }, { "docid": "5c00e186d4e2351fe4e1ad3758a2c93f", "score": "0.7796162", ...
ea37fdbe08cdbbb5ba76dc13065890e6
GET /user_testcase_xrefs/new GET /user_testcase_xrefs/new.xml
[ { "docid": "e67f60f0e69880b31bd0161cfc019259", "score": "0.711028", "text": "def new\n @user_testcase_xref = UserTestcaseXref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_testcase_xref }\n end\n end", "title": "" } ]
[ { "docid": "33d01c172cbbc00b4e5062ed2344e63c", "score": "0.65899485", "text": "def create\n @user_testcase_xref = UserTestcaseXref.new(params[:user_testcase_xref])\n\n respond_to do |format|\n if @user_testcase_xref.save\n format.html { redirect_to(@user_testcase_xref, :notice => 'User...
59cb7b704f0899dafa124300087b6ec2
Method to insert the final score into the highscores array and write to json file
[ { "docid": "9765ef269b08e92f9981fe633c8bedc2", "score": "0.8737687", "text": "def insert_score(final_score, file, highscores, initials)\n # Insert the final score at the correct position in the array\n highscores.insert(find_position(final_score, highscores), { 'name' => initials, 'score' => final_sco...
[ { "docid": "b613b9265ddd998cc489b31c2945d72d", "score": "0.73462254", "text": "def add_score (name, score)\n i = 0\n\n #Insert high score at appropriate location0\n while i < 5 && score < @highscores[i][1]\n i+=1\n end\n\n @highscores.insert i, [name, score]\n\n #Reformat the arra...
82d3b04ec275073b80df965cd7af758f
code your input_to_index and move method here!
[ { "docid": "aeb502c6808275c5ececfaa788e29356", "score": "0.0", "text": "def input_to_index(num)\r\n index= num.to_i\r\n index= index - 1\r\nend", "title": "" } ]
[ { "docid": "d0ce97dab0a46cf77972e63866618177", "score": "0.7908671", "text": "def input_to_index(move_index)\r\n move_index = move_index.to_i - 1\r\n move_index\r\n end", "title": "" }, { "docid": "6dc420db940fb321eabd0288a43a941a", "score": "0.7829489", "text": "def input_to_...
340496af94d54c9873da6dabba51f3c4
At the end of the measurement pipeline, swap out nodes with consistent empty pings
[ { "docid": "028aab67747f489c24b87f1d3d92060f", "score": "0.53603953", "text": "def swap_out_faulty_nodes(srcdst2filter_tracker)\n sources_to_swap = Set.new\n srcdst2filter_tracker.each do |srcdst, tracker|\n next if (SwapFilters::TRIGGERS & tracker.failure_reasons).empty?\n ...
[ { "docid": "60cbd7cedf72c11a5b1a272eccbe7d1f", "score": "0.6569764", "text": "def poll_nodes\n # clear any list of nodes we already know about and start fresh\n @nodes.clear\n transmit Packet::Poll.new\n end", "title": "" }, { "docid": "cd72b291d2efcc2c56434b2d20c3ea0e", ...
4666c9da7ff7ea6c011cf88291ff7f80
Show details of an individual payment method. Show details of an individual payment method. See Account Payment Methods for more info on the properties.
[ { "docid": "c0bf9912c20147610e6871fcf8d77a2d", "score": "0.0", "text": "def get_account_payment_method(account_id, pm_id, opts = {})\n data, _status_code, _headers = get_account_payment_method_with_http_info(account_id, pm_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "6364ae5bb1053406481b426a2f33276f", "score": "0.7171176", "text": "def show\n @payment_method = PaymentMethod.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_method ...
eb1339c29ae4edbd352851bea13d7d37
If forced, it saves it immediately otherwise it is assumed the model is in the process of being saved, and it just sets the attribute. In either case, it force pushes updates to a parent if something has changed.
[ { "docid": "99f798c4654ec4e61fbc10868042f6ec", "score": "0.0", "text": "def around_save_modify_accessible_client_company_ids\n if management_client_company_id_changed?\n # remove ids from old one\n ClientCompany.find(management_client_company_id_was)&.modify_accessible_client_company_ids([]...
[ { "docid": "7cf0d93dfc59596d695788e2057bb820", "score": "0.7466796", "text": "def updateWithParent!\n return self.save!\n end", "title": "" }, { "docid": "e4c029b4544db45e6dc33aa63552cf5d", "score": "0.71722305", "text": "def save_parent\n parent.save! unless parent_saved?...
9b5471c3e500f6431dae1a332bdbcfba
Diz se o sexo passado como paramentro do do genero masculino (true)
[ { "docid": "d4a6878b49684814ff6d465383c2ab85", "score": "0.0", "text": "def masculino?(sexoliteral)\n\t\t masculino = true\n\t\t masculino = false if sexoliteral == \"F\"\n\t\t return masculino\n\t\tend", "title": "" } ]
[ { "docid": "9bfc3421a7d955e6fd9cce192add8988", "score": "0.57024825", "text": "def semestre_params\n params.require(:semestre).permit(:ano, :codigo)\n end", "title": "" }, { "docid": "33c161e02fcb5631c49554620c60a91a", "score": "0.5590347", "text": "def ministrante_params\n ...
cc5ff56abcf160c84544b08fc2842227
Convert note name components into pitch class integer.
[ { "docid": "ad650daf120557b0ab49b26462aef625", "score": "0.593981", "text": "def get_pitch\n 12 * (@octave - 1) + @@letters[@letter] + @@accidentals[@accidental]\n end", "title": "" } ]
[ { "docid": "eadb02fa6e86bb02d726a52fb58954ce", "score": "0.70839536", "text": "def note_name\n note_info(self[:note]).pitch_class\n end", "title": "" }, { "docid": "55a0fe6bcd161d2efbbe94e0648ee6d4", "score": "0.68852466", "text": "def note_to_length(name)\n name.str...
9ddd16baea09cfcb0b86cfd72a35d5e9
POST /private_messages POST /private_messages.json
[ { "docid": "bc4ab2e06f8b8e074eb322e6c7b5ed87", "score": "0.71181947", "text": "def create\n @private_message = current_user.sended_private_messages.build(params[:private_message])\n @private_message[:status] = \"unread\"\n respond_to do |format|\n if @private_message.save\n format.h...
[ { "docid": "8eb666f091b9f12821efb948f07537d0", "score": "0.7225925", "text": "def create\n @private_message = PrivateMessage.new(private_message_params)\n\n respond_to do |format|\n if @private_message.save\n format.html { redirect_to @private_message, notice: 'Private message was succ...
4a769113c76e4b8c8206d6fc04831ccc
name should either be what you already want it to be, or a path to a csv
[ { "docid": "da6bb608f4c887269ab7a9d547e861c4", "score": "0.607866", "text": "def formatted_name(name)\n if name =~ /csv/\n return name.split('/').last.split('.').first\n else\n return name\n end\nend", "title": "" } ]
[ { "docid": "bd09cc5b927185e49e04c84b9cc9b02e", "score": "0.70588166", "text": "def name\n 'CSV'\n end", "title": "" }, { "docid": "9872e213ea8f476ad667fec1f6e03458", "score": "0.6967267", "text": "def create_csv(name_file)\n CSV.open(name_file, \"a\") do |csv|\n c...
27447e7992e0a234be737b13bbf45a9c
print the stats for the corpus test data
[ { "docid": "dc0a701ee6f51ab9975d8d75aca1db93", "score": "0.5720625", "text": "def stats\n easy_ham_files = load_files('easy_ham')\n hard_ham_files = load_files('hard_ham')\n spam_files = load_files('spam')\n\n easy_stats = stats_for(easy_ham_files, :ham)\n hard_stats = stats_for(hard_ham_...
[ { "docid": "a0a6097a3d8790afce53520fd8770c09", "score": "0.6868264", "text": "def print\n print_header\n @pairs.each { |name, path| print_line name, @statistics[name] }\n print_splitter\n\n if @total\n print_line 'Total', @total\n print_splitter\n end\n\n print_code_test_stat...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "966b9e494a5118217f61dcb502e80f51", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_collection_of_object_values(\"...
[ { "docid": "0795eac2a3b746fc7fea6373714e1986", "score": "0.7951372", "text": "def serialize\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": "a126e681346630c4ec3...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0018157c15ea0ea07bfd85ab21d95167", "score": "0.0", "text": "def resume_entry_params\n params.require(:resume_entry).permit(:position, :company, :company_url, :description, :start_date, :end_date, :is_current)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
5bfd739870ec6c55e891cc480f5157d3
show all planet names
[ { "docid": "fd93b659510aaf34156d202a46bc98f2", "score": "0.7453876", "text": "def list_planets\n str = \"\"\n \"Planets orbiting #{@star_name}:\"\n count = 0\n @planets.each do |planet|\n count += 1\n str += \"#{count.to_s}. #{planet.name}\\n\"\n end\n\n # return planet numbe...
[ { "docid": "2c1c850cc9b8ebd543cf2a0b8441acc9", "score": "0.8160502", "text": "def display_planet_names\n planets = []\n @bodies.each do |body|\n planets << body.name\n end\n puts planets\n end", "title": "" }, { "docid": "b8b708ea109db5985671d466425b7981", "score": "0.8...
abc0023f6ceddfc01ef99ed7fb6b7334
Sets the masks applied to the source addresses to determine eligibility for connection reuse.
[ { "docid": "b4e35b3a8943e6a9f1561a13c99ee30c", "score": "0.71836895", "text": "def set_source_mask(opts)\n opts = check_params(opts,[:source_masks])\n super(opts)\n end", "title": "" } ]
[ { "docid": "e63e1456aee839b60287c3e32a975b8e", "score": "0.60863596", "text": "def mask=(new_mask)\r\n new_mask = new_mask.to_s\r\n self.class.migrate(@mask, new_mask)\r\n @mask = new_mask\r\n end", "title": "" }, { "docid": "cb735539f5634339ba1053cbe5f553df", "score": ...
78b2b37cc38d41f60fc52df2a326e13c
Deletes a given comment.
[ { "docid": "ff8892fe28a831b6df4adb6185a87155", "score": "0.7747619", "text": "def delete_comment(comment_id)\n query_rest('delete_comment_ok', :action => :delete_comment, :target_id => comment_id)\n end", "title": "" } ]
[ { "docid": "bdf7de9f57ac08d25f5ddeb1fccccf9f", "score": "0.82442504", "text": "def delete_comment(comment)\r\n self.comments.delete(comment)\r\n comment.delete\r\n end", "title": "" }, { "docid": "fd432fc9c5d08e0f86c870e1fb7d0748", "score": "0.79433334", "text": "def del...
8cf53584c5921ad856e611b24fb3c28b
Two nodes are equivalent if they have the same class and equivalent children
[ { "docid": "883f419149eb2a27ee23fbb4c39a5a04", "score": "0.61344725", "text": "def ==(rhs)\n self.class == rhs.class && self.children == rhs.children\n end", "title": "" } ]
[ { "docid": "c5f1c755c784f7ed961112627217d231", "score": "0.76663196", "text": "def equivalent_nodes(node_1, node_2)\n EquivalentXml.equivalent?(node_1,\n node_2,\n element_order: false,\n normalize_whitespace: true...
2961fa42213ac0b72e595662abae33c0
DELETE /missions/1 DELETE /missions/1.json
[ { "docid": "2a6dabac85ae072e49d2a19c9506ca67", "score": "0.6942577", "text": "def destroy\n #@mission.destroy\n #respond_to do |format|\n #format.html { redirect_to user_path(params['mission'][:user_id].to_i), \n #notice: '任务已成功删除' }\n #format.json { head :no_content }...
[ { "docid": "d806e6a6211d01063debfc3524d45f8f", "score": "0.7562312", "text": "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d806e6a6211d01063de...
c8d9fd608b69155f26484ebf1c53a113
Test that correct default value is set for protected_terms if the list is empty.
[ { "docid": "d5b7247ff66e6d9ca7c1451680eb9c5b", "score": "0.64309645", "text": "def test_protected_terms_empty\n stubbed_method = lambda do |params|\n assert_equal '', params['protected_terms']\n end\n\n @api.stub(:send_request, stubbed_method) do\n @api.send(:transform_plain...
[ { "docid": "b21726c95e7cc7d5e17e7c8d9d4136cb", "score": "0.5932168", "text": "def has_some_terms\n if self.terms.size == 0 && !mp.text_for_cloud.blank?\n errors.add :terms, \"must not be empty\"\n end\n end", "title": "" }, { "docid": "6d651238313fc224ff19213b460a667e", "scor...
69775a925036993373fc7d75eb223fe2
check if the GridConfiguration is filtering on category
[ { "docid": "64b0541433c8b67b95d4c86c7f43ae9c", "score": "0.6906059", "text": "def filtering_on_category?(view_to_copy)\n messages = []\n parsed_settings = JSON.parse(view_to_copy.settings)\n parsed_settings[\"filters\"].each do |filter|\n messages << \"Filtering on Category!\" if filter[\"field\"]...
[ { "docid": "ebc8713c901e6426b9268b6f80259ce6", "score": "0.77962184", "text": "def filtering_on_category?\n\t\t\tmessages = []\n\t\t\tparsed_settings = JSON.parse(@view_to_copy.settings)\n\t\t\tparsed_settings[\"filters\"].each do |filter|\n\t\t\t\tmessages << \"Filtering on Category!\" if filter[\"fiel...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "770d5725a76e964f72abf4ca50e767f9", "score": "0.0", "text": "def set_episode\n @episode = Episode.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;...
3c664a65523c1299b8ce78963fadc1d3
Generates a unique token based on the options
[ { "docid": "88db5bca0269ffc4fd6431eda6a4033c", "score": "0.79997075", "text": "def generate_unique_token\n record, options = true, @has_token_id_options\n conditions = {}\n while record\n token = [ options[:prefix], Digest::SHA1.hexdigest((Time.now.to_i * rand()).to_s)].com...
[ { "docid": "a7a45a35445be41ebe7187d2f6e6bbe9", "score": "0.8004079", "text": "def generate_token(options)\n @otsdk.generateToken options\n end", "title": "" }, { "docid": "6cd9b0b792e68215b0f81902b2011920", "score": "0.7982067", "text": "def generate_token\n self.token = Diges...
d1ea9ce8f922b490fadd054c5321a103
Take the input that was entered, split it and send to be processed
[ { "docid": "75249bd74e146f99edfd11fa629fd2a5", "score": "0.6683902", "text": "def input(command)\n command = command.split(\" \")\n process(command)\n end", "title": "" } ]
[ { "docid": "6fadaf7592e0dd471c2c54d41a19a1f2", "score": "0.81393254", "text": "def process_input(input)\n input.split\n end", "title": "" }, { "docid": "8d8814bb943db32da2d6eb597f070596", "score": "0.7474687", "text": "def process_input original\n split(original)\n ...
08cd28b51a6916e430a5d81d4fd16ef5
syntactic sugar (to be used by DSL) for manipulating the routing table
[ { "docid": "e22ef8c000d6befe95e49bce19dfdfd9", "score": "0.0", "text": "def route(args)\n routes=Routes.instance\n (cmd, pattern, dest, opts)=args\n\n d=URI::parse(dest)\n\n case cmd # route [add|remove]\n when :add\n routes.add(pattern, d, opts)\n when :remove\n routes.remo...
[ { "docid": "deb60ad0dd42a1e7c47c0cae4ed25344", "score": "0.6985197", "text": "def routes=(_arg0); end", "title": "" }, { "docid": "deb60ad0dd42a1e7c47c0cae4ed25344", "score": "0.6985197", "text": "def routes=(_arg0); end", "title": "" }, { "docid": "deb60ad0dd42a1e7c47c0c...
0c22600f4d0b8187d08efc9bbec9987f
Returns a string that looks like: "BEGIN CERTIFICATE\n\nEND CERTIFICATE"
[ { "docid": "aa8e497c772979b5bcf09a2846891529", "score": "0.4999935", "text": "def get_website_cert(host, port=nil)\n port = 443 if port.nil? or port.to_i == 80\n \n `echo | openssl s_client -connect #{hostport} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'`\nend", "title": "" } ]
[ { "docid": "b8b3cc3fa5f7136319031cb3e4551706", "score": "0.7088256", "text": "def build_cert(raw_cert)\n tmp_cert = ['-----BEGIN CERTIFICATE-----']\n cert_contents = if raw_cert.lines.count == 1\n one_line_contents(raw_cert)\n else\n ...
8e0af258a555948daaf42b9bd15a44ca
Parse a given filename. Will raise errors for incorrect format or File exceptions
[ { "docid": "ea7dac620edd526397ff65adb61e0b16", "score": "0.0", "text": "def parse(filename)\n File.foreach(filename) do |line|\n @visits << Visit.new(line)\n end\n end", "title": "" } ]
[ { "docid": "1d25e88b28e14c6b50ee8ea52809f9d6", "score": "0.79359204", "text": "def parse_file filename\n raise Errno::ENOENT unless File.exists?(filename)\n raise Errno::EISDIR if File.directory?(filename)\n native_parse_file filename\n end", "title": "" }, { ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "73ddf9cf041b0d1799bc7c8fb43d2133", "score": "0.0", "text": "def set_chord\n @chord = Chord.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;...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "720fb2dfdd27614da5d354119cf2fac6", "score": "0.0", "text": "def update!(**args)\n @asset_id = args[:asset_id] if args.key?(:asset_id)\n @content_type = args[:content_type] if args.key?(:content_type)\n @id = args[:id] if args.key?(:id)\n @is_partner_upload...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
4e3d636732b86f1fcb174d4e7ac118aa
PATCH/PUT /songs/1 PATCH/PUT /songs/1.json
[ { "docid": "df610390875efb1fb38bd8339159f39a", "score": "0.0", "text": "def update\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was succ...
[ { "docid": "3b1ab44b948e56706b1ca5578070250c", "score": "0.74175227", "text": "def update\n @song.update(song_params)\n respond_with_bip @song\n end", "title": "" }, { "docid": "dd561be3bb89c9ad5681e91b1a0dc845", "score": "0.7392213", "text": "def update\n respond_to do |fo...
8a8f325e7d795ece5aa25398721c3cd9
overridden from parent class
[ { "docid": "4e9f2416c5f1c3a8f3349601e7d8d16c", "score": "0.0", "text": "def one_line_description ; attributes['comments'] ; end", "title": "" } ]
[ { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.83103114", "text": "def override; end", "title": "" }, { "docid": "e6431ff47476c9014fb64198d5853e1e", "score": "0.75541943", "text": "def overrides; end", "title": "" }, { "docid": "e6431ff47476c9014fb64198d5853e1...
167126cb8843a1f02e037f882ff8b547
DELETE /game_professions/1 DELETE /game_professions/1.xml
[ { "docid": "66a27a2107a03da57e24a73f56534c66", "score": "0.73742586", "text": "def destroy\n @game_profession = GameProfession.find(params[:id])\n @game_profession.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_professions_url) }\n format.xml { head :ok }\n en...
[ { "docid": "9d411719a7a27e5d094830a7b36da131", "score": "0.65481323", "text": "def destroy\n @confession = Confession.find(params[:id])\n @confession.destroy\n\n respond_to do |format|\n format.html { redirect_to confessions_url }\n format.json { head :no_content }\n end\n end", ...
71dde482ab4550379821c4f68813c47f
Method to return user hash from SQLite db for specified user
[ { "docid": "576a5a545c61bb98e35d33dadf9b1159", "score": "0.6135703", "text": "def get_data(user_name)\n db = read_db()\n db.results_as_hash = true\n user_hash = db.execute(\"select * from details join images on details.id = images.details_id where details.name = '#{user_name}'\")\n return user_hash[...
[ { "docid": "4d5e50f7ca6ac6137d4861e41dbc8316", "score": "0.80886847", "text": "def get_pwd_hash_from_user(username)\n db.execute(\"SELECT password_digest FROM users WHERE username = ?;\", username)\nend", "title": "" }, { "docid": "3abf21623ab071731397eb6858ec14b5", "score": "0.754371...
ab2ce436bc0a481417a1ab69419de52a
Convert the content in Nokogiri Nodes
[ { "docid": "15243093f3260053b39c51bdbf583a97", "score": "0.54602456", "text": "def page_content_to_html\n html = Nokogiri::HTML(self.page_content)\n end", "title": "" } ]
[ { "docid": "cfc126a53933b75bfa3a6a6901a99a94", "score": "0.6876375", "text": "def process(nodes)\n Array(nodes).map do |node|\n if node.text?\n node.to_html\n elsif node.elem?\n send node.name.to_sym, node\n else\n \"\"\n end\n end.join(\"...
a3c3af5b14eaf49bb7b2be116b804000
GET /inbound_churches GET /inbound_churches.json
[ { "docid": "f108671478a50c2cc21e51ebb97f264b", "score": "0.6617913", "text": "def index\n @inbound_churches = InboundChurch.all\n end", "title": "" } ]
[ { "docid": "87f85198dd60e5fdd3502fb1bd8205f8", "score": "0.57545364", "text": "def incoming_messages\n @direction = [\"incoming\", \"Incoming\"]\n fetch_message(@direction)\n render json: @messages\n end", "title": "" }, { "docid": "dc8585364ae80a7fd191b16841540f99", "score": "...