query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
2358e1af73a069ab25bf5a62fc3a5a04
CONVENIENCE METHODS FOR FOLLOWING FUNCTIONALITY Follows another user
[ { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.7271333", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" } ]
[ { "docid": "ecc13f197dcc1919cb53edb09f092bea", "score": "0.78419155", "text": "def follow(follower_id, followee_id)\n \n end", "title": "" }, { "docid": "ecc13f197dcc1919cb53edb09f092bea", "score": "0.78419155", "text": "def follow(follower_id, followee_id)\n \n e...
fffc11b86f68bb76a6349b705f195687
PUT /loans/1 PUT /loans/1.xml
[ { "docid": "e218043df76b04771ef6e14eb47ace33", "score": "0.57702535", "text": "def update\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n if @loan.update_attributes(params[:loan])\n flash[:notice] = 'Loan was successfully updated.'\n format.html { redirect_to(@loan...
[ { "docid": "7a098a6882fad73e5dd5479fe32ae2d2", "score": "0.61181533", "text": "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age...
2c4ac74393389cad1fefcac66a744989
GET /search GET /search.xml
[ { "docid": "adbf8920332173317213c499bb026e43", "score": "0.0", "text": "def search\n @bizus = Bizu.search do\n keywords params[:query] if params[:query]\n with :category, params[:category] if params[:category]\n paginate :page => params[:page], :per_page => 5\n end\n\n ...
[ { "docid": "fad00fab147405d42a6df655031a08c2", "score": "0.74557465", "text": "def show\n @res = @search.search\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @res }\n end\n end", "title": "" }, { "docid": "4cbf066298907a4a44d656c4...
4144fe0e3660fced463f572aac0cadd2
PATCH/PUT /questions/1 PATCH/PUT /questions/1.json
[ { "docid": "4df8bc84a9d46c93b8c1774c99e21fcb", "score": "0.66701066", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n ...
[ { "docid": "c3964d8d52e4f178fa285de91a0b8582", "score": "0.7100238", "text": "def update\n \t@questions = Question.find(params[:id])\n \trespond_to do |format|\n \t\tif @questions.update(questions_params)\n \t\t\tformat.html { redirect_to @questions, notice: 'questions was successfully updated.' }\n...
f40d59b204705bd2b2b5d0240a849c16
Returns the configuration as a hash. ==== Returns Hash:: The config as a hash.
[ { "docid": "44c48dbc078648b0ed16f5cab282c910", "score": "0.8836327", "text": "def to_hash\n @configuration\n end", "title": "" } ]
[ { "docid": "f8ab01adeb9873dc98e0f05a80cf8c72", "score": "0.8912273", "text": "def to_hash\n configuration\n end", "title": "" }, { "docid": "93bde85b259bc3ce9b09e8114f51a879", "score": "0.8845161", "text": "def to_hash\n self.config.to_hash\n end", "title": ""...
d259501b27c13f1253f3d678da2283d0
changes/returns this FileSystemEntry's extension using Fileext.
[ { "docid": "d31a987f72215e6421ca569462e1d0c2", "score": "0.74092144", "text": "def ext(new_ext = nil)\r\n if new_ext\r\n rename(File.ext(name, new_ext))\r\n else\r\n return File.ext(name)\r\n end\r\n end", "title": "" } ]
[ { "docid": "7d37c8ed2aba05ad6e43b2b3ae59aab9", "score": "0.75507724", "text": "def extension\n fetch('file.extension')\n end", "title": "" }, { "docid": "ba67e6e2b803eb470dde8e686c86122e", "score": "0.75039107", "text": "def file_extension\n self.class.file_extensi...
ccc56d84b6db59001818d32296ae631b
Sets the data for hiding. ==== Description objectWhereHide can be taken using findCover. hidePosition can be taken using getHideFrom. Command is not functional in ArmA 2. This command is part of getHideFrom, findCover, setHideBehind nonfunctional trio ==== Syntax object setHideBehind [objectWhereHide, hidePosition] ===...
[ { "docid": "db692379eae50bb51164a5df0cc9a639", "score": "0.70392656", "text": "def setHideBehind _obj, _args\n \"_obj setHideBehind _args;\" \n end", "title": "" } ]
[ { "docid": "a17cd9e8f6b38da975bdc1769ffe367e", "score": "0.5444038", "text": "def getHideFrom _obj, _args\n \"_obj getHideFrom _args;\" \n end", "title": "" }, { "docid": "f21a73acd1ce4de62e07790d211698e4", "score": "0.522476", "text": "def hideElement=(value)\n\t\t\t@hideEle...
1d2ef9ce6cc06ecd4c42cce610333d2d
Returns the used decryption algorithm
[ { "docid": "db69f8ccd6ced34bae2b12b71db5ef28", "score": "0.6146511", "text": "def algorithm\n ALGORITHM\n end", "title": "" } ]
[ { "docid": "c4d317663d8b21f341cf31ff310ac42c", "score": "0.752923", "text": "def app_log_decryption_algorithm\n return @app_log_decryption_algorithm\n end", "title": "" }, { "docid": "2341b0b2ccaed866210ba245c1f7d372", "score": "0.70444196", "text": "def key...
0ed8d779c35a026fad0389cc8bcea5d3
upload files to parameter specified folder ID
[ { "docid": "af50ee098f48e8c00c18608bb5b855d4", "score": "0.0", "text": "def tax_loan_upload\n\n puts \"uploading file...\"\n mixpanel_tab_event(\"Tax Return\", \"Upload Files\")\n\n #http://www.dropzonejs.com/\n client = user_client\n path = \"#{session[:userinfo]['info']['name']} - Share...
[ { "docid": "c94cc11bfa68eeb3223c0afefa1789f2", "score": "0.7400196", "text": "def upload_file_to_folder(folder_name)\n upload_files_to_folder(folder_name)\n end", "title": "" }, { "docid": "c94cc11bfa68eeb3223c0afefa1789f2", "score": "0.7400196", "text": "def upload_file_to_folde...
5b20b67e5de25de98367aecadbbc8180
DELETE /jobs/1 DELETE /jobs/1.json
[ { "docid": "3f6a95baa5102533d7266cf62c11ef02", "score": "0.0", "text": "def destroy\n\n end", "title": "" } ]
[ { "docid": "66db0ef98d50e458b6aaead27c514ac5", "score": "0.79582334", "text": "def delete(args)\n options = { body: args, basic_auth: { username: @api_key } }\n Try { self.class.post(\"/api/jobs/delete.json\", options) }.to_either >-> response {\n if response.code == 200\n Righ...
193fbc60847a270afd2fd01c07c007e7
This sets the attribute of the days in the calendar.
[ { "docid": "0e864042ceeb6c0a4af42112e25d3470", "score": "0.72231156", "text": "def setDayAttribute(attribute)\n @day_attrib = attribute\n end", "title": "" } ]
[ { "docid": "da2aed255c50bab7cdee30dcee213406", "score": "0.73351496", "text": "def day=(value)\n @day = value\n end", "title": "" }, { "docid": "de1d08d53c4503f67f63830a59feac1d", "score": "0.7245855", "text": ...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "15bbd6148634eeae1703a9d0983f5a27", "score": "0.0", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "be9d8ff5c0124f1d5efc98ec2baa3fc1", "score": "0.75917834", "text": "def test_delete_user\n delete '/users/2'\n data = JSON.parse last_response.body\n\n assert_equal 'Daniel', data['name'], 'Propiedad name incorrecta'\n assert_equal 'Arbelaez', data['last_name'], 'Propiedad last_na...
461bbcbae521185f9abc2c3305a15fe3
instead of 3.14, we could have used Math::PI. It would be better to do the rounding at the end.
[ { "docid": "fceab307e047546b275e25e124a33681", "score": "0.6402153", "text": "def volume_of_sphere(radius)\n volume = 4/3.round(2) * 3.14 * radius**3\n #volume = (4.0 / 3.0) * Math::PI * (radius**3)\n return volume.to_i\nend", "title": "" } ]
[ { "docid": "4d6e86d441b0ec61dc7942c573df8b16", "score": "0.74312466", "text": "def pi\n three = BigDecimal.new(\"3\")\n big_num = BigDecimal.new(\"640320\")\n\n n = (0..200).reduce(0) do |num, k|\n num += numerator(k) / denominator(k)\n end\n\n n *= 12\n n /= (big_num ** (three / 2))\n n = n /...
cba5a5760b0062cfbbe8655e72becbb2
Implementation for an each method
[ { "docid": "4363096dafcc65a3d7d8d5d5b8b5bd70", "score": "0.0", "text": "def each(&block)\n @_componentable_container.each(&block)\n end", "title": "" } ]
[ { "docid": "b693bcb66b53c0b90f5148140861769e", "score": "0.82345283", "text": "def each(*) end", "title": "" }, { "docid": "a95d89c6ab23926ca4affea0e096703f", "score": "0.81990343", "text": "def each\n end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e90213...
3a2d61f08cddb12f2d164025396b1531
Company descriptions Get descriptions for a given company.
[ { "docid": "669fe3b33196503c5e92a32e28228575", "score": "0.554635", "text": "def company_country_code_company_id_descriptions_format_get(country_code, company_id, format, opts = {})\n data, _status_code, _headers = company_country_code_company_id_descriptions_format_get_with_http_info(country_code,...
[ { "docid": "df2a2955e6e39778f145f757cffab47a", "score": "0.69018084", "text": "def set_description\n @company = Company.find(params[:company_id])\n @description = @company.description\n end", "title": "" }, { "docid": "8457bf7811b4d25b528700fd638cf803", "score": "0.6896773",...
655b292a1f9fbc2fc0dee23341c4c051
stores the name of the individual layers
[ { "docid": "f7f738136300e3adb8c82c0bb7e393d3", "score": "0.0", "text": "def initialize\n# @commandList = Array.new()\n# @db = Sequel.sqlite\n# @db.create_table :materials do # Create a new table\n# primary_key :id, :integer, :auto_increment => true\n# column :command_name, :...
[ { "docid": "58a507f3cb0658c7a8537f53d59559b1", "score": "0.7177186", "text": "def set_layer_name\n fail \"Layer name is required\" if tokens.empty?\n options[:layer_name] = tokens.shift\n end", "title": "" }, { "docid": "0b44ca6869edc528ae22fc0f9d46a530", "score": "0.7...
bed0edfce83f035b8c0338def478eae9
POST /ingredients POST /ingredients.json
[ { "docid": "05772949251abf8533a4369107f0c663", "score": "0.7045075", "text": "def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient, notice: 'Ingrediënt toevoegen voltooid' }\n format...
[ { "docid": "f04ad653af80f2fce922979a6af22bbc", "score": "0.7792845", "text": "def create\n @ingredient = @recipe.ingredients.new(ingredient_params)\n\n if @ingredient.save\n render :show, status: :created, location: api_v1_recipe_url(@ingredient.recipe)\n else\n render json: @ingredie...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "e730514df525cc79c8ac028e46b0d24f", "score": "0.0", "text": "def show\n @albums = @user.albums\n @followers = @user.followers\n @followees = @user.followees\n end", "title": "" } ]
[ { "docid": "4152fb6556ae83f7cdd6c362f17ad9bf", "score": "0.81049806", "text": "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n ...
a49c781e971f73e1c6217cf1e9b2bac2
PATCH/PUT /purchase_infos/1 PATCH/PUT /purchase_infos/1.json
[ { "docid": "3aa368ae8cec34b70a643ac95cc72651", "score": "0.7285322", "text": "def update\n respond_to do |format|\n if @purchase_info.update(purchase_info_params)\n format.html { redirect_to @purchase_info, notice: 'Purchase info was successfully updated.' }\n format.json { render ...
[ { "docid": "4948c64a8058650fb1122b2a7e566b10", "score": "0.6865669", "text": "def update\n respond_to do |format|\n if @info_purchase_order.update(info_purchase_order_params)\n format.html { redirect_to @info_purchase_order, notice: 'Info purchase order was successfully updated.' }\n ...
593a3e20d09dcd9c439cc4541eed9584
DELETE /codes/1 DELETE /codes/1.json
[ { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.7503115", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ...
[ { "docid": "5dba3e5f402ac300726e6e6bbb7ea7df", "score": "0.7780049", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "doci...
d9a44ec4b8c37c1988e178be4c83ab69
Returns a list of compiler certnames and letters, based on a PuppetDB query
[ { "docid": "dc0519ce1985ccca28e1d036cb56736d", "score": "0.7064389", "text": "def compilers\n @compilers ||=\n pdb_query('inventory[certname,trusted.extensions] { trusted.extensions.pp_auth_role = \"pe_compiler\" }').map do |c|\n {\n 'certname' => c['certname'],\n 'lette...
[ { "docid": "cecee409b6493207286c30a69e262370", "score": "0.7470157", "text": "def certnames\n psql = '/opt/puppetlabs/server/bin/psql -d pe-puppetdb --pset format=unaligned --pset t=on -c %s'\n query = 'SELECT certname FROM certnames WHERE deactivated IS NULL AND expired IS NULL;'\n ...
e7f164721a4c9e918b061d53bc748244
find a specific contact and print the telephone number
[ { "docid": "7eca93838d8362e596ae8487cc7f8061", "score": "0.7319494", "text": "def find_and_call_contact(contacts, name)\n\tcontacts.each do |x|\n\t\tif x[:name] == name\n\t\t\tputs \"#{x[:name]}, #{x[:telephone]}\"\n\t\tend\n\tend\nend", "title": "" } ]
[ { "docid": "f9295e8ef5c6c4c6e92cfdf78e6057f4", "score": "0.7713777", "text": "def find_and_call_contact(name)\n\t @contacts.each do |c|\n\t if c[:name] == name\n\t puts \"I found #{contact[:name].capitalize} in your contacts database\\n\"\n\t puts \"I am dialing the number now. It is #{con...
e97473774ea751e3208d4d581ece8b40
Scan XML and escape HTML entities.
[ { "docid": "bebcef6529ec3482363f54f62150780f", "score": "0.0", "text": "def scan_xml(parts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength\n return \"\" unless parts.any?\n\n out = \"\"\n while parts.any? && (parts.first[3] ...
[ { "docid": "a60f640e70045b6c6d20401d065bc636", "score": "0.7061903", "text": "def resolve_xml_entities(text)\r\n result=text\r\n result.gsub!(\"&lt;\", \"<\")\r\n result.gsub!(\"&gt;\", \">\")\r\n result.gsub!(\"&amp;\", \"&\")\r\n result\r\n end", "title": "" }, { "docid": "...
63263a0f9022286de28dcb4fd30b62c6
TODO: what to do when button is clicked?
[ { "docid": "d1e2d22a9c1670fbce669112349867df", "score": "0.0", "text": "def attach_symname_button(name, ivar_name, tooltip_text = nil)\n\t\tself.attach_label('Name', tooltip_text)\n\t\tw = Gtk::Button.new #(:label => 'OpAmp.sym')\n\t\tw.tooltip_text = tooltip_text\n\t\tw.hexpand = true\n\t\t@grid.attach...
[ { "docid": "240c6ee489e4eea6557e144da12362fa", "score": "0.7606967", "text": "def on_click\n\t\tend", "title": "" }, { "docid": "2fd4c8454a3c3d89af6945626318cf5e", "score": "0.75479895", "text": "def buttons; end", "title": "" }, { "docid": "09f742de9a89904b3fd89c0257173d...
1fe476ba15227e0e347248553a4a6091
Returns the response status
[ { "docid": "2b5ce85d5ebc0552b3d5d51b948b2b41", "score": "0.0", "text": "def status\n @status ||= parse_status\n end", "title": "" } ]
[ { "docid": "eb593ca35862303c7d0510c709b4bb79", "score": "0.91163236", "text": "def response_status\n @response[:status]\n end", "title": "" }, { "docid": "9d739c78fa663a261d81864dbf1080ce", "score": "0.89852715", "text": "def status\n response.status\n end", "titl...
ed1aafbf84d6ea46ef1f5e181ff424bc
Shows a user deletion confirmation form GET /users/:id/confirm_destroy
[ { "docid": "3b72dbc3e36e60477f03db3f53bd20b5", "score": "0.0", "text": "def confirm_destroy\n end", "title": "" } ]
[ { "docid": "7c81f7072fb4a17f90a3222a7639cb55", "score": "0.75151145", "text": "def destroy\n @user.destroy\n respond_with( @user, :notice => \"User was successfully destroyed. #{undo_link}\", :location => users_url )\n end", "title": "" }, { "docid": "23d54ad66f2e877c8729b155968a1dea"...
1af4934347cda8f50c8429d694b217d7
POST /stat_non_pat_adults POST /stat_non_pat_adults.json
[ { "docid": "7049bf894a64bb06a3e7de2b070602f4", "score": "0.69648844", "text": "def create\n @stat_non_pat_adult = StatNonPatAdult.new(stat_non_pat_adult_params)\n\n respond_to do |format|\n if @stat_non_pat_adult.save\n format.html { redirect_to @stat_non_pat_adult, notice: 'Stat non p...
[ { "docid": "4fa59b104f678c1e8b9386f1cdcbfcc0", "score": "0.6721845", "text": "def set_stat_non_pat_adult\n @stat_non_pat_adult = StatNonPatAdult.find(params[:id])\n end", "title": "" }, { "docid": "dd1656313ca33ddd9c2cb5a03d73a874", "score": "0.656018", "text": "def stat_non_...
6d6f1ddb452ae16dff0ba1832be372b6
Sort elements of the array provide optional property with which to sort an array of hashes or drops
[ { "docid": "7ab004507ecf3d969eac515b2bc235a2", "score": "0.6595273", "text": "def sort(input, property = nil)\n ary = [input].flatten\n if property.nil?\n ary.sort\n elsif ary.first.respond_to?('[]') and !ary.first[property].nil?\n ary.sort {|a,b| a[property] <=> b[property]...
[ { "docid": "df8ebbc1c591323cd85c50328186462e", "score": "0.756677", "text": "def sort_array", "title": "" }, { "docid": "9754857493eb652c86bd56e2e1696f12", "score": "0.6932108", "text": "def sort!(arr)\n arr.sort_by(&:name)\n end", "title": "" }, { "docid": "202034633...
611e6ab77ded6a556acd16c12e5dc379
this choice makes it easier to pass in something more generic to the context that uses these html generating strategies, such as a lambda instead of a Header object
[ { "docid": "522f1c78025914766d049fac375f4e9d", "score": "0.0", "text": "def call\n _generate\n end", "title": "" } ]
[ { "docid": "37557662b36425b50e7f4594103c0f3d", "score": "0.65545243", "text": "def html_template(title, body)\n%(<!DOCTYPE html>\n<html>\n <head>\n <title>#{title}</title>\n <meta charset=\"utf-8\">\n </head>\n <body>\n #{body}\n </body>\n</html>\n)\nend", "title": "" }, { "doci...
fd7e3171eba82420aa092c8acab9fd4a
DELETE /notifications/1 DELETE /notifications/1.json
[ { "docid": "8d65db33e54ed41f27c98172e5425b1b", "score": "0.72643906", "text": "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n e...
[ { "docid": "2d2a776cdd5004c1284233e70b6c00cd", "score": "0.7631812", "text": "def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end", "title": "" }, { "docid": "ce610827c8de5beb4c9c2742e16a4808", "score": "0.76106524", "text": "def de...
4d585cd07d6ce1b87c9155f2a8407e7c
def filtering_params params.require(:bike).permit(:bell, :lights, :pump, :child_seat, :padlock, :helmet, :basket) end
[ { "docid": "c3a53a89abfe8ba2edc8910cc8255423", "score": "0.0", "text": "def set_bike\n @bike = Bike.find(params[:id])\n authorize @bike\n end", "title": "" } ]
[ { "docid": "794f06aa4525c93e14767b50be7451d7", "score": "0.8063101", "text": "def bike_params\n params.require(:bike).permit(:name, :description, :price, :category, :status)\n end", "title": "" }, { "docid": "a2073e19a7b70be208bdd2c735697ce5", "score": "0.80545074", "text": "...
bc0c2261df5db6dc6e01b6e36a1feb8f
Range.new(Time.now, 1.hour) Range.new(Time.now, 1.hour.from_now) Range.new(Time.now, (Time.now + 1.hour)) Range.new(1.hour) start_at defaults to now Range.new(1.hour.from_now) start_at defaults to now Range.new(Time.now + 1.hour) start_at defaults to now
[ { "docid": "95e403ac4f9901c2dd2f350d088d04d2", "score": "0.0", "text": "def initialize(*args)\n if args.length == 2\n start_at, end_at_or_duration = *args\n elsif args.length == 1\n start_at = DateTime.now\n end_at_or_duration = args.first\n else\n raise Argume...
[ { "docid": "aa7d2dc2d9230bfa52302348760aa497", "score": "0.6974777", "text": "def beginning_of_hour\n change(min: 0)\n end", "title": "" }, { "docid": "aa7d2dc2d9230bfa52302348760aa497", "score": "0.6974777", "text": "def beginning_of_hour\n change(min: 0)\n end", "title"...
ecf830867c494f5584b5dc69d08e386a
Get patch package's names for each minor .NET versions on the current node OS Returns a Hash> with .NET version as key, and package names as value
[ { "docid": "6d5fa111d7e528d224d0725219977d01", "score": "0.0", "text": "def patch_names\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "3cde6f0250926255d2e1528571df6aa8", "score": "0.6888934", "text": "def patches(version)\n (patch_names[version] || []).map { |patch| packages[patch] }\n end", "title": "" }, { "docid": "f8513b5a2f048781d98f358a30e7c59b", "score": "0.63619167", "text": "def patches\...
4502df3bde0379df4b3c97531bf05e34
Adds the bundled frameworks to the Pods project
[ { "docid": "7c2c937846fde0840d6abd812334cd67", "score": "0.81745917", "text": "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "title": "" } ]
[ { "docid": "391f93aaf4cd8571de05fa4f915c35f4", "score": "0.7006133", "text": "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode...
a0eca2cc6edfad731d9e9c1831fa28ab
overridden devise json extended details after signin for roles
[ { "docid": "bd91b2083a8cb21f08f3e4c9b2aa68a4", "score": "0.6534407", "text": "def as_json(options={}) \n user_tbl=User.find_by id:super[\"id\"]\n if user_tbl.present?\n super(options).merge({role: user_tbl.user_roles.joins(:role).pluck(:role),profiles: user_tbl.profile,photos: user_tbl.photos...
[ { "docid": "9f0a00867e55604f5a2894e57b70fe51", "score": "0.669896", "text": "def as_json(options = nil)\n\t\tsuper({ only: [:id, :username, :email, :role] }.merge(options || {}))\n\tend", "title": "" }, { "docid": "a7ebbe8890de1e28094c9fc7ab4961f9", "score": "0.65931165", "text": "de...
19eac92cfebf76160d9d82417a0dbf4c
def after_inactive_sign_up_path_for(resource) '/welcome' end
[ { "docid": "94deb541ef6ec76299add751a062f830", "score": "0.0", "text": "def after_update_path_for(resource)\n flash[:notice] = \"Votre compte a bien été mis à jour.\" if resource.updated_at_changed?\n edit_user_registration_path\n end", "title": "" } ]
[ { "docid": "26380f5cb4d56e4bb0241e7333481f34", "score": "0.93019855", "text": "def after_inactive_sign_up_path_for(_resource)\n consultant_welcome_path\n end", "title": "" }, { "docid": "040f28aeaca9fd1b140943053282b1da", "score": "0.9117547", "text": "def after_inactive_sign_up_...
73c6feca1349810f40df49c71dd79124
DELETE /wishlistitems/1 DELETE /wishlistitems/1.json
[ { "docid": "d45e56d2dc613b7c0ddd7b33291d8791", "score": "0.79774624", "text": "def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n ...
[ { "docid": "8153cc13f03d49be420279fb0a7e187d", "score": "0.7865223", "text": "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n e...
15edcff048c0a10b3e6cf02974f68d78
Note that you probably shouldn't put taps into your Gemfile, because it depends on sequel and other gems that may not compile on Heroku (etc.) This class automatically detects if you have Bundler installed, and if so, executes the `taps` binary with a "clean" environment (i.e. one that will not pay attention to the fac...
[ { "docid": "c93cecc04915651c20c5eeb6df7a8ba8", "score": "0.5494478", "text": "def taps_pull\n args = [\n 'taps',\n 'pull',\n db_url,\n source,\n '--indexes-first',\n '--tables',\n source_table_name\n ]\n \n # http...
[ { "docid": "6d7e77cafcf2db770510bed712329f8f", "score": "0.598448", "text": "def tidy_gemfile\n %w(sqlite3 figaro dotenv).each {|gem| system \"docker-compose run --rm bin/bundle remove #{gem}\" }\n system \"docker-compose run --rm bin/bundle add pg\" unless system(\"docker-compose run --rm...
f5833bc02741b32ea4e6b15bffe97279
Update the password for the +User+ with the corresponding +perishable token+
[ { "docid": "ef722b89c824bed98f124225ab04c1f9", "score": "0.0", "text": "def update\n\t\t@user.password = params[:password]\n\t\t@user.password_confirmation = params[:password_confirmation]\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Your password was successfully updated.\"\n\t\t\tredirect_to login_pat...
[ { "docid": "e02e55ccd08b0625d94cdc450a769974", "score": "0.8444776", "text": "def update\n @token = params[:password_token]\n @user = User.find_by(set_password_token:params[:password_token])\n # @user_type = params[:user_type]\n if @user.blank?\n not_authenticated\n return\n end...
0836b111ebf5d6a8ef4e20b4a0d540c1
Run through actions, printing what would have been done, but don't execute them
[ { "docid": "ccf195cc805ec4c8b4e7f584363ee8ca", "score": "0.0", "text": "def init\n conf_file = \"#{__dir__}/../conf/auth.json\"\n @conf = WIKK::Configuration.new(conf_file)\n\n # Team information – Information about the team and aggregate usage data\n @dbx_info = Dropbox.new(token: @conf.team_info_t...
[ { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.69645166", "text": "def run_actions; end", "title": "" }, { "docid": "37b124825f7194111ecd06a95db78c49", "score": "0.6566122", "text": "def hook_report_actions\n @flavor.class.after_add_resources do\n actions ...
133c570f5135ffbf5a1738ad4e6295f5
Getter: Builds an array of vlan priority commands currently on the device. cli: spanningtree vlan 142 priority 40960 spanningtree vlan 8392,10002300 priority 53248 array: [['142', '40960'], ['8392,10002300', '53248']]
[ { "docid": "8a01c5f375ca7836e68d6aae4355920f", "score": "0.59564227", "text": "def vlan_priority\n config_get('stp_global', 'vlan_priority')\n end", "title": "" } ]
[ { "docid": "95927befbc38eb4e42f86d084c8b83b0", "score": "0.5798253", "text": "def stp_vlan_port_priority\n config_get('interface', 'stp_vlan_port_priority', @get_args)\n end", "title": "" }, { "docid": "9bad6f7b91bed7a755793f6b69eb03e6", "score": "0.5535139", "text": "def vla...
07fd29cd0f1870979e720a64f521e052
Opening HTML of a uniForm block: , except it alternates between odd and even
[ { "docid": "d4d7748edc7055c56128884d43ec7ba2", "score": "0.5178631", "text": "def start_uniform_wrapper(options = {})\n @odd = (options.delete(:first) ? true : !@odd)\n the_class = 'ctrlHolder ' + (@odd ? 'odd' : 'even')\n if options[:class]\n options[:class] = options[:cla...
[ { "docid": "705da892ae7ecd8e5450db38e102df87", "score": "0.6151828", "text": "def start_form_block (params = {})\n output = \"\"\n output << \"<li><div class=\\\"label\\\">#{params[:label]}</div>\" if params[:label]\n \n if params[:class]\n output << tag('fieldset', {:class => params[:c...
c25a18b15dea5752e57d93a9a7f05260
Print search_results to optionlist.
[ { "docid": "e404b99d93408d256fe28d4294d0177f", "score": "0.6127222", "text": "def draw_search_results items=[]\n\t\t$widgets.options_list.draw_normal items\n\t\t$widgets.mind_map.draw_welcome_screen\n\tend", "title": "" } ]
[ { "docid": "5e811fa8094b0baf11d4ffd93d01474b", "score": "0.6750295", "text": "def list_results(**opt)\n # May be overridden by the subclass.\n end", "title": "" }, { "docid": "fbe3c6b9ab2e57e9624b2975341442d2", "score": "0.6529882", "text": "def print_search_results\n system(\...
5fda331d467b3494e9ac14b3873394a3
5. You found another survivor! This means you can combine your supplies. Create a new combined supplies list out of your zombie_apocalypse_supplies and their supplies below. You should get rid of any duplicate items. Find the builtin method that helps you accomplish this in the Ruby documentation for Arrays.
[ { "docid": "a67f11f4dd21121e05ee8b2fd5e744db", "score": "0.78469384", "text": "def combine\n other_survivor_supplies = [ \"warm clothes\", \"rations\", \"compass\", \"camp stove\",\n \"solar battery\", \"flashlight\"]\n other_survivor_supplies.each do |others|\n @zombie_a...
[ { "docid": "85973b3837137d59bca6b8c7e4885917", "score": "0.58384115", "text": "def rep_items(array, rep_bills)\n array << rep_bills.reject {|bill| bill.introduced_on.nil? }.size\n array << rep_bills.reject {|bill| bill.referred_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bil...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "27467c0c0df69afabd27590f603c4849", "score": "0.0", "text": "def section_params\n params.require(:section).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
18b0cf476d662b88c588019b23a40e8c
Should this really be an attribute, or should we delegate?
[ { "docid": "7fa434d1de52245a600ff0613c05c26f", "score": "0.0", "text": "def initialize(attributes={})\n @original_object = attributes[:original_object]\n @id = attributes[:id]\n @title = attributes[:title]\n @short_title = attributes[:short_title]\n @public_...
[ { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.7293253", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.7293253", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31...
9db6a4cbfda3f6e9d16b077ea50bea42
Constructs a new source map for a heredoc.
[ { "docid": "16b484fe0328677aa57d5796d512f263", "score": "0.71250844", "text": "def smap_heredoc(expression, heredoc_body, heredoc_end)\n ::Parser::Source::Map::Heredoc.new(\n expression,\n heredoc_body,\n heredoc_end\n )\n end", "title": "" } ]
[ { "docid": "4d086194d1aa2dc7565c230e8e0273ea", "score": "0.6757079", "text": "def build_source_map\n (1..line_count).each.with_object({}) {|it, hash| hash[it] = source_line(it) }\n end", "title": "" }, { "docid": "cc320d5a5080cd26316ae258e42ff812", "score": "0.5901171", "text...
4a0bb854458bc19f839965c9942f9e9b
Add additional ssh keys to ~/.ssh/authorized_keys
[ { "docid": "48e286d382c4aabdb4e12944f75318d1", "score": "0.76944715", "text": "def add_ssh_keys\n userHome = new_resource.home || \"/home/#{ new_resource.name }\"\n\n Chef::Log.debug \"Adding provided ssh keys to authorized ssh keys\"\n\n # Do not overwrite the ~/.ssh/authorized_keys - append e...
[ { "docid": "070eda49ed40615406892cdbe7d4c5da", "score": "0.7474225", "text": "def setup_ssh_key\n ssh_keygen(key_name, '~/.dpl/id_rsa')\n setup_git_ssh('~/.dpl/id_rsa')\n add_key('~/.dpl/id_rsa.pub') if respond_to?(:add_key)\n end", "title": "" }, { "docid": "b05acf6e0fcf1f...
275e73999df317e52069021b9ea11caa
DELETE /tasks/1 DELETE /tasks/1.json
[ { "docid": "1a0001d9b7a38268248a363dbac2eaf8", "score": "0.7531433", "text": "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "d625ec15c2e62330f958b41bda0aee7e", "score": "0.78329164", "text": "def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end", "title": "" }, { "docid": "b18243b77fd384317096cdf3a65159fd", "score": "0.75888187", "text": "def delete_task\n @task = T...
254b40914864f200f9bdd10f757335fd
GET /batiments/1 GET /batiments/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "cf42eb60ecc2dc0ae74d1a83c8aed8c8", "score": "0.6882596", "text": "def index\n @batiments = Batiment.all\n end", "title": "" }, { "docid": "89dc3b117bc719b8f695fa52670150f2", "score": "0.6713915", "text": "def index\n @budgets = Budget.all\n render json: @budgets...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4a4819e5c0b05448901c869307eae4c6", "score": "0.0", "text": "def set_event\n @event = Event.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...
a9ff7ee4cc3caea20562a63e508e2a26
Redis key holding counter with IDs of model.
[ { "docid": "0cc401e45eea80eec5457495d4549847", "score": "0.6723953", "text": "def counter_key\n @counter_key ||= [*name.downcase.split(\"::\"), :idcnt].join(\":\")\n end", "title": "" } ]
[ { "docid": "6bd8ce84c5ec23175b7fc5a0ef884129", "score": "0.71100146", "text": "def redis_view(model, stores)\n stores.each do |store|\n inc_member(store, model.id)\n end\n end", "title": "" }, { "docid": "79af7dfd7a0c4f2fea63701db4b55c6a", "score": "0.6648845", "t...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "61060893aeab14ac68fe70119e56aee9", "score": "0.0", "text": "def effleurage_option_params\n params.require(:effleurage_option).permit(:name)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
de1f937ebc1fc608c31cfcb4a1de860c
Get all recent builds for a specific project
[ { "docid": "ce9e4c9ed92913088ebd2ac875664639", "score": "0.70017916", "text": "def recent_builds(username, project, params = {})\n default_config.logger.warn('[Deprecated] Use instance method CircleCi::Project#recent_builds instead')\n new(username, project, default_config).recent_builds(p...
[ { "docid": "c08bb31452256e773433fbde01d5e1d6", "score": "0.80826473", "text": "def recent_builds(params = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}\", params).get\n end", "title": "" }, { "docid": "2c237aeb07259af3dd1534929238196d", "score": "0.77158344", ...
ac788cf0c17f82e7f36835e001b3c257
used in show view
[ { "docid": "b82667a26e29034906c4fc0ce3a18cf9", "score": "0.0", "text": "def medium_notes\n return \"\" if notes.blank?\n Scrub.sanitize_html(notes.truncate(MEDIUM_LENGTH, separator: /\\s/)).html_safe\n end", "title": "" } ]
[ { "docid": "9990284430deceb330f67c996e4f9efe", "score": "0.7522732", "text": "def show \r\n end", "title": "" }, { "docid": "4ba5e2e599a8c45645b4dd847a04ce38", "score": "0.73307323", "text": "def show\t\t\t\t\n\t\t\tend", "title": "" }, { "docid": "4f8e5b2ebe628d...
6a7da8994524a4a6a731980586c4fcc0
Initialize using _options_ Hash.
[ { "docid": "dbc70b0b59da135aee3d5e0648552afd", "score": "0.0", "text": "def initialize(options)\n @reg_exprs,@canvases,@graphs,@histos = [],[],[],[]\n @kvs = options[:k]\n @reg_exprs = options[:f]\n @log = options[:log]\n end", "title": "" } ]
[ { "docid": "3190c5912e122bbf6ba8124d4f176e23", "score": "0.8502054", "text": "def initialize _options={}\n self.options = _options\n end", "title": "" }, { "docid": "443aa9a4976897821677faeabe96074b", "score": "0.83301085", "text": "def initialize\n\t\t# Set defaults\n\t\...
4c1302eb96bfb5785d909c2546e925fc
Given a snakes head and body positions, where could it move
[ { "docid": "13f581b68304c97d201ac61670d0a26d", "score": "0.0", "text": "def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, ...
[ { "docid": "3b007b40eb167b546263ad21c0d2ed06", "score": "0.6591369", "text": "def move\n # removing first element from the snake body\n unless @is_growing\n # list.shift removes the first element within a list\n @positions.shift\n end\n # after growing, snake should stop growing, i...
fbf7993b49ab3a370f684c4ec79a8403
Determine if a player has just won after performing a move
[ { "docid": "2718712b636c48cff623a5dcdac3ec00", "score": "0.0", "text": "def check_win()\n #If we have found four in a row in either the diagonals, rows, or columns, then return true immediately\n if check_columns() or check_rows or check_diagonals(populate_diagonals)\n return tr...
[ { "docid": "a16b74a98068cef537609fc7c2dd89d3", "score": "0.8358054", "text": "def player_won?\n return false unless check_situation?(@board, @player_ordered_list[0], @player_ordered_list[1])\n\n no_move_possible?(@player_ordered_list.rotate)\n end", "title": "" }, { "docid": "714a32d9...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "05351397ce04e64d74ef2c4d46803420", "score": "0.0", "text": "def admin_tip_params\n params.require(:tip).permit(:content, :rate, :approved)\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...
b4ac265e5d950a891cf4557fde548d46
Whether or not amount is in dot.
[ { "docid": "1ca8078fe3df78ac61283c722c9ee6a2", "score": "0.77494586", "text": "def dot? = unit == 'dot'", "title": "" } ]
[ { "docid": "1c728ffa221c67e28ed2d679274d5988", "score": "0.72799814", "text": "def has_decimal_part?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "3eb30bf2d82af776a6d6c1336e95809f", "score": "0.69807655", "text": "def dot_per_centimeter? = unit =...
7edc5811ea1fc7f7da4553c6a1370e15
If you job failed, you can do something interesting here. Generally you will want to ultimately raise the exception so Resque can track it.
[ { "docid": "f0fcc93b2b79d2521a9b58c2bc5d607b", "score": "0.0", "text": "def handle_exception(e)\n raise e\n end", "title": "" } ]
[ { "docid": "7b3d103e52bc8539d7f6e10514d463fb", "score": "0.75079817", "text": "def error(job, exception)\n args = @job_data['arguments']\n\n # When this is called, the worker will have aborted the job, and\n # possibly attempted to reschedule it.\n if args\n ...
914fb4e4920f93666d4a6a24cd7f1edf
Unary minus (negates pixel values)
[ { "docid": "23e47681dbcc6ab684932f96e16faa65", "score": "0.0", "text": "def -@\n self * -1\n end", "title": "" } ]
[ { "docid": "64b867066931105664362cec61d25671", "score": "0.782947", "text": "def -(other)\n other.is_a?(Vips::Image) ? \n subtract(other) : linear(1, Image::smap(other) {|x| x * -1})\n end", "title": "" }, { "docid": "234bc680cd4cc9f0f25332154cfbee04", "s...
95d36804ce73f494cfd929450afc4185
Determine whether the given url is supported by this Provider by matching against the Provider's URL schemes. It will always return false of a provider has required_query_params that are not set.
[ { "docid": "f8a32b940bfb271b4075e6555a5ef3bb", "score": "0.67181325", "text": "def include?(url)\n return false unless required_query_params_set?\n @urls.empty? || !!@urls.detect{ |u| u =~ url }\n end", "title": "" } ]
[ { "docid": "05166fe146684f2d9e1826f6369e3e4b", "score": "0.69825107", "text": "def url_valid?(url)\n schemes = [*options.fetch(:schemes)].map(&:to_s)\n uri = URI.parse(url)\n uri && uri.host && schemes.include?(uri.scheme) && uri.host.include?('.')\n end", "title": "" }, { "doc...
17779da7ab2c8dd1a5d70410be76fec1
POST /answers POST /answers.xml Pretty ashamed at how this action turned out. If I had more time, I would redo answers from the ground up. THIS NEEDS WORK BADLY!
[ { "docid": "ff5019d2d682ed02c1084582a068551a", "score": "0.0", "text": "def create\n checksub = Submission.find_by_user_id_and_position_id(current_user.id, context.id)\n @safe = true\n @answer = Array.new\n\t\t\tif params[:answer]\n\t \tfor answer in params[:answer]\n\t\t @answer << ans...
[ { "docid": "498b2f4eff6b107b6b35d9d51a595093", "score": "0.67059565", "text": "def answer\n @contest_response = get_my_latest_response(@contest.id, true)\n return play if @contest_response.completed?\n\n ans_attr = {:question_id => params[:question_id]}\n ans_attr[:question_option_id] = para...
a2b5baff3f280581d7e02ba4bb823847
add a user to a group
[ { "docid": "b2ab95c0bd48030a1a80a2b5354214d4", "score": "0.76869404", "text": "def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redi...
[ { "docid": "92865b2deba4da39174f2b9da74f1905", "score": "0.8990476", "text": "def add_user_to_group(user, group)\n\t\t\tend", "title": "" }, { "docid": "bf0b4649cd51a411f9fabe087e7d7f2a", "score": "0.8417453", "text": "def add_user(user)\n UserGroup.create(user_id: user.id, group_...
ae3eb0849e22f7e3015b183793860ee1
Get Project Notes Count
[ { "docid": "c9791c8dd005db5b261b1fa11805ca14", "score": "0.63542056", "text": "def project_projects_id_notes_count_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectNotesApi.project_projects_id_notes_count_get ...\"\n ...
[ { "docid": "99395da69d45d2d59bff15340de14f3a", "score": "0.71897405", "text": "def c\n Project.count\n end", "title": "" }, { "docid": "a65301e63c3a7c856da17f59c837bf74", "score": "0.71167195", "text": "def notes_count\n object.notes.count\n end", "title": "" }, { ...
2cb5e3640572f9a6c2f4595a60b7b41c
GET /tweets GET /tweets.json
[ { "docid": "20c0900c2182777cd8587d12869931c4", "score": "0.0", "text": "def index\n @tweets = Tweet.order_by(created_at: :desc).limit(20)\n end", "title": "" } ]
[ { "docid": "1b7298fc82aa4f8b3993f0800334caeb", "score": "0.81562936", "text": "def index\n @tweets = get_tweets\n respond_to do |format|\n format.html\n format.json { render json: @tweets}\n end\n end", "title": "" }, { "docid": "895aa559dc1a9829b45c0187c631a2a3", "sc...
c1d6a7a4ac5e32874ae9d8483ee29b6c
GET /snaps GET /snaps.json
[ { "docid": "1a13f7302e5ae53becd428a9602244e2", "score": "0.7198592", "text": "def index\n @snaps = Snap.order(created_at: :desc).limit(20).all\n end", "title": "" } ]
[ { "docid": "6db5ef131c4addbbc1087a170ec918a0", "score": "0.6968771", "text": "def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end", "title": "" }, { "docid": "aec69ca98a825bcc2bd...
5207af8eaad594ce1edcccf1ee1ead9b
select first n records from data and calculate drawdown for each
[ { "docid": "3a606fbb2e3e41d4570f15370becf495", "score": "0.56787926", "text": "def calculate_drawdowns(num = 3)\n drawdowns = []\n stock_data.first(num).each do |price_data|\n date = price_data[0]\n high = price_data[2]\n low = price_data[3]\n drawdown_amount = calculate_drawdo...
[ { "docid": "7d3ac3378d090e367bd5c6bc57e9fe67", "score": "0.54539245", "text": "def downsamp(field, n, type)\n chunks=field.each_slice(n).map\n x=Array.new\n for i in 0..(chunks.size-1)\n case type\n when 'mean'\n x << chunks[i].mean\n when 'median'\n x << chunks[i].median\n end\nend\n x\nen...
23178dc27780b4c8869cff00843aa908
Public: click Export to Excel(CSV) on Partner Signups Report section Example
[ { "docid": "32eb2bebd9a332094653ecb6744d9225", "score": "0.6495987", "text": "def click_export_to_excel\n wait_until_bus_section_load\n export_to_excel_btn.click\n end", "title": "" } ]
[ { "docid": "543a269bdf2aae990c7c42b4cd1ab31c", "score": "0.6962826", "text": "def download\n grade_entry_form = record\n send_data grade_entry_form.export_as_csv(current_role),\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form....
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b6ed62ac39274e4b5be5dd04f2851a16", "score": "0.0", "text": "def anchor_params\n params.require(:anchor).permit(:nome, :descricao, :perfil, :perspectiva, :tipo, :result_id, :anchorinfo_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...
037fd7ee29d292eb8bd94f34877d5dda
splitting string to parts with same symbols. "11222444" > [11, 222, 444]
[ { "docid": "bcfafd277b4c14c381b832f5ae234ee3", "score": "0.0", "text": "def convert_to_ar(str)\n bgn = 0\n cur = str[bgn]\n ar = []\n unless str.empty?\n str.length.times do |ind|\n next unless str[ind] != cur\n\n ar.append(str[bgn, ind - bgn])\n bgn...
[ { "docid": "0fafe41ddd366941eea0aea5d40c271f", "score": "0.67666036", "text": "def even_splitters(string)\n result = [] \n\n string.chars.uniq.each do |c|\n result << c if element_same_length?(string.split(c))\n end\n \n p result\nend", "title": "" }, { "docid": "1ba40f928a17b20924...
4409c98096922bc678f3bb19e63c362a
Returns the XML returned in the last API call.
[ { "docid": "936315be468c79d47c45df1ea12d5871", "score": "0.793454", "text": "def last_xml_response\n @xml_response\n end", "title": "" } ]
[ { "docid": "6d3ec3f49af73a7ea1e3f9a196e958b9", "score": "0.746396", "text": "def xml\n return @response.body\n end", "title": "" }, { "docid": "764de76443daf13beda61b14a266ea71", "score": "0.73823774", "text": "def get_xml\n end", "title": "" }, { "docid": ...
8a0f51b092e0d41f049b44354606db16
Serialises this resource's triples to turtle
[ { "docid": "790e02142c90507c15ac4a9112227e54", "score": "0.61190706", "text": "def to_ttl\n retrieve_triples_from_database(accept_header=\"text/turtle\")\n end", "title": "" } ]
[ { "docid": "340db37c6b3051d7e55a6d3f4152fd45", "score": "0.592927", "text": "def to_json(opts={})\n get_triples_for_this_resource.dump(:jsonld)\n end", "title": "" }, { "docid": "e60622b92e8cd389477194df64d64911", "score": "0.5897772", "text": "def make_triples (c1,rdf_class,make...
07d9d7502b05fc2750627dd77fff3eb4
Memberships do not store courts directly (accessed through reservations) We still want to track them, like they were on this model. This may lead to cases when no reservations were updated (e.g. they were in past or already paid, hence not changed) But since this is a virtual attribute it doesn't know what really happe...
[ { "docid": "74d5cb79460e4fc9a4d31a900e0a5005", "score": "0.5024975", "text": "def assigned_court_ids\n @assigned_court_ids ||= court_ids\n end", "title": "" } ]
[ { "docid": "af3e29bc05dbe2709e79323045215124", "score": "0.5551584", "text": "def apply_save_data_to_curation_concern(attributes)\n if attributes.fetch('on_behalf_of', nil).present?\n current_depositor = curation_concern.depositor\n new_depositor = ::User.find_by_user_key(...
d9241d2dec53834d2f7075aa16768bef
PATCH/PUT /tels/1 PATCH/PUT /tels/1.json
[ { "docid": "22bf68c997755715e821c78c7191c23e", "score": "0.0", "text": "def update\r\n respond_to do |format|\r\n if @tel.update(tel_params)\r\n format.html { redirect_to @tel, notice: 'tel was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @tel }\r...
[ { "docid": "6f0df87e998261b8b3ca9dce87206fe1", "score": "0.62899965", "text": "def update\n @tee = Tee.find(params[:id])\n @tee.update_attributes(tee_params)\n respond_with @tee\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6270415", "tex...
40603e16cfd556ef43e7a15e5e93d58a
make it optional with following syntax: page_count ="page_count"
[ { "docid": "06daf5a900e92dae136abfac62fced33", "score": "0.0", "text": "def initialize(title, pages)\n\t\t@title = title\n\t\t@pages = pages\n\tend", "title": "" } ]
[ { "docid": "0cbbe7e2ff356b847da4a7a348faced4", "score": "0.7103777", "text": "def paginate_every(n=nil); @paginate = n if n; @paginate || 20; end", "title": "" }, { "docid": "456ab281a99e4f16d9f8ab2200ae8606", "score": "0.7085411", "text": "def page_number\n property[:page_number]...
a9bf404f383e00a04734e23f5b2be3f7
GET /kanri_daichos GET /kanri_daichos.json
[ { "docid": "9f90549a0b72f6988861926bf6a00191", "score": "0.70203894", "text": "def index\n @kanri_daichos = KanriDaicho.page(params[:page])\n end", "title": "" } ]
[ { "docid": "7d78d46636cba1a22f0a0d3e3e32b0c4", "score": "0.6530048", "text": "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "title": "" }, { "docid": "70a9d23791650ff194a3a0908241fec0", "score": "0.64475363", "text": "def index\n @denuncia = Denuncium.all\n\n ...
f48fa9fa6fc6895e1891922ce8ee9cc0
PATCH/PUT /splashscreens/1 PATCH/PUT /splashscreens/1.json
[ { "docid": "9e3278cb68b2a86726bbbb112c20b047", "score": "0.7660374", "text": "def update\n respond_to do |format|\n if @splashscreen.update(splashscreen_params)\n format.html { redirect_to splashscreens_url, notice: 'Splashscreen was successfully updated.' }\n format.json { render ...
[ { "docid": "99af5130fdc23bd9a825142f3c64ebb6", "score": "0.6238946", "text": "def set_splashscreen\n @splashscreen = Splashscreen.find(params[:id])\n end", "title": "" }, { "docid": "804b232b635b450aed1a939f60001853", "score": "0.6002787", "text": "def create\n @splashscre...
eefdcbb274d96562a76c2272b609e89a
Checks whether a slot is included within another.
[ { "docid": "28b55aaf2ed22ddaf31731107531e950", "score": "0.5818647", "text": "def include?(other)\n other.to_set.subset?(self.to_set)\n end", "title": "" } ]
[ { "docid": "ccb766fb1b127c098cc709b7841cc76f", "score": "0.680773", "text": "def slot_overlaps\n is_overlap = false\n Slot.all.each do |slot|\n if slot.coach_id == self.coach_id # REFAC: DRY\n if self.start >= slot.start && self.start <= slot.start + (60*29)\n ...
e12a763be556724a30e1de4e14eac72c
check if mask is a valid mask
[ { "docid": "2fef8ec08672a0e3d4604ba2737b7d86", "score": "0.7486395", "text": "def is_valid_mask(mask)\n if mask =~ @@ip_re\n splitter = mask.split(\".\")\n for i in 0...splitter.length do\n tmp_i = splitter[i].to_i\n return false if ! @@mask_values.include? tmp_i\n # ch...
[ { "docid": "7c69a1978859111a23acd1a148ce5b4e", "score": "0.7757007", "text": "def has_mask?\n return true\n end", "title": "" }, { "docid": "939b3930e0aae7e3da5749b2c9c688dc", "score": "0.73361164", "text": "def mask?\n !!@mask\n end", "title": "" }, { ...
3b31ad6b5fbbedbbe2159bea1c4cfb58
Delete Invoice Email Template By Id
[ { "docid": "ec6d204e0f288b372c7e83814df82bbb", "score": "0.6440472", "text": "def finance_invoice_email_templates_id_delete_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InvoiceEmailTemplatesApi.finance_invoice_email_template...
[ { "docid": "75dc02f5b862ce5acd9808b89010cbc2", "score": "0.8353076", "text": "def delete_email_template(email_template_id)\n start.uri('/api/email/template')\n .url_segment(email_template_id)\n .delete()\n .go()\n end", "title": "" }, { "docid": "a848e42...
a86478a72201fc064ff7dba35f5ef2a7
PUT /services/1 PUT /services/1.json
[ { "docid": "dd68b9743bb592a2750dcc3353691a4d", "score": "0.0", "text": "def update\n flash.keep\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n\n format.html { redirect_to @service, :flash => {:success => 'Successfully updated the Service.'}}\n for...
[ { "docid": "19ebd2e8c5bdfadcd2fc7fbeaa1fa13e", "score": "0.7381375", "text": "def put\n verify_request!\n for uuid, attributes in @request.params.except(\"sign\")\n unless Vidibus::Uuid.validate(uuid)\n raise \"Updating failed: '#{uuid}' is not a valid UUID.\"\n ...
23a1faaf6870f46838aa2014d78b71af
Was the requested item not found or inaccessible?
[ { "docid": "60e82f58cc76b4e01f1e6b0986f5e297", "score": "0.65547204", "text": "def not_found?\n @code == 403 or @code == 404\n end", "title": "" } ]
[ { "docid": "bc96c3c893ea6bfe27ede4454de20c5a", "score": "0.74214375", "text": "def doesnt_exist\n\t\tputs \"That item doesn't exist.\"\n\t\tget_item\n\tend", "title": "" }, { "docid": "d6c8a4e497dd41ebfa8c6cd0931693b0", "score": "0.67752576", "text": "def item_not_available\n @ite...
8058b5a0ed17f2854a952fea51ad9787
Iterates over all the statements contained in the current block.
[ { "docid": "90f74626ddb7b47e0b3f394771f93fb2", "score": "0.6406066", "text": "def each_statement_deep(&ruby_block)\n # No ruby block? Return an enumerator.\n return to_enum(:each_statement_deep) unless ruby_block\n # A ruby block?\n # Apply it on self.\n ...
[ { "docid": "03c6da578e3760003c1b384e28ad04a4", "score": "0.7563736", "text": "def each_statement(&block)\n if block_given?\n @callback = block\n\n parse(@input, START.to_sym, @options.merge(:branch => BRANCH,\n :first => FIRST,\n ...
4d21d9a69b84f060e9a7780d1ea21dc2
Retrieve the informations linked to this domain (contacts, nameservers, redirections, weblogs...). This method only works on domains handled by Gandi. Return a hash with string keys containing domain informations (see API documentation) TODO: convert XMLRPC datetimes ?
[ { "docid": "b864823d967afef4a34aad32e717dd4b", "score": "0.6212932", "text": "def domain_info(domain)\n call('domain_info', domain)\n end", "title": "" } ]
[ { "docid": "e976accdbaa291000334cc9e8ab0af11", "score": "0.7016266", "text": "def get_domain_information(domain, force_update, config=CONFIG)\n info_hash = cache(domain, force_update)\n config = JSON.parse(File.read(CONFIG))\n\n domain_info = DomainInformation.new(info_hash, config)\n \n ...
d8546fa96cafe4061942cf22b25382cb
def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) << :username end
[ { "docid": "685376dd2d17ab6f3e64317731b9509b", "score": "0.0", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :role, :team_id])\n end", "title": "" } ]
[ { "docid": "431235f788a02f3756acf5775ad0323e", "score": "0.98245853", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :username\n end", "title": "" }, { "docid": "431235f788a02f3756acf5775ad0323e", "score": "0.98245853", "text": "def conf...
8718892369d9deb3a9c72f60c73b938f
Default Params for Actions
[ { "docid": "73b221c2fcb2f459009f0fa00fc9faeb", "score": "0.0", "text": "def default_addservicelink_params\n {\n serviceLink: {}\n }\n end", "title": "" } ]
[ { "docid": "f6a1671d55f99e04d4264ebbabc0f81b", "score": "0.7544264", "text": "def default_parameters(params = {}); end", "title": "" }, { "docid": "a9a2326601e621d589ca3078ab7563ea", "score": "0.73415446", "text": "def default_action_input_params(action)\n {}\n end", "tit...
45d9d9f232242be2b0fff0e521f8edf2
override to filter out system tables that otherwise end up in db/schema.rb during migrations. JdbcConnectiontables now takes an optional block filter so we can screen out rows corresponding to system tables. HSQLDB names its system tables SYSTEM., but H2 seems to name them without any kind of convention
[ { "docid": "7c2e69b5bec3ca54ba43692720bd26b9", "score": "0.68693054", "text": "def tables\n @connection.tables.select {|row| row.to_s !~ /^system_/i }\n end", "title": "" } ]
[ { "docid": "01cefd905d31b59e89fdf5273f109539", "score": "0.6605555", "text": "def tables(name = nil) #:nodoc:\n tables = @connection.tables\n tables.reject! { |t| /\\A_SYS_/ === t }\n end", "title": "" }, { "docid": "6e4e2a9521bdfb28814d75ca4b781602", "score": "0.65277...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4c214af5421a588bcc2beca050880fa5", "score": "0.0", "text": "def set_by_date\n @by_date = ByDate.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...
75e33406029e26334b936870c02c02d3
Parse of JSON request
[ { "docid": "dc7c28991788a2e5347b0699cec458e1", "score": "0.0", "text": "def to_hash(json_data)\r\n JSON.parse(json_data)\r\n end", "title": "" } ]
[ { "docid": "a32466c55469599ef8c31d09d53f5e9a", "score": "0.82114476", "text": "def parse_request request\n JSON.parse request.body.read\n end", "title": "" }, { "docid": "41a825cf4d014785bb5b8ef0f90970fc", "score": "0.81480134", "text": "def parse_request\n @json = J...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "870c46ccdb7d21ef315fda7e58a6a281", "score": "0.0", "text": "def set_invite_email\n @invite_email = InviteEmail.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339844", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6014297", "text": "de...
b14b38dd990cbcbc6025a6d5ec28b6bd
decrypt a string using a predefined encryption key and encryption_auth
[ { "docid": "b82d06fac4bd896f2f544fb55a1ca46c", "score": "0.73747236", "text": "def decrypt(encrypted_secret,encryption_key,encryption_auth)\n\n # initialize new cipher object\n decipher = OpenSSL::Cipher.new('aes-256-gcm')\n decipher.decrypt\n\n # use the base64 decoded IV which was fetched ...
[ { "docid": "e189836ba5982f42e0e1677d41ae3c0c", "score": "0.7910515", "text": "def decrypt(text)\n #Globals::CRYPT.decrypt text\n text\n end", "title": "" }, { "docid": "740f11982e05e46d1abb1b6299786fe1", "score": "0.78682584", "text": "def decrypt string, password=nil\n get...
f37315ee633646f59f0bbdde706c2d1b
The last day we charge FUF is either the day before you said you're leaving, or the facility_use_end variable, whichever is sooner.
[ { "docid": "556ab31d05dcac9c8e6dfc9a2c24a47b", "score": "0.7528247", "text": "def end_date\n unless @end_date\n departure = attendee.departed_at\n @end_date = departure - 1.day if departure\n if @start_date && (!@end_date || @end_date > UserVariable[:facility_use_end])\n @end_da...
[ { "docid": "fde0976455525963b91a094e864e7396", "score": "0.67991966", "text": "def at_end_of_day; end", "title": "" }, { "docid": "fde0976455525963b91a094e864e7396", "score": "0.67991966", "text": "def at_end_of_day; end", "title": "" }, { "docid": "fde0976455525963b91a09...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b5484491abf95e6d6824501f036c5701", "score": "0.0", "text": "def role_params\n params.require(:role).permit(:name, permissions_attributes: [:id, :resource_id, :action_create, :action_read, :action_update, :action_destroy])\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497801", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957249", "text": "def strong_params\n params.require(:request).permit(param_white...
ba82ee4aea5015956c6544138bef5f08
This method will not work because "zfs rollback" rollbacks config file but db stays latest config state
[ { "docid": "efbb5a37ff1103a997ab665368f4727d", "score": "0.0", "text": "def rollback_snapshot id, locked: false\n\t\t@logger.info \"#{self.class}##{__method__}\"\n\t\t@logger.debug \"#{self.class}##{__method__}: \" + \"id: #{id}\"\n\t\t@logger.debug \"#{self.class}##{__method__}: \" + \"locked: #{locked...
[ { "docid": "ecd2bdd5b8714bcd9f3f6005aee0dffb", "score": "0.7040268", "text": "def rollback_to_seed_data\n File.open(@database_config_path, \"w\") do |file|\n file.puts @original_database_config\n end\nend", "title": "" }, { "docid": "85298026b30c7ca203d977cc9212b12d", "score": "0.68...
bf3298c66aabdd5ce28728db5c12ac9a
For example, when an array is passed like [19, 5, 42, 2, 77], the output should be 7. [10, 343445353, 3453445, 3453545353453] should return 3453455. Hint: Do not modify the original array. def sum_two_smallest_numbers(numbers) Your code here end My solution
[ { "docid": "02b2313d21d08a73d42cfecc5ff25f25", "score": "0.8125356", "text": "def sum_two_smallest_numbers(numbers)\n numbers.sort[0] + numbers.sort[1]\nend", "title": "" } ]
[ { "docid": "a61baa1c63a06d4cbde0902e8e885b15", "score": "0.87527233", "text": "def sum_two_smallest_numbers(numbers)\n return numbers.sort().slice(0,2).reduce(0){|sum,num| sum+num}\nend", "title": "" }, { "docid": "758ec7caaa833817ba89cd3d7468771c", "score": "0.87327695", "text": "d...
538b2cb3c255c030019bf641b67340b1
before_action :check_user, only: [:update, :destroy] GET /offers
[ { "docid": "a417ac6c0bcd6ae648cf13e61cf0dd46", "score": "0.0", "text": "def index\n @offers = Offer.where(initiator_user_id: current_user.id).or(Offer.where(creator_user_id: current_user.id))\n\n render json: OffersRepresenter.new(@offers).as_json\n end", "title": "" } ]
[ { "docid": "4c1730d296ae4f4028eb64df3db4493d", "score": "0.6393523", "text": "def verify_actions\n @listing = Listing.find(params[:id])\n if current_user.customer? && @listing.user_id != current_user.id \n redirect_to root_url, notice: \"You cant do this\"\n end \n end...
8c8355b448ff908c8143656ed31851d5
generate thumbnails for converted file
[ { "docid": "842d302a8c53682b8f44716bec44b6fd", "score": "0.6343849", "text": "def generate_thumbnails\n self.thumbnails = []\n\n # generate from thumb_moments\n (JSON.parse(profile.thumb_moments) rescue []).each do |time|\n self.thumbnails << Thumbnail.generate(\n newly_converted,\n...
[ { "docid": "b9c1041624455481f1d39843261884d0", "score": "0.7781963", "text": "def generate_thumb(tmp_file_path)\n %x(convert #{tmp_file_path}.pdf[0-#{@num_thumb_pages}] -thumbnail x640 #{tmp_file_path}.png)\n stripped_file_names = (0...@num_thumb_pages).to_a.map { |i| \"#{tmp_file_path}-#{i}.png\"...
f362a93b443ccce221356b858144bb7b
GET /transaction_requests/1 GET /transaction_requests/1.json
[ { "docid": "d1db88dd64942a122d79c19e18852044", "score": "0.0", "text": "def show\n inputID = @transaction_request.input_address_id\n @input_address = InputAddress.find(inputID)\n end", "title": "" } ]
[ { "docid": "8c881930159a0e4227bb5dead3cb4e4c", "score": "0.6833962", "text": "def transactions(params = {})\n request(:get, '/transactions', params)\n end", "title": "" }, { "docid": "6c8d0bb89b3254ce41f23ee95c5e6976", "score": "0.6701848", "text": "def index\n json_respon...