query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
466656eb3cecb27d0ea4f1ece08d4ebb
PATCH/PUT /customers/1 PATCH/PUT /customers/1.json
[ { "docid": "0416890474c2e687f77b8132ad6a0116", "score": "0.6253447", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Personendaten wurden erfolgreich aktualisiert.' }\n format.json { render :show, s...
[ { "docid": "2c60a533470d8275139b2f9c3fe9d1a4", "score": "0.6988014", "text": "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "title": "" }, { "docid": "ac41031ab91b76149b7c7ee5a812520d", "score": "0.6921667", "text": "def update\n @customer = ...
136f5005c5b0c6452c186c77c722837f
++ Checks if the App is in maintenance mode and redirects if the mode is enabled.
[ { "docid": "51f293e340407f0f66d346712f77e518", "score": "0.7808891", "text": "def check_maintenance_mode()\n versioning = AppParameter.find_by_code( AppParameter::PARAM_VERSIONING_CODE )\n if versioning.a_bool?\n logger.info('--- MAINTENANCE MODE IS ON! ---')\n respond_to do |format|\n ...
[ { "docid": "d78a5f6ac1646d583f8ec8b141e66c32", "score": "0.798545", "text": "def check_maintenance_page\n if ENV.key? 'VEC_MAINTENANCE_UNDERWAY'\n redirect_to \"/maintenance.html\"\n end\n end", "title": "" }, { "docid": "f0fa5278282173d18f4bda5d4552dc4e", "score": "0.7698037...
85ae839677b067d2f8cf6784a7803bbc
Validates that the `mime_type` metadata is not included in the given list. validate_mime_type_exclusion %w[text/xphp]
[ { "docid": "e7f7ac9c8fa9fbc032bedfc553ba3152", "score": "0.8303915", "text": "def validate_mime_type_exclusion(types, message: nil)\n validate_result(\n !types.include?(file.mime_type),\n :mime_type_exclusion, message, types\n )\n end", "title": "" } ...
[ { "docid": "782b87185ad9eee329e9b331872d31b2", "score": "0.7874733", "text": "def validate_mime_type_exclusion(blacklist, message: nil)\n if blacklist.any? { |mime_type| regex(mime_type) =~ get.mime_type.to_s }\n errors << error_message(:mime_type_exclusion, message, blacklist)\n ...
5ff0257256b612dbcf2e38aef660795d
Batched version of create. POST /ops/segments/1/attendance/batch
[ { "docid": "079a0f3038124e16ca14b5bb7c140df6", "score": "0.75052357", "text": "def batch\n attendances = params.require(:attendance)\n workshop = @segment.workshop\n teachers = workshop.teacher_ids\n attendances.each do |id, status, notes|\n raise(\"Teacher id #{id} not in wor...
[ { "docid": "4d4cf1a63f5d5cc08734521cdc0de5b6", "score": "0.620094", "text": "def create_many\n lecture = Lecture.find_by(lecture_params)\n students = lecture.users\n students.each do |student|\n Attendance.create({\n user: student,\n lecture: lecture,\n status: :absenc...
0b92ab7e3d370ef2ef53d9e1766e5808
get the hash160 for this hash160 or pubkey script
[ { "docid": "1073414474369e63f5d3606e8b09e09f", "score": "0.826573", "text": "def get_hash160\n return @chunks[2..-3][0].unpack(\"H*\")[0] if is_hash160?\n return @chunks[-2].unpack(\"H*\")[0] if is_p2sh?\n return Bitcoin.hash160(get_pubkey) if is_pubkey?\n return @chunks[1].un...
[ { "docid": "c97d777b0d4d114156ed17ebb5fe65fc", "score": "0.8114002", "text": "def hash160\n Bitcoin.hash160(pubkey)\n end", "title": "" }, { "docid": "a4cfbaa0d7afee592eb8b5d1e638c0b6", "score": "0.71923083", "text": "def to_hash_160\n decode_base58(pubkey_hash_new)\n# ...
63694883b4efdbc25ea3e78671072db2
Returns a verbose version of the error description.
[ { "docid": "ee058f9e74f6f1416279f1657738d5d9", "score": "0.0", "text": "def long_display\n backtrace_display = location.join(\"\\n \")\n \"#{label}:\\n#@test_name:\\n#{message}\\n #{backtrace_display}\"\n end", "title": "" } ]
[ { "docid": "a56a6490e761262cb4bddbe0d63edc64", "score": "0.7831621", "text": "def error_description\n @values[:error_description]\n end", "title": "" }, { "docid": "a4330e39be38d129371607ddbf35f6b7", "score": "0.769602", "text": "def error_description; end", "title": "" ...
03d7f7ace2fbc22f64c918abfd8cbf8e
Create a new context. Aliases are 'testcase' and 'describe'
[ { "docid": "b2bcb4ca5bdca9f88a40d5e6bc4eedb1", "score": "0.0", "text": "def context(name, parent=default_context, &block)\n default_context.context(name, parent, &block)\n end", "title": "" } ]
[ { "docid": "d8170ab9b10e9f2bb20fe88c15468cbc", "score": "0.71807164", "text": "def test_should_create_a_new_context\n assert_nothing_raised do\n Shoulda::Context.new(\"context name\", self) do; end\n end\n end", "title": "" }, { "docid": "65b41a8c1359146e5d2b6ca5927bea41", "s...
b376909d59babfbab887fa78559a0afc
/stories/popular list of all popular stories
[ { "docid": "89f2779461deec7b29a38c9e5d368073", "score": "0.75453866", "text": "def find_popular(*args)\n path = \"stories/popular\"\n Rdigg.fetch(path, @@type, args)\n end", "title": "" } ]
[ { "docid": "74ec5c69521a2568c42c0dd215618fc4", "score": "0.7528676", "text": "def index\n @stories = Story.published\n @most_popular = Story.all_most_popular\n @most_recent = Story.all_most_recent\n end", "title": "" }, { "docid": "1cb3086563af4148e8c83343d0cf25c6", "score": "0...
e361d4e1e68a3fecc77b4c7e2c057128
Target that runs tests for all modules which are not assigned to a module group. This is to ensure that modules that are not assigned to a group are executed by the 'alltests' monkey.
[ { "docid": "ddaee4da8f1746a86b5ae66ec879afde", "score": "0.8022385", "text": "def check_nogroup\n depends :init, :compile\n groupless = @module_set.find_all { |mod| mod.groups.empty? }.map { |mod| mod.name }\n run_tests(FixedModuleTypeTestSet.new(groupless, %w(all)))\n end", "title": "" ...
[ { "docid": "5757239f94f31c3331c1c22318a8653d", "score": "0.64966226", "text": "def only_run(tests) #:nodoc:\n tests = wildcardify(tests)\n # Since the tests may reside in a sub-project, we need to set the include/exclude pattern on\n # all sub-projects, but only invoke test on the l...
dcc244b801c9018f6a291e917019c1f9
POST /organisations POST /organisations.json
[ { "docid": "b85e78fefedf0938808ef501ee5ba0e3", "score": "0.6989222", "text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully create...
[ { "docid": "39ff769766786a8a326284504b5b4e6d", "score": "0.7253842", "text": "def create\n @organisation = current_user_organisations.build(organisation_params)\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: I18n.t('controllers.org...
41285411ea83e4cb300e8e6ddaab7dbd
Interpolate the placeholders and return content from a URI
[ { "docid": "a740eebd902b8ceb634e945b6cac490f", "score": "0.66378564", "text": "def get_uri(uri, interpolate={})\n uri.gsub!('%e', Tiller::config[:environment])\n uri.gsub!('%t', interpolate[:template]) if interpolate[:template]\n\n Tiller::log.debug(\"HTTP: Fetching #{uri}\")\n resp = @clien...
[ { "docid": "6fe7b009727c30eca764ab6b529562c6", "score": "0.6075603", "text": "def interpolate_string(str); end", "title": "" }, { "docid": "6fe7b009727c30eca764ab6b529562c6", "score": "0.6075603", "text": "def interpolate_string(str); end", "title": "" }, { "docid": "d44d...
2618eddccbe598be3c8eae82003ab72b
DELETE /type_of_payments/1 DELETE /type_of_payments/1.json
[ { "docid": "64ac391f30754955d59ae7b3a89b0a03", "score": "0.7519999", "text": "def destroy\n @type_of_payment.destroy\n respond_to do |format|\n format.html { redirect_to type_of_payments_url, notice: 'Item apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "...
[ { "docid": "38b45d9603673ca270eaf0d17bd5052f", "score": "0.743988", "text": "def destroy\n @type_of_payment.destroy\n respond_to do |format|\n format.html { redirect_to type_of_payments_url, notice: \"Type of payment was successfully destroyed.\" }\n format.json { head :no_content }\n ...
a14eb0bc068d348745ca82317cd9bb4c
POST /countrys_movies POST /countrys_movies.json
[ { "docid": "affba96d8ff0f240c0d9e04d79501369", "score": "0.71364284", "text": "def create\n @countrys_movie = CountrysMovie.new(countrys_movie_params)\n\n respond_to do |format|\n if @countrys_movie.save\n format.html { redirect_to @countrys_movie, notice: 'Countrys movie was successfu...
[ { "docid": "e74aab678d4558c8cf4799f008f64bdc", "score": "0.63985425", "text": "def create\n @movie_country = MovieCountry.new(movie_country_params)\n\n respond_to do |format|\n if @movie_country.save\n format.html { redirect_to @movie_country, notice: 'Movie country was successfully cr...
c99c6d1a26ce02c88ca8d5f57251af07
TARGET = Point.new(7, 4)
[ { "docid": "05914b3bbfdbdeab52a66e386375c42c", "score": "0.0", "text": "def open?(point)\n x, y = point.x, point.y\n val = (x*x) + (3*x) + (2*x*y) + y + (y*y) + INPUT\n bin = val.to_s(2)\n count = bin.chars.count { |ch| ch == '1' }\n count.even?\nend", "title": "" } ]
[ { "docid": "2875d15caf9ccbc7183472c727f89c10", "score": "0.74638367", "text": "def p x,y\n Point.new(x,y)\nend", "title": "" }, { "docid": "46d3cf41ed12b387fdc29f8bd2c831db", "score": "0.68759763", "text": "def Point(x, y)\n Point.new(x, y)\n end", "title": "" }, { "...
02c88af4e7c59651260414bd2fb3f094
convert value stored as decimal to integer if integer question type
[ { "docid": "513b252175470257b430e9f767d19f75", "score": "0.0", "text": "def casted_minimum\n minimum.blank? ? nil : (qtype_name == 'decimal' ? minimum : minimum.to_i)\n end", "title": "" } ]
[ { "docid": "ce578d02de4a2555ac5013c6c9f13cb6", "score": "0.7749694", "text": "def typecast_to_integer(value)\n typecast_to_numeric(value, :to_i)\n end", "title": "" }, { "docid": "7ded68143c294181046732b5f049625a", "score": "0.7577224", "text": "def typecast_value_int...
e0e73f5c17ef8259c0028905abc4c2e0
DELETE /healths/1 DELETE /healths/1.json
[ { "docid": "89e8138c2d8f40876ff54a1131522212", "score": "0.0", "text": "def destroy\n authorize @health\n\n @policy.destroy\n respond_to do |format|\n format.html { redirect_to back_path || healths_url, notice: 'Insurance policy was successfully destroyed.' }\n format.json { head :no_...
[ { "docid": "e1cd9c2c5a35a873b5cb9751f104dbdd", "score": "0.77337176", "text": "def destroy\n @health_check = HealthCheck.find(params[:id])\n @health_check.destroy\n\n respond_to do |format|\n format.html { redirect_to health_checks_url }\n format.json { head :no_content }\n end\n ...
c667891ae028fd1d0d11949aafbd4b5c
Write a method select_upcase_keys that takes in a hash and returns a new hash containing keyvalue pairs of the original hash that had uppercase keys. You can assume that the keys will always be strings.
[ { "docid": "155ae2e87fd171812f0abd33616f24f7", "score": "0.8604771", "text": "def select_upcase_keys(hash)\n uppercase = {}\n hash.each do |k, v|\n if k == k.upcase\n uppercase[k] = v\n end\n end\n\n return uppercase\nend", "title": "" } ]
[ { "docid": "baf72077b0cd08ab4ae4883295c8f8d0", "score": "0.8682662", "text": "def select_upcase_keys(hash)\n upcase_keys = {}\n hash.each do |key, val|\n upcase_keys[key] = val if key == key.upcase\n end\n upcase_keys\nend", "title": "" }, { "docid": "cba63baae319baa44907835c557a0be7"...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "d7f8f39fc6015f6b2fe34828a7e0f928", "score": "0.0", "text": "def show\n\t@user = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.771752", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "a95dfe28d6b386aafc5fb53749e84258", "score": "0.75107867", "text": "def user\n...
0e4dd33e575021dd07a16a9a009a3a68
protect_from_forgery :only => :index
[ { "docid": "e925a3bd0bbaf35893846b1fdb08c1bb", "score": "0.0", "text": "def index\n@userList = TUser.find_by_sql( \n \"SELECT a.user_id, a.user_login_id, a.user_passwd, a.user_name, a.dept_id, c.dept_name, a.role_id, b.role_name, a.sex, a.phone_no, a.status\n FROM t_users a\n LE...
[ { "docid": "fe697d8a1a507e23997fb1222df48ee6", "score": "0.80506873", "text": "def protect_against_forgery?; end", "title": "" }, { "docid": "2901d60ab009777382b4329372ee3ba2", "score": "0.79356456", "text": "def protect_against_forgery?; false; end", "title": "" }, { "do...
0d8d6ba7cf8ce9fea59f2b77593bca02
Creates a new account
[ { "docid": "0414a14cdfafb8eacca5c7abbb240b23", "score": "0.0", "text": "def create_player\n @client.request_cmd(\n {\n 'player_create' => 1,\n 'app_version' => @version\n }\n )\n end", "title": "" } ]
[ { "docid": "87e0658b420ce6021de27b899a9983ee", "score": "0.8158404", "text": "def create_account(name)\r\n\r\n end", "title": "" }, { "docid": "d07f96aa1ae9bc0bb3107775603f42c0", "score": "0.81454444", "text": "def create_account(email, password)\n @api.post(Services::ACCOUNT...
d9497eafe62e780f312fb295f3ab5e78
removes all files from destdir that is not found in srcdir
[ { "docid": "0a97ce163d8e3ea678fe24001bb50811", "score": "0.0", "text": "def execute\n \n newBackup = FiRe::filesys.join(@destination, createBackupDirName)\n FiRe::filesys.mkpath newBackup\n\n FiRe::filesys.find(@destination) { |item|\n \n # prune this branch if it should be ignored...
[ { "docid": "3029065b146f364720863613b06d20b3", "score": "0.70181936", "text": "def clean_up_dirs(initial_dir, ending_dir)\n if initial_dir != ending_dir \n leftover_files = File.join(initial_dir, '*')\n \n Dir.glob(leftover_files).each do |src|\n filename = src[initial_dir.length, src.len...
d5769ab1aa57bada682ec91412f85f0b
Convert +source+ to an instance of the class.
[ { "docid": "8bea84d59c66428e248cfd4bd9df01c3", "score": "0.5779474", "text": "def from(source, specifics={})\n set = (specifics.empty? ? nil : Set.new(specifics.keys))\n base = ancestors.find{ |anc| source.class.typecasts.key?(anc) }\n if base\n cast = source.class.typecasts[base]\n ...
[ { "docid": "55ff80524e098a80111637d8577cc32a", "score": "0.6862814", "text": "def from(source)\n return nil if source.nil?\n return new source if source.is_a? Hash\n return source.dup if source.is_a? self\n return source.map { |item| from item } if source.is_a? Array\n\n ...
be835171cf4007ab457c1f3907d4e18c
the preferences in the hierarchy down to this point.
[ { "docid": "2bb0656c7b4f06349add8b4a59bb4c79", "score": "0.66918874", "text": "def final_preferences\n\t\tif not self.group.nil?\n\t\t\tmerge_down\n\t\telse\n\t\t\tself.preferences\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "e48756e4432becc84b6d2514411469e7", "score": "0.68848705", "text": "def preferences\n @_prefs ||= merged_preferences\n end", "title": "" }, { "docid": "bc88e4234b5f11772f9fbd52eb3d9b27", "score": "0.66800016", "text": "def merge_down\n\t\tself.group.final_p...
6d9eb4aec405fccd20049482406cb445
Alyssa reviewed Ben's code and says "It's a good start, but you missed a few things. You're not returning a false condition, and not handling the case that there are more or fewer than 4 components to the IP address (e.g. "4.5.5" or "1.2.3.4.5" should be invalid)." Help Ben fix his code.
[ { "docid": "40b21c179a0aada9e66ac1aea78bcf3d", "score": "0.74197996", "text": "def dot_separated_ip_address?(input_string)\n dot_separated_words = input_string.split(\".\")\n unless dot_separated_words.length == 4\n abort(\"Invalid length!\")\n end\n while dot_separated_words.size > 0 do\n wor...
[ { "docid": "916ca00bd640f851945c0719d8a9a80d", "score": "0.8031548", "text": "def valid_ip?(array)\n array.length == 4\nend", "title": "" }, { "docid": "aa5ace487dc9adf63b974aae925fc979", "score": "0.7991174", "text": "def is_string_valid_ip?(input_string)\n\n dot_separated_words =...
775a556ecfd4d4a254fba195092902a6
rubocop:enable Metrics/MethodLength rubocop:disable Metrics/MethodLength
[ { "docid": "06e7b300188a9f9cb2dc5c3f1e6cff01", "score": "0.0", "text": "def perform_request_in_thread\n @conn_thread = Thread.new do\n begin\n @connected = true\n\n resp = @client.post(\n @url,\n body: @rd,\n ssl_context: @ssl_...
[ { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6609799", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6609799", "text": "def used; end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "sc...
356a5bbad10ec7fd7f463eed5c659e4e
reduce 365 omitted reduce 366 omitted reduce 367 omitted reduce 368 omitted reduce 369 omitted reduce 370 omitted reduce 371 omitted reduce 372 omitted reduce 373 omitted reduce 374 omitted reduce 375 omitted reduce 376 omitted reduce 377 omitted reduce 378 omitted reduce 379 omitted
[ { "docid": "ee6d2a36aadf3188fd98211fe41d1f3a", "score": "0.0", "text": "def _reduce_380(val, _values, result)\n (_, line), c, _, t, rest = val\n\n result = s(:if, c, t, rest).line line\n\n result\nend", "title": "" } ]
[ { "docid": "5d54341fb90a0c63c354c3d68463fbf9", "score": "0.6698074", "text": "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "47a06518ce05914386a2b6aa82be37fc", "score": "0.65939796", "text": "def _r...
4494091c77717d5db51bc3833365c854
Make changes to name; accessible from show_name page.
[ { "docid": "9398f9d41b7b98249b8b864756e55c8e", "score": "0.73302084", "text": "def edit_name # :prefetch: :norobots:\n store_location\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n init_edit_name_form\n if request.method == :post\n @parse = parse_...
[ { "docid": "a71bbd13b1fac0924be779dc33a6d228", "score": "0.7833761", "text": "def new_name(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "7148ef9c0344f4e9d26ed3c0af666a3f", "score": "0.7623199", "text": "def name=(name)\n\t\t@new_name = name\n\tend", "t...
bc5ce743a262b44f70d0dc6b26bbe6d6
GET /events/1 or /events/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "64993e34378a276f8adcb75e4c244500", "score": "0.73724276", "text": "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "title": "" }, { "docid": "04b1a5a70f53f056cdc67f164f9201dd", "score": "0.7354757", ...
ca513b552bf4ec0e5256142d4d8307e1
GET /events/daily/2009/1 GET /events/daily/2009/1.xml GET /events/daily/2009/1.xls GET /events/daily/2009/1.csv GET /events/daily/2009/1.pdf GET /events/monthly/2009/1 GET /events/monthly/2009/1.xml GET /events/monthly/2009/1.xls GET /events/monthly/2009/1.csv GET /events/monthly/2009/1.pdf
[ { "docid": "d3b17e0f9e39310c36a10801fa60be32", "score": "0.60872597", "text": "def find_by_month\r\n #date = params[:year] + \"-\" + params[:month] + \"-\" + params[:day]\r\n if params[:period] == \"monthly\"\r\n Event.switch_data(params[:connection], \"monthly\")\r\n Event.switch_table(...
[ { "docid": "040ac2aee1c1e46decd04282d3229a41", "score": "0.66109234", "text": "def index\n nextday = future_date(params[:period]) \n @events = Event.fetch_for_period(Date.today, nextday)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @event...
f7d1ea62adac548e098e4c3bf25fecf6
Initializes a new Tag
[ { "docid": "167b120d273eb1fbf87ebbfb30357526", "score": "0.0", "text": "def initialize(owner, name)\n super()\n @name = name\n @slug = Tags.slugize name\n @uri = \"#{owner.uri}#{slug}/\"\n @output_dir = \"#{owner.output_dir}/#{slug}\"\n @...
[ { "docid": "a7b742958a43373229bb05e823397122", "score": "0.80671036", "text": "def initialize(tag)\n\n super(tag)\n end", "title": "" }, { "docid": "9a37076be9e57486a9687a64d46bffa8", "score": "0.7991524", "text": "def initialize(tag)\n super(tag)\n end", "title": "" },...
9419bff14844cd456763fe21badd9866
One time run for testing
[ { "docid": "d121bd40d9bea08eedccdcf62f45e67c", "score": "0.0", "text": "def rehearsal(&block)\n block.call if block\n end", "title": "" } ]
[ { "docid": "84148dec3c1205e779c7decaaa8f1d0a", "score": "0.7521701", "text": "def test_run_started; end", "title": "" }, { "docid": "8070cf01e82acc4e4d86843e06ba340a", "score": "0.7438678", "text": "def run_test\n\t\trun_test(20000)\n\tend", "title": "" }, { "docid": "6ac...
05856b61cedfb5ec13705b7a66b9c048
DELETE /admin/courses/1 DELETE /admin/courses/1.json
[ { "docid": "65a66b56b488db188c201b418a6b54be", "score": "0.73394966", "text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_instruction_path( @instruction ), notice: '課程刪除完成' }\n format.json { head :no_...
[ { "docid": "128adfc7af8c789c00e8dc798f017c28", "score": "0.7718705", "text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n render json: {success: \"ok\"}\n\n end", "title": "" }, { "docid": "f619bec05c1a9fc3a98e9b99abb8121d", "score": "0.7651763", "t...
814b36d05e0abb490303572d8d215c52
DELETE /add_investment_months/1 DELETE /add_investment_months/1.json
[ { "docid": "7edb1b49a3f1f03c9779122be51398e9", "score": "0.7880744", "text": "def destroy\n @add_investment_month.destroy\n respond_to do |format|\n format.html { redirect_to add_investment_months_url, notice: 'Add investment month was successfully destroyed.' }\n format.json { head :no_...
[ { "docid": "d5722e144b1e9b53e89c468d14e93fba", "score": "0.70967066", "text": "def destroy\n @add_investment.destroy\n respond_to do |format|\n format.html { redirect_to add_investments_url, notice: 'Add investment was successfully destroyed.' }\n format.json { head :no_content }\n en...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c185ed47a60d985c65611053ee48e075", "score": "0.0", "text": "def update!(**args)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012677", "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...
68188d53c0872618fc06544ecd82a839
Iterate block with record as Hash.
[ { "docid": "d35ca3d2d7c6bd8702006195b2c05e7d", "score": "0.6881566", "text": "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "title": "" } ]
[ { "docid": "4175507074ea819a9467c0c860cccebb", "score": "0.7862503", "text": "def each_record_as_hash\n\t\t@record_set.each do |record|\n\t\t\tparsed_record = parse_tuple(record)\n\t\t\tyield(record_hash(parsed_record))\n\t\tend\n\tend", "title": "" }, { "docid": "5d6474f3da60143756d0547ec11...
53efca0cd9ec798324f6b163ed311d77
Set the secret hash for generating the secure hash to be sent in the request to Paydollar
[ { "docid": "ec935983e982b9ea056d51f2c1e30a53", "score": "0.7143106", "text": "def secret_hash(value)\n @hash_key = value\n end", "title": "" } ]
[ { "docid": "59c48ba5f31c37c8d0f149c366ffa5a5", "score": "0.78975844", "text": "def generate_secure_hash(secret_hash)\n if secret_hash\n # add the merchant's seceret hash\n values = [ secondary_bank_host_status_code, primary_bank_host_status_code, status, \n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "983e160d9fbdb00a00aeba493b1781e9", "score": "0.0", "text": "def set_major_city\n @major_city = MajorCity.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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c5c143ae20dd85368157b86ca4b00868", "score": "0.0", "text": "def set_truck\n @truck_expense = TruckExpense.find(params[:id])\n @truck = Truck.find(@truck_expense.truck_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...
68d35a68d5fe9625f8bb2750f2c19ea8
Set the host name, including protocol, that will be used on all links to your sitemap files. Useful when the server that hosts the sitemaps is not on the same host as the links in the sitemap.
[ { "docid": "ebdd49475583b00ae1eb6ad78e539174", "score": "0.7149558", "text": "def sitemaps_host=(value, opts={})\n opts.reverse_merge!(:and_self => false)\n @sitemaps_host = value\n update_location_info(:host, value, opts)\n end", "title": "" } ]
[ { "docid": "5b05bab03d32da5e64599e73c0dbf988", "score": "0.7333876", "text": "def sitemaps_host=(value)\n @sitemaps_host = value\n update_location_info(:host, value)\n end", "title": "" }, { "docid": "0a391d3bfeb7aba7eb606983104d9928", "score": "0.72019595", "text"...
9464e511c52eb06c055e32d2c38c7d81
Return the next Campa form available in the underlying io like object.
[ { "docid": "4845c347abcad51883604ea21ec4fd96", "score": "0.5266287", "text": "def next\n eat_separators\n return read if !@input.eof?\n return if @current_char.nil?\n\n # Exhaust the reader if @input.eof? and !@current_char.nil?\n read.tap { @current_char = nil }\n end", ...
[ { "docid": "6a941e41870ee290390a10bd1d5255a9", "score": "0.6719033", "text": "def get_next_form\n remainder = remaining_forms\n next_form = remainder[0]\n return next_form\n end", "title": "" }, { "docid": "1897d6f4906b929877bf885169dee852", "score": "0.6136712", "text": "d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2a5582207d0aaa80000f4c28fc212180", "score": "0.0", "text": "def cldc_team_params\n params.require(:cldc_team).permit(:team_name, :team_captain, :team_captain_email, :team_captain_phone, :second_member_name, :second_member_email, :third_member_name, :third_member_email, :advisor_title, :...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74959", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957448", "text": "def strong_params\n params.require(:request).permit(param_whiteli...
b00eca7c41218b8c058f8996c4bc764a
Sets the appId property value. The application or bundle identifier of the application
[ { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.7702151", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" } ]
[ { "docid": "ac731e6a3b11cc8af3ca02d68b8724ad", "score": "0.7625574", "text": "def appid=(val)\n self.fields['appid']=val\n end", "title": "" }, { "docid": "8e64740290c9900600687b3110cdbada", "score": "0.7508409", "text": "def set(appid)\n @appid = appid\n self\n...
9e7cfae34cbd9587071ac244e6b3fbeb
Remembers a user in the database for use in persistent sessions.
[ { "docid": "aac23f71b7faed826e7975a952b3db50", "score": "0.0", "text": "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "title": "" } ]
[ { "docid": "2851e427c467049c7639c468daea3c35", "score": "0.6720419", "text": "def reload_user\n @user = User.find(session[:user][:id])\n end", "title": "" }, { "docid": "96a75f37098f9b5db8b7c451f485268e", "score": "0.6603912", "text": "def check_new_or_reseted_user\n begin\n ...
d3f8c814fd0655a315295e24238d7d27
Query execution information, such as number of retries and all tried hosts, etc.
[ { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.59992355", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n ...
[ { "docid": "c8b0166db6feec6cd0aa02c00fb6d7a6", "score": "0.651995", "text": "def get_execution_info; end", "title": "" }, { "docid": "5236963222679302ba7657a27d981260", "score": "0.5866021", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n ...
1b7653b03a082264d0e50a7d3a1e9726
If you now keep the first digit fixed in place, and rotate the remaining digits, you get 329175. Keep the first 2 digits fixed in place and rotate again to 321759. Keep the first 3 digits fixed in place and rotate again to get 321597. Finally, keep the first 4 digits fixed in place and rotate the final 2 digits to get ...
[ { "docid": "c73087ed797feb7e9af8880a9d9d645a", "score": "0.0", "text": "def rotate_array(ary)\n ary[1..-1] + [ary[0]] # need to concatenate 2 arrays\nend", "title": "" } ]
[ { "docid": "9736596bd3301266907a67791a3a1702", "score": "0.8995628", "text": "def max_rotation(number)\n number_digits = number.to_s.size\n number_digits.downto(2) do |n|\n number = rotate_rightmost_digits(number, n)\n end\n number\nend", "title": "" }, { "docid": "9736596bd3301266907...
e6dd07257befda8322e18bcc7b9384e7
GET /nagios_contact_group_service_escalation_details/new GET /nagios_contact_group_service_escalation_details/new.xml
[ { "docid": "4b7338734889c587d93cd3ac4a912031", "score": "0.8057193", "text": "def new\n @nagios_contact_group_service_escalation_detail = NagiosContactGroupServiceEscalationDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nagios_contact_g...
[ { "docid": "da25949992e98799424d3dedd53c60b4", "score": "0.7742466", "text": "def new\n @nagios_service_group_detail = NagiosServiceGroupDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nagios_service_group_detail }\n end\n end", ...
336cca4f7bed1fba27d4757653cf3dfb
Profile registration Register a new customer profile. Requires the cart.billing object to be populated along with the password.
[ { "docid": "053966007982b3a5e1d10b35b452a1de", "score": "0.0", "text": "def register_with_http_info(register_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CheckoutApi.register ...'\n end\n # verify the required parameter 'regi...
[ { "docid": "3ff7a483e96f010c4fdfb108fced5c1c", "score": "0.6940043", "text": "def create_customer_profile(options)\n requires!(options, :profile)\n requires!(options[:profile], :email) unless options[:profile][:merchant_customer_id] || options[:profile][:description]\n requires!(opt...
3b826b26e95f6641981684ee5ff65358
Provide a user friendly representation
[ { "docid": "f5e1fcb5e10d0ab5bb9f1e2f2cbf2598", "score": "0.0", "text": "def to_s\n '#<Twilio.Pricing.V2.NumberList>'\n end", "title": "" } ]
[ { "docid": "215f29191080c4bf1c51441e99ca812a", "score": "0.70430577", "text": "def to_display\n raise NotImplementedError\n end", "title": "" }, { "docid": "10e71201c7d33f56a89616b30aa39d6b", "score": "0.7025487", "text": "def to_s; description end", "title": "" }, { ...
48078a655239b9436a01621fc8034a16
Update every Resource in the 1:m Collection, bypassing validation
[ { "docid": "089f0953a3945aec25d4dc33bdfc120c", "score": "0.57366186", "text": "def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "title": "" } ]
[ { "docid": "d90b470a5115e426bea3f7fa6052d9f4", "score": "0.73701525", "text": "def update(attributes, collection)\n #collection[0].model.last_query = [attributes, collection]\n fm_params = prepare_fmp_attributes(attributes)\n counter = 0\n collection.each do |resource|\n ...
be78f7a1f4bc07b0f08f7be922daaaa4
GET /shels/1 GET /shels/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "725c9b0e4c4e665036cd47dfb54caa46", "score": "0.6844929", "text": "def index\n @sheds = Shed.all\n\n render json: @sheds\n end", "title": "" }, { "docid": "93d7b36794b96380caa881cc274f58ea", "score": "0.6695495", "text": "def show\n render json: MangaBookshelf.fi...
d27b358b61956cd6c196dc3a535ee346
Internal: Internal faraday connection where all requests go through rubocop:disable Metrics/AbcSize rubocop:disable Metrics/BlockLength
[ { "docid": "cf21cdf8065d4d435a5fa7e2897f1b8c", "score": "0.0", "text": "def connection\n @connection ||= Faraday.new(options[:instance_url],\n connection_options) do |builder|\n # Parses JSON into Hashie::Mash structures.\n unless options[:mash...
[ { "docid": "abb7b532717102ed8060ab38c0a81226", "score": "0.69723326", "text": "def connection\n @connection ||= Faraday.new(url: BASE_URI) do |conn|\n conn.use :http_cache, store: Rails.cache, logger: ActiveSupport::Logger.new(STDOUT)\n conn.request :rate_limit, max: 3, interval...
4345bfcd2c694a368596385087767e12
DELETE /movimentacaoprodutos/1 DELETE /movimentacaoprodutos/1.json
[ { "docid": "0b51dc03c2129120fa55f22fa653434b", "score": "0.7471429", "text": "def destroy\n @movimentacaoproduto.destroy\n respond_to do |format|\n format.html { redirect_to movimentacaoprodutos_url, notice: 'Movimentacaoproduto was successfully destroyed.' }\n format.json { head :no_con...
[ { "docid": "02548d8c2b2ef43f5fd2647b82eef83b", "score": "0.7521782", "text": "def destroy\n @movimentacao = Movimentacao.find(params[:id])\n @movimentacao.destroy\n\n respond_to do |format|\n format.html { redirect_to movimentacoes_url }\n format.json { head :ok }\n end\n end", ...
6e4467df6975c2ca1f6d248440ee0696
PATCH/PUT /orden_anuladas/1 PATCH/PUT /orden_anuladas/1.json
[ { "docid": "6ad27981aef117c81b18d626582bed9e", "score": "0.6553156", "text": "def update\n respond_to do |format|\n authorize @orden\n if @orden_anulada.update(orden_anulada_params)\n format.html { redirect_to @orden_anulada, notice: 'OrdenAnulada actualizado.' }\n format.json...
[ { "docid": "aa735ab556d37c70906f6b499be5d74a", "score": "0.6881426", "text": "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully u...
4e479467487fe32800b7be138c50a840
DELETE /organizations_timeline_entry/1 DELETE /organizations_timeline_entry/1.json
[ { "docid": "ed0a1cdd14e71b9fc7a64700f3358330", "score": "0.70615363", "text": "def destroy\n @organization_timeline_entry = OrganizationTimelineEntry.find(params[:id])\n @organization_timeline_entry.destroy\n flash[:notice] = 'Successfully removed entry from downtime tracker'\n redirect_to o...
[ { "docid": "b829270fe92d298cf3ee177bb4487940", "score": "0.7200863", "text": "def destroy\n @timeline.destroy\n respond_to do |format|\n format.html { redirect_to timelines_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2bb4976de1ffc244a...
013d534840b11960e7160e85eb6c0486
Use callbacks to share common setup or constraints between actions. Only allow a trusted parameter "white list" through.
[ { "docid": "d9626413eddddadfd0da48538f0ba306", "score": "0.0", "text": "def location_params\n params.require(:location).permit(:name, :user_id)\n end", "title": "" } ]
[ { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.6262482", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.59820163", "text": "def required_action\n # TODO: implement\n ...
ff6df0b2d4979773d57331fc7f83917e
def stagnate(board) if neighbors.count == 2 board.to_live << self if state == "alive" board.to_die << self if state == "dead" end end
[ { "docid": "504b5003390292cc45ed7a102f3ef867", "score": "0.0", "text": "def evaluate_cell(board)\n\t\tfind_neighbors(board)\n\t\tunder_population(board)\n\t\tovercrowding(board)\n\t\tzombify(board)\n\tend", "title": "" } ]
[ { "docid": "c4a1270e1b3b66c4b8ff675b5ea4fe60", "score": "0.68817663", "text": "def tick!\n to_die = []\n to_live = []\n\n @cells.each do |row|\n row.each do |cell|\n\n # Add up the number of 'alive' neighbouring cells\n live_neighbour_count = neighbours(cell.x, cell.y).select...
f94f4a440f57c03e8c1cb3928f349c62
PUT /course_memberships/1 PUT /course_memberships/1.json
[ { "docid": "d0a3a0329a81cbfa84c05ad682e26b79", "score": "0.76966506", "text": "def update\n @course_membership = CourseMembership.find(params[:id])\n\n respond_to do |format|\n if @course_membership.update_attributes(params[:course_membership])\n format.html { redirect_to @course_membe...
[ { "docid": "b2adf9cf6429e48bbdfc9f148a38103f", "score": "0.7035432", "text": "def update\n if @membership.update(membership_params)\n render json: @membership, status: :ok\n else\n render json: @membership.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
fd8a63daa0ccac4bf1e40e195a4d98d3
Returns a Catalog of all spell types in Scryfall's database
[ { "docid": "13f440a7063058fabc8798ce20690205", "score": "0.6985226", "text": "def spell_types(format: \"json\", pretty: false)\n request_catalogue(\"/catalog/spell-types\", format, pretty)\n end", "title": "" } ]
[ { "docid": "89b4c8a588561ee170e601830c8a07c4", "score": "0.63147676", "text": "def spells()\n spellbooks = self.spellbooks\n spells = []\n spellbooks.each { |spellbook| spells.concat(spellbook.spells()) }\n return spells\n end", "title": "" }, { "docid": "f48d89e360a5254ad4bb452...
0dfc39e5d4a096a3a281680abab7b1c6
Stops users from being impersonated by making sure only the current user can edit their own record
[ { "docid": "02d09388ccc1575ecddef248b29a92b0", "score": "0.0", "text": "def redirect_to_correct_user(path, requested_id)\n # Potential failure here if the requested_id appears multiple times.\n \n # As long as all of the routes to this controller only ever contain...\n # ...one id (a...
[ { "docid": "944d1e0b18984a9e0ad9e07b1cb79af7", "score": "0.7153112", "text": "def stop_impersonating\n stop_impersonating_user\n redirect_to root_path and return\n end", "title": "" }, { "docid": "989326a29db8c4ef9061e805485c06c5", "score": "0.6985286", "text": "def revert_imp...
f3f2d2fbeba6641f653a8baafebb6f45
return a win/loss string from a summoner stat hash
[ { "docid": "f2a26554bd78cc1f28e7b969baf961ca", "score": "0.70735896", "text": "def winloss( s )\n # puts s.inspect\n return nil if !s.is_a?( Hash )\n win = s.fetch(:wins, 0)\n loss = s.fetch(:losses, 0)\n n = s.fetch(:played)\n return \"#{win}/#{loss}\\t(n=#{n},\\t#{(win.to...
[ { "docid": "e0ff3dec7e689421138a63e377671501", "score": "0.6207429", "text": "def get_player_stat(player_name, stat)\n game_hash.each do |location, team_data|\n player_stats = team_data[:players][player_name]\n if (player_stats)\n return player_stats[stat]\n end\n end\n nil\nend", "...
7af2eb033b9446996836b6a1ac8ad145
GET /rescates GET /rescates.json
[ { "docid": "17912a104a67e00fd19e3691ba330ac2", "score": "0.7058291", "text": "def index\n @rescates = Rescate.all\n end", "title": "" } ]
[ { "docid": "b1b8216fee8f527f689d9ec97018ba69", "score": "0.6850548", "text": "def index\n @rescats = Rescat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rescats }\n end\n end", "title": "" }, { "docid": "dc0ece48134e339063d...
43e5f0db075aa142e94fea050bdd8e63
DELETE /person_tags/1 DELETE /person_tags/1.json
[ { "docid": "36d3d1274ea238ea6083f2249856547f", "score": "0.75687087", "text": "def destroy\n @person_tag.destroy\n respond_to do |format|\n format.html { redirect_to person_tags_url, notice: 'Person tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "d67c29208071bc07677edfe1b1e5ef52", "score": "0.7666938", "text": "def tagDelete(tag)\n http, req = initReq(\"tags/#{tag}\", \"DELETE\")\n http.request(req).body\nend", "title": "" }, { "docid": "d67c29208071bc07677edfe1b1e5ef52", "score": "0.7666938", "text": "def tagDe...
bbe5d5ad39ad78b0d7e0875ec778c60b
Merges any children of ke that are adjacent and of the same type and have same salient attributes. NOTE: this doesn't do any recursion. It operates on a single ke only.
[ { "docid": "fd81b417219c2d909a4393d6c3825fb3", "score": "0.6711479", "text": "def merge_adjacent_child_elements!(ke)\n if(\n ke.children.empty? || # nothing to merge\n :block == ::Kramdown::Element.category(ke.children.first) || # can't merge paras or headers\n :entity == ke.ty...
[ { "docid": "828749bd9bc923759bebabacfa3b6cb8", "score": "0.5864816", "text": "def consolidate\n roots = []\n root = @next\n min = root\n # find the nodes in the list\n loop do\n roots << root\n root = root.right\n break if root == @next\n end\n degrees = []\n roots...
5fcbfdd5af2e9e8efb6e77048511f26b
Every hour is add to hatched hour of each egg
[ { "docid": "89f701494c84798e6aa5392bdbd7f43c", "score": "0.7241538", "text": "def increase_hatched_hour(hours)\r\n end", "title": "" } ]
[ { "docid": "85f3c263e1b92b91d5f3f038fd928d3e", "score": "0.7190978", "text": "def increase_hatched_hour(hours)\n $hatched_hours = $hatched_hours + hours\n end", "title": "" }, { "docid": "6b51aa61d7964d486ba6d171efb8346e", "score": "0.6433445", "text": "def add_hour(ball)\n\t\tif...
1f0d15fc2a8b64b30ecd0faada7e0c13
Attach a network to a network zone ==== Params +id+ ID of the network zone +network_id+ ID of the network
[ { "docid": "3d0bbe01a579d0fe4d8dcf50b3b0cb99", "score": "0.88454556", "text": "def attach(id, network_id)\n request(:post, \"/network_zones/#{id}/networks/#{network_id}/attach.json\")\n end", "title": "" } ]
[ { "docid": "cd754cbca7d93403b571528ef02beddd", "score": "0.64135563", "text": "def attach(id, cidr)\n self.execute(['--local', 'attach', cidr, '--rewrite-hosts', id])\n end", "title": "" }, { "docid": "0dc3b627990d9ba1615186ceff98bd96", "score": "0.6358463", "text": "def crea...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "527493cb4933c3cfdc0cdffb59a11a1d", "score": "0.0", "text": "def shopping_management_development_params\n params.require(:shopping_management_development).permit(:categoryCd, :goods, :date, :amount, :sum, :place)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497761", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6959097", "text": "def strong_params\n params.require(:request).permit(param_white...
31d49af188ac2ed37da0795c1e7ebce3
Read short description and long description of all scripts and renerate a README.md file with proper markdown syntax.
[ { "docid": "c27765ed855a9821d91338013fe61d71", "score": "0.0", "text": "def short_description(script)\n\nend", "title": "" } ]
[ { "docid": "a6aa6193b56bc304a746752030eb3a32", "score": "0.7474345", "text": "def show_readme\n readme \"README\"\n end", "title": "" }, { "docid": "a6aa6193b56bc304a746752030eb3a32", "score": "0.7474345", "text": "def show_readme\n readme \"README\"\n end", ...
e167133da553c6b870dc3fbb2f37e8e3
checks and save the data from the file.
[ { "docid": "cb972102e3b7a3decd40f6198ec86b15", "score": "0.554903", "text": "def check_and_save(data)\n\n begin\n data.save!\n data\n rescue ActiveRecord::RecordInvalid\n data = data.refresh!\n data\n\n end\n\n end", "title": "" } ]
[ { "docid": "0801a1fd057a424bcf43e6dfd24db455", "score": "0.65756613", "text": "def write_and_verify\n File.open(@path + \"#{@name}.json\", 'w') do |f|\n f.write(@data.to_json)\n true\n end\n false\n end", "title": "" }, { "docid": "79fd9742716894d57d567fbd632bb19e", "...
e26e0e9904b13e911cba36b0ad9283fa
Initialize with user agent _user_agent_.
[ { "docid": "d0624098d647187bf11759a5932cab6c", "score": "0.84669507", "text": "def initialize user_agent\n @user_agent = user_agent.strip\n end", "title": "" } ]
[ { "docid": "12749aa5e732a434ab1d077f573bef4f", "score": "0.8304068", "text": "def initialize(user_agent)\n @user_agent = user_agent.to_s\n end", "title": "" }, { "docid": "0d901c9b9dcf85b0ccf87e8ea71d7576", "score": "0.78430134", "text": "def set_useragent(user_agent)\n @user_...
837f47c8c8f04ddd53bb0c6ae96124a8
Method that returns the calculation if it is a number_based
[ { "docid": "63049958c7065ea2da2e1d3e516165ff", "score": "0.60861", "text": "def generate\n return calculation if number_based?\n string_based\n end", "title": "" } ]
[ { "docid": "ea734ffb9fb07943eb3463b42e72b77e", "score": "0.694504", "text": "def number?\n (self.integer? or self.float?) ? (return true) : (return false)\n end", "title": "" }, { "docid": "0ce0b3be905884ec06fed338148a795d", "score": "0.6938873", "text": "def number_based?\n ...
55fd3ec99bf5ad91715a52e6beecd172
write a fucntion that removes all ODD number from an array remove_odd
[ { "docid": "bf8f5f1960359eef83d80b3339b54b29", "score": "0.8152149", "text": "def remove_odd num1\n return num1.delete_if &:odd?\nend", "title": "" } ]
[ { "docid": "1a771a88739d7704aa752b098be191bf", "score": "0.8905805", "text": "def remove_odd_numbers_from_array(arr)\n arr.reject(&:odd?)\nend", "title": "" }, { "docid": "3ecd8695714ea37a2cc4175fdbfe934c", "score": "0.8721176", "text": "def remove_odd array\n\tarray.reduce [] do |e...
10a78d18891004e7f1faa33125549919
GET /footprints GET /footprints.json
[ { "docid": "7e40d22a6770220b0a2cbc45c841fc46", "score": "0.7430633", "text": "def index\n @footprints = Footprint.all\n end", "title": "" } ]
[ { "docid": "16e2c7b0e2272392244b0b60c7019e5a", "score": "0.75104284", "text": "def index\n @footprints = Footprint.all\n end", "title": "" }, { "docid": "4930e1d1f26ae501545e98b43ff146ba", "score": "0.7380248", "text": "def index\n @foot_prints = FootPrint.all\n end", "ti...
3c1660066177af6ddd9a68fba821af1e
Return applicant (name) for the truck
[ { "docid": "314aa914b2c66428631a56c61fd9d647", "score": "0.63335675", "text": "def applicant\n @info[\"applicant\"]\n end", "title": "" } ]
[ { "docid": "c7dc6488043fac3100f58d94e4c61779", "score": "0.637547", "text": "def app\n app_name = self.respond_to?(:app_name) && self.app_name\n app_name ||= self.class.respond_to?(:app_name) && self.class.app_name\n app_name ? \"[#{app_name}]\" : \"\"\n end", "titl...
8e764384254ef08b087ca933d67516b6
Sets instance variables in the current object based on values found in the XML document and the mapping specified in GoogleApps::Atom::MAPS
[ { "docid": "938c2da5e49c97c5a43c18a0a53b0766", "score": "0.49377358", "text": "def set_instances(intersect, node)\n intersect.each do |attribute|\n instance_variable_set \"@#{@map[attribute]}\", check_value(node.attributes[attribute])\n end\n end", "title": "" } ]
[ { "docid": "7525f762a6780134840ada8f812926bc", "score": "0.6157017", "text": "def read_map(mapfile)\n mapfile = File.join(\"lib\", \"adventure\", \"data\", mapfile)\n xml = Document.new(File.open(mapfile))\n @@name = xml.root.attributes[\"name\"]\n\n xml.elements.each(\"Map/variable\") do |e...
4177bc4cf8320e46e4577c9ea8f98dba
end methods used for testing via vs code Assigns a Sample to an input
[ { "docid": "c68406bcf4054da7317f65956dc4fc33", "score": "0.0", "text": "def set_input(name, val, aft = nil)\n set_property(name, val, 'input', false, aft)\n end", "title": "" } ]
[ { "docid": "4277b19cab6879096536a2dd0fd20591", "score": "0.68327224", "text": "def initialize(sample)\n @sample = sample\n end", "title": "" }, { "docid": "1d216a00ca4c1f9d37e5b136fe85125c", "score": "0.6735328", "text": "def input_sample(name, opts = {})\n sample name...
97681e09af47c4b82cdcad31f4e6bb22
convert a tree node to a set of adjacencies
[ { "docid": "f1459d98443716b16f6879f8300b42e1", "score": "0.60566866", "text": "def to_adjacencies\n cltn = []\n _to_adjacencies( self, cltn )\n cltn\n end", "title": "" } ]
[ { "docid": "1d667203c89ec63c5fd7655397ae2d5c", "score": "0.6432202", "text": "def adjacents()\n\n al = Array.new\n\n DELTAS.each { |d| al<< move(d) }\n al\n end", "title": "" }, { "docid": "60cd46d1df9692c8a42f6c76a859f2e2", "score": "0.61476505", "text": "def nodes...
93dba0ad63b43da3f9719f3e3d309ef0
GET /service_learning_positions/1 GET /service_learning_positions/1.xml
[ { "docid": "43b33f8126fecbd5a91e2e9955437dd5", "score": "0.6262473", "text": "def show\n @service_learning_position = @organization_quarter.positions.find(params[:id])\n session[:breadcrumbs].add @service_learning_position.title(true, true, false)\n\n respond_to do |format|\n format.html #...
[ { "docid": "fca4d4969a54b345ba090ec1d7e1d784", "score": "0.6053", "text": "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "title": "" }, { "docid": "3b5dfc2d38b4057fa3be3c6b177a41ba", "score": "0.59...
7b701539723bf5a243b93a6cd965615d
Add a connection to this pool, wrapping the connection with a Makara::ConnectionWrapper
[ { "docid": "eca3f87ddda1f05d832b1cf9a80ed9de", "score": "0.68866825", "text": "def add(connection, config)\n config[:name] ||= \"#{@role}/#{@connections.length + 1}\"\n\n wrapper = Makara::ConnectionWrapper.new(connection, @proxy, config)\n wrapper._makara_weight.times{ @connections << wr...
[ { "docid": "9b1528cad17ca0aea02cc3968ad34ad0", "score": "0.6680708", "text": "def add_connection(connection)\n self.connections[connection.id] = connection\n end", "title": "" }, { "docid": "fc993207f6809d3aa3cf2bcbf1970337", "score": "0.6536684", "text": "def add_to_pool...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f63b7cd4c19798ad998276c4eb8ee594", "score": "0.0", "text": "def job_information_params\n params.require(:job_information).permit(:job_title, :company_name, :job_description, :company_location, :post_date)\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...
d7fc5759f926322769afed6e28058f79
Saves page to place specfied at name inside of test.rb definition of: config.integration_test_render_dir = Rails.root.join("spec", "render") NOTE: you must pass "js:" for the scenario definition (or else you'll see that render doesn't exist!)
[ { "docid": "b06010151cff8ec2fef3d27abe5a5ed3", "score": "0.7064414", "text": "def render_page(name)\n png_name = name.strip.gsub(/\\W+/, '-')\n path = File.join(Rails.application.config.integration_test_render_dir, \"#{png_name}.png\")\n page.driver.render(path)\nend", "title": "" } ]
[ { "docid": "5e6dee591667c47bb0844793afafcf97", "score": "0.6479205", "text": "def save_and_open_page\n return unless File.exist?(saved_page_dir)\n\n filename = \"#{saved_page_dir}/webrat-#{Time.now.to_i}.html\"\n \n File.open(filename, \"w\") do |f|\n f.write rewrite_css_and_i...
3771a55108c97dbc81d03cec4aabb1a0
Return the front battler of the Pokemon
[ { "docid": "59f6f2bf3c43d2fc987f9c3fc337fd23", "score": "0.7072079", "text": "def battler_face\n return RPG::Cache.poke_front(PFM::Pokemon.front_filename(id, form, female?, shiny?, egg?), shiny? ? 1 : 0)\n end", "title": "" } ]
[ { "docid": "f22586a8ed6f208ceda36db8b5367407", "score": "0.6827591", "text": "def battler_back\n return RPG::Cache.poke_back(PFM::Pokemon.back_filename(id, form, female?, shiny?, egg?), shiny? ? 1 : 0)\n end", "title": "" }, { "docid": "52a8a65a12c6dcecc8ed953be9e4ef91", "score":...
ec3da2dddaa96b9b1368d3a541b78a64
Decorates the provided FileSets with the information we have in the ActiveStorage table. externalIdentifier is also removed from the request.
[ { "docid": "0a68b0690329b1c6fdb1a1e071f97901", "score": "0.69294924", "text": "def decorate_file_sets(model_params)\n file_sets(model_params).each do |fileset|\n fileset[:version] = model_params[:version]\n fileset.dig(:structural, :contains).each do |file|\n next unless decoratable_...
[ { "docid": "c9e859d6477a4d9745319ed78809752b", "score": "0.6390459", "text": "def decorate_request_file_sets(model_params)\n file_sets(model_params).each do |fileset|\n fileset[:version] = 1\n fileset.dig(:structural, :contains).each do |file|\n decorate_file(file:, version: 1)\n ...
c10a0ad5c9bd42a3e8efa067a8f4241f
TODO support other transfer systems
[ { "docid": "4ec266ca959d002b5d514cd99a034198", "score": "0.0", "text": "def transferrer\n Transferrer::S3.new(self)\n end", "title": "" } ]
[ { "docid": "68742f0fb65ad6c69cdf5ab3a37d00e8", "score": "0.7891128", "text": "def transfer; end", "title": "" }, { "docid": "68742f0fb65ad6c69cdf5ab3a37d00e8", "score": "0.7891128", "text": "def transfer; end", "title": "" }, { "docid": "a6ade7da71c94d2b97a96c89876cb396",...
6e23eb9c0511b681b07cc4601ed59d2f
Determine if the string is a legal object id.
[ { "docid": "3a0683061c155636c62a2c308e1c3208", "score": "0.60016376", "text": "def legal?(string)\n /\\A\\h{24}\\Z/ === string.to_s\n end", "title": "" } ]
[ { "docid": "554aad7492add8350ab4ffa5e27ccfea", "score": "0.7730315", "text": "def id?(str); end", "title": "" }, { "docid": "b775ea848293163fea73041c6f50b0db", "score": "0.77183324", "text": "def is_id? str\n match = [KVP,DELIM]\n return false if match.a...
9a349c87a506cd49986607b8bd0313d5
attr_accessor :category_name, :category_description, :category_status attr_accessor :selectedcategoryid
[ { "docid": "78f8575a41e93316fbe4d048446fde92", "score": "0.0", "text": "def product_attributes=(product_attributes)\n\t\tproduct_attributes.each do |attributes|\n\t\t\tproducts.build(attributes)\n\t\tend \n\tend", "title": "" } ]
[ { "docid": "3ec05c4818173a6fd5ffcc233ee50583", "score": "0.70583904", "text": "def get_category_id(category_id)\n\t\tself.category_id = category_id\n\tend", "title": "" }, { "docid": "2f19c27984bdac8f9ebd7496b78ab070", "score": "0.6915609", "text": "def set_category\n\t @selecte...
23b0961faf0b560fc4d6ab462c0d02ca
Format payload and add information for publisher
[ { "docid": "b67c36a20f4ef3562d637aacc7f1439d", "score": "0.7150045", "text": "def format(payload)\n if(payload.get(:data, :repository_generator, :generated))\n payload.set(:data, :repository_publisher, :repositories,\n payload.get(:data, :repository_generator, :generated...
[ { "docid": "483cba5c438505d886663974c9860d52", "score": "0.7264611", "text": "def append_info_to_payload(payload); end", "title": "" }, { "docid": "ecbe924177413f3b67071bfd459c5d46", "score": "0.6815961", "text": "def formatted\n update_headers\n\n [encode_message(body), pu...
6e1256a53a345c79598fe7fc4dcf0636
Method to choose either the hearing time slot buttons or hearing time radio buttons
[ { "docid": "f19c881ed2d770c229cd24332a6582de", "score": "0.6567907", "text": "def select_hearing_time(time)\n find(\".cf-form-radio-option\", text: time).click\n end", "title": "" } ]
[ { "docid": "d4781f7de6b706e915647884b10fda56", "score": "0.6806256", "text": "def time_buttons\n # For each option, we'll need an id, a label and, optionally,\n # some extra content\n options = [\n [:time_boot_0, _(\"This boot\")],\n [:time_boot_1, _(\"Previous boot\")],\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3cde21b6bc2712dde87c5e5a8f373cb6", "score": "0.0", "text": "def topic_params\n params.require(:topic).permit(:title, :forum_id, :user_id)\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...
4c931a4be0691c60423f13563c2e8447
=> true even shorter
[ { "docid": "cf0246e9f15519f5ea48d0f12d1db760", "score": "0.0", "text": "def running_total(array)\n final_array = []\n array.each_with_object([]) { |num, object| final_array << (object << num).inject(:+) }\n final_array\nend", "title": "" } ]
[ { "docid": "94dee5abb10395d3dae8403243c2aee6", "score": "0.7042198", "text": "def triplet_true?(s)\r\n s.match?(/(.)\\1{2,}/)\r\nend", "title": "" }, { "docid": "6d2b243e5e91467886f7fe160eaae851", "score": "0.68933666", "text": "def make_true; end", "title": "" }, { "d...
684be4bc99b4d06ea15c4c26dbebc425
Deeply converts object to a hash. All keys will be symbolized.
[ { "docid": "051949440dc1ca6b57e80151ade389c3", "score": "0.0", "text": "def to_h\n { mid: mid, locale: locale, description: description,\n score: score, confidence: confidence, topicality: topicality,\n bounds: bounds.map(&:to_h), locations: locations.map(&:to_h),\n ...
[ { "docid": "1ff28e6294850ad5dc84105bf00c5880", "score": "0.789632", "text": "def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end", "title": "" }, { "docid": "4efef217fcf0e30d1d9316dccc58d30a", "score": "0.7241001", "text": "def t...
2ad06b1daccd69a49211970d765c804a
7 deleting item from the list
[ { "docid": "8c17954793390f96fc42e21900b83509", "score": "0.0", "text": "def delete_item(array, item_to_delete)\n if array.include?(item_to_delete) \t\n array.delete(item_to_delete)\t\n else\n puts \"Item not found\"\n end\nend", "title": "" } ]
[ { "docid": "1d7a2d21c9f34e1cd8aa7b3e286b0e3f", "score": "0.7137126", "text": "def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend", "title": "" }, { "docid": "d5481859cea6d624b28cf80bf5c42118", "score": "0.7102758...
3dcc942ff7edf10e5826658919aaec7c
POST /user_profiles POST /user_profiles.json
[ { "docid": "8706c82c1c45f288c0be3d1031bbee01", "score": "0.0", "text": "def create\n @user_profile = UserProfile.new(user_profile_params)\n @user = User.new(user_profile_params.merge({:provider => \"email\" ,:email => user_profile_params[:uid]}))\n @address = Address.new(address_params)\n if...
[ { "docid": "443f7ac6eb20f4026d28d4e500090204", "score": "0.7379001", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n f...
bdc97995ba08535d8ea663e5ba74bcde
Defines accessor which returns text of Watir element instance. Method name is element name. For textfield and textarea, value is returned. For select list, selected option text is returned. For other elements, text is returned.
[ { "docid": "7578124231a874992cdc7ceea090dc80", "score": "0.0", "text": "def define_read_accessor(name, method, *args, &block)\n watir_args, custom_args = extract_custom_args(method, args)\n include(Module.new do\n define_method name do |*opts|\n element = if block_given...
[ { "docid": "9ec98771af4d272458da6c5f054d9198", "score": "0.7511629", "text": "def get_text\n @log.debug('Returning ' + @name + ' elements text: ' + @element.text)\n return @element.text\n end", "title": "" }, { "docid": "9ec98771af4d272458da6c5f054d9198", "score": "0.7511629", ...
a413ef030d3232205851cf5ad47c8703
GET /users/1 GET /users/1.xml
[ { "docid": "48feff5eb197b84b808d89bbc231dd2f", "score": "0.0", "text": "def show\n @user = if session[:user].admin? && params.has_key?(:id)\n LinkedData::Client::Models::User.find_by_username(params[:id]).first\n else\n LinkedData::Client::Models::User.find(sessio...
[ { "docid": "156ffeeb9dfbc9b33c5e4e53037c1d05", "score": "0.7207758", "text": "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "title": "" }, { "docid": "78c91061ae58b...
c0ec8c30f52181d0ffc2c0e951352f2e
PUT /vendor_docs/1 PUT /vendor_docs/1.xml
[ { "docid": "dd6bc8628b20c51e08c9c334a136646b", "score": "0.69012064", "text": "def update\n @vendor_doc = VendorDoc.find(params[:id])\n\t@vdocs_requirement = @vendor_doc.vdocs_requirement\n\n respond_to do |format|\n if @vendor_doc.update_attributes(params[:vendor_doc])\n flash[:notice...
[ { "docid": "c2c0b673628fdc28b181d18c0afd2d5b", "score": "0.641317", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "title": "" }, { "docid": "0b83121fe2bfbe8cd2f5018131db981c", "score": "0.6139...
525fc85fa484195bfde89fc4f56038d1
Note users should only see their own jobs. Jobs are not an embedded document type within users as they must be treated separately by the processing system. Therefore, every time a job is found by id its ownership must be checked against the current loggedin user and naughty users who have posted an id they shouldn't sh...
[ { "docid": "12d84293cc8b2b2cdc3f2144df885634", "score": "0.0", "text": "def index\n # it has been requested that users only see LEFT (and LEFT-type) jobs on the LEFT pages, and\n # so on. This should do it, if different types are added in the array at the end of the search\n # string.\n @apo...
[ { "docid": "b5eb0df9ffdf5dcb9934153e203fd5a1", "score": "0.7485289", "text": "def index\n if params[:user_id]\n @user = User.find(params[:user_id])\n @jobs = @user.jobs\n else\n @jobs = Job.all\n end\n end", "title": "" }, { "docid": "b11fdc8d66a7d6aec054bd408a9c604d...
d1a01f23211f3fc25d99ff38e7b15184
Get a socket for the provided address type, given the options.
[ { "docid": "a953adbd0a92a354b33175ef9e5980be", "score": "0.56348765", "text": "def socket(socket_timeout, options = {})\n Socket::Unix.new(host, socket_timeout, options)\n end", "title": "" } ]
[ { "docid": "3deaff8d4e1c196c8d00bfb227cde5d4", "score": "0.63137656", "text": "def socket type, handler = nil, *args\n socket = Socket.new(@zmq_context.socket(type), handler, *args)\n block_given? ? yield(socket) : socket\n end", "title": "" }, { "docid": "ff41a81550baf6b9...
482aaf21327fe77f752469f1635ee070
Print the attributes of this specific country
[ { "docid": "e74b01b57880b91e03d8e6db92b5ac20", "score": "0.68494534", "text": "def print_info\n puts \"#{self.country} (#{self.country_code}):\".light_cyan\n puts \" New Confirmed Cases: #{self.new_confirmed}\".light_red\n puts \" Total Confirmed Cases: #{self.total_confirmed}\".light_red...
[ { "docid": "ec702737c1c8db04c039ecbd23c7e16a", "score": "0.7057374", "text": "def print_all_countries\n @country_lists.each do |country|\n puts puts \"#{country.country_name}\\t#{}\"\n end\n end", "title": "" }, { "docid": "4314061fc9916ad046889e3eb7dd7fe0", "score": "0.65503...
57dd982c68b6fb374e77f5b4f454953b
GET /sampling_parameters/1 GET /sampling_parameters/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "fa5ce06c81178569ea402538089a31d2", "score": "0.8002467", "text": "def sampling(params)\n @client.get(\"#{path}/sampling\", params)\n end", "title": "" }, { "docid": "6d1c74e76aa5903f6f17aaf2237cd7c2", "score": "0.7243746", "text": "def index\n @sampling_parameters ...
c39bfd038ce5d8d4255bfb843a606b07
convert a string to MD5 hash useful to generate quick random strings. ==== Parameters +string+ :: optional, the input string to be hashed :: a random string will be used for hashing, if this string is not provided ==== Return +string+ :: a 32character long MD5'ed string
[ { "docid": "29ca58281bf03463c2da3a0f325e8340", "score": "0.8242623", "text": "def make_md5(string = nil)\n # create a random string if one is not provided\n string ||= (0...32).map{ ('a'..'z').to_a[rand(26)] }.join\n # hash it\n (Digest::MD5.new << string).to_s\n end", "title"...
[ { "docid": "ef1c8b5dcc211c73bb41550a5744bcea", "score": "0.7825542", "text": "def md5(string)\n\tDigest::MD5.hexdigest(string)\nend", "title": "" }, { "docid": "e8614cab6725c39ebcb6b47cd677a81d", "score": "0.7002448", "text": "def to_md5(pass)\n return Digest::MD5.hexdigest(pass)\ne...