query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
9ee6b8cc7e193f9499a6333799c07b63
GET /film_casters GET /film_casters.json
[ { "docid": "6e01064b7170b1cd76142d08fcd7bc1a", "score": "0.7422972", "text": "def index\n @film_casters = FilmCaster.all\n end", "title": "" } ]
[ { "docid": "431a0db607f62e17b22036c864d8ff7b", "score": "0.65081024", "text": "def index\n @movie_casts = MovieCast.all\n end", "title": "" }, { "docid": "efdc78b44a0e1b9b16bfde1c9b06b603", "score": "0.6482098", "text": "def fullCast\n return JSON.parse(@badfruit.get_movie_inf...
e9ebb84ee4ab7dea6771a712377106d6
The story about the buffering is kinda similar to EventMachine, you keep receiving more than one frame in a single packet.
[ { "docid": "6d624ac745369fdd24b9726353e536d1", "score": "0.0", "text": "def on_read(chunk)\n @chunk_buffer << chunk\n while frame = get_next_frame\n receive_frame(AMQ::Client::StringAdapter::Frame.decode(frame))\n end\n end", "title": "" } ]
[ { "docid": "7f30261e1ac92cf75ee81a49c0ee6bdc", "score": "0.69522846", "text": "def buffer_receive(event, group=nil)\r\n buffer_initialize if ! @buffer_state\r\n\r\n # block if we've accumulated too many events\r\n while buffer_full? do\r\n on_full_buffer_receive(\r\n :pend...
75e345d961a8e1d48fa39e2b00543b36
Load the user's AWS Secrets
[ { "docid": "26c45b5f2e126aaa53ea3f9a125c53c5", "score": "0.758109", "text": "def load_secrets\n Awsecrets.load\n end", "title": "" } ]
[ { "docid": "0be1795c2d9b9f3300c1caaf27b65354", "score": "0.74621004", "text": "def credentials\n # load secrets from the user home directory\n @credentials = YAML::load_file(aws_secrets_file) if @credentials.nil?\n @credentials\n end", "title": "" }, { "docid": "9d468b411ec62b2628e...
84e35ce2b030cb886059b85d992103cb
helper to insert a link to popup RPX login takes options hash: link_text: text to use in the link app_name: name of the application (will be prepended to RPX domain and used in RPX dialogues) return_url: url for the RPX callback (e.g. user_sessions_url) add_rpx: if true, requests RPX callback to add to current session....
[ { "docid": "d6737b42a38866bf3802f3650bc14f8d", "score": "0.67268765", "text": "def rpx_popup(options = {})\n options = { :unobtrusive => true, :add_rpx => false }.merge( options )\n app_name = options.delete( :app_name )\n link_text = options.delete( :link_text )\n token_url = build_...
[ { "docid": "5befd144ce738efa30397b1bd580943a", "score": "0.6958996", "text": "def rpx_popup(options = {})\n\t\t\tparams = (\n\t\t\t\t{ :authenticity_token => form_authenticity_token, :add_rpx => options[:add_rpx] }.collect { |n| \"#{n[0]}=#{ u(n[1]) }\" if n[1] }\n\t\t\t).compact.join('&')\n\t\t\tunobtr...
4eb2bb199cee5c30b3b0751715e94a84
PATCH/PUT /xmt/messages/1 PATCH/PUT /xmt/messages/1.json
[ { "docid": "2d2560741e30747bca5bf47af74756ec", "score": "0.0", "text": "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html {redirect_to xmt_faq_messages_url(site_id: @site.id), notice: '留言修改成功.'}\n format.json {render :show, statu...
[ { "docid": "0721a62a337f3985296b73ef8cc0c937", "score": "0.6983865", "text": "def update\n respond_to do |format|\n @message.update!(message_params)\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e0e65227040148a40389c4df106ee18", "score": "0...
415101ba65de545f7ef207c43b544df3
Checks if a user has Admin status. If they don't, they are redirected to the login page.
[ { "docid": "f490aa4970676916e02bc9d1ae9520fd", "score": "0.0", "text": "def require_admin\n unless current_user.admin\n flash[:notice] = \"Need admin account.\"\n redirect_to(\"/login\")\n end\n end", "title": "" } ]
[ { "docid": "a5278a476c17399b3733e187b6f3fc3d", "score": "0.8756463", "text": "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "title": "" }, { ...
ce9f22de840a9811658a48ac3800ad5c
PUT /emailplans/1 PUT /emailplans/1.json
[ { "docid": "30e58cfb85afe8f1b303308a8db51cf3", "score": "0.71907556", "text": "def update\n @emailplan = Emailplan.find(params[:id])\n\n respond_to do |format|\n if @emailplan.update_attributes(params[:emailplan])\n format.html { redirect_to @emailplan, :notice => 'Emailplan was succes...
[ { "docid": "ef772d203f7a6533042814257a119c6e", "score": "0.705071", "text": "def update\n respond_to do |format|\n if @email_plan.update(email_plan_params)\n format.html { redirect_to @email_plan, notice: 'Email plan was successfully updated.' }\n format.json { render :show, status...
e7e4afd891f022c599b8c250933f41d1
Sets the cache +key+ to the provided +value+.
[ { "docid": "059136759cac10e1fed11114ad639329", "score": "0.711093", "text": "def []= key, value\n @hash[key] = value\n end", "title": "" } ]
[ { "docid": "d48553714c59a3c4e5d01a70540b083f", "score": "0.87839377", "text": "def set(key, value)\n @cache[key] = value\n end", "title": "" }, { "docid": "0b2a626e7c0072b7e397bf410f8b6268", "score": "0.85056525", "text": "def cache_set(key, value)\n cs = BirdGrinder.c...
7565eb30b837039f8741c860a860c17a
Basic Financials Get company basic financials such as margin, P/E ratio, 52week high/low etc.
[ { "docid": "f0a90c5a2c95c2cea81c10a580b93f1f", "score": "0.5892579", "text": "def company_basic_financials(symbol, metric, opts = {})\n data, _status_code, _headers = company_basic_financials_with_http_info(symbol, metric, opts)\n data\n end", "title": "" } ]
[ { "docid": "81c4a8c9d0663b9233720b17eed192e5", "score": "0.6245613", "text": "def compute_actual\n line[1] = @ho_form.line['sqft']\n line[2] = @ho_form.line['total_sqft']\n line[3] = (line[1] * 100.0 / line[2]).round(2)\n\n line['4/gross_inc'] = gross_income\n\n # We make a simplifying as...
bf70886c1d9c4c6c53d12685f903196b
GET /battle_attachments GET /battle_attachments.json
[ { "docid": "192076b608b1f5d0a8700e8ad3d10e17", "score": "0.77466726", "text": "def index\n @battle_attachments = BattleAttachment.all\n end", "title": "" } ]
[ { "docid": "5c995de3b38b37a5046451790b9e5422", "score": "0.6545199", "text": "def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key...
37c362299e0321b1371592be71bfbd12
write a method that accepts two parameters: title and rating the method should print the story title and the rating out of ten
[ { "docid": "a88490f376199687963d4275d2c71794", "score": "0.7321957", "text": "def title_and_rating(title_name, rating)\nputs(\"The title is #{title_name} and my rating is #{rating}\")\nend", "title": "" } ]
[ { "docid": "ccb750e9fbf91d9b87619f153d9cc445", "score": "0.8572201", "text": "def display_story(title, rating)\n\n#the method should print the story title and the rating out of ten\n puts \"#{title} Rating #{rating} out of 10\"\n\nend", "title": "" }, { "docid": "f07b6d6bebad42ee31fd606a99b...
a1c8bb8fabaf6c8281406a328a020d8a
Edit student, find the student by ID
[ { "docid": "6cf5b83752c5bc096738b2380582718d", "score": "0.0", "text": "def edit_student\n @student = Student.find(params[:id])\n \n #respond_to do |format|\n # format.html # show.html.erb\n #format.xml { render :xml => @student }\n #end\n end", "title": "" } ]
[ { "docid": "bcad491edd37c8df5b64029e78c20102", "score": "0.8591531", "text": "def edit\n @student = find_student\n end", "title": "" }, { "docid": "ad692ec4c2d034c888647333f87d27b4", "score": "0.84781295", "text": "def edit\n @student = Student.find(params[:id])\n end", ...
25cb4d273f67fcd585e2fa15333777f9
Method to escape HTML on form fields and avoid Cross Site Scripting
[ { "docid": "baa6cd71118878cac7023ca86845bd85", "score": "0.5947042", "text": "def h(text)\n Rack::Utils.escape_html(text)\n end", "title": "" } ]
[ { "docid": "410a1002a868a2bf15c28e6bdc0de25f", "score": "0.7617989", "text": "def escape_field( field )\n return html_escape( field ).gsub( \"\\\\\", \"&#92;\" )\n end", "title": "" }, { "docid": "47d06cf28a17247afca6975b529303d8", "score": "0.75746113", "text": "def escape_html(...
562dbf361ef19d7d113e774578ee09ac
While garbage collection should properly deallocate the CDEvents object and stop events, we need a way to stop them immediately. Can't call `dealloc`, so set watcher to nil
[ { "docid": "f5f92d235e8c23789f00c6ce9daf351a", "score": "0.7000205", "text": "def unwatch\n if @watcher\n @watcher = nil\n @enabled = false\n end\n end", "title": "" } ]
[ { "docid": "0b3c96a153939dbddcdf1332874ff0f6", "score": "0.67034173", "text": "def end_watch\n if @listener\n @listener.stop\n end\n end", "title": "" }, { "docid": "b9357457d1ac1466b974ba8f64c47410", "score": "0.6459485", "text": "def unwatch; end", "title": ...
a300695a001f819deb88b5c3f8c1c4dc
GET /journal_entries GET /journal_entries.json
[ { "docid": "5554508a991d5919e34caaa03961fe96", "score": "0.0", "text": "def index\n if (current_user.has_role? :admin) \n @journal_entries = JournalEntry.order(:dateTimeOfTraining).reverse\n elsif (current_user.has_role? :athlete)\n @journal_entries = JournalEntry.where(:user_id => curre...
[ { "docid": "d2e25353283d3ea9a1f3b4a5525ed5c6", "score": "0.76830316", "text": "def index\n @journal_entries = JournalEntry.all\n end", "title": "" }, { "docid": "d2e25353283d3ea9a1f3b4a5525ed5c6", "score": "0.76830316", "text": "def index\n @journal_entries = JournalEntry.all\...
88263d4587135f90494265ad950d17bf
Show form validation errors
[ { "docid": "d16777a4ffb76722f9003a5e7f345d35", "score": "0.72218716", "text": "def form_errors(form, show_field=true)\n html = ''\n if form.errors.any?\n plural = Russian::pluralize(form.errors.count, 'ошибка', 'ошибки', 'ошибок')\n html = %Q{\n <div class=\"alert alert-error\">\n...
[ { "docid": "42f65435c1e3fb03485e3c3eb3bb30c3", "score": "0.7589631", "text": "def form_errors(options = {})\n rendered = @template.render partial: \"form_builder/form_errors\", locals: {\n form: self,\n messages: error_messages_to_show.values.flatten,\n }\n\n log_unhandled_errors unle...
5666d637d9143e101651c5091c4aeb29
Update a webhook Update an existing webhook.
[ { "docid": "ef67574f59242788851ec9690890a609", "score": "0.6118246", "text": "def webhook_update_with_http_info(project_id, id, webhook_update_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksApi.webhook_update ...'\n end\n...
[ { "docid": "214240301a07a947ae371b647b4d26d2", "score": "0.8241091", "text": "def update_webhook(webhook_id, request)\n start.uri('/api/webhook')\n .url_segment(webhook_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", ...
3619b1d0b1d66216f6b74b316506d937
GET /outlays/1 GET /outlays/1.json
[ { "docid": "34550d3dd85b53019c30becafa39ccb3", "score": "0.8093034", "text": "def show\n @outlay = Outlay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outlay }\n end\n end", "title": "" } ]
[ { "docid": "a48ff82fefa2a88004202836f6d623af", "score": "0.70587325", "text": "def new\n @outlay = Outlay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outlay }\n end\n end", "title": "" }, { "docid": "1ef890d0130e1a6506a0f1b230...
d2b5a428bd07e263453d296a54f5147f
DELETE /data_sources/1 DELETE /data_sources/1.json
[ { "docid": "678609e68049a78b258c73332df14639", "score": "0.73425", "text": "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "bff798b24a1312cb8d82b295d199cf19", "score": "0.72695607", "text": "def destroy\n @data_source = DataSource.find(params[:id])\n @data_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sources_url) }\n format.xml { head :ok }\n end\n end", "...
8401bcbd336a4e2524433322ba25f706
Check XHubSignature to confirm that this webhook was generated by GitHub, and not a malicious third party. GitHub uses the WEBHOOK_SECRET, registered to the GitHub App, to create the hash signature sent in the `XHUBSignature` header of each webhook. This code computes the expected hash signature and compares it to the ...
[ { "docid": "179a78fd41f2f816d6d13ab5f6bcea09", "score": "0.82990295", "text": "def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, W...
[ { "docid": "52313082a445547656b6595414cb0057", "score": "0.85619855", "text": "def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, ENV['GI...
eff7f0abe0337ea0297830a9b1af9dcf
and and a lot of perserverence =|
[ { "docid": "0d41b99041251dd2fac476bb5065eea4", "score": "0.0", "text": "def post_transition(issue, new_state, comment_text = nil, resolution_regex = nil)\n # always ensure we are logged in first\n ensure_logged_in\n\n # get list of possible states\n @log.debug \"Searc...
[ { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.65161884", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.65161884", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748...
876571e3ace9eb51b5336298cceefdf7
> failure.(:error) => Failure(:error)
[ { "docid": "dcc2cf83c11aa5739549f3c952e6c4df", "score": "0.73343104", "text": "def failure\n -> value { Failure(value) }\n end", "title": "" } ]
[ { "docid": "eff43eaa7f81bcbf4eed540eec9b9957", "score": "0.71945363", "text": "def with_failures(failures); end", "title": "" }, { "docid": "eff43eaa7f81bcbf4eed540eec9b9957", "score": "0.71945363", "text": "def with_failures(failures); end", "title": "" }, { "docid": "42...
874c3df12abb7c0845669ae2f0557f19
GET /newsletters/1 or /newsletters/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "55e5bbc9b5d9e9de159f90cde144e467", "score": "0.7235554", "text": "def index\n @newsletters = Newsletter.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @newsletters }\n end\n end", "title": "" }, { "doci...
b12622c1a8dc688043dfe150db154b10
~ Action methods ........................................................... GET /course_offering/[id]/upload_roster.js
[ { "docid": "cd794aab62991fed136dc6edc3323f5c", "score": "0.6325937", "text": "def index\r\n @uploaded_roster = UploadedRoster.new\r\n\r\n #respond_to do |format|\r\n # format.js\r\n #end\r\n end", "title": "" } ]
[ { "docid": "c2ffaf64c7cb4c158dbe566e2cd07f85", "score": "0.5669552", "text": "def add_player_to_roster\n response = Hash.new\n profileId = params[:profile_id]\n teamId = params[:team_id]\n profile = Profile.find_by_id(profileId)\n roster = Roster.new(\n :team_id => teamId,\n :pr...
1b0eecf13337daf27a68197ac57cd842
Example: solution(5) should return "Value is 00005"
[ { "docid": "9b689554a4120f6a3f4c1af27dbb01b7", "score": "0.7178919", "text": "def solution(value)\n result = [0,0,0,0,0]\n value.to_s.length.times do\n result.pop\n end\n result << value\n return \"Value is #{result.join}\"\nend", "title": "" } ]
[ { "docid": "f328e05f4d8ab867edf81b244a1e1a7e", "score": "0.73742384", "text": "def solution(value)\n arr = value.to_s.split(//)\n arr.unshift('0') until arr.length == 5\n \"Value is #{arr.map(&:to_i).join}\"\nend", "title": "" }, { "docid": "3441f5d1aacccdc4f3182bf058fe9ee2", "score":...
0969362cbf257f3d7578c6910e618440
this method emits messages (periodically called)
[ { "docid": "bebc00ba45a3869737aa4a325c9c3676", "score": "0.61315876", "text": "def flush_emit\n time = Fluent::Engine.now\n if @output_per_tag\n flush.each do |tag, message|\n router.emit(\"#{@tag_prefix_string}#{tag}\", time, message)\n end\n else\n\n flush.each do |messa...
[ { "docid": "a3c161bf440bc895387b6bbd1899c0c9", "score": "0.6923776", "text": "def emitted\n @emitted = true\n self\n end", "title": "" }, { "docid": "70f9bdfcf8f0e12b387a43c63e3a2341", "score": "0.690321", "text": "def subscribed; end", "t...
1bea32cb0b36f29e98cf7f0141515488
CSS Methods: Popup (Deposits)
[ { "docid": "e6d8336748d8dbd646bb027b41623f26", "score": "0.0", "text": "def deposits_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(DEPOSITS_TAB).displayed?}\n deposits_tab = @driver.find_element(DEPOSITS_TAB)\n deposits_tab.click\n end", ...
[ { "docid": "10932f74e177cd3180b12048cb08cdd9", "score": "0.67734724", "text": "def fries_popup\n @page.div(:id => \"overlay_container\", :class => \"modal\").div(:class => \"fries_popup\")\n end", "title": "" }, { "docid": "a9ad7ce46e0421cfc05c118637479d3f", "score": "0.6430644", ...
fe2e0f041c9253a73f27dafaf9801a3c
POST /patients POST /patients.json
[ { "docid": "cfa68abbd9bf022a1278a230538fc5cc", "score": "0.6760476", "text": "def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.preprocess_and_save\n format.html { redirect_to @patient,\n notice: 'Patient was successfully created.' }\...
[ { "docid": "a2ee64584ef51110794e25dc2cd6cbcc", "score": "0.7589313", "text": "def create_patient(**params)\n endpoint = \"patients\"\n response = @connection.POST(endpoint, params, common_headers)\n raise \"HTTP error for endpoint #{endpoint} code encountered: #{response.code}\" unless re...
fb246dd8983b347b96196546bf44f97a
Again, these are not DRY (...but AM section people should be thinking of how to clean this up)
[ { "docid": "72f1d439d90b8cd81b5c1d876ff986da", "score": "0.0", "text": "def employee_is_active_in_system\n all_active_employees = Employee.active.all.map{|e| e.id}\n unless all_active_employees.include?(self.employee_id)\n errors.add(:employee_id, \"is not an active employee at the creamery\"...
[ { "docid": "87dc79c3b96b6d1cbb634c62ca4bb7dd", "score": "0.6113179", "text": "def sections; end", "title": "" }, { "docid": "98b0440e352b4d7cb8861cca95fbb99f", "score": "0.60817075", "text": "def sections(*) end", "title": "" }, { "docid": "8fcc62a65bc45e47ee355d7ac561967...
013314e0a3ee5714851d610caa2e2b87
Gets the next track from Mongo and appends its data to the buffer.
[ { "docid": "566e6166359286f89a5bceab46a00837", "score": "0.58286643", "text": "def append_queue\n if free_space > 0 \n free_blocks.times { \n if already_read < current_track.file.size\n buffer_block current_track\n else\n # We've finis...
[ { "docid": "aa3b15e175513e9c2350eb8b2bee9dc6", "score": "0.68592703", "text": "def next_track\n reload\n @tracks[@current_track_index + 1]\n end", "title": "" }, { "docid": "e9a444f5326173481e2c126f69ca7916", "score": "0.66579974", "text": "def next_track()\n @ole.N...
cca1adac7f3c942441708dde03443f0b
This draws in the contents of the scrolling window
[ { "docid": "a4e69610f918ccdebcbdbd0b1459a4d5", "score": "0.58761925", "text": "def drawList(box)\n # Determine the last line to draw.\n if @list_size < @view_size\n last_line = @list_size\n else\n last_line = @view_size\n end\n\n # Erase the scrolling window.\n ...
[ { "docid": "4bb5249e0b5227d23a014c2aed5f597c", "score": "0.74106467", "text": "def draw\n @viewport.draw content, Size([0,0]), header, footer\n end", "title": "" }, { "docid": "2c3f9c71b7f50f785377b03aedaccecf", "score": "0.6930536", "text": "def draw_content\n super\n x, y...
ff5c63f606a28d75caa2889b595bac3e
Establishes a TCP connection to the specified RHOST/RPORT
[ { "docid": "25fece8f168a3fb11774cc8cd4afc9c6", "score": "0.0", "text": "def connect(global = true, opts={})\n\n dossl = false\n if(opts.has_key?('SSL'))\n dossl = opts['SSL']\n else\n dossl = ssl\n if (datastore.default?('SSL') and rport.to_i == 443)\n dossl = true\n ...
[ { "docid": "2f89117e414223132b5bd77c6e228b36", "score": "0.7797495", "text": "def connect\n TCPSocket.new('127.0.0.1', PORT)\n end", "title": "" }, { "docid": "2f89117e414223132b5bd77c6e228b36", "score": "0.7797495", "text": "def connect\n TCPSocket.new('127.0.0.1', PORT)\n e...
bcda95480fa37fa281e29b0b7ecd480f
Expand the caller to also cover the given Rect. The Rect is still a rectangle, so it may also cover areas that neither of the original Rects did, for example areas between the two Rects.
[ { "docid": "986c00fe73665eb4c524f9d40a0162a5", "score": "0.61693996", "text": "def union!(rect)\n self.normalize!\n rleft, rtop = self.topleft\n rright, rbottom = self.bottomright\n r2 = Rect.new_from_object(rect).normalize!\n\n rleft = [rleft, r2.left].min\n rtop = [rtop, r2.top].min\...
[ { "docid": "90d8694115d047f6353b6436a4bd8898", "score": "0.66141003", "text": "def clip!(rect)\n nself = self.normalize\n other = Rect.new_from_object(rect).normalize!\n if self.collide_rect?(other)\n self[0] = [nself[0], other[0]].max\n self[1] = [nself[1], other[1]].max\n self[...
0cd3ea69fb6297278cfecdce12fd3ce8
Check OSX service is enabled
[ { "docid": "204b1bfe2a7d8ecb802a71389b6ad3d8", "score": "0.7821055", "text": "def check_osx_service_is_enabled(options,service)\n plist_file = \"/Library/LaunchDaemons/\"+service+\".plist\"\n if not File.exist?(plist_file)\n plist_file = \"/System\"+plist_file\n end\n if not File.exist?(plist_fi...
[ { "docid": "ee4e28f7c7599fa1f2b688f56b188a4c", "score": "0.7414322", "text": "def enable_osx_service(service_name)\n check_osx_service_is_enabled(service_name)\n message = \"Information:\\tEnabling service \"+service_name\n command = \"launchctl start #{service_name}\"\n output = execute_command(op...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "061d1c9b1aa6e1e486c9967a1e7f42af", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IndexDeploymentsResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "c4ca32683e8ce75eb6a187d63df8fa77", "score": "0.7665016", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6f7a7d9be674ad4cf17d6743eb1f7836", "score...
817b340e765805f3887d09464a105465
Sanitize specific fields automatically before the validation step
[ { "docid": "b041993176f7cf325defa6259a25cba3", "score": "0.73108196", "text": "def auto_sanitize *fields\n options = {} unless (options = fields.last).is_a? Hash\n options.reverse_merge! method: 'clean', remove_all_spaces: false\n\n # Each field: define a new method, then register a callback to...
[ { "docid": "f6d8ed39ec70b8b075d489ed42285b99", "score": "0.83645695", "text": "def sanitize_fields; end", "title": "" }, { "docid": "fb50b15870504a000adf1be2898e255f", "score": "0.81903136", "text": "def sanitize_fields\n sanitize_id\n sanitize_names\n sanitize_grad_sem\n e...
7e73b937b5591d3f1516630db9a12950
PUT /event_schedules/1 PUT /event_schedules/1.json
[ { "docid": "24b2823cbd475de3484de4b5bc36b3d7", "score": "0.7391929", "text": "def update\n @event_schedule = EventSchedule.find(params[:id])\n\n respond_to do |format|\n if @event_schedule.update_attributes(params[:event_schedule])\n format.html { redirect_to @event_schedule, notice: '...
[ { "docid": "ea972c6e3acb6b13ad5a695484d915dd", "score": "0.7212995", "text": "def update\r\n @schedule = Schedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @schedule.update_attributes(params[:schedule])\r\n format.html { redirect_to event_path(@schedule.event_id), notice:...
931ad60ad6017656f4d95cc9928f66a2
can also pass block in as an argument and call it but this is not preferred
[ { "docid": "d5601e8ea63ed7cd35e4896cdb137220", "score": "0.0", "text": "def do_times(count, &block)\n while count > 0\n block.call\n count -= 1\n end\nend", "title": "" } ]
[ { "docid": "82c2c52ee0341048b85434162bff4018", "score": "0.84882617", "text": "def call_block(&block)\n block.call\nend", "title": "" }, { "docid": "b489bb117b80907f333505fef44855be", "score": "0.8313074", "text": "def callBlock\n yield\n yield\nend", "title": "" }, { ...
24d78c3146c6e7aa58c772e6e3ad764f
pull off the first part of the coffeescript file name
[ { "docid": "289e693a07789623154085777d7d9486", "score": "0.72615737", "text": "def get_filestem (csfile)\n return $1 if csfile =~ /^(.+)\\.coffee$/\n print \"unexpected name for coffeescript file: #{csfile}\"\n csfile\nend", "title": "" } ]
[ { "docid": "400d2e6997d76f9aa2594e0e71ede586", "score": "0.7317348", "text": "def source_filename_for(filename)\n if filename =~ /.compiled.#{COMPILED_FILE_EXTENSION}$/\n return filename[0..-14]\n elsif filename =~ /.#{COMPILED_FILE_EXTENSION}$/\n return filename[0..-2]\n...
a13bb092e59fd84a20894860271d9bbe
Get the first textfield that includes text.
[ { "docid": "1693f15784291a1de67efdd7f0359978", "score": "0.5737501", "text": "def textfield_include text\n js = %Q(\n var t = au.getElementsByXpath('textfield[contains(@text, \"#{text}\")]').value;\n var s = au.getElementsByXpath('secure[contains(@text, \"#{text}\")]').value;\n t.conca...
[ { "docid": "b7107741173a31508e3aca0050af027d", "score": "0.79077345", "text": "def first_textfield\n ele_by_json _textfield_visible\n end", "title": "" }, { "docid": "b498b2bf32bd32a3d59ba8b632ab4e72", "score": "0.7763537", "text": "def first_textfield\n _textfield_w...
912c0e0cf8816366872f1b29941d2de1
DELETE /events/1 DELETE /events/1.json
[ { "docid": "db4eac2f67ac44c0a3a805d4a0c9447d", "score": "0.0", "text": "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "11f7138ce2d6d84fa0d9949fbd14cb07", "score": "0.7693312", "text": "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", ...
ede2f5b34d86732ca88e7e96d6960979
Remove a child node.
[ { "docid": "8d908a625a06a9be8ac5ce81759d5519", "score": "0.7967633", "text": "def remove_child (node)\n if @children\n if @children.delete(node)\n node.instance_variable_set(:@parent, nil)\n end\n end\n end", "title": "" } ]
[ { "docid": "a402d8aee1afe7d9d527242838c00cf4", "score": "0.83245456", "text": "def removeChild(node)\n raise NotImplementedError\n end", "title": "" }, { "docid": "bafa7a04bfc328c851abbd92504e8dc9", "score": "0.832029", "text": "def removeChild(child)\n child.rem...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "70ea2c57ffceb2b4e2ae3cf3ddd3d30c", "score": "0.0", "text": "def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
253e9a7fb53f07313c08906facc1c740
Clears all the listeners.
[ { "docid": "14c9731e0e7a0dd54cfd954ff2281385", "score": "0.8398277", "text": "def clear_listeners\n @@listener_classes = []\n clear_listeners_instances\n end", "title": "" } ]
[ { "docid": "26b8334d0fc9279400e3eff36ed1bb12", "score": "0.8318467", "text": "def clear_listeners\n @@listener_classes = []\n clear_listeners_instances\n end", "title": "" }, { "docid": "ac24b2784dbd4870acdb841548b2e968", "score": "0.8236747", "text": "def cl...
f6796c3d79496a763a673711250202ae
POST /auto_work_spaces POST /auto_work_spaces.json
[ { "docid": "5e3662946725fc8ac0cf5ffff53d2cda", "score": "0.733813", "text": "def create\n @auto_work_space = AutoWorkSpace.new(auto_work_space_params)\n\n respond_to do |format|\n if @auto_work_space.save\n format.html { redirect_to @auto_work_space, notice: 'Auto work space was succes...
[ { "docid": "498546d5891c392230a83937da3d6a76", "score": "0.6820788", "text": "def set_auto_work_space\n @auto_work_space = AutoWorkSpace.find(params[:id])\n end", "title": "" }, { "docid": "157eea87d875c74b1e72ee595739ee0b", "score": "0.6790582", "text": "def auto_work_space_para...
bce338d08f2dfa0e8497a4f19dfa4d6a
GET /bees GET /bees.json
[ { "docid": "5b6cb436c0dbdfca84a001e8aca042a0", "score": "0.7012832", "text": "def index\n @bees = Bee.all\n end", "title": "" } ]
[ { "docid": "55661ff5a7a662de6c34c647d1e2ee73", "score": "0.7445274", "text": "def index\n @beers = Beer.all\n\n render json: @beers\n end", "title": "" }, { "docid": "b6e57174cb69cb6659e2e5bb315caadc", "score": "0.7372749", "text": "def index\n beers = @beer.get_beers...
8815558275d84bb78391add3dc613a6c
Method to create a list input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: Create empty hash Separate all the input items by spaces while still less than item number in an array Put all the items into the hash as keys set default quantity print the list to the console [can you us...
[ { "docid": "11492be9851f93c9d64fa576704e499c", "score": "0.0", "text": "def create_grocery_list(items)\r\n\tgrocery_list = {}\r\n\titems = items.split\r\n\titems.each do |item|\r\n\t\tif grocery_list[item]\r\n\t\t\tgrocery_list[item] += 1\r\n\t\telse\t\r\n\t\t\tgrocery_list[item] = 1\r\n\t\tend\r\n\ten...
[ { "docid": "32b6e2fb48bae91c94251593dd7fb7ee", "score": "0.8507093", "text": "def create_list_items(input_string)\n\n hsh = {}\n\n # create an array containing each item\n array_input = input_string.split(' ')\n\n # create a hash from the array (iterate), containing the information of key/value pairs\n ...
31b7530d1b08ff70b6470c3508b67827
Download an asset file from a Course Downloads the asset file at the specified relative path from the latest version of the course. GetCourseFileList can be used to find the relative path of the file.
[ { "docid": "d20bb4ae22e481396f6b3107310eda5e", "score": "0.565376", "text": "def get_course_asset(course_id, relative_path, opts = {})\n data, _status_code, _headers = get_course_asset_with_http_info(course_id, relative_path, opts)\n data\n end", "title": "" } ]
[ { "docid": "9ef90edcf7d5ab16b1ba295f5522fae0", "score": "0.62619", "text": "def download_asset\n logger.info 'Downloading original asset'\n Utils.prepare_download_dir\n wait_for_load_and_click_js download_asset_link_element\n sleep 2\n wait_until(Utils.medium_wait) do\...
715120cd2b2a684e6600a7c512bf0b75
DELETE /memberships/1 or /memberships/1.json
[ { "docid": "ed5a1c1b1da767298f9ba17acb8799a9", "score": "0.70065266", "text": "def destroy\n space = @membership.space\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to space_path(space), notice: 'Membership was successfully destroyed.' }\n format.json { head ...
[ { "docid": "926805ab0c3328653f9e4936c9a2ec8c", "score": "0.7935848", "text": "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end", ...
8c66d95eb7396268f9e04f9513d53a10
edit tasks in the job order
[ { "docid": "097b27bb2c387d7150a9e4c4055d31a7", "score": "0.6073893", "text": "def menu_edit_task(task)\n loop do\n system 'clear'\n puts \"--> Task Details <--\".colorize(:cyan)\n puts @headline\n puts @pipe + \"Description: \".colorize(:cyan) + \"#{tas...
[ { "docid": "42edc70bb634c27ce11adbdc5946c3a0", "score": "0.70175934", "text": "def edit_task(hash_task, *args)\n edit_tasks([hash_task,], *args)\n end", "title": "" }, { "docid": "ad2de4daf5dcfb3e5db4467dad990830", "score": "0.6925718", "text": "def update(task_number, task) ...
86aa8ad9d4dee664d7f236aba8ba3c34
count is divisible by 15 you print "Fizzbuzz" and a new line character. Else, if the count is divisible by 3 you print "Fizz". Else, if the count is divisible by 5 you print "Buzz". Else you end up just printing the count number. You check divisibility using mod (%) which just tells you the remainder after division. So...
[ { "docid": "a1247d97fc0b3c6ce4cfb5f30a484907", "score": "0.7414799", "text": "def fizzbuzz(num)\n #You are checking the parameter num\n case\n #In the case that it's divisible by 15 then return \"FizzBuzz\"\n when num % 15 == 0 then \"FizzBuzz\"\n #Else, in the case that it's divisible by 3 then re...
[ { "docid": "c29b45c86834a9c97d83a69b4799f4a0", "score": "0.8091394", "text": "def fizzbuzz(number)\n if (number % 15 == 0)\n puts \"FizzBuzz\"\n \"FizzBuzz\"\n elsif (number % 3 == 0)\n puts \"Fizz\"\n \"Fizz\"\n elsif (number % 5 == 0)\n puts \"Buzz\"\n \"Buzz\"\n else\n puts \...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "82fb0e7bfe4fabb616f440fcdce37a45", "score": "0.0", "text": "def destroy\n authorize! :destroy, @user\n @user.update_attribute(:active, false)\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.json { head(:no_content) }\n end\n end", "title"...
[ { "docid": "be9d8ff5c0124f1d5efc98ec2baa3fc1", "score": "0.7590564", "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_nam...
b4dd7b33e07b9b6339fff9f6faec2290
pretty sure this is wrong
[ { "docid": "663e1e44e82459a5362fe5d2cd429348", "score": "0.0", "text": "def my_rotate(pos = 1)\n split = pos % length\n\n drop(split) + take(split)\n end", "title": "" } ]
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.65608317", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.65608317", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b4bf5e379f2e9f38804c733eef7af6fd", "score": "0.0", "text": "def account_master_params\n params.require(:account_master).permit(:user_id, :avaliable_balance, :status)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
907e8c947f1b6d200f4e7da0f6a92abe
method that allows us to obtain the values of the table Cross, store them as properties of a Hybrid_Cross object and then all the objects are store in the hash_cross. It just needs as a argument the name of the file:
[ { "docid": "e7477d425cc4784230cdefa0e13d76c1", "score": "0.7614878", "text": "def get_cross(hybrid_cross_file)\n lines = IO.readlines(hybrid_cross_file)#array that contains the lines of the file\n hash_cross = Hash.new() #hash that will contain the SeedStock objects\n lines[1..-1].each {|line| par...
[ { "docid": "cae6ec717c32d6a4615a1dc23fed99f6", "score": "0.5632694", "text": "def generateObject(file)\n spreadsheet = open_spreadsheet(file)\n header = spreadsheet.row(1)\n data_obj = {}\n data_obj['data'] = {}\n (0..spreadsheet.last_column - 1).each do |i|\n data_obj['data'][header...
1a19f13aec639d85d07c7c37b8b21e04
mount_uploader :photo, PhotoUploader before_validation :test def test binding.pry end
[ { "docid": "985284a6ffeb28899d7165b0c1450d10", "score": "0.0", "text": "def pick_photo\n if self.photo.present?\n photo\n else\n temp_photo\n end\n end", "title": "" } ]
[ { "docid": "7566f5db01f8d3db887fd3a24f44b8e0", "score": "0.61705565", "text": "def productphoto_upload\n \n end", "title": "" }, { "docid": "f5df94d4d910b5f005c075202c3bfa89", "score": "0.61243147", "text": "def uploader; end", "title": "" }, { "docid": "f5df94d4d910b...
c9a873c0fa5974cb7199422a6c336277
Removes projects from the group
[ { "docid": "63ebaacb53ff3ac565a172a5575cada0", "score": "0.6599672", "text": "def remove_projects_from_group(team_id, group_id, project_ids)\n params = { query: [team_id, group_id, :projects, :remove], req: project_ids.to_array_obj(:projects) }\n\n data = endpoint(name: 'TeamUserGroups', p...
[ { "docid": "4ac538490d15e9c548b007013e69e17d", "score": "0.7487206", "text": "def unlink_project\n self.project.remove_groupID(self.id.to_s)\n end", "title": "" }, { "docid": "b3b0af42cfa97aea6d01a763ee67d692", "score": "0.73336715", "text": "def purge\n @projects = []\n ...
2908e7e51174b0248229aa462e722a01
puts "Sluggish Octopus" p sluggish_octopus(fish) "fiiiissshhhhhh" puts
[ { "docid": "878abe2fc1ce37d8a7f10ef46a0436dd", "score": "0.0", "text": "def dominant_octopus(arr) # O(n log n). Divide\n return arr if arr.length < 2\n\n mid_idx = arr.length / 2\n left = arr.take(mid_idx)\n right = arr.drop(mid_idx)\n\n sorted_left = dominant_octopus(left)\n sorted_ri...
[ { "docid": "4a6c86c7415b52a506a65162f61f695c", "score": "0.70401245", "text": "def movie(pretty, ugly)\n puts \"The children's movie that is debated to be about stockholm syndrome is: #{pretty + ugly}.\"\nend", "title": "" }, { "docid": "4dd092122d41e63cc34af6ec19997446", "score": "0.69...
162fd3658e456fae595c30fa9d6ff417
Dynamic CSS for Application Layout
[ { "docid": "e3472a2fa44edb91978557cc7bc98115", "score": "0.64488983", "text": "def application\n @body = Element.style_for(\"body\").first\n @footer = Element.style_for(\"footer\").first\n @top = Element.style_for(\"top\").first\n @clicked = Element.style_for(\"clicked\").first\n respond_...
[ { "docid": "e5a34157f1af87360f9864a44d057d3e", "score": "0.66242105", "text": "def generate_grid_css\n # loads up erb template to evaluate custom widths\n css = ERB::new(File.path_to_string(CustomLayout::CSS_ERB_FILE))\n \n # bind it to this instance\n css.result(binding)\n end...
85f0ad33c9931f3ae03e6d611bcfa75e
GET /admin_exams/1 GET /admin_exams/1.xml
[ { "docid": "40b222664e9db460f6fb486dd8849e8d", "score": "0.0", "text": "def show\n @exam = Admin::Exam.find(params[:id])\n @exams = Admin::Exam.find(:all,:select=>\"Exam_Id,ExamName\")\n end", "title": "" } ]
[ { "docid": "8e43cf8a7eab1606b35811b61c78b5d8", "score": "0.7362015", "text": "def index\n @exams = current_user.organization.exams.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exams }\n end\n end", "title": "" }, { "docid":...
5743d329f352b82b3c0b0c28ff6f1e23
ScaledNetwork set works just like FeedForwardNetwork's set method,
[ { "docid": "6d3a399e2adcfd4e24394abc0e321a6b", "score": "0.48973313", "text": "def set(input)\n @distribution.reset(input) if @reset\n super(@distribution.mapped_input(input))\n end", "title": "" } ]
[ { "docid": "3ee541787b6df76a6c8059b9567d7252", "score": "0.6598754", "text": "def set_network\n\t\t@network = calculate_network(@word)\n\t\t#updates the size class variable for the TestWord Object\n\t\t@size = @network.size\n\tend", "title": "" }, { "docid": "5d6ede1aa235d5acfcf070fd7a3ba8f7...
d765466f173a497dc8cdfda28f5684f3
Returns true if a Beorbcc lexer can lex text using method method Additionally tests if type and text are correct
[ { "docid": "95d51b545ebb83d479707fb92f5522b5", "score": "0.6734451", "text": "def lex_ok(input, method, type = nil, text = nil, line = nil, coln = nil) \n lex = Beorbcc::Lexer.new(input)\n res = lex.send(method.to_sym)\n if !res \n warn \"Lexer returned nil for #{method}(#{input}) !\"; return nil...
[ { "docid": "18e2919bed8e2f427970e0ab948e0719", "score": "0.6500403", "text": "def text?; opcode == TYPES[:text]; end", "title": "" }, { "docid": "118a0dccb51b93d3903961cb1d984612", "score": "0.644686", "text": "def is_text_run?; end", "title": "" }, { "docid": "d51c68...
c36efc9a6367adfc653da0b8f2d6862b
Assign input text file path from options
[ { "docid": "9405857bb50a6de62fc90e75abb14107", "score": "0.71810323", "text": "def assign_text_file(options)\n options.on('-t', '--text-file path', String, 'Path to file with text to analyze') do |path|\n @text_file = path\n end\n end", "title": "" } ]
[ { "docid": "ea0f948f9371e434b1058ca3c5f076e6", "score": "0.66505784", "text": "def filename\n user_specified_options[:filename]\n end", "title": "" }, { "docid": "de31d73e267a5c6e090ded69d226c8c3", "score": "0.6495645", "text": "def file_name\n if @options[:file_name].nil?...
9ccfa5cb81fb8113975bee6b780d4c3f
Update visible text start point
[ { "docid": "2f7ebc89853a611fdbf7165cc54a10a7", "score": "0.72426754", "text": "def update_textstart\n if @textstart > @cursor\n @textstart = @cursor\n elsif @textstart < @cursor - @max_char - 1\n @textstart = @cursor - @max_char - 1\n end\n fix_textstart\n end", ...
[ { "docid": "60c78ddb3a418cf04bfcf5ecd0e62144", "score": "0.6884546", "text": "def redraw_prestart\n @lines[0] = \"#{(@team.to_s || 'X').rjust(4, '0')} #{label}\".ljust(16)\n @lines[1] = \"MATCH#{@match.to_s.rjust(4, '0')} POS#{@data['start_position']}\" \n end", "title": "" }, { ...
67a6a740a39067a583fe50481a9f8a37
Description: Returns whether the airport has any notam in given time
[ { "docid": "c8d10d20dd9d71d1bb9d040978beb0ef", "score": "0.7902885", "text": "def airport_has_notam(airport_id, time)\n @airport_notam_map ||= {}\n return @airport_notam_map[\"#{airport_id}-#{time.to_s}\"] if @airport_notam_map[\"#{airport_id}-#{time.to_s}\"].present?\n notam = @notams.detect{ ...
[ { "docid": "632d3429ed7dc6b478427f60144a02db", "score": "0.69885164", "text": "def existed_at?(aTime)\n return @date >= aTime\n end", "title": "" }, { "docid": "3dd623e45e324d22406fac16d0ff97fd", "score": "0.69077325", "text": "def include?(time)\n if @days[time.wday]\n #...
c0e4df1aca1c3ae8cdabf76a15dffc7f
Try to gracefully disconnect from each network, unload all scripts and exit properly.
[ { "docid": "b5e64d281a29fe09de0bd4c98b4c2cfe", "score": "0.61033326", "text": "def quit signal = :SIGINT\n @networks.each do |network|\n network.transmit :QUIT, \"Got SIGINT?\"\n network.disconnect\n end\n \n unload_scripts\n \n EventMachine.stop\n end", ...
[ { "docid": "1972e476cfd05e5ca93a5a5543538a7f", "score": "0.6943065", "text": "def shutdown\n @pool.each do |identifier, list|\n list.each do |connection|\n connection.disconnect(\"stopping agent\")\n end\n end\n end", "title": "" }, { "docid": "e8de52e19e8ed8e287ef181...
0c1327d7999e2b752062fd0fba005c30
Archives current xml file in history folder
[ { "docid": "512244af95a5f5640ebf052c36dd0813", "score": "0.74495876", "text": "def archive_xml_file\n timestamp = Time.now.strftime('%Y_%m_%d_%H_%M')\n FileUtils.mkdir_p(archive_path)\n FileUtils.mv(self.xml_file, \"#{archive_path}/#{timestamp}_mets.xml\")\n end", "title": "" } ]
[ { "docid": "c09e6346a0dd2df63dd938aa3ec36783", "score": "0.6831861", "text": "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_fi...
147f88a979b8a328850cee73a6c8d59a
.each iterates through each element in array .to_s converts value to a string .include?() checks if value is included in array Person 2
[ { "docid": "9564d9182f8dcfe821106dbb8a9cabbb", "score": "0.0", "text": "def my_array_modification_method(source, thing_to_modify)\n source.each do |x|\n if x.is_a? Integer\n source.each do |x,y|\n numb = source.index(x)\n source[numb] += thing_to_modify\n end\n e...
[ { "docid": "7ed54e4828c46cc5774cd67d141dca5f", "score": "0.6367865", "text": "def target_people_iterating arr\n arr.map do |person|\n user_extra_information(person)\n fullname_join_email\n end\n end", "title": "" }, { "docid": "84b6c170581d81002...
aee01392c510113b746bec31a126ffdc
To class 'Fixnum' add method 'prev'. The method returns the previous number assigned to itself. For example, doing 4.prev would return 3. 4.prev.prev should return 2.
[ { "docid": "cba78d0b18d0c613cc5ac913993f3388", "score": "0.0", "text": "def next\n self + 1\n end", "title": "" } ]
[ { "docid": "f6ae0cf13208b124ce13e4ab55b21591", "score": "0.82442445", "text": "def prev_num(num)\n return num - 1\nend", "title": "" }, { "docid": "118fd394e6a1e481d98cdb28a513df1c", "score": "0.8059262", "text": "def prev_num(num1)\n return num1 - 1\nend", "title": "" },...
7d3fca2caed41cc9ebf534e5a63a4ae6
All public objects are accessible via a GET request to the Cloud Files servers. You can generate a url for an object using the cloudfiles_url method.
[ { "docid": "621245d4dfdfe7422570df1caa528bac", "score": "0.0", "text": "def cloudfiles_url(thumbnail = nil)\n if @@container.public?\n File.join(@@container.cdn_url, full_filename(thumbnail))\n else\n nil\n end\n end", "title": "" } ]
[ { "docid": "a7083f8540c8f99806937170070e11aa", "score": "0.6937178", "text": "def public_url(expires = (Time.now + 5 * 365 * 24 * 60 * 60))\n requires :objectid\n # TODO - more efficient method to get this?\n storage = Fog::Storage.new(:provider => 'Ninefold')\n uri =...
9e66b74603d4f1c9f62ee294122b2294
method for checking list name input for errors
[ { "docid": "550df59e5710e0b4d81f508cff4ec577", "score": "0.8180252", "text": "def list_name_error(name)\n if session[:lists].any? { |list| list[:name] == name }\n 'List name must be unique'\n elsif !(1..100).cover? name.size\n 'List name must be 1-100 characters'\n end\nend", "title": "" ...
[ { "docid": "1cf58668c128709e86dd8e9e6b86bf75", "score": "0.8442883", "text": "def error_for_list_name(list_name)\n if !list_name.size.between?(1, 100)\n 'The list name must be between 1 and 100 characters.'\n elsif @list_names.any? { |name| name == list_name }\n 'The list name must be unique.'\n...
875ee18c5c0764e1a573143a49f58249
Accept a TCP socket and create a connection
[ { "docid": "8b98c6cf4fba26dac1f95e817f58febb", "score": "0.0", "text": "def initialize(socket)\n\t@socket = socket\n\t@logger = Logger.new(STDOUT)\n\t@logger.level = Logger::DEBUG # For learning\n\t@fin = nil\n end", "title": "" } ]
[ { "docid": "babd69491509948db729c701c7d74fcf", "score": "0.7615012", "text": "def connect\n socket = TCPSocket.new(server, port)\n\n if @ssl\n require 'openssl'\n\n ssl = OpenSSL::SSL::SSLContext.new\n ssl.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @socket = OpenSSL::SSL::SSLSoc...
0f47ddafd5faeeab625c1ac110266c33
Traverses the object and yields each node (including descendants) in order.
[ { "docid": "59e3c7d64ea38cd40488707fa61c6ae9", "score": "0.64351344", "text": "def traverse; end", "title": "" } ]
[ { "docid": "606f824ada81958ce75146838e24765b", "score": "0.7496668", "text": "def each_node(node)\n yield(node)\n node.typed_children.each do |obj_type, children|\n children.each do |name, node|\n each_node(node) { |n| yield(n) }\n end\n end\n end",...
c99fe6865b6792dd1537de75995d34d2
View to offer a View to offer a ./accept endpoint for accepting a PlatformMembershipRequest.
[ { "docid": "393121194e19d761b925580720b1710b", "score": "0.0", "text": "def deny_platform_membership_request_post(platform_pk, pk, opts = {})\n data, _status_code, _headers = deny_platform_membership_request_post_with_http_info(platform_pk, pk, opts)\n return data\n end", "title": "" ...
[ { "docid": "01449925849ab67bcb58fdfdb88f9986", "score": "0.6040546", "text": "def show\n if has_membership?(params[:id].to_i)\n @provider = Provider.find(params[:id])\n else\n @provider = current_provider\n end\n\n respond_to do |format|\n format.html # show.html.erb\n fo...
74c59b99d7128e484a045faf9c0e8074
Render a popup tag
[ { "docid": "fe59b6937cd398286e5cf1fdf1036fd2", "score": "0.72918487", "text": "def popup_tag(partial = nil, html_options = {}, &block)\n html_options.reverse_merge!({\n as: 'Popup',\n id: 'Popup',\n class: 'popup',\n overlay: true\n })\n\n if html_options.delete(:overlay) ==...
[ { "docid": "82fd816b017b306b603c8c9eac03a9f9", "score": "0.65903205", "text": "def new_gs\n render :new, layout: 'popup'\n end", "title": "" }, { "docid": "77a397ffbaa9ff69578a235c708400a9", "score": "0.6490526", "text": "def mgs_feedback_modal\n\t\t$tracer.trace(__method__)\n\t\...
94a1698e472e7f1325e5e8fd88e9e903
Extend existing work definition by alias existing method name as "orig_[method_name]"
[ { "docid": "d28db035aad77ce75efa74c5973109a8", "score": "0.8349173", "text": "def extend_work(work_name)\n work_name = work_name.to_s\n alias_method \"orig_#{work_name}\", work_name\n end", "title": "" } ]
[ { "docid": "e3ba01dca8bb53fa413a43c2834a5b44", "score": "0.6870999", "text": "def extend_hook(hook_name)\n hook_name = hook_name.to_s\n alias_method \"orig_#{hook_name}\", hook_name\n end", "title": "" }, { "docid": "f167ee5b572807ea726dc1d3004eb345", "score": "0.6450846", ...
5a74df3a8aa6fcd24737c13c8ce13ad1
Helper method to prefix the page title with the site name. Usually you wouldn't call this directly
[ { "docid": "b4263c8d10527478199050466a62550e", "score": "0.0", "text": "def prefix(x)\n delimiter = @@page_title_delimiter\n the_prefix = \"\"\n if devmode?\n the_prefix = \"[DEV] \"\n end\n if x.nil?\n \"#{the_prefix} #{@@default_page_title}\"\n else\n \"#{the_prefix} #...
[ { "docid": "54832cdd3bc9749ab5f60cdd073da0e3", "score": "0.814812", "text": "def page_title\n base_title = (t :sitename)\n if @page_title.nil?\n \"#{params[:controller].capitalize} | \" + base_title\n else\n \"#{@page_title} | #{base_title}\"\n end\n end", "title": "" }, {...
f9b393d38eee3065e2762d4db870e80d
PUT /plans/1 PUT /plans/1.json
[ { "docid": "bc6f528bdd660dcc0511475c01e047e4", "score": "0.64448416", "text": "def update\n\t\t@plan = Plan.find(params[:id])\n authorize @plan\n\t\tif user_signed_in? && @plan.editable_by(current_user.id) then\n\t\t\trespond_to do |format|\n\t\t\tif @plan.update_attributes(params[:plan])\n\t\t\t\tfo...
[ { "docid": "9a4b429036de3b938a268596cf9d8848", "score": "0.7365124", "text": "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
a8297c6eba89045ff7b3558d7e5ba704
transfer If necessary, updates +txaction+ according to the transfer status given in +params+.
[ { "docid": "866cedbebce74cf42995190022eadd79", "score": "0.66306764", "text": "def update_transfer_status(txaction)\n if transfer_given?\n # make a note of the transfer buddy, if it already has one\n if is_transfer?\n buddy = transfer_buddy || txaction\n buddy = txaction if bu...
[ { "docid": "94dc7f6653166df1bbb71c6a2c91bcf4", "score": "0.6593308", "text": "def transfer(tx)\n pay_id = get_payment_id(tx.id)\n puts \" the transaction will be transferred here ... for payment id : \" , get_payment_id(tx.id) , \" the listing author is : \" , tx.listing_author_id\n ...
029ba3d858b54dd32d1310d1da7dcb76
Tests loading all valid png files in the test suite and performs some general checks on reading header data.
[ { "docid": "ffd77e0468eb74798dab8e472b8e5933", "score": "0.8115257", "text": "def test_load_valid_png_files\n\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature != \"x\"\n\n #Reading valid png files should not raise any exception\n assert_nothing_raised do\n ...
[ { "docid": "fab786e84dc0dd748ef1c37e3265b700", "score": "0.8148718", "text": "def test_load_invalid_png_files\n\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature == \"x\"\n #Invalid png files should generally raise exception (except in the specific cases below).\n\n...
ea3f2c19108a239bcbdc11589c5bdd80
Run the entire pipeline in a sane order.
[ { "docid": "352b104c5fdead0b2f0ba19af74cf1d3", "score": "0.0", "text": "def complete\n extract_metadata.markdown.autolink.sanitize\n end", "title": "" } ]
[ { "docid": "38fc10c1ffc703d227930dd981f14315", "score": "0.68549246", "text": "def execute pipeline_commands\n pipeline_commands.each do |k, v|\n execute_pipeline k, v, []\n end\n end", "title": "" }, { "docid": "400193c5f58bd6b2eeb1076680ee3b07", "score": "0.6560402", "t...
c7d8a99f32074a44b14848ce7be59d9c
leetcode might has problem in DP solution on Ruby
[ { "docid": "750cd93576020f9a1856ad1dc7ef70f3", "score": "0.0", "text": "def longest_palindrome_dp(s)\n\n return \"\" if s.length == 0\n\n start_idx = 0\n # every char is palindrome.\n longest = 1\n longest_str = s[0]\n # create a 2 dimentional array for quick computing.\n\n matrix = Array.new(s.l...
[ { "docid": "d7c1b5fbd67c5ac628ea662529d62994", "score": "0.6965857", "text": "def DP_solve arr\n max, head, tail = 0, 0, 0\n cur_head = 0\n sum = [ [0, arr[0]].max ] # base case\n (1...arr.size).each do |j|\n sum[j] = [0, sum[j-1] + arr[j]].max # bottom-up\n p sum[j]\n cur_head = j if sum[j...
c1ef706f9b3397615fbf78e524d2b6cb
calculate the item discrimination number for each question
[ { "docid": "cfdbb5c896a929097e8f6012671d9f66", "score": "0.793985", "text": "def calculate_item_disc_for_each_question\n\n # retrieve all the questions\n questions = @questions.values\n\n questions.each do |q|\n\n # get the percent correct from top cohort\n a = get_percent_c...
[ { "docid": "471657fee730f48f40f6fc9000bf3e1d", "score": "0.54633504", "text": "def show\n @test.relations = Relation.joins(:question).where(\"relations.test_id = ?\", @test.id).select(\"relations.id, questions.identifier, questions.description\")\n @quantity = Relation.joins(:question).where(\"rel...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "4bcaa40d81e5a6be9aea5f3e9e78e035", "score": "0.0", "text": "def create\n @user = User.new(params[:user])\n\n authCode = Digest::MD5.hexdigest params[:auth][:authCode]\n\n if authCode != params[:auth][:hiddenAuthCode]\n @user.errors.add(:authcode,\"短信验证码输入不正确\")\n return\n end\n \n...
[ { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.77179813", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "a3973850c21e121410e2101...
11f03cc2b58ee28210affda0f0ced09e
Turn to face the given point.
[ { "docid": "74af3462f6fee17280aa58cb5c4f59aa", "score": "0.0", "text": "def toward(pt)\n x2, y2 = pt\n must_be_number(x2, 'pt.x')\n must_be_number(y2, 'pt.y')\n x1, y1 = xy\n set_h(90.0 - atan2(y2 - y1, x2 - x1) / DEG)\n end", "title": "" } ]
[ { "docid": "78ec46b1c42c34b048abe5ce4dddf52f", "score": "0.6240925", "text": "def turn(direction)\n return unless @placed\n @face = (ROTATION_MATRIX_MAP[direction] * face_vector).column(0).to_a\n end", "title": "" }, { "docid": "56fb4ee1000981aef10ab957d5fcf3d0", "score": "0.62131...
7e888a8e78288d06fe6360ea478844a3
POST /music_sub_categories POST /music_sub_categories.json
[ { "docid": "e50dcea3afe4b69199e2b1c0cd50432c", "score": "0.7202561", "text": "def create\n @music_sub_category = MusicSubCategory.new(music_sub_category_params)\n\n respond_to do |format|\n if @music_sub_category.save\n format.html { redirect_to @music_sub_category, notice: 'Music sub ...
[ { "docid": "aab7166f4548c63b1c7732e4070da477", "score": "0.7163208", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n @category.sub_categories.build\n else\n render json: @category.errors\n end\n end", "title": "" }, { "docid": "df1...
c8e08fc891dd0709e3b22916fd72783a
the function really just returns a constant (just avoiding the constant) unfortuantely that constant condenses every detail about the system, class names and all instance variable names. Really have to find a better way
[ { "docid": "0565c11af85d65d45ed8f6318dfdf3dd", "score": "0.0", "text": "def type_names\n { :Word => {:char_length => :Integer} ,\n :List => {:indexed_length => :Integer} ,\n :Message => { :next_message => :Message, :receiver => :Object, :frame => :Frame ,\n ...
[ { "docid": "b3049ceb452247641b178b1e539d46e7", "score": "0.73710746", "text": "def class_constant; end", "title": "" }, { "docid": "b3049ceb452247641b178b1e539d46e7", "score": "0.73710746", "text": "def class_constant; end", "title": "" }, { "docid": "c03ec0b72fb1c4e92885...
c8b180ebbb0a6f602f1187f29d6935b4
Unzip an archive to a destination directory using Rubyzip gem
[ { "docid": "36c8f7b80d6e72e689fffed0ea6cd7a3", "score": "0.75988513", "text": "def unzip_archive(archive, dest)\n # Adapted from examples at...\n # https://github.com/rubyzip/rubyzip\n # http://seenuvasan.wordpress.com/2010/09/21/unzip-files-using-ruby/\n Zip::File.open(archive) do |zf|\n zf.each...
[ { "docid": "5637ec9dc9dce15291e9a4d769957e60", "score": "0.7948456", "text": "def unzip\n cmd = \"unzip #{zip_folder} -d #{unzipped_target_folder}\"\n system cmd\n end", "title": "" }, { "docid": "d6e2c85a05ed73b623e3dbc502e9e5c5", "score": "0.79225385", "text": "def unzip_arc...
7493ad77d021c7e8126e3e22c41f996c
Redirect to Google authorization
[ { "docid": "6389af7973862383c3a4f7d71cbf4e93", "score": "0.77434945", "text": "def google_redirect\n redirect_to '/auth/google_oauth2'\n \n # binding.pry\n\n # Post to google_oauth2 with auth token\n # res = HTTParty.post(\"http://localhost:3000/auth/google_oauth2\", :headers => {\n # ...
[ { "docid": "d7952219157df120846aae1f2377784f", "score": "0.83791775", "text": "def redirect\n GoogleOauth.revoke_access(current_user)\n authorization_uri = GoogleOauth.authorization_uri(url_for(action: :callback))\n redirect_to authorization_uri.to_s\n end", "title": "" }, { "docid...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7280ddcaaded940909b3b0656fdfa985", "score": "0.0", "text": "def expense_params\n params.require(:expense).permit(:title, :amount)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496024", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69581187", "text": "def strong_params\n params.require(:request).permit(param_whit...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "ca3eeef61f1178d96bfdf7096ba30bd7", "score": "0.0", "text": "def user_bulk_params\n params.require(:user_bulk).permit(:file)\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 =...
85d9a77e57df190a2a25ad5a5797202e
Checks if reaping is enabled
[ { "docid": "3bb7f5d6f0e1db7239c09987f95b349b", "score": "0.60017264", "text": "def enabled?\n REAPERS.include?(reaper)\n end", "title": "" } ]
[ { "docid": "bd1642dfdc12de781be5fd264165443b", "score": "0.70091784", "text": "def autoreaping?; @reaping_frequency > 0; end", "title": "" }, { "docid": "2c84a8e159b4f22bed9ec5969ac2e2e4", "score": "0.5988454", "text": "def isAdjust()\n\t\tif self.type == \"ADJUST\"\n\t\t\treturn tru...
77b95d904354c5f1dab1b25e0aa46bae
Constructor [+query_text+] The simple query string to parse
[ { "docid": "f2c6eb3c02a73f7b7b8e1718a697b03c", "score": "0.7738958", "text": "def initialize(query_text)\n\n @prefix = nil\n @search_text = nil\n\n return if !query_text\n query_text = query_text.strip\n return if query_text.empty?\n\n # Try to get the search prefix:\n @prefix = PRE...
[ { "docid": "f6b1c760219946f880b0271b7b2b9746", "score": "0.74686444", "text": "def initialize(query)\n if query.is_a?(String)\n @query = query\n else\n @query = \"\"\n end\n @results = nil\n end", "title": "" }, { "docid": "b3c0a9516c3b1e1b3ec454aa1a0fd7ea", "score...
a26839f89e1fc2a9c99f4856222aeaf3
Gets the statistics for all toplevel SNATs.
[ { "docid": "48df179687d235c72d57f31c57430bde", "score": "0.0", "text": "def all_statistics\n super\n end", "title": "" } ]
[ { "docid": "55294d7905518f5af6dec71494cc70c3", "score": "0.5934438", "text": "def stats\n groups = ::Twigg::Pivotal::Status.status\n\n groups.each do |current_state, stories|\n header = pluralize stories.size,\n \"#{current_state} story\",\n ...
50fed00408edb1e6f4dabb36cb9a8ce5
Instantiates a new riskyServicePrincipal and sets the default values.
[ { "docid": "e3ee41dcc4c16d810f48d9d372dbee77", "score": "0.0", "text": "def initialize()\n super\n end", "title": "" } ]
[ { "docid": "c9d4bc6d93885c196de3df9349fea289", "score": "0.5468958", "text": "def init_defaults(user)\n logger.info(\"Setting default values for new Claim instance.\")\n if status.nil?\n self.status = \"Neu\" # Status eines neuen Claims ist immer \"Neu\"\n end\n if insert_user.nil?\n ...
e70c53f6a98c0c57e4f86d9189b146fd
Get the number of different item price
[ { "docid": "9f1238809fe03d8c10d4987dbf937c51", "score": "0.8003404", "text": "def number_of_item_price\n number_of_prices = 0\n number_of_prices += 1 unless price_definition_1.nil?\n number_of_prices += 1 unless price_definition_2.nil?\n number_of_prices += 1 unless p...
[ { "docid": "4840cfdb10d6a7446648a7b3883deeb9", "score": "0.72172624", "text": "def item_count(product_item)\n product_option.items.count(product_item) * option_count\n end", "title": "" }, { "docid": "8fe00ce8c4352e899a5fcd453c9cc6a8", "score": "0.7052631", "text": "def products_...
8cf910c3e94c78413e1718c2928b5f59
Update a dashboard list. Update the name of a dashboard list.
[ { "docid": "6fda9919cc688b732ae36aff56007391", "score": "0.64859754", "text": "def update_dashboard_list_with_http_info(list_id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DashboardListsAPI.update_dashboard_list ...'\n end\n ...
[ { "docid": "8e4b6fe9257679dc2056fe401a016af8", "score": "0.7237055", "text": "def update_dashboard_list(list_id, body, opts = {})\n data, _status_code, _headers = update_dashboard_list_with_http_info(list_id, body, opts)\n data\n end", "title": "" }, { "docid": "9f64297b554dde44...
a640875039b6805a9cf3700251d0bc17
Returns a symbol representation of this action This is used to determine how to delegate the methods within the turn
[ { "docid": "aec3254d564161c6b82db3272e0938fc", "score": "0.0", "text": "def symbol\n self.class.name.split('::').last.downcase.to_sym\n end", "title": "" } ]
[ { "docid": "fad423fc84188f4d2f952fc56aa168c4", "score": "0.7296479", "text": "def action_sym\n name.split('#', 2).last.to_sym\n end", "title": "" }, { "docid": "d63f4f3155fe6688355b5b1b849dbcdc", "score": "0.6925442", "text": "def action\n self[:action].to_sym if self[:act...
8fbdd8cc747c1ddcc33ac16b2e6d9f83
Are we connected and authenticated to the server?
[ { "docid": "5e7cfffa5538c0499ac06e8147c0d6a8", "score": "0.7568485", "text": "def authenticated?\n begin\n ensure_logged_in\n true\n rescue\n false\n end\n end", "title": "" } ]
[ { "docid": "096fe680df1015e7f32fdc8a92709017", "score": "0.844951", "text": "def authok?\n @connection.authok\n end", "title": "" }, { "docid": "096fe680df1015e7f32fdc8a92709017", "score": "0.844951", "text": "def authok?\n @connection.authok\n end", "title": "" ...
abdf0a2224328f9e04b41c5d98976e57
Finds data.first, feeds it down the accessor chain, and overwrites the stored value with the returned result. If +:pop+ is returned from the accessor chain, the stored value will be removed using data.delete_at(0).
[ { "docid": "5a54c507a3f6eaa57fc44545d4147596", "score": "0.7332053", "text": "def get_and_update(data)\n old_value = traverse_or_default(data)\n\n case yield(old_value)\n in [:clean, result, _]\n [:clean, result, data]\n in [:dirty, result, new_value]\n if data.respond_to?(:\"first...
[ { "docid": "346ef60bcbbfe60842c4a29d646591b5", "score": "0.6312845", "text": "def pop\n if !@data\n @data\n else\n last_value = @data.value\n @data.value = @data.next_node.value\n @data.next_node = @data.next_node.next_node\n last_value\n end\n end", "title": "" ...