query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
285534d1ed83f15d8f13236e411babc1
Adds the given record to the index. Record may be a hash, or a Ferret::Document instance
[ { "docid": "dd20de84a2a0faf0d42fcadd4dab1ea1", "score": "0.6947557", "text": "def add_record( record, boost = nil )\n add_records [ [ record, boost ] ]\n end", "title": "" } ]
[ { "docid": "317445005e7cbc01b5977a5a5a17d364", "score": "0.8745463", "text": "def add(record)\n record = record.to_doc unless Hash === record || Ferret::Document === record\n ferret_index << record\n end", "title": "" }, { "docid": "5f74b9717c9aaf65b70232fa2d6f419e", "score"...
1e7bf682a47df377adfdffb5c0709165
POST /appointments POST /appointments.json
[ { "docid": "20ed07c4280a03e88ee80b76e6309bbd", "score": "0.7258103", "text": "def create\n if params.has_key?(:appointment)\n @appointment = Appointment.new(appointment_params)\n @selected_timeslot = Timeslot.where(start: @appointment.start.to_datetime).first\n @appointment.end = (@app...
[ { "docid": "0da77372d165085abb28cd8a3b7ba383", "score": "0.7684639", "text": "def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.save\n render json: @appointment, status: :created, location: @appointment\n else\n render json: @appointment.errors, status:...
077ac431825ea9c9f7082ba23ac69184
Create the Sqoop2 Server Database tables.\n\nThis command is to be run whenever a new database has been specified. Will\ndo nothing if tables already exist. Will not perform an upgrade. Only\navailable when Sqoop2 Server is stopped.\n\nAvailable since API v10.
[ { "docid": "27c58d0c45aa11f78b86f97732cb225b", "score": "0.0", "text": "def api_v11_clusters_cluster_name_services_service_name_commands_sqoop_create_database_tables_post(service_name, cluster_name, opts = {})\n api_v11_clusters_cluster_name_services_service_name_commands_sqoop_create_database_tabl...
[ { "docid": "151eaaa707a6c1aeaf841eedd93e26af", "score": "0.7010026", "text": "def create_tables\n self.conn.exec(\n File.read(\"./lib/creating_tables.txt\")\n \n )\n end", "title": "" }, { "docid": "134612772a5e972788b2c93698fce5bf", "score": "0.657...
3fc764faa5fdddf4d14adb6590659765
Ensure valid credentials, either by restoring from the saved credentials files or intitiating an OAuth2 authorization. If authorization is required, the user's default browser will be launched to approve the request.
[ { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.62972116", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, to...
[ { "docid": "fdf03d140fe16dc072651520e61398ac", "score": "0.69314516", "text": "def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a285974ab39b136061bd905e3863af3f", "score": "0.0", "text": "def set_experience\n @experience = Experience.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...
699c3ed8a572eb60321069be522cd5db
Return the last node in the list
[ { "docid": "339aba84b38ebed7cfb6b71b309e5cf6", "score": "0.82751375", "text": "def last\n node = @head\n while node && node.next\n node = node.next\n end\n node\n end", "title": "" } ]
[ { "docid": "31c2a0c1e36b9a9c3ca821f0df46a064", "score": "0.84200203", "text": "def last\n node = @head\n node = node.next while (node.next)\n node\n end", "title": "" }, { "docid": "57e9b46b90bd9d805e7dbeffd143b29b", "score": "0.84022206", "text": "def last\n return ...
0ff02f22f8ed1bef9ad16a1ca782bb19
Join translation keys into one.
[ { "docid": "2f21b249e150a8e320c8099128a02806", "score": "0.65792334", "text": "def join_keys *segments\n segments.map(&:to_s).select(&:present?).join(\".\")\n end", "title": "" } ]
[ { "docid": "f3a0edd1633304a42f1078faa62e853c", "score": "0.6394983", "text": "def expand_keys(key)\n key.to_s.split(FLATTEN_SEPARATOR).inject([]) do |keys, k|\n keys << [keys.last, k].compact.join(FLATTEN_SEPARATOR)\n end\n end", "title": "" }, { "docid": ...
24c48d1eb0bd670eaf4a719b5463a8ec
Delete Payee by Id Use v4 instead This API will delete Payee by Id (UUID). Deletion by ID is not allowed if: Payee ID is not found If Payee has not been onboarded If Payee is in grace period If Payee has existing payments
[ { "docid": "1d975d6563e8379df653b15e60571e64", "score": "0.7491007", "text": "def delete_payee_by_id_v3(payee_id, opts = {})\n delete_payee_by_id_v3_with_http_info(payee_id, opts)\n nil\n end", "title": "" } ]
[ { "docid": "a05e4b51c7d336f05bd888bc7e3a80de", "score": "0.77393377", "text": "def delete_payee_by_id_v4(payee_id, opts = {})\n delete_payee_by_id_v4_with_http_info(payee_id, opts)\n nil\n end", "title": "" }, { "docid": "ec8ce2d271d92a62e5ecc86d85bab9a8", "score": "0.691737...
1ff814ea5d60741bae05345921a4bbe8
GET /entries GET /entries.json
[ { "docid": "f733715c354102ef089123e1d70e3f4d", "score": "0.6334137", "text": "def index\n @entries = Entry.by_user(current_user).page(params[:page]).per(PER_PAGE)\n respond_to do |format|\n format.js { render 'entries/index_smart_phone', :layout => false}\n format.html\n format.js...
[ { "docid": "b6b93dc022ed0d53ef0d20859d99112b", "score": "0.7879974", "text": "def entries opts = {}\n get :entry, opts\n end", "title": "" }, { "docid": "375b5b4634fbcf282593112630b69413", "score": "0.76968324", "text": "def index\n @entries = Entry.all\n\n render json:...
9cb28b6ac423aeb78de4dae33a7be9ce
used in the views so need to sanitize
[ { "docid": "ca287c29709fc75361015bd1860a964b", "score": "0.0", "text": "def sanitize_assignment_type t\n t if valid_assignment_types.include? t\n end", "title": "" } ]
[ { "docid": "09e1968a751411c8bc2d27017c494d38", "score": "0.7518306", "text": "def sanitize!; end", "title": "" }, { "docid": "c9acfa8b1ee81e36e717933d298a68c6", "score": "0.7235429", "text": "def validate_and_sanitize\n super\n end", "title": "" }, { "docid": ...
11dafe58683626787d0338b415e53a16
This should return the minimal set of attributes required to create a valid Event. As you add validations to Event, be sure to update the return value of this method accordingly.
[ { "docid": "d614aae5fed6491b4a8f9d4b018700e9", "score": "0.70868057", "text": "def valid_attributes\n {\n name: \"Event Name\"\n }\n end", "title": "" } ]
[ { "docid": "8cb6807f553f68359a2d8a11a86f8954", "score": "0.72414345", "text": "def valid_attributes\n {\n \"name\"=>\"Dummy Event\", \n \"description\"=>\"Dummy event description data\", \n \"start_date\"=> Time.zone.now.strftime(\"%Y/%m/%d %H:%M:%S %z\"), \n \"end_date\"=> (Time....
44bab8a33e3d85e920830dd2b67519eb
DELETE deletes a post
[ { "docid": "63a5a279148db32525a41a201581fc43", "score": "0.75901985", "text": "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n redirect_to posts_path\r\n end", "title": "" } ]
[ { "docid": "febca30e40e7b1d65b9798305f0ea9d1", "score": "0.8328918", "text": "def delete_post\n\t \n \tend", "title": "" }, { "docid": "54f541c73e424c00e6b4d28897141cf0", "score": "0.82965916", "text": "def delete\n @post = Post.find(params[:id])\n end", "title": "" }, ...
f790fc529d1d1425c1ca0d7b37932fe3
Do nothing. This backend isn't cached
[ { "docid": "5001343d32f051c7abfbee7c52d8dad8", "score": "0.0", "text": "def refresh_metrics_cache\n\tend", "title": "" } ]
[ { "docid": "e7af100b66bde1865b6a59d1b74c4522", "score": "0.7418107", "text": "def do_not_cache!; end", "title": "" }, { "docid": "e7af100b66bde1865b6a59d1b74c4522", "score": "0.7418107", "text": "def do_not_cache!; end", "title": "" }, { "docid": "e7af100b66bde1865b6a59d1...
3c47fd0ca9fe156d0cffb891cd76d0b0
Returns the value of the identity attribute, if declared. Falls back to name if no identity attribute is declared.
[ { "docid": "f29d745ed3b779672cebf12b11f9fac7", "score": "0.7721844", "text": "def identity\n if identity_attr = self.class.identity_attr\n send(identity_attr)\n else\n name\n end\n end", "title": "" } ]
[ { "docid": "354c0d1f1604c846b5101d6e29c70e7d", "score": "0.72823817", "text": "def identity(name = nil)\n if name\n @identity = name\n else\n @identity || :id\n end\n end", "title": "" }, { "docid": "dbb0286ec8318faf1e125ee2e17ca9f6", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "dac73bfd9d20bb7ff614a861b080d384", "score": "0.0", "text": "def set_response\n @response = Response.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...
a236daa77f56c268eef21bf38a849118
SP16.4 end refresh token (keeping same expires_at) if it exists
[ { "docid": "b98d55d6540564b054fe0037330bffc0", "score": "0.0", "text": "def refresh_token\n if remember_token?\n self.remember_token = self.class.make_token\n save(:validate => false) \n end\n end", "title": "" } ]
[ { "docid": "02e38bdc2aec4529f694444b48999622", "score": "0.79026073", "text": "def access_token_if_expired\n if self.token_updated_at <= 58.minutes.ago\n data = {\n client_id: Rails.application.secrets.google_client_id,\n client_secret: Rails.application.secrets.google_...
2749e9d4953fda9eb026e4057f453d75
Backs up the specified storage account. Requests that a backup of the specified storage account be downloaded to the client. This operation requires the storage/backup permission.
[ { "docid": "b6b135dd6843c54e3c3670fd41417448", "score": "0.7363538", "text": "def backup_storage_account(storage_account_name, api_version, opts = {})\n data, _status_code, _headers = backup_storage_account_with_http_info(storage_account_name, api_version, opts)\n data\n end", "title": ...
[ { "docid": "cddcd2657ac4de45bbe13935f2b85c51", "score": "0.6879551", "text": "def backup account\n return unless valid_argument?(account, \"backup\")\n @heroku_credentials.backup account\n @ssh_identity.backup account\n end", "title": "" }, { "docid": "feef0a465d3bdc7b2d5b2...
e646be0b7903fc8edc690d1c0ec2fda1
in before filter : provider (find_provider)
[ { "docid": "3160661da064ba826100fa9bb9840e28", "score": "0.0", "text": "def destroy\n device = @provider.device\n if device\n if @provider.tech == \"SIP\" or @provider.tech == \"IAX2\"\n exceptions = device.prune_device_in_all_servers(nil, 0)\n raise exceptions[0] if exceptions....
[ { "docid": "f92dcc11763bf4029f6bfcdf20f8a2f4", "score": "0.7619848", "text": "def prepare_provider; end", "title": "" }, { "docid": "f92dcc11763bf4029f6bfcdf20f8a2f4", "score": "0.7619848", "text": "def prepare_provider; end", "title": "" }, { "docid": "dad214aca4b5e82370...
7157555253b4757c16c3b9fe0156a2c0
Get the content from banner.txt file
[ { "docid": "0f54bdda69358459ce32761150b69061", "score": "0.7270202", "text": "def get_banner()\n file_content = File.open(\"src/ui/banner.txt\").read\n print(file_content.red)\nend", "title": "" } ]
[ { "docid": "dd1d5c138f4f6a48e6360b29b67ea56d", "score": "0.81771636", "text": "def banner()\n\n file = File.open(\"resources/banner.txt\", \"r\")\n\n puts file.read()\n\n end", "title": "" }, { "docid": "9bacd6b325f38e4ee5aa03b6f088addd", "score": "0.7143601", "text"...
d831351faee034e034334bc2c98b0412
TODO(jaycarlton): make this an option For every environment in the envs_file, fetch all items of interest from the appropriate Stackdriver APIs. (Note that in future we may wish to broaden this to other APIs, though in the case of the Trace API we'd need new permissions on the service acccount.)
[ { "docid": "4273f5e3c994ca015024d2f3344e0e3e", "score": "0.0", "text": "def backup_config\n visit_envs do |env_bundle|\n backup_alert_policies\n if DO_BACKUP_ALL\n backup_all_metrics\n else\n backup_custom_metrics\n backup_user_logs_based_metrics\n end\n ...
[ { "docid": "af7a36fc9becde871d8ae335e7746ccf", "score": "0.66354847", "text": "def getDeployedEnvs()\n envArray = Array.new\n stacks = @cfUtil.getKeystoneStacks('keystone-2-')\n stacks.each do |stack|\n stk = stack.downcase\n if stk.include? '-common-'\n env = stk.split('keysto...
55a8e469a746bfc3f6d69a34c9fc867b
GET /papers/new GET /papers/new.xml
[ { "docid": "2166a4d21c3c5a96e2bc137167360fa1", "score": "0.74477404", "text": "def new\n @paper = Paper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paper }\n end\n end", "title": "" } ]
[ { "docid": "66aace935673cc360da0a693542e5ab0", "score": "0.7396039", "text": "def new\n @newspaper = Newspaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newspaper }\n end\n end", "title": "" }, { "docid": "d364e92db1692a7f...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "182007ea597b865142e9d68c3a31dd3b", "score": "0.0", "text": "def set_company_type\n @company_type = CompanyType.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
ed8097ab123fef64b37a45f15774481a
POST /reviews POST /reviews.json
[ { "docid": "dd42b39dd7a583b29540a042d6c8a06b", "score": "0.640811", "text": "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.json { render action: 'show', status: :created, location: @review }\n format.html { redirect_to posti...
[ { "docid": "85ed0140f118234007d9b7596431ee2d", "score": "0.7576602", "text": "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "title": "" }, { "docid": "620586b92549532ff06fec9ef046cc91", "score": "0.75637454", "t...
365d4a01a593f16be2181dc0c3b26ec9
DELETE /caisses/1 DELETE /caisses/1.json
[ { "docid": "34ac5ba44508022a469233ff613e6095", "score": "0.0", "text": "def destroy\n authorize! :destroy, Caisse\n @caisse.destroy\n respond_to do |format|\n format.html { redirect_to caisses_url, notice: 'Caisse was successfully destroyed.' }\n format.json { head :no_content }\n ...
[ { "docid": "693cbedc935d7e16705bccae9fdf4311", "score": "0.70851827", "text": "def destroy\n @caiss.destroy\n respond_to do |format|\n format.html { redirect_to caisses_url, notice: \"Supprimer avec succés.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, {...
3c782f0113c0365529b3278d0d009020
GET /admin/student_majors/1 GET /admin/student_majors/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0ce860f62ee011fdcebbeb99b1889550", "score": "0.7593924", "text": "def index\n @admin_student_majors = Admin::StudentMajor.all\n end", "title": "" }, { "docid": "967c1e05b3d0af3437c301331c176827", "score": "0.71282184", "text": "def index\n @undergraduate_majors = U...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3c9e0b9073493034c7e18988143f09da", "score": "0.0", "text": "def set_location_record\n @location_record = LocationRecord.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...
5500ed7556f2ea24c7bee04e25375e82
check the email exists and that the corresponding user's first name matches the one given. Then, create a new PasswordReset for that user.
[ { "docid": "46edcf1f6cb85a3214f70303b455440c", "score": "0.8207906", "text": "def create\n email, name = params[:password_reset_request].values_at(:email, :name)\n user = User.where('lower(\"users\".\"email\") = ?', email.downcase.strip).first\n\n if user and user.first_name.downcase.strip == n...
[ { "docid": "9f4856337dcb516e0eec74c416a75bb8", "score": "0.7613603", "text": "def create\n email = params[:password_reset][:email].strip\n if email.present? && @user = User.where(:email => email).first\n @user.deliver_password_reset_instructions!\n flash[:success] = t(\"password_reset.ch...
d89187c15250048a393f2a6d374327c6
ALTER TABLE pokemon ADD COLUMN hp INTEGER DEFAULT 60;
[ { "docid": "7ecb22d32a82c1a68b54c594d50150ab", "score": "0.0", "text": "def initialize(hp=nil)\n @db = db\n @id = id\n @name = name\n @type = type\n @hp = hp\n end", "title": "" } ]
[ { "docid": "5936ce821b081d8f4e44f4f02a13b6e3", "score": "0.7486641", "text": "def alter_hp(hp,db)\n #db.execute(\"ALTER TABLE pokemon ADD COLUMN hp INTEGER DEFAULT 60 END;\") unless db.execute(\"SELECT hp FROM pokemon\")==nil\n db.execute(\"UPDATE pokemon SET hp=? WHERE id=?;\",hp,self.id)\n #i...
dc25ca1124e15eb59a693db1f7270332
PUT /mosttinymobsetups/1 PUT /mosttinymobsetups/1.json
[ { "docid": "38b457cdb66abef511064229a9edd447", "score": "0.7101288", "text": "def update\n @mosttinymobsetup = Mosttinymobsetup.find(params[:id])\n\n respond_to do |format|\n if @mosttinymobsetup.update_attributes(params[:mosttinymobsetup])\n format.html { redirect_to @mosttinymobsetup...
[ { "docid": "595cb1cbaa08ae6937ef6e0284f8293b", "score": "0.672872", "text": "def create\n @mosttinymobsetup = Mosttinymobsetup.new(params[:mosttinymobsetup])\n\n respond_to do |format|\n if @mosttinymobsetup.save\n format.html { redirect_to @mosttinymobsetup, notice: 'Mosttinymobsetup ...
36626c23c31df4a6d41812fd971d12ed
GET /works GET /works.json
[ { "docid": "9ed950beb8d1fcf9851ac71414c50006", "score": "0.0", "text": "def index\n if current_user.typeof == true\n @works = Work.all\n else\n redirect_to home_home_page_path\n end\n end", "title": "" } ]
[ { "docid": "0a6cfdcfae749733303521cd79bf1794", "score": "0.79752797", "text": "def index\n \n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works}\n end\n\n end", "title": "" }, { "docid": "207dabf2ebe89596203...
6015b658d53f46f4581d761964fcdb75
save changes of a post tag
[ { "docid": "a0bd4016d01afa684f44f8bb5cdec1a1", "score": "0.65186715", "text": "def update\n args = {post_tag: @post_tag, post_type: @post_type}; hooks_run(\"before_update_post_tag\", args)\n if @post_tag.update(params.require(:post_tag).permit!)\n @post_tag.set_options(params[:meta]) if param...
[ { "docid": "b54df0659ba957610a99c72f87d1db5b", "score": "0.717816", "text": "def save\n # http://rightscale.rubyforge.org/right_aws_gem_doc/classes/RightAws/SdbInterface.html#M000238\n self.date = Time.now.to_i\n\n attr = {\n 'text' => self.text,\n 'title' => self.title,\n...
36d1d4d4355398e44ab74bf688583fd2
PATCH/PUT /blog_titles/1 PATCH/PUT /blog_titles/1.json
[ { "docid": "3be24b0a3e4a0f20356a0c8245ef7d8a", "score": "0.6753707", "text": "def update\n respond_to do |format|\n if @blog_title.update(blog_title_params)\n format.html { redirect_to @blog_title, notice: 'Blog title was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "93c100d6b85706c21596274e5fdb5723", "score": "0.63352686", "text": "def update\n# @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n format.html { redirect_to @blog, :notice => 'Blogs was successfully updated.' }\n ...
c1bc42691548780e2510068cc3b56194
Converts the specified user input value to a valid game board index.
[ { "docid": "0d1a4b9d05b47aa533083635790eeb21", "score": "0.0", "text": "def input_to_index(user_input)\n return user_input.to_i() - 1\nend", "title": "" } ]
[ { "docid": "c624443a9386bba728a0ed12a42ae08e", "score": "0.7810679", "text": "def input_to_index (user_input)\n user_input.to_i-1 #converts user_input argument to integer w .to_i\n #and to match board index position, subtracts 1 from converted user input integer\nend", "title": "" }, { "do...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "e396d8b255a3431fe73d41988197865e", "score": "0.0", "text": "def ucc_params\n params.fetch(:ucc, {}).permit(:user_id,:carabineros_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
6754ac9fbd400fbf8094e3ead5e3be35
Virtual Attributes to simplify Start and End Date Time Entry
[ { "docid": "a1bf5e28978d13417f9936ebb6bf29a0", "score": "0.0", "text": "def start_date\n start_date_time.to_date.strftime('%m/%d/%Y') if start_date_time.present?\n end", "title": "" } ]
[ { "docid": "a4c2e361e055bf42e914b59aaaca4dd4", "score": "0.7437705", "text": "def attributes\n %i[start_date end_date]\n end", "title": "" }, { "docid": "acb503c0051fb51a8b94eadad7e2398e", "score": "0.73307085", "text": "def custom\n @start_time = @start_time.to_time.begin...
173cb996d261cbca285800f342d75dd5
Set the object position. Do nothing is obj is nil
[ { "docid": "7b8b5ff924f2e54dd65b5977dc774bb0", "score": "0.8337061", "text": "def set_object_position(obj, value)\n obj.x = value if obj\n end", "title": "" } ]
[ { "docid": "bbc76bd3feaeb65d00a2d0a0e5194ddd", "score": "0.8173986", "text": "def set_object_position(obj, value)\n obj.y = value if obj\n end", "title": "" }, { "docid": "f9a369d9d55666295696987f862ebdd1", "score": "0.8131583", "text": "def set_object_position(obj, value...
35cef47dfe713b0d13d402efd0f89956
if the value is a string, adds quotes returns value
[ { "docid": "5126c4005f21480b13aa02f1014d1887", "score": "0.8759545", "text": "def add_quotes_if_string(value)\n if value.is_a? String\n value = add_quotes_to_string(value)\n end\n value\n end", "title": "" } ]
[ { "docid": "90eb87655b47acb311c95fc1acdcfa59", "score": "0.8091113", "text": "def quote(value)\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n end\n end", "title": "" }, { ...
49da1f866ad149ad8015b219e795e3d7
Custom attribute writer method with validation
[ { "docid": "702a0c84132acb8321e75d8cef1bbb66", "score": "0.0", "text": "def group=(group)\n if !group.nil? && group.to_s.length > 255\n fail ArgumentError, 'invalid value for \"group\", the character length must be smaller than or equal to 255.'\n end\n\n if !group.nil? && group.to...
[ { "docid": "5a0bcdaca95c21b13aacca36f9fad742", "score": "0.6955513", "text": "def _write_attribute(attr_name, value); end", "title": "" }, { "docid": "5812dd7a37c0eccc3d9481c23d74c649", "score": "0.69278884", "text": "def write_attribute(attr_name, value); end", "title": "" }, ...
b8bdd35f8a678667d62dbaf02d30df03
Won return the board positions if someone has won
[ { "docid": "cc07ba5b93d03bf69614ea80982c6d7a", "score": "0.75720745", "text": "def won?(board)\n # cycle through WIN_COMBINATIONS\n WIN_COMBINATIONS.detect { |winning_combo|\n # print win_index\n # print '\\n'\n position_taken?(board,winning_combo[0]) &&\n position_taken?(board,winning_c...
[ { "docid": "b68228a797acd7f159eb8b622ef3b15c", "score": "0.796098", "text": "def winner\n board.position(won?[0]+1) if won?\n end", "title": "" }, { "docid": "6c94d87759b6bf459580505638f68e39", "score": "0.7843892", "text": "def won?(board)\n\n win_index_1 = WIN_COMBINATIONS[0...
430f58d118f81dc244ee21d50179ba57
Necessary for proper translations
[ { "docid": "f466e6cc1da9cb6df4d99c05982bffc4", "score": "0.0", "text": "def i18n_scope\n :activemodel\n end", "title": "" } ]
[ { "docid": "335961c358398912a0fb0cb91e9b31b1", "score": "0.785273", "text": "def translations; end", "title": "" }, { "docid": "912b0330f8480225fb1e16b8f867fb23", "score": "0.76390773", "text": "def translation\n super\n end", "title": "" }, { "docid": "c01cc97882...
486698e68997510d18571080815553f5
DELETE /sample_users/1 DELETE /sample_users/1.json
[ { "docid": "2bebf8672354a10585810ef3bb0214ad", "score": "0.71085936", "text": "def destroy\n @sample_user.destroy\n respond_to do |format|\n format.html { redirect_to sample_users_url, notice: 'Sample user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"...
[ { "docid": "8e69eb3ff3374e0db6fa9eb17958df65", "score": "0.7566179", "text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "6f74a32c6fdb67babd4a903e37b5baa4", "score": "0.738733", "text": "d...
1430ae18d1370472b4a71a32c9413499
Check if any search parameters have been set
[ { "docid": "06dda798ff3f85285453c64bb9f59ac0", "score": "0.7605555", "text": "def has_search_parameters?\n params[:search_field].present? || search_state.has_constraints?\n end", "title": "" } ]
[ { "docid": "8d96139d9bd38d764dd7b8767150dd02", "score": "0.8133901", "text": "def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end", "title": "" }, { "docid": "c957a83412a0cb8b40e74e5e9e0901df", "score": "0.7825...
97ac6e32408a8d27b188707f8d1e6673
GET /meetusers/1 GET /meetusers/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "4136f5e0d5cb325def7b9d5f8ca1ac66", "score": "0.7185992", "text": "def index\n @meetusers = Meetuser.all\n end", "title": "" }, { "docid": "9c2ce78f7a00128b617097a3b3584705", "score": "0.6952065", "text": "def show\n @users_meeting = UsersMeeting.find(params[:id])\n...
dc43da82467dd310122fd687efb855e4
Method to get list of regions in Company
[ { "docid": "115cbcf100876bd310af9ce6acc4ebc1", "score": "0.7684338", "text": "def region\n @regions = @company.companyregions\n respond_with @regions\n end", "title": "" } ]
[ { "docid": "9e6650de349bddf8d1c504e11964f924", "score": "0.7385533", "text": "def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend", "title": "" }, { "docid": "66a6c3cd96ec6746e4d2b4bbffd3e2b6", "score": "0.720217", "text": "def getVendorsAndRegions\n fetch(@config[:fin...
362a5f978975539501ae3da54562f58c
PUT /admin/meetings/:id PUT /admin/meetings/publication_date1.xml
[ { "docid": "00591e91c6f3ba88d71900e5b90844ea", "score": "0.5599523", "text": "def update\n @meeting.attributes = params[:meeting]\n\n respond_to do |format|\n if @commit_type == 'preview' && @meeting.valid?\n format.html do\n find_children\n render :template => 'admin...
[ { "docid": "37669956f25eefa62fa0a449788d26fc", "score": "0.67261666", "text": "def update\n @publication = Publication.find(params[:id])\n\n @publication.assign_attributes(params[:publication])\n\n add_missing_translation_content(@publication.publication_translations)\n\n respond_to do |form...
a3f5d27eac42bdfe528488f62106be10
Arrays bulk reverse. together_reverse has alias :treverse not empty case lists = [[1, 2], [5, 6]] ret = lists.together_reverse print ret => [[2, 1], [6, 5]] print lists => [[1, 2], [5, 6]] one empty case lists = [[1, 2], []] ret = lists.together_reverse print ret => [[2, 1], []] print lists => [[1, 2], []]
[ { "docid": "f36570a2e930303e4fa17f63e8b5b941", "score": "0.79158497", "text": "def together_reverse\n if_not_contain_array_rails_type_error\n reduce([]) { |ret, list|ret << list.reverse }\n end", "title": "" } ]
[ { "docid": "edd7cd4c926882c76a0691ea966f10c1", "score": "0.8028211", "text": "def together_reverse!\n if_not_contain_array_rails_type_error\n reduce([]) { |ret, list|ret << list.reverse! }\n end", "title": "" }, { "docid": "0cb80bb60bab2b1fae32fd93f746a196", "score": "0.6880855", ...
f5c565f2507ea4b1f047bcec4f3791de
Log message at level (which should be :error, :warn, or :info) to all loggers.
[ { "docid": "bf9ce744fbf7764897dd01a0130cc68e", "score": "0.7528929", "text": "def log_each(level, message)\n @loggers.each{|logger| logger.send(level, message)}\n end", "title": "" } ]
[ { "docid": "3bf9ab139157b4c5f57b37d7a4b5fe1a", "score": "0.753653", "text": "def log_each(level, message)\n @loggers.each{|logger| logger.send(level, message)}\n end", "title": "" }, { "docid": "6a8af772096bb2467375c0ccff34d68c", "score": "0.7453465", "text": "def log_eac...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "de7e5773ff73489d6fbea0ab410f6a3e", "score": "0.0", "text": "def x_ray_params\n params.require(:x_ray).permit(:paitent_id, :comments, :image, :paitent_serialnumber,:technicians_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7476921", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.7168177", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist =...
b61343f5fd1764cbea2e258fea991c77
Count the images of one html page.
[ { "docid": "85275157e00bd571144934cbe96efb6a", "score": "0.82931626", "text": "def count_images_of_one_page(page)\n perform_search_for_single_page('//img', [], page)\n end", "title": "" } ]
[ { "docid": "3ff7efb147f82884a3b6061f4f717fd2", "score": "0.729852", "text": "def number_of_images\n images.count\n end", "title": "" }, { "docid": "8ae103500c68e66ae440fc8e47c84f64", "score": "0.7210144", "text": "def count_all_images(dir)\n perform_global_search('//img', []...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e7bd394698df9519806450cca3675bc6", "score": "0.0", "text": "def set_outcome_measure\n @outcome_measure = OutcomeMeasure.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...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "2f106e304d8afcd81f7544336d1ce04c", "score": "0.0", "text": "def form_params\n # params.require(:form).permit(:template_id, :recipient_user_id, :date_filled_out, :is_complete, :update_by, :insert_by, :insert_time, :update_time)\n ActiveModelSerializers::Deserialization.jsonapi_parse...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
b734c0b833eb0dcb1de0c5e42a907124
Your code here too!
[ { "docid": "401eefc19b600fe67f171f2a9907ddd6", "score": "0.0", "text": "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "title": "" } ]
[ { "docid": "d509f8cefdd8fc87fefabff3705478b5", "score": "0.6569012", "text": "def custom\n \n end", "title": "" }, { "docid": "7ec57c3874853e50086febdbdd3221bf", "score": "0.64869237", "text": "def wedding; end", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223e7c753f...
5ef78d5eebdaf159e3b140b458ebd55b
sets a members' score to a specific value
[ { "docid": "32c90ffd4845b34d94cac340dc7cc826", "score": "0.7199989", "text": "def set_member_score(lb, handle, score, json)\n if (params[:score].to_i == -1)\n lb.remove_member(handle)\n {:status => 'success', :message => \"#{params[:handle]} removed from the #{params[:leaderboard]} leaderboard.\"...
[ { "docid": "136f850ee73ff37bd7fc01b5f5da84f2", "score": "0.73612994", "text": "def score=(value)\n @score = value\n end", "title": "" }, { "docid": "f363fbcae6f134f5074f501a015ece80", "score": "0.72241676", "text": "def score=(points)\n s = points\n s ...
4c588ad4f3f4c00eceb75c2b74b49b88
GET /user_subjects/1 GET /user_subjects/1.json
[ { "docid": "c2d698f468a90260357bf8b79800289e", "score": "0.67743576", "text": "def show\n @user_subject = UserSubject.find(params[:id])\n end", "title": "" } ]
[ { "docid": "d8abbbce5251f94c269394087d910daf", "score": "0.7308164", "text": "def index\n @user_subjects = UserSubject.all\n end", "title": "" }, { "docid": "22302448f0890bdf7227fcfc6f4519b9", "score": "0.72988766", "text": "def cellect_subjects(workflow_id)\n cellect.get ...
d801c5624951f02fdb13ed6237d09b46
Adds a new error message to the current error messages
[ { "docid": "71c48b8ec016f984506f223c03dceaa4", "score": "0.0", "text": "def add(message)\n @messages << message\n end", "title": "" } ]
[ { "docid": "b22a0a1b82660d6c9baa01159e78175e", "score": "0.8320231", "text": "def add(message)\n @errors << message\n end", "title": "" }, { "docid": "006ecdf007d8ee42c47bfc28e5e45978", "score": "0.8256584", "text": "def add_error( message )\n add_to_message_list :...
a725c25f0a30c4978c6da59186195734
Add a new goal Adds a new goal, returns the ID upon success.
[ { "docid": "603265cceb76f3e1f8afdaf8e3f3304a", "score": "0.0", "text": "def goals_post_with_http_info(goal_type, expected_type, period, expected, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GoalsApi.goals_post ...\"\n end\n # verify...
[ { "docid": "299479d12486c179a22a9a4fcda4a973", "score": "0.7383857", "text": "def addGoal(goal)\n @goals[@goals.count] = goal\n end", "title": "" }, { "docid": "3d62f05a1bc0cec87f0a6b7a54b14cbe", "score": "0.71512544", "text": "def add_goal(goal)\n sql = \"INSERT INTO #{GO...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c27dddc1674a5c5f54a7de2cf13b41f6", "score": "0.0", "text": "def project_strong_params\n params.require(:project_strong).permit(:name, :user_id, :description, :project_types_id)\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...
cdfbaf1b0fe3de573b3fe33e975e4ef4
Sets the columnIndex property value. Represents the column number of the first cell in the range. Zeroindexed. Readonly.
[ { "docid": "813af832167920711b016142760ee68f", "score": "0.61056817", "text": "def column_index=(value)\n @column_index = value\n end", "title": "" } ]
[ { "docid": "de05a5c32fa5a41525c70ff1a95205cc", "score": "0.60999453", "text": "def column idx\n @columns[idx] || Column.new(idx, default_format, :worksheet => self)\n end", "title": "" }, { "docid": "3d66a7535976ba8aa8eb6b091443ddbe", "score": "0.5395268", "text": "def set(in...
e73a4d349bffbea2660d4ee968872005
Returns this string's protocol or '' if it doesn't have one. 'sms://foobar'.protocol => 'sms' 'foobar'.protocol => ''
[ { "docid": "135ff80ea47e56388f03405b2abdc71f", "score": "0.7249257", "text": "def protocol\n self =~ AddressRegexp ? $1 : ''\n end", "title": "" } ]
[ { "docid": "46c88ceaa6fe0a1a5468acfc4be0b9c1", "score": "0.69139767", "text": "def get_http_protocol\n @input[-3].downcase.to_sym\n end", "title": "" }, { "docid": "67fc8886894d563a4d748e1b7ea7d8c8", "score": "0.6786376", "text": "def protocol\n \"http\"\n # TODO: ssl, ...
0b88d6348868a54b84c7b43efe5160e6
Before adding the where clauses, we have to make sure the right tables are joined into the query. We use .includes() instead of .joins() so we can get an OUTER JOIN
[ { "docid": "c601e4147a5dbecc67942679cebdf1b0", "score": "0.5276356", "text": "def handle_joins fields, select = nil\n ret = select || scoped\n fields.each do |qualified_field|\n assoc, foreign_table, field = parse_field(qualified_field)\n ret = ret.joins(join_string(assoc, foreig...
[ { "docid": "ff089982a353eaadee0abf0d74dc5a3b", "score": "0.68931055", "text": "def includes\r\n return nil unless @joins and not @joins.empty?\r\n includes = @joins.collect{|j| j.includes}\r\n end", "title": "" }, { "docid": "6b79a6f9ce5d6842c46990837e7aafe2", "score": "0.63...
2322cce9713b45a4764229a2f8310295
Adds a planet to the solar system
[ { "docid": "eeff792a0feaf3f7648fc98b0116d2c0", "score": "0.84057164", "text": "def add_planet(new_planet)\n @planets << new_planet\n end", "title": "" } ]
[ { "docid": "3bf6f816d22d745f2b5a05f0b2560d72", "score": "0.90570426", "text": "def add_new_planet(planet)\n @solar_system << planet\n end", "title": "" }, { "docid": "b91de17e6c5383dd6875ea19a29aee1b", "score": "0.85671484", "text": "def add_planet(planet)\n planets << plane...
e5d6ab7655edbdeebac6aac50f15bb4f
GET /surf_courses GET /surf_courses.json
[ { "docid": "f717c865020da536cd09df5cd8c4e279", "score": "0.0", "text": "def index\n @surf_courses = SurfCourse.all.order('position ASC')\n end", "title": "" } ]
[ { "docid": "ac29ec1c64f22e52fd6ae72b9fdecd55", "score": "0.7567188", "text": "def get_courses\n @prof = Professor.find(params[:pro_id])\n\n render json: @prof.courses\n end", "title": "" }, { "docid": "7a79770aa26ca2c83c3deb686f183b52", "score": "0.7380366", "text": "def index...
ff600ed4500836c97d0d15a9e36c9f54
Assumptions: Each node contains a single digit Singly linked lists Each node contains a single digit integer Each list number is stored in reverese order Each linked list can have a different length Time Complexity: N + M + K (N = first list length, M = second list length, K output list length) Space Complexity: K? Alt...
[ { "docid": "95a88bead8142b842ea85dc6ba028f39", "score": "0.53439337", "text": "def linked_list_to_number(head)\n # Initialize variable\n number = \"\"\n curr_node = head\n # Step through linked list\n while curr_node\n # Concatenate number to strings (in reveres order)\n num...
[ { "docid": "ee7d11b9b4bb09a27512dfd0f4c214fe", "score": "0.6779424", "text": "def merge_k_lists(lists)\r\n arr = []\r\n (0...(lists.length)).each do |idx|\r\n current = lists[idx]\r\n while current do\r\n arr << current.val\r\n current = current.next\r\n ...
de612a66524d006c6033774f2a17c2e3
Lookup primary group for a given user id
[ { "docid": "315a3489efc0552c81e25d6e7dbc7ca4", "score": "0.0", "text": "def [](user_id)\n users[user_id]\n end", "title": "" } ]
[ { "docid": "c6daeb0bf946dc585e63045d8999f658", "score": "0.6811292", "text": "def find_in_users_groups(id)\n g = Group.find(id)\n return g if current_user.groups.include? g\n end", "title": "" }, { "docid": "71f7ad983c406eedde97286e9f519c70", "score": "0.6754094", "text": "def...
b0b323eaa8f01016233a64f24ea5bc0c
UNIT TESTS FOR METHOD calculate_price Equivalence Classes: n/a test that proper calculation of gold is happening
[ { "docid": "c7e6b545c71024dd4fd0ecea6049d00e", "score": "0.77169836", "text": "def test_gold_total\n test_prospector = Prospector.new 'p1'\n ore = { 'gold' => 1, 'silver' => 0 }\n test_prospector.add_to_holdings(ore)\n assert_equal test_prospector.calculate_price(ore), 20.67\n end", "ti...
[ { "docid": "40b051e18813a9f9f42f80b3346f51d0", "score": "0.7567421", "text": "def test_silver_total\n test_prospector = Prospector.new 'p1'\n ore = { 'gold' => 0, 'silver' => 1 }\n test_prospector.add_to_holdings(ore)\n assert_equal test_prospector.calculate_price(ore), 1.31\n end", "ti...
6b177e432084b2a2343be9bacbab5b08
test numeric_to_letter() to ensure correct letter grade from a given number grade [0100] check arguments to see if they raise errors
[ { "docid": "40bedaf0f4bab2ee7f8714c21929f8bd", "score": "0.73750955", "text": "def test_numToLet_Args\n \n #string arguments raise errors\n assert_raise ArgumentError do\n numeric_to_letter(\"helloWorld\")\n end\n\n #negative input raises error\n assert_raise ArgumentError do\n ...
[ { "docid": "6f01d91d6876a61dee38331e173151d8", "score": "0.83292854", "text": "def test_numeric_to_letter\n assert_equal \"A\", numeric_to_letter(90)\n assert_equal \"B\", numeric_to_letter(89)\n assert_equal \"C\", numeric_to_letter(79)\n assert_equal \"D\", numeric_to_letter(69)\n asser...
c4c7a7c45d4c8ed897d1fd0797132139
Returns true if the version is a correctly formatted semantic or timestamp version number
[ { "docid": "947277542e88a5a71768c1bbb938a1d5", "score": "0.0", "text": "def valid?(_options = {})\n latest? || semantic? || timestamp?\n end", "title": "" } ]
[ { "docid": "faafd8112d51b5d5d8c2e613957c3c12", "score": "0.74723643", "text": "def is_version(string)\n return false if string === false || string === true || string.nil?\n string.to_s.match(/^\\d+[\\d\\.a-zA-Z\\-_~]*/)\n end", "title": "" }, { "docid": "68036c58730b5fc9f37db776...
e77c0c527858d6e4824746d1dbf21632
set home path based on pixi count
[ { "docid": "73af9362b5a39b59196d972f5ca018d7", "score": "0.6157631", "text": "def set_home_path\r\n ControllerManager::set_root_path @cat, @region\r\n end", "title": "" } ]
[ { "docid": "6ba428db92c5bac1520f115c54c768d3", "score": "0.6286736", "text": "def set_home\n\n end", "title": "" }, { "docid": "e34b1502b9f26d1c7e9f190e84babaaa", "score": "0.5895886", "text": "def pixi_home\r\n if mobile_device?\r\n link_to image_tag('sm_px_word_logo.png'),...
5b59a4ea4736d3f2783231f30952c9e7
We could let that one slip but why? If someone does TDD he deserves gratification
[ { "docid": "c7ff48b5863f70c0d6d023c9937ce0b0", "score": "0.0", "text": "def test_get_composition_with_files_warns_the_noble_developer_and_he_quickly_corrects_himself\n assert_raise(Mosquito::SageAdvice) do\n @req.query_string_params = {:hello => \"welcome\", :somefile => MockUpload.new(\"pic.jpg...
[ { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.71199906", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.71199906", "text": "def spec; end", "title": "" }, { "docid": "c03913fcaf2f5653b6a6a80ccc15091c", "...
61eebf4457396be19c105639492e3888
Baseline implementation for the set_min_cpu_platform REST call
[ { "docid": "706b0df45fe1d341794963c73af1b483", "score": "0.8117461", "text": "def set_min_cpu_platform request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_min_cpu_platform_requ...
[ { "docid": "a4cb222e568fadde26883ba2b1bae21b", "score": "0.7802568", "text": "def set_min_cpu_platform request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instances/#{request_pb.instance}/setMinCpuPlatform\"\n body = re...
89f118969fe255f9ae5078cb7a472da0
GET /carts or /carts.json
[ { "docid": "29b95e860cd1cb2d20837814e98d20c0", "score": "0.6567161", "text": "def index\r\n @carts = Cart.all\r\n end", "title": "" } ]
[ { "docid": "85d01ffdc5cfb2ae949b6c570415bdd1", "score": "0.7573834", "text": "def all\n @carts = Cart.get_all_of_carts(@user, params[:page])\n if @carts.present?\n @carts\n else\n @object = 'Cart'\n render \"api/v1/errors/404\", status: 401\n end\n end", "title": "" },...
1ed6b92fa78f6678e4f528cf3736cdeb
user_deck_statistics(user, deck) percentage correct guesses for user for particular card
[ { "docid": "80e8bd5ff4a4ef8c089dd8a7cffc5570", "score": "0.8856056", "text": "def user_card_statistics(user, card)\n total_user_card_guesses = 0\n total_user_card_guesses_correct = 0\n\n card.guesses.each do |guess|\n if guess.user_id == user.id\n total_user_card_guesses += 1 ...
[ { "docid": "a67205e223ef08e26dbeab5a88ab41cb", "score": "0.9338946", "text": "def user_deck_statistics(user, deck)\n total_user_guesses = 0\n total_user_correct = 0\n\n deck.cards.each do |card|\n card.guesses.each do |guess|\n if guess.user_id == user.id\n total_user_guess...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "e6020bdd0896caa8aadf53cf8aded0d4", "score": "0.0", "text": "def foo65_params\n params.require(:foo65).permit(:foo1, :foo2, :foo3, :foo4, :foo5)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "800a2bc6ce0e4ba3c049912251fb1432", "score": "0.0", "text": "def introduction_params\n params.require(:introduction).permit(:title, :content)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.71207976", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.705222", "text": "def expected_permitted_parameter_names; end", "title": ""...
0c09d0922a9503dd6fd9de13527ebaff
PATCH/PUT /sw_devs/1 PATCH/PUT /sw_devs/1.json
[ { "docid": "f3d10fa51e3dc4c22f3cfb1f3d96bed5", "score": "0.66253054", "text": "def update\n respond_to do |format|\n if @sw_dev.update(sw_dev_params)\n format.html { redirect_to @sw_dev, notice: 'Sw dev was successfully updated.' }\n format.json { render :show, status: :ok, locatio...
[ { "docid": "79901f60efb4ad1b3797f922128e08b0", "score": "0.63016707", "text": "def update\n respond_to do |format|\n if @sw_dev_type.update(sw_dev_type_params)\n format.html { redirect_to @sw_dev_type, notice: 'Sw dev type was successfully updated.' }\n format.json { render :show, ...
46e9ff463c42e846528661fb5efcfc93
GET /events/1/host_field_types/new GET /events/1/visitor_field_types/new
[ { "docid": "f7f5868a738dc22c3a29fcdc647fd5b1", "score": "0.6938097", "text": "def new\n @field_type = get_field_type\n @data_types = FieldType.data_types_list.map {|k, v| [v, k]}\n @field_type.data_type = params[:data_type] unless params[:data_type].nil?\n respond_with @event, @field_type do...
[ { "docid": "4392c8ea1b1e0e6315f0a872d3fa92ed", "score": "0.68397266", "text": "def new\n @feature = get_feature\n @host_field_types = @event.host_field_types.map {|t| [t.name, t.id]}\n @visitor_field_types = @event.visitor_field_types.map {|t| [t.name, t.id]}\n @feature_list = Feature.featur...
12571b885f01b442084b58b7cbe57855
GET /enfermedadesoculares GET /enfermedadesoculares.json
[ { "docid": "76cca32a328194c2dbea801757919159", "score": "0.6705136", "text": "def index\n @enfermedadesoculares = Enfermedadesoculare.all\n end", "title": "" } ]
[ { "docid": "f23ca27eb69f43814ac7b8b921c72d70", "score": "0.6370282", "text": "def index\n @dioceses = Diocese.all\n\n render json: @dioceses\n end", "title": "" }, { "docid": "5f79df246ffffee21a9b2e5f6e14ad08", "score": "0.6320161", "text": "def index\n @solicitacoes = Soli...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "bd187adbf011a1004385b6e5ecb2d767", "score": "0.0", "text": "def set_task_administrative\n @task_administrative = TaskAdministrative.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...
988aaf486d3357101b42d6aef4d0992d
Sign and Send a Transaction Sign and send transaction onto the network.
[ { "docid": "e201089409b18031e637c2a283fbaf2e", "score": "0.6385887", "text": "def sign_and_send(coin, body, opts = {})\n data, _status_code, _headers = sign_and_send_with_http_info(coin, body, opts)\n return data\n end", "title": "" } ]
[ { "docid": "aac9382087f906e48699d6f423e27f5c", "score": "0.82695854", "text": "def send_transaction(tx)\n stx = sign_transaction(tx)\n send_raw_transaction(stx)\n end", "title": "" }, { "docid": "aac9382087f906e48699d6f423e27f5c", "score": "0.82695854", "text": "def send_trans...
c0b3717b54c6ac02a8dcf318632ce770
did i do this right?? created a song array when initialized idk if this is right. shovel all song.names in array to be printed out with the print_songs array.
[ { "docid": "ee16070548d2c84ec7a0028c2c95f180", "score": "0.0", "text": "def add_song(song)\n @song << song.name\n song.artist = self\n \n end", "title": "" } ]
[ { "docid": "111511e9c99407aa76bd8d8a3d8572c2", "score": "0.8022668", "text": "def print_songs\n # #songs returns an array of the artist's songs\n songs.each do |song|\n print song.name += \"\\n\"\n end \n end", "title": "" }, { "docid": "3dcb843015af45db57e37a42103...
a79bb4977e25541ec913492d12a1f57d
The relative path to the Lua script
[ { "docid": "722abb3ce4d0bdc4f1304ff96128eae9", "score": "0.8294998", "text": "def script_path\n File.join(__dir__, 'scripts', \"#{script_name}.lua\")\n end", "title": "" } ]
[ { "docid": "9566a23b5178acdca0f3b40488133c05", "score": "0.76071817", "text": "def path\n File.join root, 'scripts'\n end", "title": "" }, { "docid": "86d094d926c016755e2ba10d2be4213b", "score": "0.7594367", "text": "def script_path\n @script_path\n end", "title":...
91e67f221d96831f847a08cf8d9fa53d
GET /requests/1 GET /requests/1.json
[ { "docid": "e6c4f3726a9d010ebae7f986dc1208ed", "score": "0.0", "text": "def show\n \tredirect_to root_path\n end", "title": "" } ]
[ { "docid": "ff35d8a60fdbaad33b71eebbd3c9889b", "score": "0.692488", "text": "def index\n @requests = Request.all\n\n render json: @requests\n end", "title": "" }, { "docid": "2f778aa6d58730967e6957a2a4f947ab", "score": "0.6776916", "text": "def show\n @request = Request.fin...
f075880726b245e4ca0ea29c36f4c5f6
define dog years calculator and output number of dog years
[ { "docid": "68f5d0186e9942a74deaa0618690cccb", "score": "0.8072989", "text": "def dog_years(human_years)\n human_years * 7\n end", "title": "" } ]
[ { "docid": "88b62089861855817b936de017e253f9", "score": "0.83194584", "text": "def dog_years(age)\n \thuman_year = age * 7\n \tp human_year.to_i\n end", "title": "" }, { "docid": "98cb673f20f259baa04b4ac37f440831", "score": "0.81391555", "text": "def dog_years(year)\n\t\tp year*7\...
275e73999df317e52069021b9ea11caa
DELETE /tasks/1 DELETE /tasks/1.json
[ { "docid": "403da1f63e80f904d646f3a2cc702edd", "score": "0.7309377", "text": "def destroy\n @task_list.tasks.find(params[:id]).destroy\n render nothing: true\n end", "title": "" } ]
[ { "docid": "d625ec15c2e62330f958b41bda0aee7e", "score": "0.78326327", "text": "def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end", "title": "" }, { "docid": "b18243b77fd384317096cdf3a65159fd", "score": "0.75876695", "text": "def delete_task\n @task = T...
af31d63de6f15762e6aee4bfe4551054
Approval User Params: user_id > Indicate a user's id which will be approved or rejected approved > Indicate this is approval operation if this param is not nil. Otherwise, it is reject operation. comment > Indicate a comment to this operation.
[ { "docid": "7ea1b54c3ce2947885e97a0862df8313", "score": "0.72471553", "text": "def approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target...
[ { "docid": "3f60e490bbd05ce6f7d89a18a10fc48a", "score": "0.70806414", "text": "def approve_user(user_id)\n post(\"/users/#{user_id}/approve\")\n end", "title": "" }, { "docid": "91b6ad00ed5ab91afb7d2e37bf8d5ef6", "score": "0.6896547", "text": "def approve(user)\n if !self....
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0f911d9f75f4a47e10b3be111926d5d9", "score": "0.0", "text": "def set_race_join\n @race_join = RaceJoin.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...
1acd947b384fef076158b1090e159859
GET /glossaries/new GET /glossaries/new.json
[ { "docid": "5e4536a9ec79c62f338585b6c031c402", "score": "0.8219263", "text": "def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end", "title": "" } ]
[ { "docid": "7f8c506237983aa908da70eaed778ca4", "score": "0.7652954", "text": "def create\n @glossary = Glossary.create_glossary(params[:glossary])\n\n respond_to do |format|\n if @glossary.save\n format.html { redirect_to @glossary, notice: 'Glossary was successfully created.' }\n ...
0d8376d475102775409beff4883a031b
POST /db_statuses POST /db_statuses.json
[ { "docid": "50ba91602a69f2ec160defc51aed32c3", "score": "0.5850754", "text": "def create\n @db_status = DbStatus.new(db_status_params)\n\n respond_to do |format|\n if @db_status.save\n format.html { redirect_to @db_status, notice: 'Db status was successfully created.' }\n format...
[ { "docid": "702b552b6f1b01fec2c33623059ab6e1", "score": "0.69478476", "text": "def create_statuses\n end", "title": "" }, { "docid": "702b552b6f1b01fec2c33623059ab6e1", "score": "0.69478476", "text": "def create_statuses\n end", "title": "" }, { "docid": "981b7360678bb4...
3f7fd550ca73c249f0523de3f5a4c998
GET /materiales/:material_id/caracteristicas/new GET /materiales/:material_id/caracteristicas/new.xml
[ { "docid": "5696c761c43ddc8f8190ca641f679f25", "score": "0.8375645", "text": "def new\n\t\t@material = Material.find(params[:material_id])\n @caracteristica = Caracteristica.new\n @caracteristica.material = @material\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml...
[ { "docid": "3726ec8a4b65b8b865baac5541044ffd", "score": "0.77564543", "text": "def create\n \t@material = Material.find(params[:material_id])\n @caracteristica = @material.caracteristicas.create(params[:caracteristica])\n\n respond_to do |format|\n if @caracteristica.save\n\t\t\t\tformat.htm...
b4b68fa01ebd502ca165fdc47f5a1d3f
Once the prices of the variant are updated all the line_items prices where the order is not completed should also be updated. update_orders() method update the price of the line_items prices where the order is not complete. This is very specific to customer requirement.
[ { "docid": "9ab13502f83bf91653cb139068a9c685", "score": "0.7998382", "text": "def update_orders\n # Get all the order which is not completed\n orders = Spree::Order.where(completed_at:nil)\n # Iterate over the order object, update the line_items, personalization cost.\n order...
[ { "docid": "3f6c9fdb8c70a16c58840968ef54b557", "score": "0.774875", "text": "def update_line_items!\n return unless @order.line_items.any?\n @order.line_items.each do |line_item|\n update_line_item_price!(line_item)\n end\n end", "title": "" }, { "docid": "d388712de7...
b053d4f4893253039650660e9d6e2b7e
determines the mathematical direction white moves up & black moves down
[ { "docid": "96c2e2215b3d7b00cb5229a2d0641da9", "score": "0.65558124", "text": "def rank_direction\n color == :white ? -1 : 1\n end", "title": "" } ]
[ { "docid": "a4164ded10d3944fd9eb43e12bc8d3fd", "score": "0.7777935", "text": "def direction\n color == :black ? 1 : -1\n end", "title": "" }, { "docid": "f78b39633a73412fb84be2dadf923ef2", "score": "0.7641237", "text": "def direction\n if color == :black then -1 else 1 end...
6145f0b2ef42a0ff7010a35742664292
This method is called after config_params have read configuration parameters
[ { "docid": "525415b8da7c83babee9a7997d69eb70", "score": "0.0", "text": "def configure(conf)\n super\n\n # TimeParser class is already given. It takes a single argument as the time format\n # to parse the time string with.\n @time_parser = TimeParser.new(@time_format)\n e...
[ { "docid": "8e5e727e7c1b31be164723aa67545666", "score": "0.6968053", "text": "def configure(config)\n super\n\n configure_params(config)\n end", "title": "" }, { "docid": "ef610bbed481bd991185b62147a1dc34", "score": "0.68393767", "text": "def receive_initial_config...
edbb4fb3e3b12973837d02db3eca4c6b
Public: All of the data across all revision snapshots. Returns an Array of OpenStructs, each with the form: OpenStruct.new :name => probe_name, :values => values
[ { "docid": "e6938877551fa1231676332c30a20b78", "score": "0.7309664", "text": "def versioned_data\n self.class.exposed.map do |method|\n os = OpenStruct.new(:name => Probe.clean_probe_name(method))\n os.values = project.snapshots.reverse.map do |snapshot|\n value = $redis.get(...
[ { "docid": "05b85e18a9e32e6c8325cd251394fa77", "score": "0.71982116", "text": "def versioned_probes\n shas = snapshots\n Probe.all.map do |probe|\n struct = OpenStruct.new\n struct.name = probe.name.downcase.to_sym\n struct.description = probe.description\n struct.p...
66c1bc1af92860826234d0c58f5ba9d8
Parse the output of the `pactl list sinks` command
[ { "docid": "42b0ab75b9815a5ac1ba1bed6e7a6eea", "score": "0.6381789", "text": "def parse(data)\n data.split('Sink ').collect do |chunk|\n next if chunk.empty?\n\n match = chunk.match(CHUNK_REGEX)\n keys = %i[id state name description channel_map mute volume balance ba...
[ { "docid": "6e399b6045bf42ef2949fb0689eb8973", "score": "0.6366671", "text": "def indexed_sink_names\n @sink_names ||= `pactl list sinks`.\n scan(/(?:Sink #(\\d+)|Description: (.+))|alsa.driver_name = (.+)|device.vendor.name = (.+)/).\n flatten.\n compact.\n map { |s| s.gsub(/^\"|\"$/, '') ...
0f6468a625d77cbcc1636b42128c1c2e
returns true if collection of digits (digs) is pandigital on the interval [a,b]
[ { "docid": "6de45d730494ac71b0180d1656427e0d", "score": "0.8511063", "text": "def isABPandigital digs, a, b\n\t\ts = digs.to_s\n\t\t(a..b).each do |x|\n\t\t\treturn false if s.count(x.to_s) != 1\n\t\tend\n\t\ttrue\n\tend", "title": "" } ]
[ { "docid": "f79cf2ca988e61ae21ef60c391ee4b20", "score": "0.8367391", "text": "def pandigital?(n, a, b) \n needed_digits = (a..b).to_a.to_s\n present_digits = n.to_s.split(//).uniq.sort.to_s\n needed_digits == present_digits\n end", "title": "" }, { "docid": "cdef61a77d8c...
d2833b675d3f1d84b9dd19a46e3a3e89
def associate_messaging_service_with_phone_number(msg_svc = messaging_service, ph_number = outgoingNumber) puts "hey user, go do this in the Twilio console" puts "their API doesn't support this action yet :( :( :(" end
[ { "docid": "9f1edb0263adee1b0f7d132a1280cd54", "score": "0.643737", "text": "def associate_notify_with_messaging_service\n unless notify_service.messaging_service_sid\n notify_service.update(messaging_service_sid: messaging_service.sid)\n update_notify_service!\n end\nend", "title": "" } ]
[ { "docid": "1186ad6ef5e9719583f0095a5f239b77", "score": "0.7100281", "text": "def add_phone_number(phone_number)\n if has_number?(phone_number) || ! phone_number.try(:id)\n puts(\"phone_number is ill formed in add_phone_number\")\n return\n end\n\n list_memberships.create! :phone_numb...
3b0a9defd860b7ddba7344c8cfd95ce3
< loop through groups explode each group undo the explode
[ { "docid": "bafcd7c13ea739c90a00a97445dae9dd", "score": "0.6043669", "text": "def explodeforundo(model, entity)\n if entity.class == Sketchup::Group\n puts entity\n model.start_operation \"explode\"\n entity.explode\n model.commit_operation\n end \nend", "title": "" } ]
[ { "docid": "bd5d44a265890e27a686922096e05963", "score": "0.6610722", "text": "def apply_groups(data) # :nodoc:\n items, pieces, final = [], [], []\n data.each do |line|\n changed = line_changed?(line, pieces)\n new_items = build_items(line, changed)\n changed = g...
d8d53d00b5fbb89dd42c3bb9048b6e38
POST /plays POST /plays.json
[ { "docid": "982ab62eaa0ee77af84a20dcf92b29e8", "score": "0.62255514", "text": "def create\n @play = Play.new(play_params)\n @play.active = true\n @play.user = if current_user\n current_user\n else\n user = User.new_guest_user\n ...
[ { "docid": "12f3e2c50486ddaf8692b7b9441d3919", "score": "0.70887536", "text": "def create\n @play = Play.next\n\n respond_to do |format|\n if @play.save\n format.html { redirect_to @play, notice: 'Play was successfully created.' }\n format.json { render :create, status: :created...
9b14c0fdb179e81be89223ee9cd4539c
GET RESPONSE AND BODY FROM SERIALIZER detect lit doc code and process it lit code syntax:
[ { "docid": "948ad1c34f612112f8bbe5b938c59bd4", "score": "0.0", "text": "def scan_serializer_for_body(model_name)\n return scan_hash(\"@b:\", \"app/serializers/#{model_name.downcase}.rb\")\n end", "title": "" } ]
[ { "docid": "d6186b69640604de0bfa9f581d6e0c84", "score": "0.6226238", "text": "def docs_body(text)\n debug \"\\t --docs_body--\"\n text = text.gsub(\"Body\",\"\")\n\n debug \"Body Block: \" + @@body_block\n\n if \"request\" == @@body_block\n\n @@request_body = text.gsub(\"\\n\", \"\").gs...
b5337ef82c3b00bdfcd1d6d188cfb855
p vigenere_cipher("toerrishuman", [1]) => "upfssjtivnbo" p vigenere_cipher("toerrishuman", [1, 2]) => "uqftsktjvobp" vigenere_cipher("toerrishuman", [1, 2, 3]) => "uqhstltjxncq" p vigenere_cipher("zebra", [3, 0]) => "ceerd" p vigenere_cipher("yawn", [5, 1]) => "dbbo"
[ { "docid": "d03c83675aba738b486c8b04e89e6a9a", "score": "0.0", "text": "def vowel_rotate(str)\n vowels = \"aeiou\"\n vowel_order = \"\"\n counter = 0\n rotated = \"\"\n # iterate through string to get vowel order, make the index be the key and the vowel as the value\n # rotate values to the left \...
[ { "docid": "537a9bd5ff9f84a84560c799c02f8140", "score": "0.80319065", "text": "def vigenere_cipher(message,keys)\n string = \"\"\n alpha = (\"a\"..\"z\").to_a\n message.each_char.with_index do |char,i|\n new_ind = (alpha.index(char) + keys[(i%keys.length)]) % 26\n string += alpha[...