query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
listlengths
19
19
metadata
dict
GET /electronica_consejeros GET /electronica_consejeros.json
def index @electronica_consejeros = ElectronicaConsejero.all end
[ "def index\r\n @electrica_consejeros = ElectricaConsejero.all\r\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\r\n @consejeros = Consejero.all\r\n end", "def index\n @tecn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /electronica_consejeros POST /electronica_consejeros.json
def create respond_to do |format| if @electronica_consejero.save format.html { redirect_to @electronica_consejero, notice: 'Se añadió un nombre de consejero de ingeniería electrónica correctamente.' } format.json { render :show, status: :created, location: @electronica_consejero } ...
[ "def create\n @condominios = Condominio.new(params[:condominio])\n\n respond_to do |format|\n if @condominios.save\n format.html { redirect_to @condominios, notice: 'Condominio was successfully created.' }\n format.json { render json: @condominios, status: :created, location: @condominios }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /electronica_consejeros/1 PATCH/PUT /electronica_consejeros/1.json
def update respond_to do |format| if @electronica_consejero.update(electronica_consejero_params) format.html { redirect_to @electronica_consejero, notice: 'El nombre del consejero de ingeniería electrónica se actualizó correctamente.' } format.json { render :show, status: :ok, location: @e...
[ "def update\n @condominios = Condominio.find(params[:id])\n\n respond_to do |format|\n if @condominios.update_attributes(params[:condominio])\n format.html { redirect_to @condominios, notice: 'Condominio was successfully updated.' }\n format.json { head :ok }\n else\n format.htm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /electronica_consejeros/1 DELETE /electronica_consejeros/1.json
def destroy @electronica_consejero.destroy respond_to do |format| format.html { redirect_to electronica_consejeros_url, notice: 'El nombre del consejero de ingeniería electrónica se eliminó correctamente.' } format.json { head :no_content } end end
[ "def destroy\n @condominios = Condominio.find(params[:id])\n @condominios.destroy\n\n respond_to do |format|\n format.html { redirect_to condominia_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @electronica_asignatura.destroy\r\n respond_to do |format|\r\n forma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /aggregate_metadata/new GET /aggregate_metadata/new.json
def new @aggregate_metadatum = AggregateMetadatum.new respond_to do |format| format.html # new.html.erb format.json { render json: @aggregate_metadatum } end end
[ "def new\n @aggregate = Aggregate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aggregate }\n end\n end", "def new\n @aggregate_metric_metadata = AggregateMetricMetadata.new\n\n respond_to do |format|\n format.html # new.html.erb\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /aggregate_metadata/1 DELETE /aggregate_metadata/1.json
def destroy @aggregate_metadatum = AggregateMetadatum.find(params[:id]) @aggregate_metadatum.destroy respond_to do |format| format.html { redirect_to aggregate_metadata_url } format.json { head :no_content } end end
[ "def destroy\n @aggregate_metric_metadata = AggregateMetricMetadata.find(params[:id])\n @aggregate_metric_metadata.destroy\n\n respond_to do |format|\n format.html { redirect_to(aggregate_metric_metadatas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aggregate = Aggrega...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom contexts This contexts provides all of the base hooks for testing against a cinchbot. It reduces the boilerplate code needed to run each test. It should only be used in the outermost context, as it creates and runs fake IRCd and cinchbot instances.
def describe_with_cinchbot(comment, &block) context_class = context comment.to_s do before(:context) do @config = YAML.load_file File.join(TEST_ROOT, '/_config/cinchize.yml') @ircd = Ircd.new @config['servers']['network_test']['nick'], @config['servers']['network_test']['channels'].first @cinchb...
[ "def set_context\n require 'factory_bot_rails'\n require './test/contexts'\n include Contexts\n puts 'Contexts enabled'\n if Contexts.respond_to?(:create_all)\n create_all\n puts 'Contexts built'\n end\nend", "def context\n @context ||= new_context_mock(context_options, &finalize_proc)\n e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
message has been sent?
def msg_sent? true end
[ "def message_sent?\n message.sent?\n end", "def message_sent?\n message.state == 'sent'\n end", "def sent?\n self.status == 'sent'\n end", "def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end", "def has_next_message\n\t\tend", "def receive_message\n #$>.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of symbols. one symbol (column name) for each column that contains errors.
def get_columns_with_errors(model_instance) list = model_instance.errors.map {|e| e[0].to_sym} end
[ "def errors\r\n\t\t\tresult = []\r\n\t\t\t@table.each do |key, symbol|\r\n\t\t\t\tresult << InternalError.new(\"no domain symbol set on #{key.inspect}\") if symbol.class <= DomainValueSymbol && symbol.domain_symbol.nil?\r\n\t\t\tend\r\n\t\t\treturn result\r\n\t\tend", "def symbol cols\n decode_values :symbol, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /item_classifications GET /item_classifications.json
def index @item_classifications = ItemClassification.all end
[ "def list_item_classifications(companyId, itemId, options={}) path = \"/api/v2/companies/#{companyId}/items/#{itemId}/classifications\"\n get(path, options, AvaTax::VERSION) end", "def classifications(classification)\n params = {\n classification: classification\n }.compa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /item_classifications POST /item_classifications.json
def create @item_classification = ItemClassification.new(item_classification_params) respond_to do |format| if @item_classification.save format.html { redirect_to @item_classification, notice: 'Classificação criada com sucesso.' } format.json { render :show, status: :created, location: @i...
[ "def create_item_classifications(companyId, itemId, model) path = \"/api/v2/companies/#{companyId}/items/#{itemId}/classifications\"\n post(path, model, {}, AvaTax::VERSION) end", "def create\n @item_classification = ItemClassification.new(params[:item_classification])\n\n respond_to do |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /item_classifications/1 PATCH/PUT /item_classifications/1.json
def update respond_to do |format| if @item_classification.update(item_classification_params) format.html { redirect_to @item_classification, notice: 'Classificação atualizada com sucesso.' } format.json { render :show, status: :ok, location: @item_classification } else format.htm...
[ "def update_item_classification(companyId, itemId, id, model) path = \"/api/v2/companies/#{companyId}/items/#{itemId}/classifications/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n @item_classification = ItemClassification.find(params[:id])\n\n respond_to do |format|\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /item_classifications/1 DELETE /item_classifications/1.json
def destroy @item_classification.destroy respond_to do |format| format.html { redirect_to item_classifications_url, notice: 'Classificação destruída com sucesso.' } format.json { head :no_content } end end
[ "def destroy\n @item_classification = ItemClassification.find(params[:id])\n @item_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to item_classifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_class = ItemClass.find(params[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find an `at_version` argument passed to a parent node. If one is found, then a design collection further up the AST has been filtered to reflect designs at that version, and so for consistency we should only present versions up to the given version here.
def at_version_arg(parent) ::Gitlab::Graphql::FindArgumentInParent.find(parent, :at_version, limit_depth: 4) end
[ "def at_version_arg(parent)\n # TODO: remove coercion when the compatibility layer is removed\n # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883\n version_id = ::Gitlab::Graphql::FindArgumentInParent.find(parent, :at_version, limit_depth: 4)\n version_id &&= VersionID.coerce_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test_reviewer_home Description: This method does the functional testing for the reviewer methods
def test_reviewer_home post('index', {}, {}) assert_response(:success) assert_template('tracker/index') post('index', {}, lee_hweng_session) assert_response(:success) assert_template('tracker/reviewer_home') #follow_redirect #assert_no_tag :content => "POST Placement Review" en...
[ "def test_reviewer_view\n \n # Verify that the reviewer view is called when the user is \n # logged in as a reviewer.\n mx234a_pre_art = design_reviews(:mx234a_pre_artwork)\n mx234a = designs(:mx234a)\n \n get(:view,{ :id => mx234a_pre_art.id}, ted_dft_session)\n assert_response(:suc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test_home_page_redirects Description: This method does the functional testing for the home page redirects.
def test_home_page_redirects post('admin_home', {}, {}) assert_redirected_to(:controller => 'tracker', :action => 'index') post('reviewer_home', {}, {}) assert_redirected_to(:controller => 'tracker', :action => 'index') post('manager_home', {}, {}) assert_redirected_to(:controller =...
[ "def test_home\n @current_test_name = \"Arch - Testing Home Page\"\n each_driver do\n each_view_redirects do\n common_elements?\n end\n end\n end", "def test_my_default\r\n get '/'\r\n follow_redirect!\r\n assert last_response.ok? # Tests if a positive redirect response receive...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /evaluation_builders GET /evaluation_builders.json
def index @evaluation_builders = @event.evaluation_builders end
[ "def index\n @builders = Builder.all\n end", "def builders\n @builders ||= {}\n end", "def builders(*values)\n if values.size > 0\n @builders ||= []\n @builders += values.flatten\n else\n @builders || (@project.parent ? @project.parent.eclipse.builders : [])\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /evaluation_builders POST /evaluation_builders.json
def create @evaluation_builder = @event.evaluation_builders.new(evaluation_builder_params) @evaluation_builder.organization_id = @event.organization_id respond_to do |format| if @evaluation_builder.save format.html { redirect_to @evaluation_builder, notice: 'Evaluation builder was successfully...
[ "def index\n @evaluation_builders = @event.evaluation_builders\n end", "def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n render :show, status: :created\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end", "def crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /evaluation_builders/1 PATCH/PUT /evaluation_builders/1.json
def update respond_to do |format| if @evaluation_builder.update(evaluation_builder_params) format.html { redirect_to @evaluation_builder, notice: 'Evaluation builder was successfully updated.' } format.json { render :show, status: :ok, location: @evaluation_builder } else format....
[ "def create\n @evaluation_builder = @event.evaluation_builders.new(evaluation_builder_params)\n @evaluation_builder.organization_id = @event.organization_id\n respond_to do |format|\n if @evaluation_builder.save\n format.html { redirect_to @evaluation_builder, notice: 'Evaluation builder was su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /evaluation_builders/1 DELETE /evaluation_builders/1.json
def destroy @evaluation_builder.destroy respond_to do |format| format.html { redirect_to event_evaluation_builders_url(@event), notice: 'Evaluation builder was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @builder.destroy\n respond_to do |format|\n format.html { redirect_to builders_url, notice: 'Builder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate and set the corrective_change parameter, based on the old_system_value of the property.
def calculate_corrective_change(old_system_value) # Only idempotent properties, and cases where we have an old system_value # are corrective_changes. if @property_instance.idempotent? && !@property_instance.sensitive && !old_system_value.nil? # If the values aren't insync, we have confi...
[ "def new_system_value(property, event, old_system_value)\n if event && event.status != \"success\"\n # For non-success events, we persist the old_system_value if it is defined,\n # or use the event previous_value.\n # If we're using the event previous_value, we ensure that it's\n # an array. ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If it's a failure, use 'err', else use either the resource's log level (if available) or 'notice'.
def log_level status == "failure" ? :err : (@default_log_level || :notice) end
[ "def rollbar_level(severity)\n [:debug, :info, :warning, :error, :critical, :error][severity] || :error\n end", "def resolve_log_level\n if auto_log_level?\n if using_output_formatter?\n :warn\n else\n :info\n end\n else\n Chef::Confi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the node if it is in a list. You should be careful to only remove nodes that are part of this list.
def remove?(node) if node.head return remove!(node) end return nil end
[ "def remove_node\n # Interface method\n end", "def remove_node(node)\n\t\tif is_node(node)\n\t\t\tindexing.remove_element(node)\n\t\t\ttrue\n\t\telse\n\t\t\t#raise ArgumentError, 'The node is invalid (non Node object or node isn\\'t in the graph)'\n\t\t\tfalse\n\t\tend\n\tend", "def remove\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update survey_answer, journal_entry.answered_at, csv_survey_answers.age, csv_score_rapports.age | created_at, csv_answers.age
def update_date entry = JournalEntry.find(params[:journal_entry][:id]) entry.follow_up = params[:journal_entry][:follow_up] date_param = params[:journal_entry][:created] if date_param.blank? entry.save flash[:notice] = "Opfølgning er rettet" redirect_to journaL_path(entry.journal) ...
[ "def update\n # TODO: try to retrieve the survey_sheet then update, avoid hacking by faking a id of non-self survey_sheet\n \n if (has_survey_responses(params))\n #render :text => \"in update, params has responses, so we can parse and update!\"\n # * parse and update the survey_sheet and response...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /post302s/new GET /post302s/new.xml
def new @post302 = Post302.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post302 } end end
[ "def create\n @post302 = Post302.new(params[:post302])\n\n respond_to do |format|\n if @post302.save\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }\n format.xml { render :xml => @post302, :status => :created, :location => @post302 }\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /post302s POST /post302s.xml
def create @post302 = Post302.new(params[:post302]) respond_to do |format| if @post302.save format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') } format.xml { render :xml => @post302, :status => :created, :location => @post302 } else format.h...
[ "def r302(*args)\n add_rule :r302, *args\n end", "def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /post302s/1 PUT /post302s/1.xml
def update @post302 = Post302.find(params[:id]) respond_to do |format| if @post302.update_attributes(params[:post302]) format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" }...
[ "def update\n @post301 = Post301.find(params[:id])\n\n respond_to do |format|\n if @post301.update_attributes(params[:post301])\n format.html { redirect_to(@post301, :notice => 'Post301 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :actio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /post302s/1 DELETE /post302s/1.xml
def destroy @post302 = Post302.find(params[:id]) @post302.destroy respond_to do |format| format.html { redirect_to(post302s_url) } format.xml { head :ok } end end
[ "def destroy\n @post301 = Post301.find(params[:id])\n @post301.destroy\n\n respond_to do |format|\n format.html { redirect_to(post301s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post443 = Post443.find(params[:id])\n @post443.destroy\n\n respond_to do |format|\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the number of columns defined in TotalSpaces2. This does not change the actual number of desktops present, you should call add_desktops_on_display or remove_desktops_on_display as appropriate after changing the number of columns. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_grid_columns_on_...
def set_grid_columns_on_display(columns, display_id) TSApi.tsapi_setDefinedColumnsOnDisplay(columns, display_id) end
[ "def num_cols=(num_c)\n (num_c - num_cols).times do\n add_col\n end\n end", "def columns=(integer); end", "def start_columns(size = 2, gutter = 10)\n # Start from the current y-position; make the set number of columns.\n return false if @columns_on\n\n @columns = {\n :current => 1,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Command TotalSpaces2 to switch to the given space number on the main display. Returns false if the space number was invalid. The on_space_change notification will be sent. TotalSpaces2.move_to_space(1)
def move_to_space(space_number) TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0) end
[ "def move_to_space(space_number)\n TSApi.tsapi_moveToSpace(space_number)\n end", "def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end", "def move_space_on_display_to_position_on_display(space_number, from_display_id, position_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Command TotalSpaces2 to switch to the given space number. Returns false if the space number was invalid. The on_space_change notification will be sent. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_to_space_on_Display(1, display_id)
def move_to_space_on_display(space_number, display_id) TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id) end
[ "def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end", "def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_num...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the name for a space on the main display. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. TotalSpaces2.set_name_for_space(1, "Home")
def set_name_for_space(space_number, name) TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0) end
[ "def set_name_for_space_on_display(space_number, name, display_id)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)\n end", "def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpace(space_number, name)\n end", "def change\n old_name = @space.name\n @sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the name for a space. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_name_for_space_on_display(1, "Home", display_...
def set_name_for_space_on_display(space_number, name, display_id) TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id) end
[ "def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)\n end", "def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpace(space_number, name)\n end", "def display_name_set(name)\n display_name.set(name)\n end", "def chan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel the on_space_change notification.
def cancel_on_space_change $tsapi_on_space_change_block = nil TSApi.tsapi_unsetSpaceWillChangeCallback end
[ "def onCancel(flag, view)\n @activate = false\n @ended = true\n clearSelection()\n cleanup()\n \nend", "def cancel_process (wfid)\n\n @context.storage.put_msg('cancel_process', 'wfid' => wfid)\n end", "def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel the layout change notification
def cancel_on_layout_change $tsapi_on_layout_change_block = nil TSApi.tsapi_unsetLayoutChangedCallback end
[ "def cancel_timesheet_alert\n \n render :layout => 'none' \n \n end", "def click_cancel_config_edit\n wait_for_update_and_click_js cancel_button_element\n end", "def uninstall\n self.installed_view.removeConstraint(self.layout_constraint)\n self.layout_constraint = nil\n sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move a window to a given space The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid.
def move_window_to_space(window_id, space_number) TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0) end
[ "def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpace(window_id, space_number)\n end", "def move_window_to_space(window, space)\n execute \"window #{window} --space #{id_for(space)}\"\n end", "def move_window_to_space_on_display(window_id, space_number, display_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move a window to a given space on the main display The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid.
def move_window_to_space_on_display(window_id, space_number, display_id) TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id) end
[ "def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end", "def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpace(window_id, space_number)\n end", "def move_window_to_space(window, space)\n ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move space to a new position in the grid on the main display. Returns false if the space_number or position_number is not valid. TotalSpaces2.move_space_to_position(4, 2)
def move_space_to_position(space_number, position_number) TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0) end
[ "def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPosition(space_number, position_number)\n end", "def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move space to a new position in the grid. Spaces can only be moved within their own display. Returns false if the space_number or position_number is not valid. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_space_to_position_on_display(4, 2, display_id)
def move_space_to_position_on_display(space_number, position_number, display_id) TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id) end
[ "def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end", "def move_space_to_position(space_number, position_number)\n TSAp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move space to a new position on another screen. This won't work if you do not have displays have separate spaces enabled. Returns false if any parameters are not valid. display_id = TotalSpaces2.main_display[:display_id] display2_id = TotalSpaces2.display_list[1][:display_id] TotalSpaces2.move_space_on_display_to_posit...
def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id) TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id) end
[ "def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end", "def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. TotalSpaces2.add_desk...
def add_desktops(number_to_add) TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0) end
[ "def add_desktops(number_to_add)\n TSApi.tsapi_addDesktops(number_to_add)\n end", "def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end", "def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. display_id = TotalSpa...
def add_desktops_on_display(number_to_add, display_id) TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id) end
[ "def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end", "def add_desktops(number_to_add)\n TSApi.tsapi_addDesktops(number_to_add)\n end", "def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would ...
def remove_desktops(number_to_remove) TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0) end
[ "def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktops(number_to_remove)\n end", "def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end", "def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would ...
def remove_desktops_on_display(number_to_remove, display_id) TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id) end
[ "def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end", "def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktops(number_to_remove)\n end", "def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move a particular window to the front and activate it. This might be usful after moving windows to other desktops.
def set_front_window(window_id) TSApi.tsapi_setFrontWindow(window_id) end
[ "def bring_to_front\n \t\tautoit.WinActivate title, ''\t\t\n \tend", "def activate\n @window.activate\n end", "def activate_process_window( pid )\n pid , hwnd = find_parent_process_with_hwnd(pid)\n wsh.AppActivate(pid) if pid\n end", "def window_activate(title, text = nil)\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind an app to a space. The bundle_id is normally in the format "com.apple.mail" Setting the space_uuid to AllSpaces will result in an app appearing on every desktop. Setting the space_uuid to nil will delete the setting for the given bundle_id. TotalSpaces2.bind_app_to_space("com.apple.mail", "AllSpaces")
def bind_app_to_space(bundle_id, space_uuid) TSApi.tsapi_bindAppToSpace(bundle_id, space_uuid) end
[ "def bind_app_services(app, service_instance_guid)\n service_instance = @client.service_instance(service_instance_guid)\n service_binding = @client.service_binding\n service_binding.app = app\n service_binding.service_instance = service_instance\n app.bind(service_instance)\n\n end", "def update(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the current week, from the specified array of weeks, based on the weeks' start times
def get_current_week_from_weeks(weeks) now = DateTime.now weeks.each { |week| if now < week.start_time return (week.number - 1) end } return weeks.last.number end
[ "def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end", "def week\n [Time.new(year, month, week_start), Time.new(year, month, week_end)]\n end", "def week(*weeks)\n TExp::Week.new(normalize_weeks(weeks))\n end", "def setup_weeks(week_start)\n a_date = self.first\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the week number based on whether any games in that particular week have already started
def game_week now = DateTime.now all_games = NflSchedule.where(year: Date.today.year) .order(:start_time) week_started = 0 all_games.each { |game| if (week_started < game.week) && (now > game.start_time) week_started = game.week end } return week_st...
[ "def game_week\n now = DateTime.now\n all_games = NflSchedule.where(year: current_season_year)\n .order(:start_time)\n week_started = 0\n all_games.each { |game|\n if (week_started < game.week) && (now > game.start_time)\n week_started = game.week\n end\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /university_profiles/1 GET /university_profiles/1.json
def show @university_profile = UniversityProfile.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @university_profile } end end
[ "def profiles\n hash = {:username => @username}\n @api.request(\"users/profiles/?#{build_query_string(hash)}\")\n end", "def profile_detail()\n get(\"profile\")\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def get_profiles\n if authenticate\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /university_profiles/new GET /university_profiles/new.json
def new @university_profile = UniversityProfile.new @university_profile.university_courses || @user.build_university_courses respond_to do |format| format.html # new.html.erb format.json { render json: @university_profile } end end
[ "def new\n @profile = current_user.profiles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /university_profiles POST /university_profiles.json
def create @university_profile = UniversityProfile.new(params[:university_profile]) respond_to do |format| if @university_profile.save format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' } format.json { render json: @university...
[ "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: 201, location: @profile }\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /university_profiles/1 PUT /university_profiles/1.json
def update @university_profile = UniversityProfile.find(params[:id]) respond_to do |format| if @university_profile.update_attributes(params[:university_profile]) format.html { redirect_to @university_profile, notice: 'University profile was successfully updated.' } format.json...
[ "def update\n if @university.update(university_params)\n render json: @university, status: :ok #, location: @university\n else\n render json: @university.errors, status: :unprocessable_entity\n end\n end", "def update_current_user_profile_data(user_profile_data)\n # PU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /university_profiles/1 DELETE /university_profiles/1.json
def destroy @university_profile = UniversityProfile.find(params[:id]) @university_profile.destroy respond_to do |format| format.html { redirect_to university_profiles_url } format.json { head :no_content } end end
[ "def destroy\n @profile = Profile.find(params[:id])\n @profile.user.destroy\n @profile.destroy\n\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @official_profile = OfficialProfile.find(params[:id])\n @of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the basic blocks in an array of instructions.
def basic_blocks(insns) # Jump and branch targets give us the start of each basic block. targets = targets(insns) # Create a basic block for each jump or branch target. blocks = {} targets.each_with_index do |start, index| # Slice the instructions that form this blo...
[ "def build_basic_blocks\n block_starts = find_basic_block_starts\n\n length = 0\n blocks =\n iseq\n .insns\n .grep(Instruction)\n .slice_after do |insn|\n length += insn.length\n block_starts.include?(length)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert one basic block to a fragment of graph.
def basic_block_to_fragment(insns, ip=0, profile=nil) # Basic blocks start with a merge node. merge = Node.new(:merge) # We're going to build up a list of names and stack values coming into # this basic block that we're going to need to connect up later when # we form a complet...
[ "def fragment(ast_node, &block)\n GeneratedFragment.new(self, ast_node).tap do |frag|\n yield frag if block_given?\n end\n end", "def visit_block(node); end", "def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle warning emails to all users
def warning_email(user, warning) @user = user @warning = warning mail to: @user.email, subject: 'CastleBridge Warning Email' end
[ "def sendWarning(warning)\n users = User.all\n users.each do |user|\n TextMailer.warning_email(user, warning).deliver_now\n end\n end", "def warned\n\t\t# Pick a random user and temporary set his status to 'warned'\n\t\tuser = User.first\n\t\tuser.status = 'warned'\n\t\tUserStatusMailer.set_mail(us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reindex specific user only , instead of whole class.
def reindex_user! Sunspot.index! self end
[ "def reindex\n return unless search_data.keys.detect { |key| send(\"#{key}_changed?\") }\n Rails.logger.debug \"User #{id} is gonna be re-indexed\"\n super\n end", "def reindex( _uid, _text )\n # TODO\n end", "def refresh_user_search_index()\n start.uri('/api/user/search')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates a new securityContainerRegistryEvidence and sets the default values.
def initialize() super @odata_type = "#microsoft.graph.security.containerRegistryEvidence" end
[ "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.registryValueEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.registryKeyEvidence\"\n end", "def initialize()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the registry property value. The registry URI.
def registry=(value) @registry = value end
[ "def registry_value=(value)\n @registry_value = value\n end", "def registry_key=(value)\n @registry_key = value\n end", "def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_dir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /qs/1 DELETE /qs/1.json
def destroy @q.destroy respond_to do |format| format.html { redirect_to qs_url } format.json { head :no_content } end end
[ "def destroy\n @q = Q.find_by_unique_id(params[:id])\n @q.destroy\n\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
even if list order is incorrect, parser shouldn't failed and it is recognized as toplevel.
def test_nested_ordered_list_incorrect assert_nothing_raised do parser = Juli::Parser.new parser.parse(data_path('t005.txt'), Juli::Visitor::Tree.new) end end
[ "def parse_first_list_line(indentation, content); end", "def parse_list; end", "def validate_top_level!\n invalid = @root.nil? && @tokens.any? do |t|\n !t.route?\n end\n fail UnexpectedTypeError, 'Found non-route at toplevel' if invalid\n end", "def parse_args\n nolfws\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax answer the next page for paginated Prescriber search
def nextPrescribers @searchPrescribers = Prescriber.nextPrescribers params[:start], params[:page], 9 render template: 'common/search/js/nextSearchPrescribers.js' end
[ "def nextPrescribers\n @searchPrescribers = Prescriber.nextActivePrescribers params[:start], params[:page], 9\n @searchController = \"prescriptions\"\n render template: 'common/search/js/nextSearchPrescribers.js'\n end", "def nextPrescriptions\n nextPage = params[:page] ? params[:p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /prescribers/1 DELETE /prescribers/1.json
def destroy @prescriber.destroy respond_to do |format| format.html { redirect_to prescribers_url, notice: 'Prescriber was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @prescriber.destroy\n # respond_to do |format|\n # format.html { re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if one of the sample attachments is audio
def contains_audio? result = false sample_attachments.map{|sa| result = true if sa.is_audio?} result end
[ "def audio?\n !!(self.file_content_type =~ %r{^(audio)/.*$})\n end", "def audio?\n media_type == :audio\n end", "def audio?\n content_type.start_with?(\"audio\")\n end", "def is_audio_type?\n file_content_type =~ /\\Aaudio\\/.*\\Z/\n end", "def audio?\n has_stream_of :audio\n end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if one of the sample attachments is video
def contains_video? result = false sample_attachments.map{|sa| result = true if sa.is_video?} result end
[ "def video?\n content_type.start_with?(\"video\")\n end", "def is_video_type?\n file_content_type =~ %r(video)\n end", "def video?\n !!( content_type =~ Transit.config.video_regexp )\n end", "def video?\n media_type == :video\n end", "def video_file_type?\n MIME::Types.of(@raw_n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if one of the sample attachments is document
def contains_document? result = false sample_attachments.map{|sa| result = true if sa.is_document?} result end
[ "def is_document?\n @type == :document\n end", "def document?\n self.type == \"Document\"\n end", "def document?\n self.type == \"Assetabler::Document\"\n end", "def is_type_attachment?()\n\t\t\t\tif !@result.nil?\n\t\t\t\t\t@result.each do |elem|\n\t\t\t\t\t\tif elem[:type] == 'attachment...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if one of the sample attachments is image
def contains_image? result = false sample_attachments.map{|sa| result = true if sa.is_image?} result end
[ "def image?\n attachment.content_type =~ /^image/\n end", "def image?\n !(self.attachment_content_type =~ /^image.*/).nil?\n end", "def image?\n attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def image?\n self.file_content_type == '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get videos using playlist ID
def get_vidio_playlist key id #playlstId is the Uploads ID in channel_details channel_vidios = Youtube.get('/playlistItems?part=snippet&playlistId=UU-lHJZR3Gqxm24_Vd_AJ5Yw&key=' + key) end
[ "def all_videos_of_one_playlist playlist_id\n result = get_videos playlist_id\n next_page_token = result['nextPageToken']\n videos = result['items']\n loop do\n break if next_page_token.nil?\n result = get_videos(playlist_id, next_page_token)\n next_page_token = result['nextPageToken']\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /work_articles POST /work_articles.json
def create @work_article = WorkArticle.new(work_article_params) respond_to do |format| if @work_article.save format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.created', resource: t('work_articles.form...
[ "def create\n article = @project.articles.create(params_for_create)\n\n respond_with article do |format|\n format.json do\n if article.errors.blank?\n render json: decorate_article(article), status: :accepted\n else\n render json: { error: { err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /work_articles/1 PATCH/PUT /work_articles/1.json
def update respond_to do |format| if @work_article.update(work_article_params) format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.updated', resource: t('work_articles.form.resource')) } format.json ...
[ "def update\n article = Article.find(params[:id])\n article.update(article_params)\n render json: { article: article }\n end", "def update\n respond_to do |format|\n if @articles123.update(articles123_params)\n format.html { redirect_to @articles123, notice: 'Articles123 was successfully ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /work_articles/1 DELETE /work_articles/1.json
def destroy @work_article.destroy respond_to do |format| format.html { redirect_to work_articles_url } format.json { head :no_content } end end
[ "def destroy\n @articles123.destroy\n respond_to do |format|\n format.html { redirect_to articles123s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @articles1.destroy\n respond_to do |format|\n format.html { redirect_to articles1s_url }\n format.json { h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts all .less files in +paths+ to STYLESHEETS_PATH/[filename].css. Options: compress Remove all newlines? `true` or `false`.
def run(options = {}) paths.map {|path| Dir["#{path}/*.less"]}.flatten.each {|less_source| destination_filename = "#{File.basename(less_source, File.extname(less_source))}.css" destination = "#{STYLESHEETS_PATH}/#{destination_filename}" if !File.exists?(destination) || File.stat(less_source...
[ "def run(options = {})\n paths.each do |path|\n Dir.chdir(path) do\n Dir[\"**/*.less\"].each do |less_sheet|\n directory = File.dirname(less_sheet)\n target_filename = File.basename(less_sheet, File.extname(less_sheet)) + \".css\"\n destination = \"#{directory}/#{target_fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
execute cassandra's nodetool and return output as string
def nodetool_cmd(cmd) `nodetool -h #{config[:hostname]} -p #{config[:port]} #{cmd}` end
[ "def nodetool_cmd(cmd)\n out = `nodetool -h #{config[:hostname]} -p #{config[:port]} #{cmd} 2>&1`\n [out, $CHILD_STATUS]\n end", "def nodetool_info()\n out = `/opt/cassandra/bin/nodetool info`\n if $? == 0\n props = {}\n out.split(\"\\n\").each do |line|\n p = line.split(':')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$ nodetool status Datacenter: LON5 ================ Status=Up/Down |/ State=Normal/Leaving/Joining/Moving Address Load Tokens Owns Host ID Rack UN 172.16.1.1 1.88 GB 256 ? 5uu5274d0c1c46f1b73cc28ffdcad10e A125 DN 172.16.1.2 2.55 GB 256 ? 4uu6478c0e29468cad38f417ccbcf403 A125 UL 172.16.1.3 3.24 GB 256 ? fuu0063da0334a78...
def parse_ndstatus# rubocop:disable all nodestatus = nodetool_cmd('status') nodestatus.each_line do |line| next if line.match(/^Datacenter:/) next if line.match(/^=======/) next if line.match(/^Status/) next if line.match(/State/) next if line.match(/^--/) next if line.match(...
[ "def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the default locale for the object
def default_locale evaluate_localization_option!(:default_locale) end
[ "def default_locale\n return @default_locale\n end", "def default_locale\n self.found_locale ||= find_locale\n end", "def default_locale\n client.default_locale\n end", "def default_locale=(value)\n @default_locale = value\n end", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the missing translation placeholder
def missing_translation_placeholder field evaluate_localization_option!(:placeholder, field) end
[ "def text_unfound\n case @lang\n when :en then \"Unfound localized text for `#{id}#{extension}'\"\n when :fr then \"Impossible de trouver le texte localisé `#{id}#{extension}'\"\n end\n end", "def t(key, default = '')\n c = I18n.t(key)\n if c.match(/translation missing/i)\n c = I18n.t(key, local...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the node at the end of the list and returns its value
def remove_last raise 'No such element' if @size == 0 elt = @tail.value if @size == 1 @head = nil @tail = nil else @tail = @tail.previous @tail.next.previous = nil @tail.next = nil end @size -= 1 return e...
[ "def pop\r\n # Return nil if the list is empty\r\n if self.head.nil?\r\n return nil\r\n end\r\n self.size -= 1\r\n return delete_element(self.head).value\r\n end", "def remove_last\n raise 'Empty List' if empty?\n\n item = @tail\n @tail = item.prev_node\n @tail.next_node =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the last element without removing it
def peek_last raise 'No such element' if @size == 0 @tail.value end
[ "def last\n elements.last\n end", "def last\n return nil if @list.empty?\n @list[tail]\n end", "def my_but_last( list )\n element_at list, length( list ) - 1\nend", "def last\n lambda do |_rec, acc|\n acc.slice!(0, acc.length - 1)\n end\n end", "def remove_last\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize a node with value v, previous p and next n
def initialize(v, n, p) @value = v @next = n @previous = p end
[ "def initialize(value, n)\n @value = value\n @next = n\n end", "def initialize(value = nil, next_node = nil, prev_node = nil)\n @value = value\n @next = next_node\n @prev = prev_node\n end", "def initialize(v, d, n = nil)\n self.node = n\n self.vector = v\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates the content of block and stores the result as content_for :sidebar. Because content_for concatenates the block, you can call sidebar multiple time and yield all the final content once. See ActionView::Helpers::CaptureHelpercontent_for for the full API documentation. ==== Examples Sidebar => Sidebar
def sidebar(&block) content_for :sidebar, &block end
[ "def widget_sidebar(&block)\n @widget_options[:sidebar_html] = capture(&block)\n end", "def sidebar!\n content_for(:layout_sidebar) do\n 'true'\n end\n end", "def wrapper(options={}, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n options[:class] = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /meeting_follow_ups GET /meeting_follow_ups.json
def index @meeting_follow_ups = MeetingFollowUp.all end
[ "def meetups\n add_breadcrumb \"My Meetups\", \"/users/#{current_user.id}/meetups\"\n\n @user = User.find(params[:id])\n if params[:status]\n @meetups = Meetup.find_user_meetups(current_user, params[:status])\n else\n @meetups = @user.meetups.order(:updated_at).reverse_order\n end\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /meeting_follow_ups POST /meeting_follow_ups.json
def create @meeting_follow_up = MeetingFollowUp.new(meeting_follow_up_params) respond_to do |format| if @meeting_follow_up.save format.html { redirect_to meeting_follow_up_record_employee_plans_path(plan_id: params[:meeting_follow_up][:employee_plan_id]), notice: 'Meeting follow up was successfull...
[ "def create\n @follow_up = FollowUp.new(params[:follow_up])\n\n respond_to do |format|\n if @follow_up.save\n format.html { redirect_to @follow_up, notice: 'Follow up was successfully created.' }\n format.json { render json: @follow_up, status: :created, location: @follow_up }\n else\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /meeting_follow_ups/1 PATCH/PUT /meeting_follow_ups/1.json
def update respond_to do |format| if @meeting_follow_up.update(meeting_follow_up_params) format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' } format.json { render :show, status: :ok, location: @meeting_follow_up } else format.html ...
[ "def update\n @follow_up = FollowUp.find(params[:id])\n\n respond_to do |format|\n if @follow_up.update_attributes(params[:follow_up])\n format.html { redirect_to @follow_up, notice: 'Follow up was successfully updated.' }\n format.json { head :no_content }\n else\n format.html ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /meeting_follow_ups/1 DELETE /meeting_follow_ups/1.json
def destroy @meeting_follow_up.destroy respond_to do |format| format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @meetup = Meetup.find(params[:id])\n @meetup.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n @follow_up = FollowUp.find(params[:id])\n @follow_up.destroy\n\n respond_to d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal: Builds body of a mixin Returns string representation of a mixin with asset helper functions
def build_mixin_body(scope) @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' } <<-STYL asset-url(key) return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} () asset-path(key) return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[...
[ "def build_mixin_body(scope)\n @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' }\n <<-STYL\n#{generate_helper(scope, 'asset')}\n#{generate_helper(scope, 'image')}\n#{generate_helper(scope, 'audio')}\n#{generate_helper(scope, 'video')}\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the cache of defined VMs for a user. It is a hash with VM id as key and VmUsage as value
def vms(user) vms=@users[user] @users[user]=vms=Hash.new if !vms vms end
[ "def user_vms(user)\n running_vms.select { |vm| vm.handle['UID'] == user.id }\n end", "def total(user)\n usage=VmUsage.new(0.0, 0, 0)\n \n @users[user].each do |id, vm|\n usage.cpu+=vm.cpu\n usage.memory+=vm.memory\n usage.num_vms+=1\n end if @u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns total consumption by a user into a VmUsage object
def total(user) usage=VmUsage.new(0.0, 0, 0) @users[user].each do |id, vm| usage.cpu+=vm.cpu usage.memory+=vm.memory usage.num_vms+=1 end if @users[user] usage end
[ "def get_user_total(user)\n self.get_user_items(user).to_a.sum(&:user_cost)\n end", "def usage_summary(now=DateTime.now)\n summary = {\n this_month: { secs: 0, hours: 0, overage: {}, ondemand: {}, cost: 0.00 },\n current: [],\n history: [],\n }\n year = now.utc.year\n month = now.ut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /hp_searches GET /hp_searches.json
def index @hp_searches = HpSearch.all end
[ "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.htm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /hp_searches POST /hp_searches.json
def create @hp_search = HpSearch.new(hp_search_params) respond_to do |format| if @hp_search.save format.html { redirect_to @hp_search, notice: 'Hp search was successfully created.' } format.json { render :show, status: :created, location: @hp_search } else format.html { rend...
[ "def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end", "def json_POST_search(request)\n options = search_options(request)\n data = request.env['rack.input'].read\n JSON.parse(data).map do |topic, lat, lon|\n t = Time.now\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /hp_searches/1 PATCH/PUT /hp_searches/1.json
def update respond_to do |format| if @hp_search.update(hp_search_params) format.html { redirect_to @hp_search, notice: 'Hp search was successfully updated.' } format.json { render :show, status: :ok, location: @hp_search } else format.html { render :edit } format.json { r...
[ "def update\n respond_to do |format|\n if @advance_search.update(advance_search_params)\n format.html { redirect_to @advance_search, notice: 'Advance search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n forma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /hp_searches/1 DELETE /hp_searches/1.json
def destroy @hp_search.destroy respond_to do |format| format.html { redirect_to hp_searches_url, notice: 'Hp search was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @advance_search.destroy\n respond_to do |format|\n format.html { redirect_to advance_searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
one_task.rake one_task task will run another_task.rake another_task task will run my_tasks_all_mine.rake mine:task1 task will run mine:task2 task has a duplicate (will not run) mine:task3 task has a duplicate (will not run) mine:task4 task will run other_tasks_run_all.rake other_task1_run_me task will run other_task2_r...
def create_rake_files(base_dir) one_task_fn = File.join(base_dir, 'one_task.rake') make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn) another_task_fn = File.join(base_dir, 'another_task.rake') make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_...
[ "def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end", "def all_evaluated_tasks_in_files(given_dir)\n eval_tasks = []\n\n [SOMETASK1, SOMETASK2, SOMETASK3, SOMETASK4, SOMETASK5].each do |sometask|\n eval_tasks << OneTimeTasker::EvaluatedRakeTask.new(sco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the file exists, ask if it's ok to overwrite. return true only if they said it was ok to overwrite. If the file does not exist, return true (it's ok to create it)
def ok_to_create?(filepath) File.exist?(filepath) ? prompt_to_overwrite?(filepath) : true end
[ "def write_okay?(file)\n if File.exist?(file)\n if $FORCE\n FileUtils.rm_r(file)\n else\n return nil.status(:already_exists, file)\n end\n end\n true\n end", "def overwrite?(path)\n if File.exist?(path)\n return yes? \"A file already exists ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make rake tasks for of the tasks in tasknames, in the file named filepath. Makes all directories needed for the filepath if they don't already exist.
def make_tasks_in_file(tasknames = [], filepath = '.', task_body = "\n", namespace: '') indent = "" filedir = File.dirname(filepath) FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir) File.open(filepath, 'w') do |f| unless namespace.empty? indent = " " f.puts namespace_start(...
[ "def make_tasks_in_file(tasknames = [], filepath = '.', task_body = \"\\n\")\n filedir = File.dirname(filepath)\n FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir)\n\n File.open(filepath, 'w') do |f|\n tasknames.each do | taskname |\n f.puts simple_rake_task(taskname, task_body)\n end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code for a simple task. The body of the task is given :task_body
def simple_rake_task(task_name = 'test_task', indent: '', task_body: "\n") "\n" + indent + "desc 'task named #{task_name}'\n" + indent + "task :#{task_name} do\n" + indent + " " + task_body + indent + "end\n\n" end
[ "def simple_rake_task(task_name = 'test_task', task_body = \"\\n\")\n \"namespace :shf do\\n\" +\n \" namespace :test do\\n\" +\n \" desc 'task named #{task_name}'\\n\" +\n \" task :#{task_name} do\\n\" +\n task_body +\n \" end\\n\" +\n \" end\\n \" +\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the input & output paths for the given script build phase.
def set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) if input_output_paths_use_filelist?(phase) [input_paths_by_config, output_paths_by_config].each do |hash| hash.each do |file_list, files| generator = Generator::FileList.new(files...
[ "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.she...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a 'Embed Pods Frameworks' Script Build Phase if present
def remove_embed_frameworks_script_phase_from_target(native_target) remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME) end
[ "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a shell script build phase responsible to copy the xcframework slice to the intermediate build directory.
def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {}) phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME) phase.shell_scri...
[ "def add_carthage_copy_phase(target)\n shell_script_name = 'Carthage copy-frameworks Run Script'\n target_names = target.shell_script_build_phases.map(&:name)\n unless target_names.include?(shell_script_name)\n shell_script = target.new_shell_script_build_phase shell_script_name\n shell...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a 'Copy XCFrameworks' Script Build Phase if present
def remove_copy_xcframeworks_script_phase_from_target(native_target) remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME) end
[ "def remove_framework_from_xcodeproj(framework_name)\n\n # Delete framework files\n source_dir_path = File.dirname(source_project_path)\n result_dir_path = File.join(source_dir_path, framework_name)\n \n if File.exist?(result_dir_path)\n FileUtil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a script phase from a native target by name
def remove_script_phase_from_target(native_target, phase_name) build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) } return unless build_phase.present? native_target.build_phases.delete(build_phase) end
[ "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }