query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9c766e7cbea1f3fa562b9ea3b2890139", "score": "0.0", "text": "def media_file_params\n params.require(:media_file).permit(:image, :video, :name)\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...
727d71093b21f589da7537eb649d1d43
True if this record has been modified by some mechanism other than a request from the client. Used to send a status back to the client to let them know that they'll need to fetch the latest representation. For example, this flag is used when the user's data is combined with a that their local copy of the record include...
[ { "docid": "f8aeba1225990563fd4e3b510bea023b", "score": "0.734716", "text": "def system_modified?\n @system_modified\n end", "title": "" } ]
[ { "docid": "fa9f3af0fc901d10a6dba7ab00be6feb", "score": "0.8085593", "text": "def modified?\n self.is_modified\n end", "title": "" }, { "docid": "119e86742b132ed18976c4d9dd7e1776", "score": "0.8011797", "text": "def modified?\n @modified\n end", "title": "" }, ...
cb7ec114d5d63ccd966edc399b44820a
Create item (and bib)
[ { "docid": "17e34425962a1c99a8d6acfa063fcd43", "score": "0.76500154", "text": "def create_item\n props = {\n bibIds: [create_bib],\n itemType: 50,\n location: 'os',\n barcodes: [@data[:item_barcode]],\n }\n props[:callNumbers] = [@data[:call_number]] unless (@data[:call_numb...
[ { "docid": "6e2818bf7999f5fe16ec81474f3ac535", "score": "0.7364559", "text": "def create_item(base, meta, contents)\n it = Nanoc::Item.new(contents, meta, base)\n @items << it\nend", "title": "" }, { "docid": "6e2818bf7999f5fe16ec81474f3ac535", "score": "0.7363086", "text": "de...
5a144a3d0e5eac5160031a22adfb6e2b
release 2: bubble sort Pseudocode a sorting method that takes an array of integers and uses a sorting algorithm. The method should return a sorted version of the array. Your pseudocode should not be Rubyspecific. define the method and parameter(s) call method with an array of integers look at the first and second items...
[ { "docid": "67387f201897ca868a89513696e9f362", "score": "0.0", "text": "def bubble_sort(arr)\n sorted = false\n until sorted\n sorted = true\n for i in 0..(arr.length - 2)\n if arr[i] > arr[i + 1]\n sorted = false\n arr[i], arr[i + 1] = arr[i+1], arr[i]\n end\n end\n ...
[ { "docid": "94ab7144f079c8662e384e98b96398df", "score": "0.8136203", "text": "def bubble_sort(array_to_be_sorted)\n n = array_to_be_sorted.length\n (0..n-1).each do |i|\n\t\tj = 0\n\t\twhile j <= n-2-i do\n\t\t\tif array_to_be_sorted[j] > array_to_be_sorted[j+1] then\n\t\t\t\t\tarray_to_be_sorted[j],...
5742f51ed2cf58d0f2c96cab6fb359c7
one for each hypothetical day. It should return a pair of days representing the best day to buy and the best day to sell. Days start at 0.
[ { "docid": "d2d0eb4914698d87a5db0b88c29764ab", "score": "0.73992044", "text": "def stock_picker(days)\n pairs = {}\n\n days.each.with_index do |buy_price, buy_idx|\n days.each.with_index do |sell_price, sell_idx|\n next if sell_idx < buy_idx\n pairs[[buy_idx, sell_idx]] = sell_price - buy...
[ { "docid": "6a2da52aabaedc66f6bfb8749eaab7e7", "score": "0.76018405", "text": "def stock_picker(days)\n buy_day = 0\n maximum = 0\n best_days = []\n\n while buy_day <= days.length\n buy_price = days[buy_day]\n\n (buy_day..days.length-2).each do |possible_sell_day|\n sell_price = days[poss...
7cf3afd2fa3256fc19ae0577b4e6760f
Fire and forget method of sending a command to the command bus If the given command is a bare object, it will be wrapped in a command message before being dispatched on the command bus.
[ { "docid": "de22bc6ed4086fc4d0d73487c8c54954", "score": "0.70903677", "text": "def send(command)\n send_with_callback command, CommandCallback.new\n end", "title": "" } ]
[ { "docid": "406380ff65e11ab0a3daf2d5992a3055", "score": "0.7100422", "text": "def send_command_via_queue(command)\n state.send_command_via_queue(self, command) \n end", "title": "" }, { "docid": "22c61058566b8229597174d684c5794d", "score": "0.7080589", "text": "def s...
517f378d4fda93feda5e797d70c9af7d
Adds up +existing_value+ and +new_values+ if not nill. [parameter:] +existing_value+ _Float_ A value corresponding to a EndUse attribute. +new_value+ _Float_ A value corresponding to a EndUse attribute.
[ { "docid": "f5f7583ccb53e08e0c9e62a8aa1ef9da", "score": "0.6034816", "text": "def add_values(existing_value, new_value)\n if existing_value && new_value\n existing_value += new_value\n elsif new_value\n existing_value = new_value\n end\n return e...
[ { "docid": "626657247c539ee511ccfab32a69a43a", "score": "0.5184546", "text": "def merge_end_use!(other)\n @heating = add_values(@heating, other.heating)\n @cooling = add_values(@cooling, other.cooling)\n @interior_lighting = add_values(@interior_lighting, other.interior_lighti...
8f92235ed57dabb7c79b029c1fee78bc
Tells the technician to gather cuvettes and container
[ { "docid": "9c2966abf82203089e00730f9bc429b8", "score": "0.6830738", "text": "def gather_cuvettes items \n show do\n title \"Gather Plastic Cuvettes\"\n \n check \"Go to the shelf under the plate reader.\"\n check \"Gather #{items.length + 1} cuvettes.\"\n check ...
[ { "docid": "7a890adfc5f6900f8ab692dc521c362b", "score": "0.5347925", "text": "def prepare_equipment\n show do\n title 'Gather materials'\n check 'Fill 2 buckets with ice.'\n check \"Get the 24-well aluminum block out of the 4 #{DEGREES_C}\" \\\n 're...
60bc50742a05c172ad7f4d56202adc69
another function, computes and outputs gromits per wallace
[ { "docid": "b6c4f941b9f82d2993781ea5e850fb2b", "score": "0.6587298", "text": "def gromits_per_wallace(gromits, wallaces)\n puts \"We are cheesing at a rate of #{gromits.to_f / wallaces.to_f} Gromits per Wallace.\"\nend", "title": "" } ]
[ { "docid": "9c9350d0a2eaf4212fcef08ca4345ccd", "score": "0.6213771", "text": "def galoes\n\t\t@tanque/3.785\n\tend", "title": "" }, { "docid": "cfd3e04a8c6b46bded7c202447d9e6d6", "score": "0.5941848", "text": "def funcG(h, m, n)\n kk = [0,0,0,0,0,0,0,0]\n tt = [0,0,0,0,0,0,...
aefd872e187ae14d41880173297dab82
Returns the set of service identifiers.
[ { "docid": "599bba1019a562f0ed88e750c624b0ca", "score": "0.0", "text": "def list\n invoke_with_info(LIST_INFO)\n end", "title": "" } ]
[ { "docid": "b7baf31ffbd5cdae3c8095592fcfa46a", "score": "0.79133797", "text": "def service_ids\n @stashboard.service_ids\n end", "title": "" }, { "docid": "171b49716a17ab34f934b0e15df046f5", "score": "0.76593304", "text": "def service_ids\n SERVICE_IDS[self.class]\n end",...
617a801926ff5b7ef337ed85293798e6
In the case where both arguments given, use an optimized version.
[ { "docid": "a6ba833ebf82fe136d932f5316caaea6", "score": "0.0", "text": "def as_hash(key_column, value_column = nil, opts = Sequel::OPTS)\n if value_column && !opts[:hash]\n clone(:_sequel_pg_type=>:hash, :_sequel_pg_value=>[key_column, value_column]).fetch_rows(sql){|s| return s}\n {}\n ...
[ { "docid": "dae00eddd9062a5b7dba53e0595fd92f", "score": "0.6504555", "text": "def optimize(_src, _dst, options = {})\n fail NotImplementedError, \"implement method optimize in #{self.class}\"\n end", "title": "" }, { "docid": "ffc3cca32cdd0a9809a4664f0922fe30", "score": "0.641899...
c8376773d0b61091c5ce9ddddc8cab79
Get the equation from the user
[ { "docid": "ad2b8b50f3e0865d7266b09d8b3ca1c4", "score": "0.69391346", "text": "def equation\n\tputs \"Enter your equation here:\"\n\tprint \"> \"\n\t\tuser_input = gets.chomp.gsub(' ', '').scan(/\\d+|[+-]|[*]|[\\/]|[(]|[)]|[.]/)\n\t\tuser_input = user_input.map do |x| \n\t\t\tif x == \"0\"\n\t\t\t\tx.to...
[ { "docid": "9f5ce030cdcc163e3a442ff53eb82701", "score": "0.74824476", "text": "def get_equation(n)\n eval \"@yp#{n}\"\n end", "title": "" }, { "docid": "650fd92e53172daa072e7e4c519fd235", "score": "0.74346966", "text": "def working_equation\n default_equation || ''\n...
544c076030d781e6d5b0e916a3deff98
Kaminari defaults param_name to :page, will_paginate always uses :page
[ { "docid": "72770fc9a584b95b740d9ac7b56f9fc8", "score": "0.8686223", "text": "def pagination_param\n Kaminari.config.param_name\n end", "title": "" } ]
[ { "docid": "bb7c0e434385bb3f43aa151565d0134a", "score": "0.81098247", "text": "def pagination_page_param\n WillPaginate::ViewHelpers.pagination_options[:param_name]\n end", "title": "" }, { "docid": "4dbd278d81d7821f5ba52914020c0d4c", "score": "0.7671999", "text": "def page_from_...
4c2ec134451573d7d07ba3ca0e8693b8
GET /masters/residence_messages/1 GET /masters/residence_messages/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "583503392b6de95f980316674d2735fc", "score": "0.6556408", "text": "def show\n message = Message.find_by rsaid: params[:id], id: params[:msgid];\n respond_to do |format|\n format.json {render json: {'message' => message.message}}\n end\n end", "title": "" }, { "doc...
c8ede91caa24bef43bbcb0bfdd09ef78
Internal reference for destroy_document. Override this for alternate implementations of removing the document.
[ { "docid": "9be028f6cd4ccb386f48a35c0b0af832", "score": "0.79918593", "text": "def _destroy_document(opts = {})\n destroy_document(opts)\n end", "title": "" } ]
[ { "docid": "ddf265be88c1108e092898e0ab7ba56c", "score": "0.79782915", "text": "def destroy(document)\n document.destroy\n end", "title": "" }, { "docid": "55f32b7138a4d365acb634ddf4ff9616", "score": "0.7735619", "text": "def destroy\n @document.destroy\n end", "title"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "94a09e23349059087e24abd5c49113fe", "score": "0.0", "text": "def set_device\n @device = Device.where(id: params[:id]).first\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...
f380461f9d8957268ee9a907257af1be
PATCH/PUT /imes/d089hs/1 PATCH/PUT /imes/d089hs/1.json
[ { "docid": "e3968c000c8848635134b68de245226d", "score": "0.6445988", "text": "def update\n respond_to do |format|\n if @imes_d089h.update(imes_d089h_params)\n format.html { redirect_to @imes_d089h, notice: 'D089h was successfully updated.' }\n format.json { render :show, status: :o...
[ { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.66509366", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.6642546", "text": "def put(pa...
fa8af747832883b0dd2fe46c78585607
Challenges that have not been accepted
[ { "docid": "2317b01414dc71aba1ab73a354b9f3b5", "score": "0.7624209", "text": "def pending_challenges\n challenges.where(accepted: false)\n end", "title": "" } ]
[ { "docid": "d4e01a15ce8a7266c8075a94b95429fc", "score": "0.6715374", "text": "def remove_all_challenges\n errors = 0\n @challenges.each do |challenge|\n if not remove_challenge(challenge)\n errors += 1\n end\n end\n return errors\n end", "title": "" }, { "docid"...
9aa70dfcb502fccaab38c460fd6a9fd0
Creates a vizkit plugin object Plugins, whose list is returned by custom_plugins, are created with createPlugin(lib_name, plugin_name) Where +lib_name+ is the name of the plugin library without the "lib" and "viz.so" parts. For instance, a package that installs a library called libvfh_starviz.so will do createPlugin("v...
[ { "docid": "406a5b2be8eb7c386ae20be447f65b03", "score": "0.8093222", "text": "def createPlugin(lib_name, plugin_name = nil, plugin_spec = PluginSpec.new(plugin_name))\n\tpath = findPluginPath(lib_name)\n\tif !path\n\t Kernel.raise \"cannot find lib#{lib_name}-viz.so in VIZKIT_PLUGIN_RUBY_PATH.\"\n\te...
[ { "docid": "242b5f5d4467c7768ad99f98bbbdc50f", "score": "0.68863124", "text": "def create_plugin_plugin\r\n empty_directory(plugin_name + '/plugin')\r\n template('plugin.vim.tt', plugin_name + '/plugin/' + plugin_name + '.vim', config)\r\n end", "title": "" }, { "docid": "ac720a...
f49e0bc0e23dbb52946c8522a4bd4ea9
=============================================================================== Start a trainer battle against one trainer ===============================================================================
[ { "docid": "d50c8ef148a5152e75c31a83b35ca8c5", "score": "0.60824436", "text": "def pbTrainerBattle(trainerid,trainername,endspeech,\n doublebattle=false,trainerparty=0,canlose=false,variable=nil)\n if $Trainer.pokemonCount==0\n Kernel.pbMessage(_INTL(\"SKIPPING BATTLE...\")) if $D...
[ { "docid": "100b709968f5048d69b7af45c789559d", "score": "0.6239193", "text": "def train_first(player1, player2, runs)\n separation\n tateti = Tateti.new\n p1 = 0\n p2 = 0\n ties = 0\n runs.times do\n loop do\n tateti = player1.play_to_learn(tateti, player2)\n break p1 += 1 if !tateti....
d79482f6259c7c9d1d89bf6891ed00a3
POST /knowledges POST /knowledges.json
[ { "docid": "a1896ab30c02d145147c091729407f2d", "score": "0.0", "text": "def create\n @knowledge = Knowledge.new(knowledge_params)\n @knowledge.profile = current_user.profile\n\n respond_to do |format|\n if @knowledge.save\n format.html { redirect_to knowledges_path, notice: 'Knowled...
[ { "docid": "6cffa9126e695912ccf784ae4a2fe952", "score": "0.60486805", "text": "def create\n @knowledge = current_user.knowledges.new(params[:knowledge])\n\n respond_to do |format|\n if @knowledge.save\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully created.'...
0bb8f9078ec7897e22b66d434e8743ae
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
[ { "docid": "ce70fac0c5a8030f996fe73af60dd1c0", "score": "0.71444523", "text": "def smallest_positive_number(num)\n num_arr = (1..num).to_a\n idx = 1\n result_arr = []\n result = 0\n count = 0\n\n while result == 0\n count = idx * 20\n num_arr.each do |i|\n result_arr << i if count%i==0\...
[ { "docid": "e7a2946750884d38d8fc1dd13944e9f2", "score": "0.82911336", "text": "def p5\n puts \"The smallest positive number that is evenly divisible by all of the numbers from 1 to 20 is:\"\n puts (1..20).reduce(:lcm)\n end", "title": "" }, { "docid": "89412a7e4e281c3dabed2d463...
bb52b29fff0fdb9f35d8db411234de65
Returns true if the given pos on the board is nil, else false
[ { "docid": "b9e985044b48dc403de841e7f6a67324", "score": "0.0", "text": "def empty?(pos)\n self[pos] == nil\n end", "title": "" } ]
[ { "docid": "b329060ab447d69c95c71058daeaa5e2", "score": "0.7949353", "text": "def position_taken?(board, pos)\n if(board[pos]==\"\" || board[pos]==\" \" || board[pos]==nil)\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "ca86d0c110ce2e57d93ea9206d62e34f",...
9d98df9f548322ceb02908c67f2b3d53
PATCH/PUT /ruzes/1 PATCH/PUT /ruzes/1.json
[ { "docid": "9bdd84bb403655cd8830782769a6a6a7", "score": "0.6123759", "text": "def update\n respond_to do |format|\n if @ruze.update(ruze_params)\n format.html { redirect_to @ruze, notice: 'Ruze was successfully updated.' }\n format.json { render :show, status: :ok, location: @ruze ...
[ { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6720193", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6720193", "tex...
6d4dbe1ab1775ec66b8934de5094d1df
GET /s3_snapshots/1 GET /s3_snapshots/1.xml
[ { "docid": "7d7b28c96ae23c7eaf041e965a5fcb77", "score": "0.76051", "text": "def show\n @s3_snapshot = S3Snapshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @s3_snapshot }\n end\n end", "title": "" } ]
[ { "docid": "e4750876842ae4de1c11d62f50b927b7", "score": "0.7702756", "text": "def snapshots surl\n bucket_name, path, snapshot = Snapshot.s3url_splice surl\n puts \"from bucket #{bucket_name}, path #{path}\" unless options[:verbose] < 1\n bucket = Snapshot.s3.bucket bucket_name\n ...
78d6f91c2f7a2ea637006eaa9d95e068
Fetch the public key (PEM format) rsa_public_key and dsa_public_key are aliased for backward compatibility
[ { "docid": "90cd67ae9be999853da6854d7baddde1", "score": "0.7604754", "text": "def public_key\n public_key_object.to_pem\n end", "title": "" } ]
[ { "docid": "e178a7afd7ef8dd29e54af2d1ec16678", "score": "0.78142315", "text": "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "title": "" }, { "docid": "e178a7afd7ef8dd29e54af2d1ec16678", "score": "0.78142315", "text": "def public_key\n OpenSSL::PKey.read(pub...
ef811f3eb742e5ac451a567d9ea4a867
Deceive YAML by setting Color value on ivar setter
[ { "docid": "2556ca3549c54f83fdaf01d6386890b7", "score": "0.0", "text": "def instance_variable_set(ivar, value)\n method_name = FROM_YAML[ivar]\n return method_name ? send(method_name, value) : super(ivar, value)\n end", "title": "" } ]
[ { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.68925", "text": "def color=(color); end", "title": "" }, { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.68925", "text": "def color=(color); end", "title": "" }, { "docid": "d2333d4a3f1ccfee5da3315ccac0...
317c2aa28018bf32c51e7d8fc22d2afd
The method below will display each question, each user answer, and each actual answer.
[ { "docid": "885754b8387e784e7ef3231e7e4305fe", "score": "0.7306305", "text": "def display_results\n @score = 0\n @questions.each do |number, question|\n puts \"\"\n puts \"Question #{number}: #{question}\"\n puts \"\"\n puts \"Your answer: #{@user_answers[number]}\"\n gets...
[ { "docid": "f8a4ce12a39ec0eb24c979e5833820aa", "score": "0.71794057", "text": "def display_questions\n @questions.each do |number, question|\n puts \"\"\n puts \"Question #{number}: #{question}\"\n puts \"\"\n option_to_skip_case(number)\n puts \"\"\n end\n end", "tit...
380afccf872d12cf4703fdc3d3cf20c3
DELETE /budgets/1 DELETE /budgets/1.json
[ { "docid": "19f61815ef5e40da5be13a5fdf99e932", "score": "0.80596507", "text": "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "f128646684747725713c9184560358cb", "score": "0.8040027", "text": "def destroy\n @api_v1_budget.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
7a93a4191f1fee37c8f79f1aa68f2257
GET /bio_urls GET /bio_urls.json
[ { "docid": "6418c69b422f0bcaf542f12d810dcb81", "score": "0.71593595", "text": "def index\n @bio_urls = BioUrl.all\n end", "title": "" } ]
[ { "docid": "c75e60ac37a37e941a4cb141a6958622", "score": "0.63385993", "text": "def biography artist\n url = \"http://developer.echonest.com/api/v4/artist/biographies?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\nend", "title": "" }, { "docid": "be1f486184797cc2ac663b0e4fb9c4b0",...
d578c19598b5e519bae99b831ee22907
identical to get_string but does not show as a popup with buttons, just ENTER This is required if there are multiple inputs required and having several get_strings one after the other seems really odd due to multiple popups Unlike, get_string this does not return a nil if Cc pressed. Either returns a string if ENTER pr...
[ { "docid": "7f853752ee67960ce94412df3de0420f", "score": "0.54039335", "text": "def get_line text, config={}\n begin\n w = one_line_window\n form = RubyCurses::Form.new w\n\n f = Field.new form, :label => text, :row => 0, :col => 1\n form.repaint\n w.wrefresh\n while((ch = w.getchar())...
[ { "docid": "22cdae515a07063b996778831eda6d03", "score": "0.6703989", "text": "def input_string prompt=\"Insert: \", maxlen=80\n #ret, str = rb_getstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)\n ret, str = rb_getstr(@form.window, $error_message_row, $error_m...
217b39569f954133b62ef8c8f2c3ff18
PUT /position_metric_points/1 PUT /position_metric_points/1.json
[ { "docid": "2859e229e93c3042d9e027f03b7e0e5b", "score": "0.7818665", "text": "def update\n @position_metric_point = PositionMetricPoint.find(params[:id])\n\n respond_to do |format|\n if @position_metric_point.update_attributes(params[:position_metric_point])\n format.html { redirect_to...
[ { "docid": "6816968c796355500abd36671285b6b6", "score": "0.7362121", "text": "def update\n @position_metric = PositionMetric.find(params[:id])\n\n respond_to do |format|\n if @position_metric.update_attributes(params[:position_metric])\n format.html { redirect_to @position_metric, noti...
9d9182f02affcc47c09042ac931b595a
+uuid+ RFC4122 ver.5 uuid; guaranteed to be universally unique See
[ { "docid": "62a52342905f5285873490fe33f3d06b", "score": "0.0", "text": "def url_uuid\n UUID.sha1_create(UUID_URL_NAMESPACE, self.normalize.to_s)\n end", "title": "" } ]
[ { "docid": "805fd06b2a3609957ba449365d425176", "score": "0.8359999", "text": "def uuid_v4; end", "title": "" }, { "docid": "d5d47794ca8e1ebc301e8bf5ad9102dc", "score": "0.78607494", "text": "def uuid\n char_array = [('a'..'f'), (0..9)].map { |i| i.to_a }.flatten # set an array of ch...
1364fb9c70aea3ad99be98d7ff0800cd
Return the "Natural' property value for the date_property, in this case the date property itself."
[ { "docid": "b37c50e87607f256eec426629dd32ccd", "score": "0.0", "text": "def to_ri_cal_date_or_date_time_value\n self\n end", "title": "" } ]
[ { "docid": "1a829135ccf22a783eff6cebaa0ed346", "score": "0.66798973", "text": "def exdate\n exdate_property.map {|prop| prop ? prop.ruby_value : prop}\n end", "title": "" }, { "docid": "d0caa665d756e78dc65b982fcee40160", "score": "0.64904034", "text": "def getPropertyAsDa...
b5c941d4effda532651267253a77784e
Joins two URIs together.
[ { "docid": "68c0626fcbeebd1b8f8730cc1121d29b", "score": "0.5542878", "text": "def +(uri)\n if !uri.kind_of?(self.class)\n uri = URI.parse(uri.to_s)\n end\n if uri.to_s == \"\"\n return self.dup\n end\n \n joined_scheme = nil\n joined_userinfo = nil\n ...
[ { "docid": "93826ea1378b53e181daffbf38a217b6", "score": "0.7594012", "text": "def join(*uris); end", "title": "" }, { "docid": "93826ea1378b53e181daffbf38a217b6", "score": "0.7594012", "text": "def join(*uris); end", "title": "" }, { "docid": "fdc21001ab62670534476ce3fd32...
b5af566b10f5d7e9eb6be87c0c7d4dd6
Custom windows that use the NSBorderlessWindowMask can't become key by default. Therefore, controls in such windows won't ever be enabled by default. Thus, we override this method to change that.
[ { "docid": "42d026db172bbeafec17bc9bfd4087e1", "score": "0.6928957", "text": "def canBecomeKeyWindow\n true\n end", "title": "" } ]
[ { "docid": "83d13ac8142a7b1c5b2093c46da56cbd", "score": "0.72564095", "text": "def canBecomeKeyWindow\n false\n end", "title": "" }, { "docid": "0a1e9126dcbe57943455838ff87c9610", "score": "0.6097515", "text": "def disable_player_control\n @windows[Menu_Actor].active = false\n...
b813da0774bb5e2ed6973e89f9fb8ce3
GET /regurls/1 GET /regurls/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "d58d76ffb7ec600c34709a8819e19c78", "score": "0.67973673", "text": "def index\n @regurls = Regurl.all\n end", "title": "" }, { "docid": "a6b2defc1d999c59a6b0cb1677d9069c", "score": "0.6021876", "text": "def index\n @urls = Url.all\n\n respond_to do |format|\n ...
55d3b847f7014072a6bde08a3641b263
Return nil at this level, but not at initialize. The reason is not to throw error on `nil.create_activity`, for validation error of target is common case. SimpleActivity should let it pass.
[ { "docid": "013361c4660e47369b43cd8d261f7c60", "score": "0.0", "text": "def save\n if validate_attrs\n Activity.create(activity_attrs).tap do |activity|\n Callbacks.run(activity)\n end\n else\n warning\n end\n end", "title": "" } ]
[ { "docid": "ba6b515c20dcd93e1b28ff01d7675630", "score": "0.65741", "text": "def init_activity(obj)\n if obj.nil?\n logger.error(\"Activity #{self.id}; called init_activity with nil\")\n else\n self.activity_name = obj.class.name\n self.activity_id = obj.id\n end\n end", "tit...
7dc7628c8417f4c5affda88a3bd886e5
slot time of 51.2 microseconds is way too little even 1 second still results in collision growing but it doesn't seem to get to 10 so we'll leave it at that for now
[ { "docid": "90d59817b5ef4bd28afb5e9ea9131d37", "score": "0.7431683", "text": "def slot_time\n #5.12e-5 # you wish\n 1\n end", "title": "" } ]
[ { "docid": "b1e56619d258d3d502d055f596837836", "score": "0.6589997", "text": "def book_slot(time, slots)\n end", "title": "" }, { "docid": "374dda1f84ce58ba03681d194c8c851c", "score": "0.63165855", "text": "def print_slot(time)\n end", "title": "" }, { "docid": "0ef8a8a...
a836b422d69def403b223e952e733a5a
The dispatch method takes a String or a Symbol as an argument and calls the method with the same name. Examples: dispatch(:del) => Will call the `del` method in the current class dispatch("add") => Will call the `add` method in the current class To understand this, read the doc :
[ { "docid": "bab685a834bdd3bd62200da61e1a9709", "score": "0.6409855", "text": "def dispatch(task)\n self.send(task.to_sym)\n end", "title": "" } ]
[ { "docid": "fd829d0f79e4289aee73ac97c70a836f", "score": "0.66448325", "text": "def dispatch(meth, given_args, given_opts, config); end", "title": "" }, { "docid": "035b64f4949204a207444fe01efc8708", "score": "0.66085094", "text": "def dispatch\n base.dispatch\n end", "tit...
e2a926200cd9dfa95cae09bc2f847b21
POST /lab_memberships POST /lab_memberships.xml
[ { "docid": "441c2ee4f080b8b5446c50c0237a5e57", "score": "0.73559225", "text": "def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successf...
[ { "docid": "78c0a695ab47b9186a8c5a1d157bab56", "score": "0.70346457", "text": "def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end", "title": "" }, { "docid": "7534598dd9c5727547576eec5f64595f...
42b3f6cb979b61953491f1ea78be96a2
parser rule argsRest (in Giraffe.g) 169:1: argsRest returns [list] : ( COMMA args | );
[ { "docid": "0759ead7568f2fa7880d4e093baca848", "score": "0.7634322", "text": "def argsRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n return_value = ArgsRestReturnValue.new\n\n # $rule.start = the first token seen before matching\n...
[ { "docid": "84eeb4e87c2dc162e266fa249013db53", "score": "0.76154923", "text": "def argsRest\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n return_value = ArgsRestReturnValue.new\n\n # $rule.start = the first token seen before matching\...
c6b44db25c653c266b3344fff1764f4f
Disable the user or admin account
[ { "docid": "1829323865896eb3a9368cebead2b9d8", "score": "0.6526228", "text": "def disable!\n self.disabled = true\n save\n end", "title": "" } ]
[ { "docid": "39ef33fdd5a823c280bd74d8b2a58279", "score": "0.7923948", "text": "def disable\n @user.suspend!\n respond_to do |format|\n format.html { redirect_to admin_users_path, notice: \"#{@user.full_name} has been deleted.\" }\n end\n end", "title": "" }, { "docid": "c8f2a55...
3d2fc6a3c12158e075c039014535fb20
Admin latestupdates page nb. public home page is homehome
[ { "docid": "969fa0f5dc2b57828f8fcc8b4aa712ce", "score": "0.0", "text": "def index\n @page_collections = Chemistry::PageCollection.order(title: :asc)\n render layout: chemistry_admin_layout\n end", "title": "" } ]
[ { "docid": "b187a6e5ea14f410387c639f0cd4f87a", "score": "0.6834609", "text": "def admin_home\n \n end", "title": "" }, { "docid": "d5ca9adc2b62a8f0fd59be03a9d5e13a", "score": "0.64862245", "text": "def set_admin_home\n\n end", "title": "" }, { "docid": "1c72ff470b9...
ae9ec9925da6256ec30ccf5d54d78058
PUT /digital_content_creator_relationships/1 PUT /digital_content_creator_relationships/1.json
[ { "docid": "12d914d7bf8c2221733fa08fb0851582", "score": "0.6632618", "text": "def update\n @digital_content_creator_relationship = DigitalContentCreatorRelationship.find(params[:id])\n\n respond_to do |format|\n if @digital_content_creator_relationship.update_attributes(params[:digital_conten...
[ { "docid": "6458852d6b99717a838c1361b77ebb79", "score": "0.62363565", "text": "def destroy\n @digital_content_creator_relationship = DigitalContentCreatorRelationship.find(params[:id])\n @digital_content_creator_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to di...
5f9e625f5ca3003e4b518bf784659ea6
we want to omit these columns
[ { "docid": "b98ecded1fa91b8efea09d9ca51e9299", "score": "0.0", "text": "def exclude\n [exceptions, self.class.exclude_always, foreign_key, polymorphic_type].flatten.uniq\n end", "title": "" } ]
[ { "docid": "b522ddb4659d30d72d095e64dcfcb332", "score": "0.7858352", "text": "def columns_without_attr_ignore\n unless defined?(@columns) && @columns\n @columns = columns_with_attr_ignore\n @columns.reject! { |column| ignore_attributes.include?(column.name) }\n end\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9562aab1aef035315106e13943be97db", "score": "0.0", "text": "def owner_type_params\n params.require(:owner_type).permit(:name, :description)\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...
addcdff5c53a30fd37f90f412d5042fa
called when .save is called on an object that has no Handle (i.e. does not already exist in iTunes U)
[ { "docid": "779c3728d82bbb25db85c09f84a13a2e", "score": "0.0", "text": "def create(connection = nil)\n connection ||= self.base_connection\n \n response = Hpricot.XML(connection.process(Document::Add.new(self).xml))\n raise CannotSave, response.at('error').innerHTML if response.at('e...
[ { "docid": "40584d317fda3673dfaff44e08643bfd", "score": "0.6725729", "text": "def save\n save! unless do_not_save\n end", "title": "" }, { "docid": "40584d317fda3673dfaff44e08643bfd", "score": "0.6725729", "text": "def save\n save! unless do_not_save\n end", "title": "" ...
0121bda3c204f1ab92850133a4bc091f
Returns the authenticating client referenced by the consumer key in the given request, or nil if no consumer key was given or if the given consumer key was invalid.
[ { "docid": "ed52cac9eda286e78961d2205c2a7215", "score": "0.5725378", "text": "def authenticating_client\n #return false unless signed?\n @authenticating_client ||= OohAuth::AuthenticatingClient.first(:api_key=>consumer_key)\n end", "title": "" } ]
[ { "docid": "661656c75d49bebb877e4b98192bcaca", "score": "0.62332153", "text": "def consumer_key\n oauth_merged_params[:oauth_consumer_key]\n end", "title": "" }, { "docid": "c9d2036fa8b5f6f6b3d0b78c2d4ec035", "score": "0.5758253", "text": "def get_consumer\n ::OAut...
9054dbe0a36274e883e20221934dc87f
timer / scheduler (usually for the producer) yield returns true to continue looping, else false
[ { "docid": "9b54438695b37e5f6db041e2837606bf", "score": "0.0", "text": "def run_loop(interval, duration: nil, feedback: nil)\n # run the experiment for duration given\n stop = Time.now + duration if duration\n feedback ||= -> (time_took, interval) {\n extra = interval - time_took\n pr...
[ { "docid": "b79c7b1ccc22f2f128c95ab81f1df3b9", "score": "0.7280575", "text": "def loop_wait_before_first_iteration?\n false\n end", "title": "" }, { "docid": "a0b968aab4c711775a661aeb4a7c62a2", "score": "0.7148706", "text": "def loop\n result = true\n\n ...
99eca4a89c8e10712c5a822188ead7a2
filter out repetitive/uneeded fields that tend to get included from entries created via browser plugin: there's always a chance this will rm some fields you actually care about, so enable with caution!
[ { "docid": "49c850d3292dc9d8ec1b7161e2efa07b", "score": "0.0", "text": "def filtered_attrs\n attrs.reject do |k, _|\n kd = k.downcase\n kd.empty? || kd.start_with?(\"html\") || kd.include?(\"remember\") ||\n kd == \"persistent\" || kd.include?(\"tos\") || kd.include?(\"captcha\") ||\...
[ { "docid": "b882de49bb2ea4df048bd775cd7052df", "score": "0.7384636", "text": "def sanitize_fields_excluded; end", "title": "" }, { "docid": "d6f30906dfdbf2b4386e600a5d9a39ca", "score": "0.7362556", "text": "def remove_all_fields\n end", "title": "" }, { "docid": "0557a...
fbe59cefecdf27798305c6c942505094
Returns the value associated to a key, delegating to parent if not found and allowed
[ { "docid": "17bb770a7edf09841a742d8eb95ba682", "score": "0.6356082", "text": "def [](key, delegate = true)\n pairing.has_key?(key) ? pairing[key] : (delegate && parent && parent[key])\n end", "title": "" } ]
[ { "docid": "f80704d9990f54e4113a223d21ca2698", "score": "0.7343593", "text": "def find(key)\n current_and_parent_pair = find_current_and_parent_nodes(key)\n if current_and_parent_pair[:current] \n return current_and_parent_pair[:current].value\n else\n return nil\n end\n end", ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "d6e785d496f1db89852c364933371629", "score": "0.0", "text": "def my_memory_params\n\t params.require(:my_memory).permit(:title, :description, :memory_date, :user_id, :theme_id, :location_id, :image, locations_attributes: [:id, :_destroy, :name, :lat, :log])\n\t end", "title": ...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9ba8f1534e298a2f39c56d0953ffbca9", "score": "0.0", "text": "def set_r72\n @r72 = R72.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61637366", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60446453", "text": "def action_hoo...
0a1ca3dd2764c84109d9e6984bf8e907
this is just a container method to start, made to avoid using example/play.rb
[ { "docid": "fa73a7f9614474ec4992b1faefda0abc", "score": "0.0", "text": "def now\n step_1 #get grid info\n\n sleep 1 #simulating for a little break ;)\n\n step_2 #get human info\n\n sleep 2 #simulating for a little break ;)\n\n step_3 #get computer info\n\n sleep 2 #simulati...
[ { "docid": "399a618fd04286682bd3721f0e44cffc", "score": "0.74898064", "text": "def start\n # TODO\n end", "title": "" }, { "docid": "a1084004f26c85d907ef7471b95afd71", "score": "0.7249278", "text": "def start\n\tend", "title": "" }, { "docid": "e099ea90333103e3bcc...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9d5485a132722e9a5a5691efea62a10f", "score": "0.0", "text": "def set_booking\n @booking = Booking.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;...
fc36679bf2eb0e2e9088d5249a15b4d7
POST /addresses POST /addresses.json
[ { "docid": "2b7d43b124ceeaf1f516509ff2743d1b", "score": "0.6685573", "text": "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { r...
[ { "docid": "b14c211cdde246e4da1972e76459748a", "score": "0.68061566", "text": "def create_and_verify(params = {})\n wrapped_params = {}\n wrapped_params[:address] = params\n\n @client.make_request(:post, 'addresses/create_and_verify', MODEL_CLASS, wrapped_params).address\n end", "title": "...
b5a191c969693d5231e28cf04ad107fc
Sets the resource creating an instance variable
[ { "docid": "9698b32762e2c82019cdf47db4273166", "score": "0.7021343", "text": "def resource=(new_resource)\n instance_variable_set(:\"@#{resource_name}\", new_resource)\n end", "title": "" } ]
[ { "docid": "252375b87d69acc0e659fa5346afee33", "score": "0.8182672", "text": "def set_resource\n\t\tend", "title": "" }, { "docid": "e76bbf1a3d4aa24f8948146ddda620be", "score": "0.81793356", "text": "def set_resource\n instance_variable_set(\"@#{resource_name}\", load_resource)\n ...
37b24132527101d12f12667e1db72e33
GET /cloud_resources/1 GET /cloud_resources/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "20e48bb130fbcb28a42f8e7b4782df00", "score": "0.6921259", "text": "def cloud_resources\n @cloud_resources ||= ::CloudResources.new\n return @cloud_resources\n end", "title": "" }, { "docid": "6080915b41bfde5f542a7e1cf294bc66", "score": "0.6582551", "text": "def get(...
da81067a249aae386f5cd0aa1dabf3ef
Finds all commits belonging to a dataset with an edit to the given key.
[ { "docid": "d49007a304f4199af08a4d454c6dd8df", "score": "0.8118308", "text": "def find_commits(dataset, edit_key)\n dataset.commits\n .joins(:dataset_edits)\n .where(dataset_edits: { key: edit_key })\n .order(updated_at: :desc)\n end", "title": "" } ]
[ { "docid": "fc621928c6365ced4143e992171bba14", "score": "0.81515485", "text": "def find_commits(dataset, edit_key)\n dataset.commits\n .joins(:dataset_edits)\n .where(dataset_edits: { key: edit_key })\n .order(updated_at: :desc)\n end", "title": "" }, { "docid": "fc621928c...
968256d9847467bad7ff48cb4d932a6e
nice succinct code found here:
[ { "docid": "d588273bfc4904023a16ca58a4d3f6d9", "score": "0.0", "text": "def hasDupes(a)\n return a.uniq.length == a.length\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.5905936", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.58944815", "text": "def probers; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", ...
5dae5e5f0abfc851ab70c725deec433c
PATCH/PUT /metrics/1 PATCH/PUT /metrics/1.json
[ { "docid": "d9dbfe82fc9967c40798453be13b21c1", "score": "0.69217116", "text": "def update\n respond_to do |format|\n if @metric.update(metric_params)\n format.html { redirect_to @metric, notice: 'Metric was successfully updated.' }\n format.json { render :show, status: :ok, locatio...
[ { "docid": "15c52c322f4ccb65e4f8e7eed5820e32", "score": "0.72264653", "text": "def update\n @metric = @idea.metrics.find(params[:id])\n\n if @metric.update_attributes(params[:metric])\n render json: { text: \"success\"}\n else\n render json: { text: \"fail\"}\n end\n end", "ti...
089b57c4dbbbe1cdea01711fec593559
def render_stars_from_rate (rating = 0) (1..10).map do |i| if rating.round == i radio_button_tag "rating", i, true, :disabled => read_only else radio_button_tag "rating", i, false, :disabled => read_only end end end
[ { "docid": "de5f9bcb55f95cfae72f761f592c2548", "score": "0.0", "text": "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_asc_or_desc}\" : nil\n direction = column == sort_column && sort_asc_or_desc == \"asc\" ? \"desc\" : \"asc...
[ { "docid": "5745348532e6dda85734aff14e6fca9d", "score": "0.85296947", "text": "def render_stars (object_to_star, read_only = false, rate = nil)\n# field_set_tag nil, :class=> \"stars\" do\n if object_to_star then\n rating = object_to_star.average_rating||0\n else\n rating = ra...
038c37ebb42591a2f4bff14e91a425a3
Override rails default render action to look for a branded version of a template instead of using the default one. If no override exists, the default version in ./app/views/[:controller]/[:action] will be used The path in the app/views/branded/ directory must match the the file it is replacing. For example: app/views/b...
[ { "docid": "99a12948b272fab42cffe37a8ba8bb5a", "score": "0.59071714", "text": "def prepend_view_paths\n prepend_view_path \"app/views/branded\"\n end", "title": "" } ]
[ { "docid": "ec3ddd4d8366f9c04cccdf69ad6ea679", "score": "0.70326585", "text": "def default_render\n @renderit_template ||= RenderIt.get_template_name(request)\n template_path = default_template_name + '_' + @renderit_template\n if view_paths.find_template(template_path, default_template_f...
792e910bb2e7de8534534b21dc008c4e
Returns boolean response about whether this instance is in a lit state. Cycling through the faded steps is considered not lit.
[ { "docid": "fb895ce82050b1db781c65be30b442fa", "score": "0.6578889", "text": "def is_lit?\n return @pulseStep < @pulse\n end", "title": "" } ]
[ { "docid": "b6b1b2c90cfa4ee012cd50354bc9fd36", "score": "0.6663029", "text": "def halted?\n power_state == \"Halted\"\n end", "title": "" }, { "docid": "0df526d305daa69abefa2fad0714e28c", "score": "0.64760906", "text": "def solved?\n @light_state.count(true) == 0\n end", ...
ec56234d3c12d2ea89faca1a7ff76adf
one too many 'end'
[ { "docid": "5e99385d00fe839041d1de3686aedbd4", "score": "0.0", "text": "def looper\n for i in 1..10\n puts i #needs an indent\n end\n # needs to return the final result of the loop to fulfil the test.\nend", "title": "" } ]
[ { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.73886913", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.73886913", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "sc...
bc39c7b2addeb6183dfcaaa018e61fba
GET /votes GET /votes.json
[ { "docid": "e5ccdb20ef67208aee606eaa6dab77ae", "score": "0.5991147", "text": "def index\n @votes = Vote.all\n if params[:poll]\n @poll = Poll.find(params[:poll])\n if Vote.find_by_ip_and_poll_id(request.remote_ip, @poll.id) == nil\n redirect_to \"#{new_vote_url}?poll=#{@poll.id}\"...
[ { "docid": "9ba722e79a826849b743b3bfe76c15f9", "score": "0.84528613", "text": "def votes(options = {})\n get('/votes', options)\n end", "title": "" }, { "docid": "bbf2f9ba4a189cbdfa6bc9c10a56b7cb", "score": "0.7669005", "text": "def getvotes\n @the_question = Question.find...
2435816752ff0fe2bc1c8a1dd2a75db0
def select_appt_by_date puts "You can search for appointments booked by date."
[ { "docid": "706f5ad91c4617c59a5681ed1a648ed0", "score": "0.5823872", "text": "def next_appointment\n\n puts \"Please see your next appointment:\"\n\n @new_patient.my_next_appointment\n\n search_appointments\n\n end", "title": "" } ]
[ { "docid": "e1c0fbb89a8405f40074cadcd089917d", "score": "0.68506783", "text": "def view_doctor_appointments(db, doctor_name_or_id)\n appointments = db.execute(\"SELECT patients.name, patients.next_appt FROM patients JOIN doctors ON patients.doctor_id=doctors.id WHERE doctors.id=? OR doctors.name=?\", [...
fcf7fcd343ca2143875b60f3c712001c
Remove a entry object from the collection
[ { "docid": "e79b3bd9c6bf717e778b760e4431792e", "score": "0.70856035", "text": "def remove(argument)\n @collection.delete_if { |f| f == argument }\n end", "title": "" } ]
[ { "docid": "eafebd675388533b22f1c3397b9e00a9", "score": "0.8408751", "text": "def remove(entry); end", "title": "" }, { "docid": "4536f45d49265ec5c15b91729469f99b", "score": "0.8095166", "text": "def remove entry\n @db.find(entry).status = :removed\n end", "title": "" }...
f6fb3d8c26e922a0a9d9b83eb6e73a75
Does My List Include This? exercise Small Problems exercises from LaunchSchool
[ { "docid": "6e64b71158f7825f2152931e8e81a038", "score": "0.0", "text": "def include?(arr, value)\n index = 0\n while index < arr.length\n return true if arr[index] == value\n index += 1\n end\n false\nend", "title": "" } ]
[ { "docid": "4a8d16f5e67e23aa7b73946ac317228b", "score": "0.59961885", "text": "def exercise_list\n #list=\"\"\n #exercises.each do |e|\n #list += e.name\n #if e != exercises.last\n # list += \", \"\n #else\n # list += \".\"\n #end\n #end\n...
34761d72cb151af38bd1f0e28f0becea
Spawns a longrunning section of code and returns the ID of the spawned process.
[ { "docid": "513301236db3183499a7379e3177b9a9", "score": "0.0", "text": "def initialize(options={})\n self.handle = fork_it(options) { yield }\n end", "title": "" } ]
[ { "docid": "030aae2be7e8e242d7b346694ba54670", "score": "0.64836776", "text": "def spawn\n # TODO(sissel): Do this in a platform-safe way (ruby, jruby, etc)\n @pid = ::Process.fork do\n begin\n run \n rescue => e\n puts :CHILDERR => e\n end\n exit 0\n end\n en...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "16d2cf39a29650eb1a13ccac5ac8d00b", "score": "0.0", "text": "def courier_request_params\n params.require(:courier_request).permit(:weight, :service_type, :cost, :payment_mode, :status, :sender_fullname, :sender_address, :sender_phone, :sender_pincode,\n ...
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6949516", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.68133247", "text": "def strong_params\n params.require(:listing_member).permi...
674050ebab2bfff045682ffc67cfe063
finds eighenvector and eighenvalue given Marix a initial lambda value (eighenvalue) initial x value (eighenvector) precission
[ { "docid": "bf80ef240cbf35f0124447734288925c", "score": "0.6976068", "text": "def eighenvector(a, lambdak, xk, e)\n # make sure diff is > e\n diff = e + 1\n\n # make initial values for yk1\n yk = [0]*a.size_y\n\n # cycle counter\n i = 0\n\n while diff > e do\n # (A - lambdak ...
[ { "docid": "36cd1328598ad8a6047c77e4355eb220", "score": "0.5991145", "text": "def find_eigenvector\n apr = gen_approximation\n begin\n old_apr = apr\n apr = self * apr\n end while (!old_apr.good_enough?(apr))\n apr\n end", "title": "" }, { "docid": "87c789b45410f6f0c5e...
2a8fd55a4d210e6b9d17529891edf479
1. What is the line number where the error occurs? => The error is on line 87. 2. What is the type of error message? => It's an argument error but a 0 for 1 argument error. 3. What additional information does the interpreter provide about this type of error? => Wrong number of argument (0 for 1) 4. Where is the error i...
[ { "docid": "3fb4fb33be420068795166bb5045303e", "score": "0.0", "text": "def cartmans_lie(lie, name)\n puts \"#{lie}, #{name}!\"\nend", "title": "" } ]
[ { "docid": "913ecd4067d7203cfadb64a231a628bf", "score": "0.67153883", "text": "def cartman_says(offensive_message)\n puts offensive_message\nend", "title": "" }, { "docid": "913ecd4067d7203cfadb64a231a628bf", "score": "0.67153883", "text": "def cartman_says(offensive_message)\n put...
4e1537b56949a37dbdc8aafae367bd6b
Returns true if some events are queued
[ { "docid": "972d086adba8597899f9cd9c0ca90a53", "score": "0.8295222", "text": "def has_queued_events?\n !@propagation.empty?\n end", "title": "" } ]
[ { "docid": "2fd618510f9635848908709aca0237da", "score": "0.7808109", "text": "def has_pending_events?\n\t\treturn self.pending_event_count.nonzero? ? true : false\n\tend", "title": "" }, { "docid": "3857b7fbcf7aa355e3a6d5c281e3f9fc", "score": "0.75087607", "text": "def queued_message...
6c65a1cedae960fc71b67bae648b62db
List notifications for a specific thread
[ { "docid": "cbb5a7e0a5c1b2ba8a86d0360f205cb1", "score": "0.7286618", "text": "def thread_notifications(thread_id, options = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "f64da52e98bbb2c3a0a683ef1784e5d9", "score": "0.7568806", "text": "def thread_notifications(thread_id, options = {})\n get \"notifications/threads/#{thread_id}\", options\n end", "title": "" }, { "docid": "a4c6029e1ad29d30b594e25bf082ead4", "score": "0.68705714", ...
4c84006e513500e194fe6507029d879e
Migrate leads from the ORS app to all Local Leads Apps
[ { "docid": "37ff12132a2848ec69ce3ac38d3e10c8", "score": "0.635451", "text": "def ors_to_local\n puts(self.class.name + '.' + __method__.to_s + ' - ' + Time.now.utc.to_s)\n models_list = @ors.find_ors_to_local_lead\n models_list.each do |national_ors|\n sleep(3600) unless $podio_flag == tru...
[ { "docid": "05359e288d85952a7bcaec2958246de0", "score": "0.57693213", "text": "def migrate_all\n d1_accounts = DataMapper.repository(:daitss1) { ACCOUNT.all }\n d1_accounts.each do |act|\n act_prjs = DataMapper.repository(:daitss1) { ACCOUNT_PROJECT.all(:ACCOUNT => act.CODE) }\n \n ...
5c801c844dd80ad5fb62ee219b24a02d
Creates the session though twitter oauth
[ { "docid": "564752f7e195630f7e356d1935329760", "score": "0.0", "text": "def create\n omniauth = request.env[\"omniauth.auth\"]\n credentials = omniauth['credentials']\n\n if current_user && current_user.twitter_linked?\n # The user is logged in and he already linked his account in the past...
[ { "docid": "b883e8fc170bdffb83b2d8b2d752404b", "score": "0.75355726", "text": "def create_twitter_oauth\n puts 'params=' + params.inspect\n @request_token = session[:request_token]\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n ...
311fdedfeca3bd626fe32555384d6182
Set workbook background image.
[ { "docid": "291197b9d0234fd988db157aed56cd5d", "score": "0.0", "text": "def cells_workbook_put_workbook_background_with_http_info(name, png, opts = {})\n warn \"Warning: #cells_workbook_put_workbook_background_with_http_info() is deprecated.\"\n if @api_client.config.debugging\n @api_cl...
[ { "docid": "65c764a6a5463dfca5a04b1d037d612f", "score": "0.7590959", "text": "def set_background(image)\n raise \"Couldn't locate #{image}: $!\" unless File.exist?(image)\n\n @background_image = image\n end", "title": "" }, { "docid": "435c3df21489fde5e74180daa50a3f84", "sco...
9fc5a2cf424d9cd73692044bad459ad4
DELETE /room_users/1 DELETE /room_users/1.json
[ { "docid": "34d5a2c6982c958d2deaab52ccae3d92", "score": "0.0", "text": "def destroy\n\t\tif @room_setting.owner == current_user\n\t\t\toutput = {\"type\": \"delete\", \"content\": @room_setting}\n\t\t\t@room_setting.destroy\n\t\t\thead :no_content\n\t\t\tRoomChannel.broadcast_to @room_setting, output\n\...
[ { "docid": "4e0bb0ebe24f3d4c427d2c638f83e36a", "score": "0.7645122", "text": "def destroy\n @user = User.find(params[:id])\n @user.rooms.destroy_all\n @user.destroy\n\n render :json => {message: \"Success\"}, status: :ok\n end", "title": "" }, { "docid": "941d7c97784bbd056273339...
ccbd47eac7a609a9040e21efd944ea44
GET /recipes/1 GET /recipes/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "af6ec53ba13a068dc8155bbc36de0ced", "score": "0.79409945", "text": "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "title": "" }, { "docid": "7d28fd8...
d4f8c7909d8abe1c53a6ac4076d4acf2
PATCH/PUT /vendortransactions/1 PATCH/PUT /vendortransactions/1.json
[ { "docid": "553fca37a13e8436c886ea611a73d9a1", "score": "0.62573195", "text": "def update\n respond_to do |format|\n if @vendortransaction.update(vendortransaction_params)\n set_formatted_dates()\n\n ids = params[:invoices]\n ids = ids.split(\",\")\n balances = params...
[ { "docid": "7a8ef00d5c86866bf468b7a681d9ffe4", "score": "0.6223494", "text": "def update\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n respond_to do |format|\n if @transaction.update_values(transaction_...
41f4a124cbc24af82b33c69724fe15ee
NOTE: can only draw 0..98 chars at once
[ { "docid": "78a1392bf2577fecef14e2d1bbd2fa4f", "score": "0.0", "text": "def draw(astr = nil, ax = nil, ay = nil, awrap_x = nil, awrap_y = nil)\r\n self.str = astr if astr\r\n self.x = ax if ax\r\n self.y = ay if ay\r\n self.wrap_x = awrap_x if awrap_x\r\n self.wrap_y = awrap_y if awrap_y\...
[ { "docid": "d3617280c53293a95693a5a73e352e28", "score": "0.75418645", "text": "def large_char(char:, x: -10, y: -10, clr: nil)\n y = @y if y == -10\n x = @x if x == -10\n save_x = x\n save_y = y\n set_pos(x: x, y: y) \n @fcolor = clr if clr \n \n if x > -1\n put_str(x: x-1, ...
73603a05c644022148428f72bd7c3337
before_save :ensure_gigabytes_set def ensure_gigabytes_set self.number_of_free_gigabytes ||= 10 end
[ { "docid": "f8b53b08994de2d19746dfadeb48334c", "score": "0.56124884", "text": "def number_of_free_gigabytes\n if plan_id == 'pro'\n 100\n elsif plan_id == 'basic'\n 10\n else\n 1\n end\n end", "title": "" } ]
[ { "docid": "32c168013f7a13e5487140ac5920868e", "score": "0.66958576", "text": "def set_capacity\n self.capacity ||= 100\n end", "title": "" }, { "docid": "8c8e238450db38ee0d94fb0346ba2aa9", "score": "0.60936487", "text": "def site_creation_default_storage_limit_in_m_b=(value)\n ...
3267e8c4fad4f4bbddbf2a2eb13ba5ee
DELETE /men_fashions/1 DELETE /men_fashions/1.json
[ { "docid": "e1604a5893ac3e124d30b509c6ccc533", "score": "0.7294195", "text": "def destroy\n @men_fashion = MenFashion.find(params[:id])\n @men_fashion.destroy\n\n respond_to do |format|\n format.html { redirect_to men_fashions_url }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "876c8e06bd10b22913d92f9e6c148c87", "score": "0.7072541", "text": "def destroy\n @dish_menu.destroy\n respond_to do |format|\n format.html { redirect_to edit_cafeteria_menu_path(@dish_menu.menu.cafeteria, @dish_menu.menu), notice: 'El plato se eliminó del menú.' }\n format.jso...
1ff649e8fd85be82933834b7331fc0a0
require 'active_record' require 'factory_girl' require File.expand_path(File.dirname(__FILE__)) + '/../models/example.rb' require_relative 'factories' require 'accept_values_for' require 'securerandom'
[ { "docid": "1314ae832d9130ef1c276439a16a2da0", "score": "0.0", "text": "def app\n Sinatra::Application\nend", "title": "" } ]
[ { "docid": "72a651f827a8c807d43beca1ce838069", "score": "0.6936586", "text": "def load_factory\n begin\n require \"faker\"\n require \"factory_girl\"\n Dir.glob('test/factories/*_factory.rb').each { |file| require file }\n #puts \"Factory_girl loaded.\"\n rescue LoadError => e\n puts \"...
6ec29a794c341117e138c12fa1397c13
The first method uses Arrayfind_index to scan the array for the first element that has the specified value. find_index returns the index number of the found element, which will always have a truthy value, or nil if no such element is present. We then use !! to force the return value to true or false in accordance with ...
[ { "docid": "f7279e1efb3c09140e4b30048250df57", "score": "0.7896539", "text": "def include?(array, value)\n !!array.find_index(value)\nend", "title": "" } ]
[ { "docid": "8311b643a9e94b072c2af8d90cb480e2", "score": "0.7982888", "text": "def include?(array, value)\n # https://ruby-doc.com/core-2.7.2/Array.html#method-i-find_index\n !!array.find_index(value)\nend", "title": "" }, { "docid": "3c90db5c7bf9a94fa9d5305e9512db37", "score": "0.71274...
3726312f157f89ddc9b0f0f00084caa0
POST /suits POST /suits.json
[ { "docid": "a77f528377e7a1519f6f348fabea3ee9", "score": "0.6112361", "text": "def create\n @suit = Suit.new(params[:suit])\n\n respond_to do |format|\n if @suit.save\n format.html { redirect_to @suit, notice: 'Suit was successfully created.' }\n format.json { render json: @suit,...
[ { "docid": "9818acf4e95978425a2bf037f7a17d70", "score": "0.6080366", "text": "def create\n @suit = Suit.new(suit_params)\n\n respond_to do |format|\n if @suit.save\n format.html { redirect_to @suit, notice: 'Suit was created.' }\n format.json { render :show, status: :created, lo...
3a9b25387f065e2c8143cfa7ca56c165
Directories and Files file__tsv_output_file
[ { "docid": "065189992ca559431f122523d5e09942", "score": "0.80572355", "text": "def file__tsv_output_file\n\n return File.join( directory__stream_outputs( @cdsl ), name__tsv_output_file )\n\n end", "title": "" } ]
[ { "docid": "6f493f1277c955d1f041522d85abffec", "score": "0.7184137", "text": "def tsv_output\n delimited_output(\"\\t\")\n end", "title": "" }, { "docid": "f8a23611c46e7e5a7ed6d699652426ea", "score": "0.67725164", "text": "def to_tsv(file, opt={})\n delimiter = \"\\t\"...
b7869a958b41a921d4a39ab8f9d130bd
Insert a value into the tree Returns nil
[ { "docid": "2b707d9aec3ae7817a57e66349b93958", "score": "0.0", "text": "def insert(insert_value)\n if left_child.nil?\n self.left_child = BinaryHeap.new(insert_value)\n elsif right_child.nil?\n self.right_child = BinaryHeap.new(insert_value)\n else\n left_count = left_nodes.count...
[ { "docid": "3d3b339d55329ce1cac5434973485c83", "score": "0.83688784", "text": "def insert(value)\n return @root = TreeNode.new(value) if !@root\n find_insert_position(@root, value)\n end", "title": "" }, { "docid": "3c81e4c24edce71a8bb499db30a972dd", "score": "0.8363743", "tex...
4ad18f3433fbff0c242515b1d8aa04cb
GET /fuel_tanks/1 GET /fuel_tanks/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "96a8bfae5a9ad1d61523794f25c7e4bf", "score": "0.71758443", "text": "def index\n @tanks = Tank.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tanks }\n end\n end", "title": "" }, { "docid": "4a967d880e23a1831a710ad55a...
1d873e5e880658bcd0c3d16ac55998ed
POST /bookmarks POST /bookmarks.json
[ { "docid": "5b7fb0468e876472611d02cfcfdefd60", "score": "0.7053024", "text": "def create\n @bookmark = Bookmark.new(bookmark_params)\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.json...
[ { "docid": "add5ada2b67e9fc846994a651b3786eb", "score": "0.7601388", "text": "def create\n @bookmark = Bookmark.new(params[:bookmark])\n# req = ActiveSupport::JSON.decode(request.body)\n# @bookmark = Bookmark.new(req)\n\n respond_to do |format|\n if @bookmark.save\n format.html {...
ab4e87a9716a10ed54e68d19b9b6950b
Returns a hash fei => variable_hash containing all the variable bindings (expression by expression) of the process instance.
[ { "docid": "98a995759cc5dce442a935969a8c582c", "score": "0.6445491", "text": "def all_variables\n\n return nil if @expressions.empty?\n\n @expressions.each_with_object({}) { |exp, h|\n h[exp.fei] = exp.variables if exp.variables\n }\n end", "title": "" } ]
[ { "docid": "68483d2a8a6e059b71202a1b2e4dfc9e", "score": "0.70748675", "text": "def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end", "title": "" }, { "docid": "47d5b0b52f24d72ee9023a7ea5555f20", "score": "0.70074135", ...
b0446c890d8f15d78ec338154394dd7c
Used to compare if two nodes are the same
[ { "docid": "811f9668a9e99e3a13b35960166c04c5", "score": "0.0", "text": "def ==(other)\n other.id == @id\n end", "title": "" } ]
[ { "docid": "46a8d01b5cbaada4a6c9c568ffa2c99d", "score": "0.7868131", "text": "def eql?(other_node)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "5e6a870b233e4ce307d75b5db255a099", "score": "0.77651536", "text": "def equal_nodes?(nod...
fab30a18e0e2d82752fa04dbc87bee17
Need to create a search action in case user hits enter on the live_search box, or else disable hardsubmit on the form.
[ { "docid": "449c4d7f9ccb69caa77454758e0f6035", "score": "0.5822369", "text": "def live_search\n restrict('allow only store admins') or begin\n @phrase = (request.raw_post || request.query_string).slice(/[^=]+/)\n if @phrase.blank?\n render :nothing => true\n else\n @sqlph...
[ { "docid": "4611c3110a5813f4aaaab59519649c05", "score": "0.6539231", "text": "def global_search(arg)\r\n first_time_popup_close\r\n driver.find_element(:id, \"keywordsearch-input\").send_keys arg\r\n driver.find_element(:id, \"keywordsearch-button\").click\r\n end", "title": "" }, ...
1b9e588f4855ab6919b423b7088e8657
doc = Nokogiri::HTML(open(" doesn't want to work ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ALL TEAM LINKS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[ { "docid": "b6389e11b125c5525cc9253c08420481", "score": "0.0", "text": "def get_team_homepage()\n\tteamMenu = @doc.css(\"div#teamMenu\")\n\tteams = [];\n\tteamMenu.children.each do |team|\n\t\tteams<< team\n\tend\n\n\tteams.each do |team|\n\t\tputs team.attributes['href'].value\n\tend\n\n\treturn teams\...
[ { "docid": "29cf2b6cffad9b134de62b85f6ae7a54", "score": "0.6451902", "text": "def parse_html(user,parent_dagr)\n url = \"\"\n url += parent_dagr.storage_path + \"/\" + parent_dagr.name\n puts url\n page = Nokogiri::HTML(open(url))\n \n return_string = \"\"\n #add all video and adeo ...
14b491b7cd05de28a60d12d9631df2f1
returns all the attributes, the ruby class and the _id and _rev of a model as a Hash
[ { "docid": "39ca88d23c7ceca85dfdb5789834a8e2", "score": "0.0", "text": "def to_hash\n (self.class.properties).inject({}) do |props, property|\n property.serialize(props, self)\n props\n end\n end", "title": "" } ]
[ { "docid": "0f9c2f62758ea854c421382edad7519d", "score": "0.7257177", "text": "def to_h\n {\n model: @model.name,\n attributes: @attributes\n }\n end", "title": "" }, { "docid": "6c0a6baeba7e56861a697568761ad595", "score": "0.72488046", "text": "def attribut...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "acca52a5133857d08c109f092e4d2e21", "score": "0.0", "text": "def set_pracownicy\n @pracownicy = Pracownicy.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...
96ef725f9ff722e1f7040985e48ace24
An alias to `==`.
[ { "docid": "efc962be1f2a1879e8c78e2edc45b6a0", "score": "0.711207", "text": "def eql?(t)\n self == t\n end", "title": "" } ]
[ { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.879938", "text": "def ==(*) end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.879938", "text": "def ==(*) end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "scor...
8176b3dbda2d854d63653ca1f42a2111
Handles matching for noncollection values, including the logic behind the wildcard Any. In the case of a collection, defers instead to match_enumerable.
[ { "docid": "ca73d7510ae7884c10aae0b7301e126a", "score": "0.5202395", "text": "def match_item(from_self, from_other)\n if Any == from_other\n true\n elsif Enumerable === from_other && Enumerable === from_self\n match_enumerable(from_self, from_other)\n else\n from_othe...
[ { "docid": "9bb3ad410382d85e253e31afa06c3225", "score": "0.647419", "text": "def match(v, rest = nil)\n if v.is_a?(Array)\n _match_array(v, rest)\n else\n super(v)\n end\n end", "title": "" }, { "docid": "d25be7770d7b30d1c9a97ec3ab06efa...