query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
3d153504479f42513b685d289db05788
Create an SLFT return menu item
[ { "docid": "1fc892cc7fae96d0b087e2838f94bca1", "score": "0.69878584", "text": "def create_slft_return_item\n [{ name: t('.slft_return'), link: returns_slft_summary_path(new: true),\n current?: request.path.include?('returns/slft') }]\n end", "title": "" } ]
[ { "docid": "257673aab412344887694efa06db7ca8", "score": "0.72004837", "text": "def create_lbtt_return_item\n [{ name: t('.lbtt_return'), link: returns_lbtt_return_type_path(new: true),\n current?: request.path.include?('returns/lbtt') }]\n end", "title": "" }, { "docid": "457...
8ca04e8235640d99eb37b1501d2f2158
Uses JavaScript to select the option whose text matches the given string.
[ { "docid": "72d09d216703c2971592af9cfb83a4a4", "score": "0.0", "text": "def select!(*str_or_rx, text: nil, value: nil, label: nil)\n key, value = parse_select_args(str_or_rx, text, value, label)\n\n if value.size > 1 || value.first.is_a?(Array)\n value.flatten.map { |v| select_by! key, ...
[ { "docid": "ecf68c8eebdd916821fe436d5c58d5a5", "score": "0.7271758", "text": "def select_text(str)\n element_call { execute_js :selectText, @element, str }\n end", "title": "" }, { "docid": "6cf36b6c113394fe7c9aa6ab7290b84a", "score": "0.7040158", "text": "def select_text(tex...
0d6c5823633eced8b64d58606d457fcc
Build up writes and only write once
[ { "docid": "6d53b407b59c29023cb25c986f707949", "score": "0.56243604", "text": "def buffer &writes\n begin\n buffer_on!\n writes.call\n ensure\n buffer_off!\n end\n flush_buffer!\n end", "title": "" } ]
[ { "docid": "7a23843231a2e9e17b87272f45c4a33b", "score": "0.66572964", "text": "def make_fresh_writelist\n @to_write = {}\n @data.keys.each do |namelist|\n @to_write[namelist] = Array.new(@data[namelist].size, '')\n end\n end", "title": "" }, { "docid": "3c64b0bfe0368244769410a...
e129caad1447202a473767bd44f2df7f
returns array of percentages for all most_popular categories [0.05, 0.09, 0.0, 0.7] if a hood does not have any checkins for that category, it is represented at 0.0 in the array
[ { "docid": "10efa0f5c3eedf56ea1792ddf3a55b6a", "score": "0.7734498", "text": "def array_of_category_percents\n hash_most_pop_categories = Category.most_popular_by_count(3)\n array = hash_most_pop_categories.keys.map do |category_name|\n if self.category_name_percentage_hash.keys.include?(cate...
[ { "docid": "38a919088b6f7b185e3d15e59786bf64", "score": "0.6430846", "text": "def percent_correct_by_category(category)\n correct_array = []\n @correct.map do |x|\n if x.category == category\n correct_array << x\n end\n end\n (correct_array.count.to_f / deck.cards_in_category(...
309ab42d90572df1b62b3a0572472e4e
(see Typeto_simple_value) Compound types are returned as a hash from the field name (as a string) to the converted field value.
[ { "docid": "a8fbeed7e7bdb47259cd59cf5ecd67ae", "score": "0.61316913", "text": "def to_simple_value(options = Hash.new)\n apply_changes_from_converted_types\n result = Hash.new\n raw_each_field { |name, v| result[name.to_s] = v.to_simple_value(options) }\n resu...
[ { "docid": "bd3cbe9cc0f566b63d0a1ecd6c853485", "score": "0.6591287", "text": "def to_hash\n {type => value}\n end", "title": "" }, { "docid": "fdfe205ae97e10c6ea32f606037af43f", "score": "0.639266", "text": "def type_info(field)\n field = field.dup\n field[:...
96d9bb8779c04a79c2c1d61863fbfc9e
PATCH/PUT /chemical_structures/1 PATCH/PUT /chemical_structures/1.json
[ { "docid": "572016b26da6450f989ad9d0af7da19d", "score": "0.71818316", "text": "def update\n respond_to do |format|\n if @chemical_structure.update(chemical_structure_params)\n format.html { redirect_to chemical_structures_path, notice: 'Chemical structure was successfully updated.' }\n ...
[ { "docid": "199494d4a60c58181b12b48d57a7d463", "score": "0.6569754", "text": "def update\n respond_to do |format|\n if @structure.update(structure_params)\n format.html { redirect_to @structure, notice: 'Structure was successfully updated.' }\n format.json { head :no_content }\n ...
53fbc47a7f3cec742ef0af97b4fe41f5
$Path message for "caveats".
[ { "docid": "baa7ddd4b6e1ba94910b1a9c1d16fcc6", "score": "0.0", "text": "def mmapath_message\n s = <<~EOS\n Add the following line\n AppendTo[$Path, \"#{mma_app_path}\"]\n to the file printed by\n FileNameJoin[{$UserBaseDirectory, \"Kernel\", \"init.m\"}]\n Or run the foll...
[ { "docid": "345c30802b5c45841fe8483e0f1ce856", "score": "0.6756152", "text": "def caveats_strings\n find_strings(find_method_def(@body, :caveats))\n end", "title": "" }, { "docid": "5b4be3914856bc566af7705ef2278e89", "score": "0.6195003", "text": "def caveats; nil end", ...
5f3013de04975afa4cfc972673dc47cd
GET /events/unstar GET /events/unstar.xml
[ { "docid": "652e48e84b86bdb0536cbf5570cdc47f", "score": "0.52934504", "text": "def unstar\n set_starred_state(false)\n end", "title": "" } ]
[ { "docid": "32b29b1fe3a599010409c7576646d8d7", "score": "0.5890912", "text": "def all\n get(\"#{domain}/unsubscribes\")\n end", "title": "" }, { "docid": "7a122ee38133b095c0409a5ef9595c43", "score": "0.5689148", "text": "def index\n @events = Event.where(archived: nil)...
8fb16a38034943fcbc21452cb2cba6c4
GET /blogs/1 GET /blogs/1.json
[ { "docid": "3a8b3f057e4a4f6be031dd51175db07e", "score": "0.0", "text": "def show\n @blog = Blog.find(params[:id])\n if current_user\n @comment = current_user.blog_comments.new(:email => current_user.email, :name => current_user.name) \n else \n @comment = BlogComment.new\n end\n ...
[ { "docid": "309c2019db2d4e2dfd7579f55e52ad16", "score": "0.769736", "text": "def index\n @blogs = Blog.all\n render json: @blogs\n end", "title": "" }, { "docid": "1d0439fac40ac935f4e67fbc0a52c313", "score": "0.7618499", "text": "def index\n @blogs = Blog.all\n\n res...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f27332395e79a017d7663302bf15df93", "score": "0.0", "text": "def course_creation_task_params\n params.require(:course_creation_task).permit(:empire_course_id, :course_creation_templete_id, :task, :task_note_1, :task_note_2, :task_note_3, :assign_1, :assign_2, :assign_3, :extra_s, :extra_...
[ { "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...
73d5efb2e3d6ca8f896f9b0bc99b93de
Notify all observers of action with args. If the callback registered for an observer is a Proc, it is invoked as: callback.call(observed, args) If the callback is a not a Proc, it is invoked as: observer.send(callback, observed, args) If action is nil, observers of all actions are notified.
[ { "docid": "1293b6a77e5dac040a3033d9e5e8388e", "score": "0.82662445", "text": "def notify_observers observed, action, args\n action ||= [ @observers_by_action.keys ]\n action = [ action ] unless Array === action\n action = action.dup\n action.push nil # ALL ACTIONS\n\n ...
[ { "docid": "49b309fcd6a0fb2a15e770715ea91efa", "score": "0.829315", "text": "def notify_observers! observed, action, args = nil\n args ||= EMPTY_ARRAY\n actual_action = action\n action ||= @callback_by_action.keys.to_a\n action = [ action ] unless Array === action\n\n ...
1e2f6fc675451092ddc86ca7f5a191e2
Public: Returns Xcode Build Dstroot string. Examples xcode_build_dstroot => "dstroot" Returns build_dstroot String.
[ { "docid": "21431186f9255422f4c9c99c6f23ab87", "score": "0.83528656", "text": "def xcode_build_dstroot\n @json['xcode']['build_dstroot']\n end", "title": "" } ]
[ { "docid": "b49be44c9107c77435a1046c76aa1f2a", "score": "0.6422385", "text": "def root_path\n ZergXcode::Paths.project_root_at source_filename\n end", "title": "" }, { "docid": "b6952c7d1d99e8504a6b374253b46f9d", "score": "0.6270363", "text": "def root\n if BUILD_CONFIG[:stagi...
5f99ea3b228070d15a29c091c07f093b
eligible_rules returns an array of promotion rules where eligible? is true for the promotable if there are no such rules, an empty array is returned if the rules make this promotable ineligible, then nil is returned (i.e. this promotable is not eligible)
[ { "docid": "ffd5a9a16e77de57ff85f5e535af1856", "score": "0.8340939", "text": "def eligible_rules(promotable, options = {})\n # Promotions without rules are eligible by default.\n return [] if rules.none?\n eligible = lambda { |r| r.eligible?(promotable, options) }\n specific_rules = ...
[ { "docid": "71afc2a3aaa2d4be33b13e9dcbb8cfab", "score": "0.83246404", "text": "def eligible_rules(promotable, options = {})\n # Promotions without rules are eligible by default.\n return [] if rules.none?\n eligible = lambda { |r| r.eligible?(promotable, options) }\n specific_rules = rules.s...
c723485f8b0b6294f553bfe65da7574e
New user confirmation mail
[ { "docid": "d587b9267232931015bb9ac69f1d8100", "score": "0.7376238", "text": "def confirmation_instructions(record, token, opts={})\n\t\t@user_name = record.full_name\n \t\t@confirmation_link = \"#{ENV['DOMAIN']}/users/confirmation?confirmation_token=#{token}\"\n\t\tp \"-------------------------------...
[ { "docid": "c550f92cc10bd874e98afe4a3251cfa7", "score": "0.79453886", "text": "def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"kat_tun_jinkazu_love@yahoo.co.jp\", subject: \"登録完了通知\"\n end", "title": "" }, { "doc...
af43ba3211e882dd09652646f6824102
This is a template method that is used to escape results values (returned in execute) that would cause the XML to be invalid. This method is not necessary if values do not contain character that have special meaning in XML (&, ", ), however it is a good practice to use it for all return variable results in case the val...
[ { "docid": "9924368ca2def54b5d463405898949da", "score": "0.0", "text": "def escape(string)\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\n end", "title": "" } ]
[ { "docid": "8bac79ec1cf079b85a6a8276aa1f36d0", "score": "0.64414084", "text": "def escape_value(value)\n value = escape_not_value(value)\n value = escape_sign_value(value)\n value = escape_quotation_value(value)\n value = escape_sql_value(value)\n return value\n e...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "aec90786b865ca3108aa83a845eb25e4", "score": "0.0", "text": "def live_program_params\n params.require(:live_program).permit(:live_id, :started_at, :user, :title, :desc, :url, :player_status)\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...
2f1d0002b3f8c35dcea39dee75e125a3
get the domain name without the .com part, from an email address
[ { "docid": "482005519159191aa77ba556b7cdc06f", "score": "0.90201753", "text": "def get_domain_name_from_email_address(email)\n email.split('@')[1].chomp(\".com\")\nend", "title": "" } ]
[ { "docid": "5116ce933e0f2a45e823680b1e29bcf8", "score": "0.8853201", "text": "def get_domain_name_from_email_address(email)\n\temail.split(\"@\")[1].split(\".\")[0]\nend", "title": "" }, { "docid": "a186b735cd92eb12e064c334fa5e18c5", "score": "0.88253605", "text": "def get_domain_nam...
4c76da3528dcf2bc86cbfdb59283617b
rerolls dice at the specified indexes
[ { "docid": "db4be71fa028e5e5739215e37b827c1d", "score": "0.6786998", "text": "def reroll(indexes)\n\t\tindexes.each do |i|\n\t\t\t@hand[i] = rand(6) + 1\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "26f14916523c07cef5d130cb40e4f7d2", "score": "0.6830051", "text": "def roll_dice\n puts (1..@number_of_dice).to_a.map { |x| x=Random.rand(@die_sides) + 1 }\n end", "title": "" }, { "docid": "e4804d71371c909b7afeb81be651de8b", "score": "0.67518616", "text": "def dice(fa...
b13fbd233c71bbb0318b61a4e190fc9f
DELETE /rooms/1 DELETE /rooms/1.json
[ { "docid": "522767b4967a9e899fb5961458ed5f73", "score": "0.7620118", "text": "def destroy\n @room = Room.find(params[:id])\n @room.destroy\n\n respond_to do |format|\n format.html { redirect_to rooms_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "5ffe5e19ba019a010c48a5619bab6b3d", "score": "0.7669845", "text": "def destroy\n @room = Room.find(params[:id])\n @room.destroy\n render json: {:success => true, :message=> \"Room has been deleted successfully\"}, status: 201\n end", "title": "" }, { "docid": "1e875f96d3...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "82226a3a67adc3be3fc0ffd03a55104a", "score": "0.0", "text": "def set_course\n @course = Course.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
1ef5084ac48b6d3eedb6f571dbf60ab5
each player gets 9 cards. They are ordered in a rack. Cards are taken FROM the draw pile.
[ { "docid": "79c01fee784ef4c977dff6dadcf992dc", "score": "0.7361249", "text": "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card fr...
[ { "docid": "3fb0ed3f72db567a23511d39aa23fd0e", "score": "0.72270155", "text": "def cards_for_player player, deck\n\t1.upto(7){ |i| \n\t random_card = deck.sample\n\t player.push_card_to_hand(random_card)\n\t deck.delete_if{ |card| card.rank == random_card.rank and card.color == random_card.color }\n\...
12c0e9895b651448b0a65f8f98c35387
:type key: String :type value: String :type timestamp: Integer :rtype: Void
[ { "docid": "a1b9e4761a2842caf4ce105033ccc3b5", "score": "0.74544746", "text": "def set(key, value, timestamp)\n @values[key] << value\n @stamps[key] << timestamp\n end", "title": "" } ]
[ { "docid": "435faff9e133698ead4d4f6615f70231", "score": "0.74824756", "text": "def set(key, value, timestamp)\n @map[key] = [] unless @map.key?(key)\n \n @map[key] << { v: value, t: timestamp }\n end", "title": "" }, { "docid": "6a91409fb50b0923417605089fc152e1", ...
81281da43d2dbd29ca7b4a551257aa61
Set or retrieve the group the package should install as. This varies with operating system and may be ignored if the underlying packager does not support it. Defaults to +Ohai['root_group']+. If +Ohai['root_group']+ is +nil+, it defaults to +"root"+.
[ { "docid": "cc9a44517a4e99f3c0f55a2144e89dc1", "score": "0.82787216", "text": "def package_group(val = NULL)\n if null?(val)\n @package_group || Ohai[\"root_group\"] || \"root\"\n else\n @package_group = val\n end\n end", "title": "" } ]
[ { "docid": "70f1f52c67a696458a7eece30b5c489e", "score": "0.82802576", "text": "def package_group(val = NULL)\n if null?(val)\n @package_group || Ohai['root_group'] || 'root'\n else\n @package_group = val\n end\n end", "title": "" }, { "docid": "e7d9bfc32f8ab8b...
9552e64d4add2a225e50c9e7991b8992
actions used when developing, but won't be kept
[ { "docid": "090340f133a276ae736a0a0be0c46d0f", "score": "0.0", "text": "def whatever\n end", "title": "" } ]
[ { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.75892705", "text": "def actions; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.75132674", "text": "def run_actions; end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108...
debb24217cadb85b81f607b0c58e22e6
if one of the messages has a preset plain text character at the given position, this message is returned. If not, we look for a space character in one of the messages
[ { "docid": "894887d72e4322e68498f787c6afc439", "score": "0.6969389", "text": "def known_message(pos)\n message = message_with_pre_set_char(pos) || message_with_space(pos)\n OTP.log.warn \"Failed to determine any character for position #{pos}\" if message.nil?\n message\n end", "tit...
[ { "docid": "d1a2dd789478506dd83f88cef24b9f47", "score": "0.7123291", "text": "def message_with_space(pos)\n message = messages.find do |m1|\n messages.none? { |m2| m1.binary_xor_at(pos, m2) =~ /^00.*1/ }\n end\n return nil if message.nil?\n\n OTP.log.info \"#{pos} - Found spac...
f6776375ce82762b2ab95c4d850e045d
Adds the column family (asynchronous)
[ { "docid": "675f2a20e8e78970d8409443ff4a7f36", "score": "0.5166549", "text": "def add_family name, opts\n _add_family name, opts, false\n end", "title": "" } ]
[ { "docid": "0575523493f745d8f0ec0551a6a7b264", "score": "0.6433835", "text": "def add_column_family(cf_def)\n return false if Cassandra.VERSION.to_f < 0.7\n\n @schema = nil\n return client.system_add_column_family(cf_def)\n end", "title": "" }, { "docid": "d0b0b03d1fcadb9a4a9623eb1...
3bce021d7e8a8c1ca0fe74787ccf7d9d
shifting the values in the array
[ { "docid": "07bb6497ef268c2e3b8ea2453fe0d2fc", "score": "0.0", "text": "def moveLeft(arr)\n\tarr.shift\n\tarr.push(0)\n\tarr.each do |x|\n\t\tx\n\tend\n\t# arr.push(0)\nend", "title": "" } ]
[ { "docid": "17d1dfa1a8282568ca2f940365fe5a24", "score": "0.84426916", "text": "def shift_values(arr)\n\tarr.slice(arr[0],arr[1]).push(0)\nend", "title": "" }, { "docid": "f92db02d1690197e82bbd8bbd663563c", "score": "0.8177004", "text": "def shiftArray(arr); arr.push(0).shift end", ...
594b5a3d8e46c408026a05afe3c32505
POST /people POST /people.xml
[ { "docid": "683adeb744c24f9d31521a230abaab51", "score": "0.0", "text": "def create\n @person = Person.new(params[:person])\n flash[:notice] = @person.Name + ' created.' if @person.save\n end", "title": "" } ]
[ { "docid": "9cf96f38dc025371acec30fef5762fc2", "score": "0.7056334", "text": "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = N...
29f9e44a62de422a00c8ac3ae121493c
Your code below this
[ { "docid": "5f0f195d94f3de6fee0b08d700e313ee", "score": "0.0", "text": "def company_strings(companies)\n companies.map { |company| \"#{company.name}, #{company.size}\" }\nend", "title": "" } ]
[ { "docid": "d509f8cefdd8fc87fefabff3705478b5", "score": "0.68808544", "text": "def custom\n \n end", "title": "" }, { "docid": "a18186567d58d46fbcb43c48faf2ab4b", "score": "0.65139526", "text": "def apply\n\t\t\n\tend", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223...
6f3dc29db7155fd877484b37d53a0362
No associated view here. Just a redirect or a render.
[ { "docid": "fd43371528e4168a68de47d4adbd9786", "score": "0.0", "text": "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to root_path\n end", "title": "" } ]
[ { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6997708", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6997708", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", ...
73e812002729f9e0a6b1a9043fa3eaff
method to load the students from the students.csv file
[ { "docid": "686bf6ff43b0a3216d547b8b882cc551", "score": "0.7874567", "text": "def load_students(filename = 'students.csv')\n CSV.foreach(filename) do |line|\n name = line[0]\n cohort = line[1]\n assign_students(name, cohort)\n end\nend", "title": "" } ]
[ { "docid": "881196133e99125adbff1999b22946b9", "score": "0.82443786", "text": "def load_students(filename = \"students.csv\")\n #open file for loading\n file = File.open(filename, \"r\")\n file.readlines.each do |line|\n name, cohort = line.chomp.split(\",\")\n # add student data to t...
0af56df2b591b6988e17c9e15963e753
Return a randomized weather string to bring a little variety to this
[ { "docid": "765be7034f473944c039c4f00465a211", "score": "0.73556674", "text": "def get_weather\n [\"sunny\", \"cloudy\", \"rainy\", \"stormy\", \"snowy\", \"hot\", \"cold\"].sample\n end", "title": "" } ]
[ { "docid": "bb97b6fa2f4f6518b94e7157fe4acad0", "score": "0.7772235", "text": "def whats_the_weather\n if rand(2) == 1 then\n :sunny\n else\n :stormy\n end\n end", "title": "" }, { "docid": "bd4e2c6b6ed395413bde280b8e89c957", "score": "0.70521384", "text": "def ran...
1fc9da21ed118233827ac8a2f051c33e
Create or update IPv6 NDRA profile If profile with the ndraprofileid is not already present, create a new IPv6 NDRA profile instance. If it already exists, replace the IPv6 NDRA profile instance with this object.
[ { "docid": "80f37bba930ba2292e051b6cd1d85546", "score": "0.722325", "text": "def create_or_replace_ipv6_ndra_profile_0(ndra_profile_id, ipv6_ndra_profile, opts = {})\n data, _status_code, _headers = create_or_replace_ipv6_ndra_profile_0_with_http_info(ndra_profile_id, ipv6_ndra_profile, opts)\n ...
[ { "docid": "c919956b61c6893a7d085cc716a01464", "score": "0.7285302", "text": "def create_or_replace_ipv6_ndra_profile(ndra_profile_id, ipv6_ndra_profile, opts = {})\n data, _status_code, _headers = create_or_replace_ipv6_ndra_profile_with_http_info(ndra_profile_id, ipv6_ndra_profile, opts)\n d...
2af9b0092d7953f14b8c2bcb5d78798d
Return only ACE keys in the order they are found in an ACE entry
[ { "docid": "50fa702d4d132824bbcb2ba01c5f5dd6", "score": "0.0", "text": "def inspect\n return_value = [:target, :perms, :inheritance, :perm_type].collect do |key|\n key_value = @hash[key]\n if key_value.is_a? Array\n \"#{key} => #{key_value}\\n\"\n else\n \"#{k...
[ { "docid": "1078e8efe6fc110956ec2a8d99063b0e", "score": "0.6156959", "text": "def entry_keys(include_all = true)\n keys = @group.entries(include_all).collect {|e| e.key }\n unless @group.key.blank?\n keys.collect! {|k| k.gsub(@group.key + '.', '') }\n end\n keys\n end", ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "f4c3599f04d7f07f91fe90efb6f4184e", "score": "0.0", "text": "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "title": "" } ]
[ { "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...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "42089b737a43e500e0b0f4f7234b82db", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:name, :password, :role)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79427844", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6957069", "text": "def permitted_params\n params.permit!\n end", "title"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "493ad1a848fe6bdcaa9f22b2b6dd238e", "score": "0.0", "text": "def set_job\n @job = Job.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...
26896a0e5941843b96b5c27b9c26bc4c
:kext should be unloaded before attempting to delete the relevant file
[ { "docid": "c2fce8e5059d09f2177e23f02a0ef3bb", "score": "0.61176986", "text": "def uninstall_kext(directives)\n Array(directives[:kext]).each do |kext|\n ohai \"Unloading kernel extension #{kext}\"\n is_loaded = @command.run!(\"/usr/sbin/kextstat\", args: [\"-l\", \"-b\", kext],...
[ { "docid": "751c73611628453f518274b0dcbf150d", "score": "0.6673685", "text": "def delete_from_disk; end", "title": "" }, { "docid": "96a64b5e29bebf4538883ade67b1bddb", "score": "0.6554569", "text": "def purge\n ::FileUtils.rm(@fname)\n end", "title": "" }, { "doci...
d32e8f0027e3e4a84360b56fb23442a6
The position of the rollback segment header within the page.
[ { "docid": "f6e7ed4ed07157a3f3fad58c8ac7557b", "score": "0.66072655", "text": "def pos_rseg_header\n pos_page_body\n end", "title": "" } ]
[ { "docid": "a78035c3930c5929a70042f0bf7fe1d2", "score": "0.7423857", "text": "def pos_header\n @position - 2\n end", "title": "" }, { "docid": "b2f7ca66c752bcd9c0f810a38233cf92", "score": "0.67434186", "text": "def relative_header_offset; end", "title": "" }, { "d...
6ddae37a7eecf0312c94dc0dd56a134c
PATCH/PUT /teams/1 PATCH/PUT /teams/1.json
[ { "docid": "aa2b70ed86d1ef1fca106d05e138476e", "score": "0.0", "text": "def update\n notice = 'Team has not been changed yet'\n type = 'warning'\n assigned_players = (params[:team][:team_assignments] or [])\n if @team.team_voting_complete?\n notice = 'Team voting is already complete'\n ...
[ { "docid": "555b6bd116d1f3a4d47cec062f720056", "score": "0.73921126", "text": "def update\n render json: Team.update(params[\"id\"], params[\"team\"])\n end", "title": "" }, { "docid": "ca341bd1773af925e24be57cf8927a6e", "score": "0.7175854", "text": "def update\n team = T...
23f75b58b05877be010b9b659576c8c3
Return a Net::HTTPResponse read for this +path+.
[ { "docid": "ed5d20c66a6b6321f0ae1a00724351eb", "score": "0.0", "text": "def make_http_request(path, io = nil)\n raise ArgumentError, \"Path must start with forward slash\" unless path.start_with?('/')\n begin\n str = @uri.to_s\n str.chomp!('/')\n str += Puppet::Util.uri_en...
[ { "docid": "34a206b0945172eef2fc315af3c493a8", "score": "0.7196304", "text": "def http_get(path)\r\n response, data = @http.get(path)\r\n end", "title": "" }, { "docid": "655dd5a63460e710ad77bc95432a6936", "score": "0.71546775", "text": "def get(path)\r\n response, data = @u...
758aa9fabc6eea55d253202ee0e6bb78
GET /profiles/<profile_id/profile_images/ GET /profiles/<profile_id/profile_images.xml
[ { "docid": "b9a68d87c58d3eeccc692549db584afb", "score": "0.7018477", "text": "def index\n @profile_images = @profile.profile_images_large # do something to ignore thumbnail entries?\n @profile_image = ProfileImage.new\n end", "title": "" } ]
[ { "docid": "b9b0672041b2ea98351ab15b73cbc152", "score": "0.69577616", "text": "def index\n @profile_images = ProfileImage.all\n end", "title": "" }, { "docid": "b9b0672041b2ea98351ab15b73cbc152", "score": "0.69577616", "text": "def index\n @profile_images = ProfileImage.all\n ...
00a5936b192152861479bf9d3153f16c
The Add method should throw an exception when called with an input containing at least one negative number.
[ { "docid": "808f5cce6262988464b8e0e483bfc872", "score": "0.0", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration23\n # Arrange.\n @inputValue = '//[$]\\n1$-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n ...
[ { "docid": "387b2052e1c0ddadc67b2625b7d6c6cf", "score": "0.71164185", "text": "def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\n raise ArgumentError, \"Enter Positive Number\" unless num_1 > 0\nend", "title": "" }, { "docid": "887280f7b72bd208cc53c339757a7946", "score":...
84727f9d12b178006bfc0fe15b72e336
PATCH/PUT /multiplayers/1 PATCH/PUT /multiplayers/1.json
[ { "docid": "b99cc6085cf6e743a1f5ea3a1a3db73a", "score": "0.6976511", "text": "def update\n respond_to do |format|\n if @multiplayer.update(multiplayer_params)\n format.html { redirect_to @multiplayer, notice: 'Multiplayer was successfully updated.' }\n format.json { render :show, s...
[ { "docid": "d65a97a4cbcb60c25eb948fdc88d9f0f", "score": "0.60678524", "text": "def set_multiplayer\n @multiplayer = Multiplayer.find(params[:id])\n end", "title": "" }, { "docid": "0a27fda59598968c957806883ad7fc36", "score": "0.60132766", "text": "def update\n respond_to d...
7e63dc218b598d4657f16498a6701f23
GET /key_indicate/indicator_files/1 GET /key_indicate/indicator_files/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "c1a84fb035b4c627d256ba9bf02c0349", "score": "0.67493486", "text": "def index\n @indicate_indicator_files = Indicate::IndicatorFile.all\n end", "title": "" }, { "docid": "0499b75069cd59720811464524df5cbc", "score": "0.6302066", "text": "def set_indicate_indicator_file\...
1bbe9491650b4340a0a875db3fc0d30b
enter a deadline for an existing task, format or the deadline must be Month/Day/Year
[ { "docid": "9990d6123802ac5c83dabadfa419fec3", "score": "0.785415", "text": "def deadline (rest)\n id_string, datedl = rest.split(/ /,2)\n id = id_string.to_i\n #checking id the deadline entered is a valid date\n begin\n dl = Date.strptime(datedl, \"%m/%d/%Y\")\n #code using date g...
[ { "docid": "6700d793cd7380d181f0309c1f99953e", "score": "0.7031413", "text": "def deadline\n \"July 4, 2014\"\n end", "title": "" }, { "docid": "d25da6ec9ae964eeb9314094e692dc1a", "score": "0.70129365", "text": "def deadline_cannot_be_in_the_past\n errors.add(:deadline, \"ca...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "60bb2cb1c64b443f8f5e5515d0b9ddc9", "score": "0.0", "text": "def set_basin\n @basin = Basin.new(site_id: params[:site_id]) if params[:id] == \"new\"\n @basin = Basin.find(params[:id]) unless params[:id] == \"new\"\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...
ea257f32526f11922b89037053f6d6c4
Explicitly sets an attribute as dirty.
[ { "docid": "e56d0937984abb3f3377851fcc6bda5b", "score": "0.7695624", "text": "def attribute_dirty!(name, value)\n dirty_session.dirty!(name, value)\n end", "title": "" } ]
[ { "docid": "8aa45c7b8a33dd924c1ef90582f58ba6", "score": "0.77617043", "text": "def dirty!(name, value)\n dirty_attributes[name] = value\n end", "title": "" }, { "docid": "8aa45c7b8a33dd924c1ef90582f58ba6", "score": "0.77617043", "text": "def dirty!(name, value)\n d...
c60abe62f2aa3e7397e2a95d87d348ee
Updates the associated record with custom update method Returns the number of affected rows.
[ { "docid": "d06a51e9b0982154357ca93a9de14ed3", "score": "0.0", "text": "def _update_record(attribute_names = @attributes.keys)\n # check if class has custom update method\n if self.class.custom_update_method\n # run before/after callbacks defined in model\n run_callbacks(...
[ { "docid": "fe0c5a57902b535373d600a0599b84e3", "score": "0.6990035", "text": "def update\n @record = dao.where(slug: identifier).first\n return failed_result unless @record.update(updated_attrs.to_h)\n successful_result\n end", "title": "" }, { "docid": "58b...
71e2e30bf24b46a70e4f464c53f888a4
Creates a subscription for a customer to a subscription plan. If you provide a card on file in the request, Square charges the card for the subscription. Otherwise, Square bills an invoice to the customer's email address. The subscription starts immediately, unless the request includes the optional `start_date`. Each i...
[ { "docid": "04815b6327aec9b2c851c6b86118ae2f", "score": "0.57810515", "text": "def create_subscription(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare hea...
[ { "docid": "8ac2f1ef9a78b8262373f3521f1d3a1c", "score": "0.7925466", "text": "def create_subscription\n subscription = nil\n stripe_call do\n local_plan = Plan.active.find(@params[:user][:plan_id])\n return false if local_plan.nil?\n stripe_plan = Stripe::Plan.retrieve(local_plan.st...
f3dfd7e1632193687bea2b28664fc1f5
every message is an HTTP POST request. the protocol is always write and read.
[ { "docid": "c333dbf685f7eea5412736b5b5a0f7ee", "score": "0.61087877", "text": "def message(msg)\n \n # the REST protocol is always a POST\n request = Net::HTTP::Post.new(@uri.request_uri)\n \n # the message body\n request.body = msg\n request['Content-Type'] = \"application/octet-st...
[ { "docid": "ad696425ed8293a571a2b6384011a513", "score": "0.6632198", "text": "def http_method\n :post\n end", "title": "" }, { "docid": "620ee20619ded7437eb9769fd160fc7d", "score": "0.6596905", "text": "def post(body)\n body = body.to_s\n request = Net::HTTP...
729f31d56bdf35734189a4286b5164e0
Produces the name of a hero from Heroes 3.
[ { "docid": "6e1ada2a1ca2235d1d4411d51623a583", "score": "0.0", "text": "def name; end", "title": "" } ]
[ { "docid": "be572712dee31fa86474845bd3b5db92", "score": "0.74685717", "text": "def name\n parse('superhero.name')\n end", "title": "" }, { "docid": "4032f79a8254a9edbd7febd1d87154e4", "score": "0.7263424", "text": "def hero\n fetch('heroes_of_the_storm.heroes')\n...
4c07e1bbe08328e0d01234599e8191a6
GET /college_be_records/new GET /college_be_records/new.xml
[ { "docid": "4253a400b00a14bc5c5d9c18f33400a1", "score": "0.75630987", "text": "def new\n @college_be_record = CollegeBeRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @college_be_record }\n end\n end", "title": "" } ]
[ { "docid": "2a4e6a26a9ed1e3fab0bd35b50c8d113", "score": "0.74848384", "text": "def new\n @college = College.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @college }\n end\n end", "title": "" }, { "docid": "90a420e12d05de5687d1b...
891c40201600ede91324b2d96b0acffa
Returns array of: Pixel xdimension Pixel ydimension unit (see png spec)
[ { "docid": "d2c57e0feb433fb5fdff3eaa1e77676e", "score": "0.58267474", "text": "def get_data\n xd = @data[0..3].unpack(\"C*\")\n xd = Shared::interpret_bytes_4(xd)\n yd = @data[4..7].unpack(\"C*\")\n yd = Shared::interpret_bytes_4(yd)\n unit = @data[8].unpack(\"C*\")[0]...
[ { "docid": "2d49409a595f1c3495e154f57c29b7c1", "score": "0.70131546", "text": "def extent\n @size.map{|i| i * @pixels}\n end", "title": "" }, { "docid": "826447b7a2af81d5b35b2beb91dd994c", "score": "0.69115126", "text": "def pixels; end", "title": "" }, { "docid": "cb...
53ffbcf0fe783e939b70387553a71355
require 'rubydebug' Debugger.wait_connection = true Debugger.start_remote
[ { "docid": "5916b3986e796ef56dbfa5d3ffaf3047", "score": "0.0", "text": "def rb_main_init\n path = OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation\n rbfiles = Dir.entries(path).select {|x| /\\.rb\\z/ =~ x}\n rbfiles -= [ File.basename(__FILE__) ]\n rbfiles.each do |path|\n require( ...
[ { "docid": "ca9224cc3dd6f5b2fd107e09e92af065", "score": "0.8961345", "text": "def rdebug\n\tDebugger.wait_connection = true\n\tDebugger.start_remote\n\tdebugger\nend", "title": "" }, { "docid": "115fc74f0b6c2fdc104cd098dbe94226", "score": "0.7553457", "text": "def debugger\n require...
e8c8d314c38273c8b2789576f6bade7f
Updates actor status (use status window)
[ { "docid": "552774684f2cb08f65a309cd456f0db1", "score": "0.8299587", "text": "def update_actor_status()\n \n # Updates Status window if is visible\n if @status_window.visible\n if Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP) ||\n Input.repeat?(Input::LEFT) || Input.repeat...
[ { "docid": "d21f963af55a8e62728705439382aba6", "score": "0.81926244", "text": "def status_command(actor)\n @status_window.actor = actor\n @status_window.refresh\n @status_window.visible = true\n end", "title": "" }, { "docid": "d21f963af55a8e62728705439382aba6", "score": "0.819...
ff0dcc6cab8d0a652c89b560436ff386
GET /custumers GET /custumers.json
[ { "docid": "fb5e7bf7900d3c90978ca842f9c44312", "score": "0.74368596", "text": "def index\n @custumers = Custumer.all\n end", "title": "" } ]
[ { "docid": "90ffc04eb01b55e8a208012f6a17f595", "score": "0.7425112", "text": "def customer_list\n perform_get_request('/customer/list')\n end", "title": "" }, { "docid": "1184b78361a692f67e210655c2a33fbd", "score": "0.7315511", "text": "def index\n @custome...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b7c0a2223d5632c9e786b41c64c35d02", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation,\n :current_password, :state)\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...
19e8a8b42e5ac1918de92c27d730f33c
Run a single configuration
[ { "docid": "e84b0ee65d703b4fb4dc07e89402cf25", "score": "0.0", "text": "def run_trial(t)\n perhost = t[:nd] <= t[:perhost] ? 1 : t[:perhost]\n # Keep a seperate output file for the trial\n puts \"---- #{t[:exp]}: sf#{t[:sf]} q#{t[:q]} n#{t[:nd]} s#{t[:sw]} #{perhost} perhost trial #{t[:trial]}----\"\...
[ { "docid": "7115e4a3af32bd4e63921e36275b68e3", "score": "0.71129566", "text": "def config(command)\n ensure_mode(:configuration)\n run(command)\n end", "title": "" }, { "docid": "0034fc3dbda50b38ec6117ca1edffdbc", "score": "0.70620555", "text": "def configure_and_run(par...
6780f64311358005e968d5180f47c465
functions defined after this section are direct ================ Direct Functions START ================
[ { "docid": "68bc3fc0843a01ab05defcd2d197bf99", "score": "0.0", "text": "def create_category_tabs(final_counts)\n \n order = final_counts.sort_by {|k,v| v.to_i}.map{|i| i[0].to_i}.reverse\n \n html = '<div style=\"padding-top:15px;\"></div>' \n \n order.each do |i|\n \n ...
[ { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.6909591", "text": "def internal; end", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223e7c753f5e2e", "score": "0.68789256", "text": "def telegraphical()\n end", "title": "" }, { "docid": "67081eb3c98dc9ab87bd97...
cfdecae30f2fe28832e14b0a0577e3f9
The above solution requires O(2n) time in the worst case. That can be reduced by using a hash map instead of a set. Then instead of moving by one char every iteration we could move by the index stored in position corresponding to the char That way instead of going through they same characters one by one, once we encoun...
[ { "docid": "9873403aeb43f66c4d43394f9d16cb7b", "score": "0.0", "text": "def length_of_longest_substring_sl_optimised(s)\n ans = 0\n i= 0\n char_hsh = {}\n \n for j in (0...s.length) do\n if char_hsh.include?(s[j])\n i = [i, char_hsh[s[j]]].max\n end\n ans = [ans, j-i+1].max\n char_...
[ { "docid": "8fd9e38b39eddafae0c2b3567cbc823c", "score": "0.70647645", "text": "def remove_adjacent_duplicates(input)\n # create empty strings\n result = \"\"\n last = \"\"\n # checks each letter in string\n input.chars.each do |letter|\n # if letter does not match letter in string,...
8667b781960b8fe9eaea427631f6544f
The columns to select when loading the association.
[ { "docid": "bfb0058635e258e5f14e1bfd95471098", "score": "0.0", "text": "def select\n self[:select]\n end", "title": "" } ]
[ { "docid": "5d1bfaed8bc5bcaf00a09d10c4e4d133", "score": "0.74422", "text": "def columns\n select.inject([]) do |columns, column|\n columns << {\n :type => all_columns[column][:type]\n }.merge({\n :id => column.to_s,\n :label => column_label(column)\n })\n end...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "46489c80130b2625b3f5b9e0e3a387cd", "score": "0.0", "text": "def set_type_client\n @type_client = TypeClient.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;...
5f474b51b1c613542889c7592a3ef0be
Any variable with a _100 at the end of it is an int 100 May seem a little strange, but it's part of some legacy code. Make new helper methods
[ { "docid": "fd09ebbe006e09657a872787327b011d", "score": "0.0", "text": "def make_new_event\n event = Hash.new\n event[:event_game_type] = 2 # 1=Pairs, 2=Teams.\n event[:event_scoring_method] = 0 # Nicolas will define later.\n event[:event_team_round_one_pairing_option] = 0 # 2BD\n event[:event_te...
[ { "docid": "ece6493dc3dd42c41af064f1f1ff6f50", "score": "0.6392107", "text": "def res; (magic_def * 100).to_i - 100; end", "title": "" }, { "docid": "acb6e628dd2b3f8b57f61c379030ab5d", "score": "0.61697876", "text": "def res\n (magic_def * 100).to_i - 100\n end", "title": "" ...
b530df75baf02ef852211d3d1fa7cbe2
class HTTP < Protocol Creates a new Net::HTTP object for the specified +address+. This method does not open the TCP connection. ExtendedHTTP :: initialize
[ { "docid": "5a5451840e00f52a7e0ea076d35b9a55", "score": "0.7599747", "text": "def initialize(address, port = nil)\n @address = address\n @port = (port || HTTP.default_port)\n @curr_http_version = HTTPVersion\n @no_keepalive_server = false\n @close_on_empty_response = false\n ...
[ { "docid": "9d8bdf203cf94db39b552d8c26df254b", "score": "0.7802554", "text": "def initialize(address, port = nil)\n @address = address\n @port = (port || HTTP.default_port)\n @local_host = nil\n @local_port = nil\n @curr_http_version = HTTPVersion\n @keep_alive_timeout =...
8df754fbf58f989f8c08fd11f170416d
Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you'd like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need no...
[ { "docid": "4b8af6f1aee687ec6dc9b76bfb758695", "score": "0.79520464", "text": "def create_in_workspace(client, workspace: required(\"workspace\"), options: {}, **data)\n\n self.new(parse(client.post(\"/workspaces/#{workspace}/tasks\", body: data, options: options)).first, client: client)\n ...
[ { "docid": "c0da7c51388796756ae44cc93f71fe53", "score": "0.81645644", "text": "def create(client, workspace: nil, options: {}, **data)\n with_params = data.merge(workspace: workspace).reject { |_,v| v.nil? || Array(v).empty? }\n self.new(parse(client.post(\"/tasks\", body: with_params,...
c5af75d299e4118be727ee0541b30689
GET /manage_nourishes/1 GET /manage_nourishes/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "76547032216fa6d2e19b4b20add615e3", "score": "0.7490498", "text": "def index\n @manage_nourishes = ManageNourish.all\n end", "title": "" }, { "docid": "16bbd638ed6762274585428a613b5121", "score": "0.64392114", "text": "def create\n @manage_nourish = ManageNourish.ne...
374383723186400d5781e0da99dc155b
post '/frogs' do frog = Frog.create(:name => params[:name]) frog.color = params[:color] frog.pond_id = params[:pond_id] frog.save redirect '/frogs' Write the code to save new frogs and redirect to the index view listing all frogs. end
[ { "docid": "1f8b26d627f1464ceba92eae06df99f2", "score": "0.0", "text": "def new\n @ponds = Pond.all\n @frog = Frog.new\n # Write the code to send to the new form view.\n end", "title": "" } ]
[ { "docid": "1aaad90d2a94c1699fd4a84cbcd8f3bd", "score": "0.76463735", "text": "def create\n @frog = Frog.new(frog_params)\n\n respond_to do |format|\n if @frog.save\n format.html { redirect_to @frog, notice: \"Frog was successfully created.\" }\n format.json { render :show, stat...
7a5071c855536832d34178eebb5ab043
Get the inner_html of the REXML node.
[ { "docid": "deb25325cfc5779a145c6fb54950802f", "score": "0.57423675", "text": "def inner_html\n @children.join\n end", "title": "" } ]
[ { "docid": "88557012160d57669a170f422c459803", "score": "0.7315988", "text": "def inner_html\n @node.children.map(&:to_s).join\n end", "title": "" }, { "docid": "2e8d7f5d0e894b8edb11ca81178882ea", "score": "0.7306631", "text": "def inner_html\n @node.chil...
1fa53df15c8650af694b9d8fca8a0f15
returns nil if no changes, otherwise returns Repo::Difs::Summary object if change updates sha on object it returns diffs_summary opts can have keys: :force
[ { "docid": "7ab04928af68dfab99662c62d7ee0095", "score": "0.0", "text": "def pull_remote_repo_changes!(remote, opts = {}) \n RepoManager::Transaction.reset_on_error(self) do \n opts_fast_foward = {\n force: opts[:force],\n remote_name: remote.remote_ref,\n ...
[ { "docid": "bed0edbe1c3b7d97e54620e0cfa8e7d7", "score": "0.5893781", "text": "def ret_summary\n DiffTypesAndMethods.inject(Summary.new) do |h, (diff_type, diff_method)|\n res = map { |diff| diff.send(diff_method) }.compact\n res.empty? ? h : h.merge(diff_type => res)\n end\n e...
b65a60485bac21ee77a3f7c5bc5da36c
Merge this location with another.
[ { "docid": "4c3a46ff106449c434d594adb6086dd3", "score": "0.57167387", "text": "def update_location_merge(merge)\n if !@location.mergable? && merge.mergable?\n @location, merge = merge, @location\n end\n if in_admin_mode? || @location.mergable?\n old_name = @location.display_name\n ...
[ { "docid": "3fd2fd91c7d284f61d0cfbbd045839cd", "score": "0.66154724", "text": "def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end", "title": "" }, { "docid": "6595c3f91cfd8d3a73b1c676518bb7c3", "score"...
529a12fce4fff4c449d3752be3c2f952
delegate :question_card, to: :basic_metric_card
[ { "docid": "1e8d8cd1d369dcea0633eb8efbef4659", "score": "0.0", "text": "def normalize_value value\n return value if value.is_a? String\n return \"0\" if value < 0\n return \"10\" if value > 10\n value.to_s\nend", "title": "" } ]
[ { "docid": "5ca146c92fa7615e90aae33bba1d5768", "score": "0.6468382", "text": "def variables_card\n metric_card.metric_variables_card\nend", "title": "" }, { "docid": "6b7c5f966107fb572b612eca1c4d42ca", "score": "0.5961991", "text": "def get_card\n end", "title": "" }, { ...
500eb24030a9ceaacd1b582e450ba5ff
used to display the status of the boxes in the "/displayanalysis"
[ { "docid": "b48c94cca352d4b6cdafb0b955ef41ff", "score": "0.6847034", "text": "def webdisplayanalysis\n\t\tfor i in (0..21) do\n\t\t\ts = \"_\"\n\t\t\tg = \"_\"\n\t\t\tb = i + 1\n\t\t\tif @openedboxes[i] == 0\n\t\t\t\ts = \"Closed\"\n\t\t\t\tg = \"[#{b}]\"\n\t\t\telse\n\t\t\t\ts = \"Opened\"\n\t\t\t\tg =...
[ { "docid": "4c80634987fa2bcd38c5bb237df3cf63", "score": "0.7109962", "text": "def status\n show_config\n show_info\n end", "title": "" }, { "docid": "261a774c2cd560c3092b4c88ce4deb8f", "score": "0.66311747", "text": "def display\n activity = '/-\\\\|?'\n...
8f057f9c1a5cfab84407fa7023b4e98b
longer string on inside. Strings will not be the same length, but they may be empty (length0).
[ { "docid": "c746f666835e31bc402763bab3ca9579", "score": "0.0", "text": "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend", "title": "" } ]
[ { "docid": "017eea661f9b590c416dfc6af05489f4", "score": "0.6812023", "text": "def check_length_or_truncate(str, length)\n if !str.nil? && str.length > length\n str = str[0,length]\n end\n str\n end", "title": "" }, { "docid": "15916fef233af264cc9426f6f3bc22fd", "score": "0...
8f416a843f3d77ff19692ff0025ca13f
GET /user_followings GET /user_followings.json
[ { "docid": "ba86206b253811a90fbe3bec297908be", "score": "0.74112695", "text": "def index\n @user_followings = UserFollowing.all\n end", "title": "" } ]
[ { "docid": "2e0fabd3994d157af67ddcbfddee8d70", "score": "0.8589112", "text": "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "title": "" }, { "docid": "2e0fabd3994d157af67ddcbfddee8d70", "score": "0.858...
3dc8d5a6f5b01fa6e72519614778fc40
POST /siswas POST /siswas.json
[ { "docid": "adb21e742efec11d3e50ce1239c09b1c", "score": "0.6978134", "text": "def create\n @siswa = Siswa.new(params[:siswa])\n\n respond_to do |format|\n if @siswa.save\n format.html { redirect_to @siswa, notice: 'Siswa was successfully created.' }\n format.json { render json: ...
[ { "docid": "266a34bc663f290b44c9b2af5c3cd2f5", "score": "0.61526614", "text": "def create\n @post_thesis = PostThesis.new(post_thesis_params)\n\n respond_to do |format|\n if @post_thesis.save\n format.html { redirect_to @post_thesis, notice: 'Post thesis was successfully created.' }\n ...
8b2f6d15666dd0a496042301bf361c3c
show modal for adding flag reason
[ { "docid": "6ee18eaf13bbea681c1c975310b70daa", "score": "0.54387444", "text": "def add_flag\n\t\trender layout: false\n\tend", "title": "" } ]
[ { "docid": "b6b5f96a8f71180473a11f7ede934193", "score": "0.7024009", "text": "def show\n if params[:modal] == 'true'\n @modal = true\n render :show, layout: false\n end\n end", "title": "" }, { "docid": "b6b5f96a8f71180473a11f7ede934193", "score": "0.7024009", "text"...
5d1e0c7b22e3be3aeff8fa3d5829c0bf
3 Fibonacci Number Location By Length
[ { "docid": "a95ecb296e3ab3a0358b77b589124f81", "score": "0.0", "text": "def find_fibonacci_index_by_length(num)\n fibonacci = [1, 1]\n loop do\n fibonacci << (fibonacci[-2] + fibonacci[-1])\n break if fibonacci[-1].to_s.length == num\n end\n fibonacci.size\nend", "title": "" } ]
[ { "docid": "200f0a4096a0314120512d1335580b77", "score": "0.8000504", "text": "def find_fibonacci_index_by_length(length)\n a, b = 1, 1\n index = 2\n\n until b.to_s.length >= length\n a, b = b , b + a\n index += 1\n end\n index\nend", "title": "" }, { "docid": "e73b989aa75b2a830a54...
455929c9c6a33a026db630aa27120193
DELETE /ractions/1 DELETE /ractions/1.json
[ { "docid": "534530ff4edf1d913d249d73a93e93b9", "score": "0.64952695", "text": "def destroy\n @raction.destroy\n end", "title": "" } ]
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.74368775", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": ...
1e19ad32e02178427d54740bf1b853ba
Returns the `HalClient::Representation` returned from submitting the form. answers `Hash` containing the answer key to submit. Keys are the field names; values are the values to submit.
[ { "docid": "9d12aa919224e92b1aab2d1fb6e5f391", "score": "0.635348", "text": "def submit(answers={})\n if :get == method\n hal_client.get(target_url(answers))\n else\n hal_client.public_send(method, target_url(answers), body(answers), \"Content-Type\" => content_type)\n end\n...
[ { "docid": "3cc63ae2b42cb3b620f74ca7eca14fd2", "score": "0.6379932", "text": "def answer_form\n\t\t@id = params[:id]\n\t\t@pos = params[:pos]\n\t\t\n\t\t@review_assignment = ReviewAssignment.find(@id)\n\t\t@review_mapping = ReviewMapping.find_all_by_user_id_and_review_assignment_id(current_user.id,@id)[...
9eb598ad25304ac8487b5e2f10d23fd9
PATCH/PUT /hola_mundos/1 PATCH/PUT /hola_mundos/1.json
[ { "docid": "a9f9503fa79530908b3603324d1d92e2", "score": "0.64380133", "text": "def update\n respond_to do |format|\n if @hola_mundo.update(hola_mundo_params)\n format.html { redirect_to @hola_mundo, notice: 'Hola mundo was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "84d3ec930637547860dc20becbf29000", "score": "0.67110837", "text": "def update\n respond_to do |format|\n if @momo.update(momo_params)\n format.html { redirect_to @momo, notice: 'Momo was successfully updated.' }\n format.json { render :show, status: :ok, location: @momo...
a41e18d178d0b260fe58eef8cd2282ca
Accuracy Convert Googles Accuracy integer into a word describing how accurate the match is
[ { "docid": "11f3fd746c42a385fe500288ea9bc714", "score": "0.5962736", "text": "def accuracy\n @accuracy ||= accuracy_map[@hash[\"AddressDetails\"][\"Accuracy\"].to_i]\\\n rescue nil\n end", "title": "" } ]
[ { "docid": "bee0e8b0d569d74ea9d2a10efcc152ce", "score": "0.7446944", "text": "def accuracy_text\n acc = data.accuracy\n return text_get(11, 12) if acc == 0\n\n return acc.to_s\n end", "title": "" }, { "docid": "a915ba6da63e62fe1765b6015afb1225", "score": "0.638673", ...
5dbb03b73f5429a593fe6c6c99b04ffb
The exponent for this term. The default value is 1.
[ { "docid": "80ae9542df95a39768a1100ce6aa2022", "score": "0.8109348", "text": "def exponent\n super || 1\n end", "title": "" } ]
[ { "docid": "f325e5f1760528fc4ca1339e5599979c", "score": "0.81669486", "text": "def exponent\n @exponent ||= if (exponent = @node['exponent'])\n exponent.to_i\n end\n end", "title": "" }, { "docid": "fe9999d5caa80c98a2035...
763b262e806b5e987a1d23b1430575a2
rsync the itunes directory to a temputsdirectory. want to have a place to lame encoding.
[ { "docid": "08ba1fe234e394d2ea0b632c909a3625", "score": "0.5563633", "text": "def rsync_to_usb\n\t\tputs \"\\n=> copying to usb.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_temp, @@dir_dest)\n\tend", "title": "" } ]
[ { "docid": "732d604d47be3eddae0aedd50216fcd1", "score": "0.71659195", "text": "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "title": "" }, { "docid": "ee69cd7380faf4a4bf4ca80c7d4dfe2b", "score": "0.65275586...
3dc1372302c5a93c6076fdec8dec50a6
GET /events/1/programs/new GET /events/1/programs/new.json
[ { "docid": "75de531c94167c8c09aafec1879f48b9", "score": "0.8376433", "text": "def new\n @event = Event.find(params[:event_id])\n @program = @event.programs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end", "title"...
[ { "docid": "f24f50fdc0d89fafb6964f6b15c17d2c", "score": "0.74929094", "text": "def new\n @program = Program.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end", "title": "" }, { "docid": "f24f50fdc0d89fafb6964f6...
d3516138948d6e04b295d62c65c9dc2f
Creates a new Document
[ { "docid": "0ff27691f5d612ae81f9975eb144811f", "score": "0.0", "text": "def initialize(params={})\n file = params.try(:delete, :file)\n super\n if file.is_a? ActionDispatch::Http::UploadedFile\n self.filename = sanitize_filename file.original_filename\n self.content_type = file.conten...
[ { "docid": "d22ee6e59b783447ffdba68f8446c8c4", "score": "0.82701164", "text": "def create_document\n\t\t@document = Document.new\n\tend", "title": "" }, { "docid": "9dd1fa55e8e7b93977b3ddbcd92387db", "score": "0.793602", "text": "def new_document\n @document = Document.new\n end"...
4bda4012364e8e540cc7b37e9b65664e
The DTM segment in the SVC loop is to be used to express dates and date ranges specifically related to the service identified in the SVC segment If service from and to dates are same, only print one segment with qual 472 Else print one segment each for the two dates
[ { "docid": "3dc379c25af60e4381329eb74853b548", "score": "0.679162", "text": "def service_date_reference\r\n service_date_elements, svc_date_segments = [], []\r\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\r\n to_date = service.date_o...
[ { "docid": "a4f0a641185f0c54c9056e9502108b0c", "score": "0.6996888", "text": "def service_date_reference\n svc_date_segments = []\n from_date = @service.date_of_service_from.strftime(\"%Y%m%d\") unless @service.date_of_service_from.blank?\n to_date = @service.date_of_service_to.strftime(\"%Y%m%...
70a65073b8ffcf4aee9171b98869623e
Returns true if Storable is a Specimen and supported by this SpecimenArrayType.
[ { "docid": "d85e0ca9e86ad307b4a62700370a9ae6", "score": "0.6434875", "text": "def can_hold_child?(storable)\n Specimen === storable and storable.specimen_class == specimen_class and specimen_types.include?(storable.specimen_type)\n end", "title": "" } ]
[ { "docid": "b98dd165da47ab5275ff0be92402a64b", "score": "0.62856853", "text": "def array_type?\n type = self.sexp_type\n @@array_types.include? type\n end", "title": "" }, { "docid": "0bfa18644b0f8a962d4f83a08477d069", "score": "0.6115034", "text": "def array?\n false\n...
c82eb8d144ec92e92757dee91d4b9c40
The Redacted URL for the torrent.
[ { "docid": "912cfa9ac6f642d26a862c2568798d5d", "score": "0.61947215", "text": "def url\n \"https://redacted.ch/torrents.php?id=#{group.id}&torrentid=#{id}\"\n end", "title": "" } ]
[ { "docid": "045b78dccd642aea74d20695673063e5", "score": "0.66274345", "text": "def to_uri\n @url\n end", "title": "" }, { "docid": "d7437a3679b8767a87c36822958e1175", "score": "0.6620975", "text": "def url\n @uri.to_s\n end", "title": "" }, { "docid": "ac9...
31dea5af060cad426800e5c112770ebd
PUT /walls/1 PUT /walls/1.json
[ { "docid": "7d8ba736d1263fa0c6da1d3d5bd6a8c2", "score": "0.7027757", "text": "def update\n\n @wall = Wall.find(params[:id])\n\n unless @wall.is_owned_by? current_user\n redirect_to \"index\", notice: \"You are not allowed to edit this wall.\"\n return\n end\n\n respond_to do |forma...
[ { "docid": "4f9ef3675b9d92599bfa6e1943e1925d", "score": "0.7336616", "text": "def update\n respond_to do |format|\n if @wall.update(wall_params)\n format.html { redirect_to @wall, notice: 'Wall was successfully updated.' }\n format.json { render :show, status: :ok, location: @wall ...
cc29517563cb2b8ac74ef18b929f0f8a
A Hash of all url schemes, where the keys represent schemes supported by all registered Provider instances and values are an Array of Providers that support that scheme.
[ { "docid": "58679cac4799d2d1964004d1f6e247be", "score": "0.0", "text": "def urls\n @@urls\n end", "title": "" } ]
[ { "docid": "17713ae4b8d3d6210fa94387fcf29dd9", "score": "0.6220927", "text": "def collection_protocols\n collection_registrations.map { |reg| reg.protocol }.uniq\n end", "title": "" }, { "docid": "728ebd335a0759f6e38c1c48fb6e5377", "score": "0.61880296", "text": "def create_s...
8b9f0335dc8e9f51337230c932a7fb14
Appends new relocation to the section. Requires ELFFile rebuild to save changes.
[ { "docid": "d326af189f7aeb25297a8bd27f1c3959", "score": "0.6117458", "text": "def append(type:, index:, offset:, addend: nil)\n raise ArgumentError, \"#{addend.nil? ? '' : 'un'}expected addend\" if addend.nil? == rela?\n\n klass = rela? ? Structs::ELF_Rela : Structs::ELF_Rel\n hdr =...
[ { "docid": "77e1a8d34a3c7b9b84e72686b9564132", "score": "0.62875015", "text": "def rebuild\n # ELF header is placed at the beginning of ELF\n all = header.to_binary_s\n\n sections.each do |s|\n s.rebuild\n\n # skip adding section data if it has none\n next if s.size <...
1421e1a2962942bc4dbc624e2c2f480c
Use breadth first search to seek a Path Use set named 'visted' to mark the visted cell Use queue named 'que' to do the search In particular, each element in the queue has three attributes: path, trans, cur path is the path between two points based on cell coordinate. trans is the path between two points based on cellwa...
[ { "docid": "7a7668c01acbc6ea27ea8a84fd95353a", "score": "0.6497316", "text": "def solve(begX, begY, endX, endY)\n return [],[] if(validate_two_end(translate(begX),translate(begY), translate(endX),translate(endY)) == false)\n start = [begX,begY]\n start_tran = [translate(begY),translate(begX)]\n...
[ { "docid": "c70304f9016017b3f14482af0f664906", "score": "0.6876985", "text": "def solve\r\n matrix = @maze\r\n finished = false\r\n\r\n start = Discovered.new(@starting_point[:x],@starting_point[:y],nil)\r\n frontier = []\r\n visited = []\r\n frontier << start\r\n\r\n while !frontie...
30cec3fbf71bea2dc908ee2a48b4698e
GET /admin/users GET /admin/users.json
[ { "docid": "644df14e27c2fead8c5959b9bb1efd4c", "score": "0.0", "text": "def index\n @admin_users = Admin::User.all.order(:id => :desc).where(:master => \"true\")\n @q = @admin_users.ransack(params[:q])\n @admin_users = @q.result(distinct: true).page(params[:page]).per(7)\n end", "title": "...
[ { "docid": "8a29471646191d84def95f7af1e081bf", "score": "0.7933867", "text": "def users(args = {})\n get(\"/users.json\",args)\n end", "title": "" }, { "docid": "1b36c6d085c50d9b823abd98e9d4a7dd", "score": "0.7912021", "text": "def list_users\n self.class.get('/users')...
9629191807191d8f729adf7fffca787e
The number of items that have encountered fatal errors on the queue during the last [stat_timeout] minutes.
[ { "docid": "0a40ded2e4e49fe1eab233bac24f1c29", "score": "0.6292425", "text": "def number_errors\n Timberline.redis.xcard attr(\"error_stats\")\n end", "title": "" } ]
[ { "docid": "f332736ad435ba7e8e6b28c78828aab8", "score": "0.7214849", "text": "def size\n Resque::Failure.count\n end", "title": "" }, { "docid": "c34d3f57faee504a21f38ae41adc6f8d", "score": "0.6942021", "text": "def amount_of_failed_jobs()\n # returning the amount of eleme...
ee5cdbe1c5bfb68838a2e40b7d5b8f8f
Takes all the files normalized from above and sen them to Song, to be proccessed
[ { "docid": "e6c4f2459d2b189848ac2a4ed17c260a", "score": "0.7398883", "text": "def import\n files.each{|f| Song.new_by_filename(f)}\n end", "title": "" } ]
[ { "docid": "83d4c5322b96d53851b571563cadd212", "score": "0.78626645", "text": "def import\n self.files.each {|files| Song.create_from_filename(files)}\n end", "title": "" }, { "docid": "a41efe60a6ed43ea73c353994a3fd171", "score": "0.7776306", "text": "def import\n\t\tself.files.e...
b819b335ac433d528406336f615cc376
Add additional page definitions to collection. Useful for extending the page layouts from an Alchemy module. === Usage Example Call +Alchemy::PageLayout.add(your_definition)+ in your engine.rb file.
[ { "docid": "2c9d440edf841e5931379a3053fec721", "score": "0.7742892", "text": "def add(page_layout)\n all\n if page_layout.is_a?(Array)\n @definitions += page_layout\n elsif page_layout.is_a?(Hash)\n @definitions << page_layout\n else\n raise TypeErr...
[ { "docid": "ee50a7ed4ebbda8b771ddae8f10d9cc4", "score": "0.6449414", "text": "def add_template_pages; end", "title": "" }, { "docid": "8ed3b51768974d8b6b239963400022ae", "score": "0.60396594", "text": "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sit...
d18122fd94c3c629e71b4e909330ad34
GET /shifts GET /shifts.json
[ { "docid": "de56fcea1436659d62087e0b3bb78690", "score": "0.5465272", "text": "def index\n # pass var to js\n gon.date1 = @date1 = params[:date1].to_date\n gon.date2 = @date2 = params[:date2].to_date\n gon.filter = @filter = params[:filter]\n \n @shifts = @current_user.shifts.by_date_ra...
[ { "docid": "46f3f02bd778b7412ccc38e682fd0dfb", "score": "0.7483861", "text": "def index\n @shifts = @group.shifts\n @shift = current_user.shifts.new(group: @group)\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: Shift.fullcalendar_format(@shifts...
0bd362f4c7f1e917ae916869c612defd
Search the web for a term, and print the titles of matching web pages.
[ { "docid": "3260241f72ed555e9fe73c8c50935caf", "score": "0.6580248", "text": "def search(term)\n base_uri = 'http://api.search.yahoo.com/NewsSearchService/V1/newsSearch'\n\n # Make the HTTP request and read the response entity-body as a JSON\n # document.\n json = open(base_uri + \"?appid=restbook&o...
[ { "docid": "25e9399d691ae99620f20d3d738ac33d", "score": "0.70203733", "text": "def search(terms)\n response = HTTParty.get(\"http://share.popgo.org/search.php\", :query => {\"title\" => terms})\n parse_html(response.body)\n end", "title": "" }, { "docid": "f90b8d5030a6dd00...
aadbc7a5e180b19631c8f6f7f2c18a21
GET /messages/1 GET /messages/1.json
[ { "docid": "43f27bbfd6aa6f761eae1e6741d6cc98", "score": "0.0", "text": "def show\n @message = Message.find(params[:id])\n puts @message, @message.notes\n @message\n end", "title": "" } ]
[ { "docid": "ea7086ff90058b90c171a0d36a56b3ff", "score": "0.74382997", "text": "def show\n @message = User.find(params[:id]).messages\n\n render json: @message\n end", "title": "" }, { "docid": "01d640eaab3a1942727bd3c46448dee5", "score": "0.7432324", "text": "def show\n msg...