query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Does this person currently have access to health coverage or a Health Reimbursement Arrangement that they are not enrolled in (including through another person, like a spouse or parent)?
def eligible_hash return [] # TODO: refactor as per offered markets @medicaid_hash[:insuranceCoverage].each do |_eligible_coverage| next if enrolled_coverage[:insuranceMarketType] == 'NONE' result << { kind: Ffe::Types::BenefitsKindMapping[enrolled_coverage[:insuranceMarketType].to_sym], status: 'is_eligible', start_on: Date.parse('2021-01-01'), # default value end_on: nil } end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cant_be_claimed_by_other_and_below_income_requirement?\n dependent.cant_be_claimed_by_other_yes? && dependent.below_qualifying_relative_income_requirement_yes?\n end", "def resolve_admission_visible?\n if @current_right.employee? || @current_right.external?\n then full_admission?\n els...
[ "0.6971547", "0.68541104", "0.67984533", "0.6675985", "0.6567603", "0.6537876", "0.6529181", "0.65071994", "0.6498856", "0.64824724", "0.6475954", "0.6474943", "0.641239", "0.6404495", "0.6360805", "0.63606125", "0.6359033", "0.63518614", "0.6348906", "0.63443446", "0.6341368...
0.0
-1
Is this person currently enrolled in health coverage or getting help paying for health coverage through a Health Reimbursement Arrangement?
def enrolled_hash result = [] @insurance_coverage_hash[:enrolledCoverages].each do |enrolled_coverage| next if ['NONE', 'EMPLOYER_SPONSORED'].include?(enrolled_coverage[:insuranceMarketType]) if enrolled_coverage[:insuranceMarketType] == "INDIVIDUAL_INSURANCE" && @medicaid_hash && @medicaid_hash[:insuranceCoverage] # TODO: what need to be done for EMPLOYER_SPONSORED for medicaid when "INDIVIDUAL_INSURANCE" @medicaid_hash[:insuranceCoverage].each do |medicaid_coverage| next unless medicaid_coverage[:insuranceMarketType] next if ['NONE', 'EMPLOYER_SPONSORED'].include?(medicaid_coverage[:insuranceMarketType]) next unless @medicaid_hash[:enrolledInHealthCoverageIndicator] result << { kind: Ffe::Types::BenefitsKindMapping[medicaid_coverage[:insuranceMarketType].to_sym], status: 'is_enrolled', start_on: Date.parse('2021-01-01'), # default value end_on: medicaid_coverage[:medicaidEndIndicator] ? medicaid_coverage[:medicaidEndDate] : nil } end else next unless enrolled_coverage[:insuranceMarketType] next unless Ffe::Types::BenefitsKindMapping[enrolled_coverage[:insuranceMarketType].to_sym] result << { kind: Ffe::Types::BenefitsKindMapping[enrolled_coverage[:insuranceMarketType].to_sym], status: 'is_enrolled', start_on: Date.parse('2021-01-01'), # default value end_on: nil } end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_honors #its gonna return true or false depdening if the object/student has honors\n if @gpa >= 3.5\n return true \n end \n return false \n end", "def is_member_of_household_if_required?\n return true unless requires_member_of_household_test?\n\n requires...
[ "0.6739171", "0.65589523", "0.64644766", "0.6376629", "0.63613856", "0.63407296", "0.6336976", "0.6336014", "0.6335779", "0.6328288", "0.6304173", "0.62682116", "0.6264157", "0.6262661", "0.62436634", "0.62148386", "0.62048227", "0.61938846", "0.6176657", "0.6175309", "0.6168...
0.0
-1
Is this person currently enrolled in health coverage or getting help paying for health coverage through a Health Reimbursement Arrangement?
def enrolled_esc_hash return [] unless @insurance_coverage_hash[:employerSponsoredCoverageOffers] # if insuranceMarketType is 'EMPLOYER_SPONSORED' then proceed to next step enrolled_coverages = @insurance_coverage_hash[:enrolledCoverages].select {|ec| ec[:insuranceMarketType] == 'EMPLOYER_SPONSORED'} return [] if enrolled_coverages.empty? @insurance_coverage_hash[:employerSponsoredCoverageOffers].collect do |_k, esc| next unless esc[:escEnrolledIndicator] esc_hash = AcaEntities::Ffe::Transformers::Cv::Esc.transform(esc.merge(kind: 'employer_sponsored_insurance', :status => "is_enrolled", phone: emp_phone(esc))) esc_hash[:employer].delete(:employer_phone) if esc_hash[:employer] && emp_phone(esc).blank? esc_hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_honors #its gonna return true or false depdening if the object/student has honors\n if @gpa >= 3.5\n return true \n end \n return false \n end", "def is_member_of_household_if_required?\n return true unless requires_member_of_household_test?\n\n requires...
[ "0.673941", "0.65596807", "0.64648944", "0.63766456", "0.6361567", "0.6340877", "0.6337309", "0.6337132", "0.6336302", "0.63284653", "0.63038397", "0.62683326", "0.6264327", "0.6263603", "0.6243463", "0.6216108", "0.6205022", "0.61945325", "0.61765146", "0.6176198", "0.616903...
0.0
-1
This is from attachment_fu_fixtures.
def attachment_model?(fixture) # HABTM join tables generate unnamed fixtures; skip them since they # will not include attachments anyway (you'd use HM:T) return false if fixture.nil? || fixture.class_name.nil? klass = if fixture.respond_to?(:model_class) fixture.model_class elsif fixture.class_name.is_a?(Class) fixture.class_name else Object.const_get(fixture.class_name) #fixture.class_name.camelize.constantize end # resolve real class if we have an STI model if k = fixture[klass.inheritance_column] klass = k.camelize.constantize end fixture_mising_file_for = fixture.to_hash.keys.grep(/file_for_/).empty? (klass && !fixture_mising_file_for) ? klass : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachment\n raise NotImplementedError, 'Please implement me. :('\n end", "def attachment; end", "def test_attachments_added\n Attachment.storage_path = TestHelper.files_path + '/files'\n issue = Issue.find(1)\n email = HelpdeskMailer.\n email_to_supportclient(\n issue,\n ...
[ "0.6770159", "0.6696701", "0.6283699", "0.6229266", "0.6154415", "0.61231565", "0.5916787", "0.5889247", "0.5887766", "0.58584815", "0.58106697", "0.58020484", "0.57302105", "0.5708757", "0.57058", "0.5654502", "0.5615778", "0.55751884", "0.5571758", "0.55538285", "0.5548003"...
0.5714219
13
Get information regarding the specified Cloud Instance === Required arguments type type of the cloud instance. Possible values are "ec2", "rackspace", "gogrid" instance_id id of the cloud instance in Monitis === Optional arguments timezoneoffset offset relative to GMT, used to show results in the timezone of the user
def info(type, instance_id, options={}) args = {type: type, instanceId: instance_id}.merge(options) get('cloudInstanceInfo', args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance_of_cloud(cloud_id, instance_of_cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances/#{instance_of_cloud_id}\") \n end", "def aws_instance_get(opts)\n AWS::EC2.new.instances[opts[:instance_id]]\n end", "def get_ec2_details(instance_id)\n ec2 = Aws::EC2::C...
[ "0.6161115", "0.6156417", "0.58374923", "0.5662537", "0.56257737", "0.56236386", "0.5543438", "0.5540554", "0.54755205", "0.54700935", "0.54425293", "0.54369766", "0.5377214", "0.53469706", "0.5304596", "0.5296391", "0.52764606", "0.5274775", "0.5258344", "0.52577055", "0.524...
0.7380922
0
GET /kf/sort_types GET /kf/sort_types.json
def index conditions = [] params[:per_page] = perpage if params[:per_page].nil? params[:page] = 1 if params[:page].blank? unless params[:search].blank? conditions.push "title like ? or description like ?" conditions.push "%#{params[:search]}%" conditions.push "%#{params[:search]}%" end @kf_sort_types = Kf::SortType.order("id DESC").paginate(:page => params[:page], :per_page => params[:per_page] ,:conditions => conditions) respond_to do |format| format.html # index.html.erb format.json { render json: @kf_sort_types } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sort_types = SortType.all\n end", "def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_tab...
[ "0.7310264", "0.6901032", "0.6749362", "0.66999304", "0.6572333", "0.65362", "0.64672244", "0.6371749", "0.63447756", "0.6295172", "0.62512213", "0.622824", "0.6224141", "0.62176085", "0.6203221", "0.6195682", "0.6168764", "0.613779", "0.61067", "0.60890394", "0.6077962", "...
0.69284993
1
GET /kf/sort_types/1 GET /kf/sort_types/1.json
def show @kf_sort_type = Kf::SortType.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @kf_sort_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sort_types = SortType.all\n end", "def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"title like ? or description like ?\"\n conditions.push \"%#...
[ "0.7407455", "0.6886707", "0.6772972", "0.67474604", "0.66431576", "0.6605025", "0.6537386", "0.65272313", "0.6484814", "0.64376825", "0.64157367", "0.63276917", "0.63265973", "0.6315456", "0.6292207", "0.628211", "0.6213078", "0.6190755", "0.6181705", "0.61720484", "0.615807...
0.72082376
1
GET /kf/sort_types/new GET /kf/sort_types/new.json
def new @kf_sort_type = Kf::SortType.new respond_to do |format| format.html # new.html.erb format.json { render json: @kf_sort_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @kf_sort_type = Kf::SortType.new(params[:kf_sort_type])\n\n respond_to do |format|\n if @kf_sort_type.save\n format.html { redirect_to kf_sort_types_url({:page => params[:page]}), notice: 'Sort type was successfully created.' }\n format.json { render json: @kf_sort_type, statu...
[ "0.7509356", "0.7160151", "0.71418476", "0.6609113", "0.6438381", "0.6252697", "0.61429995", "0.6070451", "0.5962859", "0.5949688", "0.58969563", "0.58820546", "0.58225423", "0.58022875", "0.579487", "0.57849973", "0.5702127", "0.56778634", "0.5669851", "0.5662975", "0.566297...
0.778308
0
POST /kf/sort_types POST /kf/sort_types.json
def create @kf_sort_type = Kf::SortType.new(params[:kf_sort_type]) respond_to do |format| if @kf_sort_type.save format.html { redirect_to kf_sort_types_url({:page => params[:page]}), notice: 'Sort type was successfully created.' } format.json { render json: @kf_sort_type, status: :created, location: @kf_sort_type } else format.html { render action: "new" } format.json { render json: @kf_sort_type.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sort_types = SortType.all\n end", "def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_tab...
[ "0.6817673", "0.6803999", "0.66339386", "0.63523656", "0.6283269", "0.6172277", "0.60445774", "0.6036694", "0.60232687", "0.59714526", "0.58344734", "0.58241326", "0.57855463", "0.575487", "0.5754733", "0.5752283", "0.574899", "0.574899", "0.5747693", "0.5746359", "0.5732689"...
0.6941032
0
PUT /kf/sort_types/1 PUT /kf/sort_types/1.json
def update @kf_sort_type = Kf::SortType.find(params[:id]) respond_to do |format| if @kf_sort_type.update_attributes(params[:kf_sort_type]) format.html { redirect_to kf_sort_types_url({:page => params[:page]}), notice: 'Sort type was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @kf_sort_type.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @sort_type.update(sort_type_params)\n format.html { redirect_to @sort_type, notice: 'Sort type was successfully updated.' }\n format.json { render :show, status: :ok, location: @sort_type }\n else\n format.html { render :edit }\n for...
[ "0.7033368", "0.67520094", "0.6654694", "0.6523376", "0.6520682", "0.64555", "0.6344083", "0.6135027", "0.608219", "0.60049415", "0.5956442", "0.5932856", "0.58494633", "0.58329576", "0.5829314", "0.5772021", "0.56875914", "0.5661305", "0.56543964", "0.5632907", "0.5588571", ...
0.72249204
0
DELETE /kf/sort_types/1 DELETE /kf/sort_types/1.json
def destroy @kf_sort_type = Kf::SortType.find(params[:id]) @kf_sort_type.destroy respond_to do |format| format.html { redirect_to kf_sort_types_url({:page => params[:page]}) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sort_type.destroy\n respond_to do |format|\n format.html { redirect_to sort_types_url, notice: 'Sort type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kf_sort = Kf::Sort.find(params[:id])\n @kf_sort.destroy\n\n respond...
[ "0.74730843", "0.6476687", "0.6438022", "0.63571686", "0.63566947", "0.6345226", "0.634209", "0.63361657", "0.6317694", "0.63074946", "0.6300656", "0.6297253", "0.62945867", "0.628615", "0.62770337", "0.62645555", "0.62551594", "0.6251596", "0.62496066", "0.62319815", "0.6220...
0.780744
0
GET /cabinet/transports GET /cabinet/transports.json
def index @cabinet_transports = Transport.eager_load(:map_layer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_transports(level, format, names)\n transport_names = Array(names)\n # rubocop:disable LineLength\n #transports = @transports.select { |t| (t.up_to_level? level) && (t.format == format) }\n transports = @transports\n # rubocop:enable LineLength\n return transports if Array(nam...
[ "0.6007799", "0.5623272", "0.5577498", "0.55764", "0.5484271", "0.5446106", "0.5419598", "0.5293647", "0.51976967", "0.51937914", "0.51923686", "0.51599497", "0.514887", "0.51383436", "0.51215374", "0.5059468", "0.49962756", "0.4985491", "0.48978797", "0.48749498", "0.4874949...
0.6752842
0
GET /cabinet/transports/1 GET /cabinet/transports/1.json def show end GET /cabinet/transports/new
def new @cabinet_transport = current_user.transports.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cabinet_transport = current_user.transports.new(cabinet_transport_params)\n respond_to do |format|\n if @cabinet_transport.save\n public_send(params[:transport][:status])\n format.html { redirect_to cabinet_transports_path, notice: I18n.t('created') }\n else\n for...
[ "0.7202626", "0.6888484", "0.6885551", "0.66751355", "0.66751355", "0.66751355", "0.66585106", "0.6653309", "0.65700626", "0.65159816", "0.6502627", "0.6392964", "0.6349603", "0.6330216", "0.63087165", "0.62992245", "0.6293414", "0.6263963", "0.62212664", "0.62099075", "0.620...
0.80675906
0
POST /cabinet/transports POST /cabinet/transports.json
def create @cabinet_transport = current_user.transports.new(cabinet_transport_params) respond_to do |format| if @cabinet_transport.save public_send(params[:transport][:status]) format.html { redirect_to cabinet_transports_path, notice: I18n.t('created') } else format.html { render :new } format.json { render json: @cabinet_transport.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cabinet_transport = current_user.transports.new\n end", "def create_transports\n @transport = Transport.new(strong_params_transports)\n @transport.value = calculate_transport_emissions\n @transport.user = @user\n @transport.save\n end", "def index\n @cabinet_transports = Transpor...
[ "0.57502496", "0.56126213", "0.5428443", "0.5370238", "0.5340381", "0.5294982", "0.5267044", "0.51990455", "0.5184055", "0.51214266", "0.5009426", "0.4986321", "0.49860775", "0.49833617", "0.4965873", "0.4890542", "0.48720932", "0.48720932", "0.48720932", "0.48573115", "0.485...
0.65239984
0
PATCH/PUT /cabinet/transports/1 PATCH/PUT /cabinet/transports/1.json
def update respond_to do |format| if @cabinet_transport.update(cabinet_transport_params) public_send(params[:transport][:status]) format.html { redirect_to cabinet_transports_path, notice: I18n.t('updated') } else format.html { render :edit } format.json { render json: @cabinet_transport.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.6032919", "0.596297", "0.59566563", "0.5720547", "0.5670075", "0.56541866", "0.56492096", "0.5644824", "0.5632196", "0.561097", "0.5578803", "0.5544935", "0.55412465", "0.55397564", "0.5486192", "0.54621166", "0.5461963", "0.545206", "0.54416907", "0.54409003", "0.5437028"...
0.67123234
0
DELETE /cabinet/transports/1 DELETE /cabinet/transports/1.json
def destroy @cabinet_transport.destroy respond_to do |format| format.html { redirect_to cabinet_transports_path, notice: I18n.t('deleted') } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format...
[ "0.6586172", "0.6583339", "0.65300494", "0.64225423", "0.6334508", "0.62777793", "0.62728876", "0.62506986", "0.62495977", "0.62020946", "0.6173425", "0.6173425", "0.6161049", "0.6153423", "0.61091435", "0.6107842", "0.61022156", "0.61014944", "0.6100911", "0.6091735", "0.608...
0.7322157
0
Use callbacks to share common setup or constraints between actions.
def set_cabinet_transport @cabinet_transport = Transport.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cabinet_transport_params permitted = Transport.globalize_attribute_names + [ :gis_type_name, :status, :map_layer_id, :transport_type_id, geo_json_attributes: %i[id geo_type position] ] params.require(:transport).permit(permitted) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
todo: check why the last number does not transform to int with "to_i".
def int_to_chess(number_list) # if its just one element return an array inside an array chess_notation = [] number_list.each do |square| square_notation = [] letter = num_to_letter(square[0]) number = square[1] square_notation.push(letter, number) chess_notation.push(square_notation) end # todo: flatten if theres only one element inside! chess_notation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_int() end", "def to_int() end", "def to_i\n end", "def to_i\n end", "def to_i\n e...
[ "0.76714593", "0.76714593", "0.76714593", "0.76714593", "0.76714593", "0.7634751", "0.7634751", "0.7634751", "0.7634751", "0.7634751", "0.7634751", "0.7515678", "0.7515678", "0.7455759", "0.740994", "0.740994", "0.7359315", "0.72220826", "0.71838975", "0.70520437", "0.7038133...
0.0
-1
========================================================================================= $ ./cyberdojo update =========================================================================================
def update # cyber-dojo.sh does actual [update] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update ; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update() end", "def update\n #Nothing necessary\n end", "def update\n \n end", "def update()\n end", ...
[ "0.7019418", "0.6942385", "0.6942385", "0.6942385", "0.6942385", "0.6942385", "0.6942385", "0.6942385", "0.6942385", "0.68431777", "0.6765578", "0.6751971", "0.66792536", "0.667858", "0.6672684", "0.65905493", "0.65905493", "0.65905493", "0.65905493", "0.65803975", "0.6559888...
0.82577986
0
========================================================================================= $ ./cyberdojo clean =========================================================================================
def clean # TODO: help? # TODO: check for unknown args # Can give the following # Error response from daemon: conflict: unable to delete cfc459985b4b (cannot be forced) # image is being used by running container a7108a524a4d command = "docker images -q -f='dangling=true' | xargs docker rmi --force" run command end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean; end", "def clean_up\n end", "def clean_up\n end", "def clean!\n Cleaner.remove_package(package)\n end", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean()\n\t\tSystem::clean target()\n\tend", "def pkg_clean\n sysprint \"#{@name} clean\"\n\n FileUtils::rm_rf(@...
[ "0.70924586", "0.653744", "0.653744", "0.63694966", "0.62678385", "0.62678385", "0.62313366", "0.6133081", "0.6132408", "0.6130185", "0.60131854", "0.59317344", "0.59317344", "0.59317344", "0.59317344", "0.59108967", "0.58496165", "0.58496165", "0.58354926", "0.58354926", "0....
0.0
-1
========================================================================================= $ ./cyberdojo down =========================================================================================
def down help = [ '', "Use: #{me} down", '', "Stops and removes docker containers created with 'up'", ] if ['help','--help'].include? ARGV[1] show help exit failed end # TODO: check for unknown args # cyber-dojo.sh does actual [down] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def down; end", "def down \r\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n\n end", "def down\n end", "def shut_down\n end", "def down\n help = [\n '',\n \"Use: #{me} down\",\n '',\n \"Stops and removes d...
[ "0.73952836", "0.7173972", "0.70723206", "0.70723206", "0.70723206", "0.70723206", "0.70723206", "0.7046073", "0.69961923", "0.6559594", "0.63943785", "0.6382332", "0.6205599", "0.6124868", "0.6044264", "0.5999263", "0.59576416", "0.5844776", "0.5711855", "0.5711855", "0.5711...
0.66360325
9
========================================================================================= $ ./cyberdojo sh =========================================================================================
def sh help = [ '', "Use: #{me} sh", '', "Shells into the cyber-dojo web server docker container", ] if ['help','--help'].include? ARGV[1] show help exit failed end # TODO: check for unknown args # TODO: check if server is running (as per [logs] command below) # cyber-dojo.sh does actual [sh] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_result; result['run_cyber_dojo_sh']; end", "def script; end", "def script; end", "def shell_api; end", "def autorun; end", "def cmd; end", "def setup\r\n end", "def standalone; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end",...
[ "0.64778847", "0.6431991", "0.6431991", "0.6363903", "0.6352241", "0.6308192", "0.6244031", "0.61987036", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6172615", "0.6150155", "0.6150155", "0.6150155", "0.614543", ...
0.60688305
35
========================================================================================= $ ./cyberdojo logs =========================================================================================
def logs help = [ '', "Use: #{me} logs", '', "Fetches and prints the logs of the web server (if running)", ] if ['help','--help'].include? ARGV[1] show help exit failed end # TODO: check for unknown args if `docker ps --quiet --filter "name=cdf-web"` == '' puts "FAILED: Cannot show logs - the web server is not running" exit failed else puts `docker logs cdf-web` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logs\n end", "def logs\n\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n end", "def logger_output; end", "def logger; end", "def logger; end", "def logger; end", "def logger; en...
[ "0.74157083", "0.72932535", "0.7259012", "0.7259012", "0.7259012", "0.7259012", "0.7259012", "0.7259012", "0.7259012", "0.7259012", "0.71576166", "0.7097548", "0.70335436", "0.70335436", "0.70335436", "0.70335436", "0.70335436", "0.70335436", "0.70335436", "0.70335436", "0.70...
0.0
-1
========================================================================================= $ ./cyberdojo up =========================================================================================
def up_arg_ok(help, args, name) vol = get_arg("--#{name}", args) if vol.nil? || vol == 'default-' + name # handled in cyber-dojo.sh return true end # TODO: edge case... this is not type checked # cyber-dojo up --languages=default-exercises if vol == '' show help puts "FAILED: missing argument value --#{name}=[???]" return false end if !volume_exists?(vol) show help puts "FAILED: volume #{vol} does not exist" return false end type = cyber_dojo_type(vol) if type != name show help puts "FAILED: #{vol} is not a #{name} volume (it's #{type})" return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\r\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "d...
[ "0.6569636", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6501257", "0.6437355", "0.64166605", "0.64166605", "0.64166605", "0.64166605", "0.64166605", "0.64166605", "0.6416660...
0.0
-1
========================================================================================= $ ./cyberdojo volume =========================================================================================
def volume help = [ '', "Use: #{me} volume [COMMAND]", '', 'Manage cyber-dojo setup volumes', '', 'Commands:', minitab + 'create Creates a new volume', minitab + 'rm Removes a volume', minitab + 'ls Lists the names of all volumes', minitab + 'inspect Displays details of a volume', minitab + "pull Pulls the docker images inside a volume's manifest.json files", '', "Run '#{me} volume COMMAND --help' for more information on a command", ] case ARGV[1] when 'create' then volume_create when 'rm' then volume_rm when 'ls' then volume_ls when 'inspect' then volume_inspect when 'pull' then volume_pull else show help end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume\n @volume\n end", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def volume; self.class.volume; end", "def volume; property('volume'); end", "def volume\n @length * @width * @depth\n end", "def get_volume()\n return(get_cmd('AG;',0.1,0.5,3).gsub(/...
[ "0.78524226", "0.76760495", "0.7618209", "0.7503193", "0.739426", "0.7362389", "0.73306435", "0.7118862", "0.71077865", "0.7084909", "0.7019615", "0.70027536", "0.69819474", "0.69792277", "0.6978118", "0.6975737", "0.6973202", "0.69401526", "0.68769175", "0.686562", "0.682422...
0.6337684
44
========================================================================================= $ ./cyberdojo volume create =========================================================================================
def volume_create help = [ '', "Use: #{me} volume create --name=VOLUME --git=URL", "Use: #{me} volume create --name=VOLUME --dir=PATH", '', 'Creates a volume named VOLUME from a git clone of URL', 'Creates a volume named VOLUME from a copy of PATH' ] # asked for help? if [nil,'help','--help'].include? ARGV[2] show help exit failed end # unknown arguments? knowns = ['name','git','dir'] unknown = ARGV[2..-1].select do |argv| knowns.none? { |known| argv.start_with?('--' + known + '=') } end if unknown != [] show help unknown.each { |arg| puts "FAILED: unknown argument [#{arg.split('=')[0]}]" } exit failed end # required known arguments args = ARGV[2..-1] vol = get_arg('--name', args) url = get_arg('--git', args) dir = get_arg('--dir', args) if vol.nil? || (url.nil? && dir.nil?) show help exit failed end if vol.length == 1 msg = 'volume names must be at least two characters long. See https://github.com/docker/docker/issues/20122' puts "FAILED: [volume create --name=#{vol}] #{msg}" exit failed end if volume_exists? vol msg = "#{vol} already exists" puts "FAILED: [volume create --name=#{vol}] #{msg}" exit failed end # cyber-dojo.sh does actual [volume create] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume(options)\n # Creating the volume is part of the server creation\n end", "def create_volume(options)\n # Creating the volume is part of the server creation\n end", "def volume_create(name)\n @log.info \"Creating volume #{name} from offering id #{DISK_OFFERING...
[ "0.8132278", "0.8132278", "0.7921072", "0.78841376", "0.75485444", "0.74330443", "0.7336266", "0.7272421", "0.72379214", "0.7168302", "0.70387924", "0.6966309", "0.6957829", "0.6932734", "0.6885475", "0.68473226", "0.6844902", "0.68243796", "0.6798225", "0.6669368", "0.660124...
0.74419034
5
========================================================================================= $ ./cyberdojo volume ls =========================================================================================
def volume_ls help = [ '', "Use: #{me} volume ls", '', 'Lists the names of all cyber-dojo volumes', '', minitab + '--quiet Only display volume names' ] if ['help','--help'].include? ARGV[2] show help exit failed end # There is currently no [--filter label=LABEL] option on [docker volume ls] # https://github.com/docker/docker/pull/21567 # So I have to inspect all volumes. Could be slow if lots of volumes. names = run("docker volume ls --quiet").split names = names.select{ |name| cyber_dojo_volume?(name) } if ARGV[2] == '--quiet' names.each { |name| puts name } else types = names.map { |name| cyber_dojo_type(name) } urls = names.map { |name| cyber_dojo_label(name) } headings = { :name => 'NAME', :type => 'TYPE', :url => 'SRC' } gap = 3 max_name = ([headings[:name]] + names).max_by(&:length).length + gap max_type = ([headings[:type]] + types).max_by(&:length).length + gap max_url = ([headings[:url ]] + urls ).max_by(&:length).length + gap spaced = lambda { |max,s| s + (space * (max - s.length)) } name = spaced.call(max_name, headings[:name]) type = spaced.call(max_type, headings[:type]) url = spaced.call(max_url , headings[:url ]) puts name + type + url names.length.times do |n| name = spaced.call(max_name, names[n]) type = spaced.call(max_type, types[n]) url = spaced.call(max_url , urls[n]) puts name + type + url end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_volumes\n Docker::Volume.all({}, client)\n rescue\n []\n end", "def list_volumes\n response = @connection.req(\"GET\", \"/#{@volume_path}\")\n volumes_hash = JSON.parse(response.body)[\"volumes\"]\n volumes_hash.inject([]){|res, current| res << OpenStack::Volume::Volum...
[ "0.74190503", "0.73382515", "0.7190842", "0.68871546", "0.68590057", "0.67773986", "0.6764583", "0.6746657", "0.6727527", "0.67217493", "0.65190095", "0.6451039", "0.641028", "0.6404427", "0.63665503", "0.6321427", "0.62932795", "0.6290067", "0.62753147", "0.6224678", "0.6214...
0.7667499
0
========================================================================================= $ ./cyberdojo volume inspect =========================================================================================
def volume_inspect help = [ '', "Use: #{me} volume inspect VOLUME", '', 'Displays details of the named cyber-dojo volume', ] # asked for help? vol = ARGV[2] if [nil,'help','--help'].include? vol show help exit failed end # TODO: check for unknown args exit_unless_is_cyber_dojo_volume(vol, 'inspect') command = [ 'docker run', '--rm', "--user=root", "--volume=#{vol}:/data:#{read_only}", '--volume=/var/run/docker.sock:/var/run/docker.sock', "#{cyber_dojo_hub}/web:#{docker_version}", "sh -c 'cd /usr/src/cyber-dojo/cli && ./volume_inspect.rb /data'" ].join(space=' ') print run(command) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_ls\n help = [\n '',\n \"Use: #{me} volume ls\",\n '',\n 'Lists the names of all cyber-dojo volumes',\n '',\n minitab + '--quiet Only display volume names'\n ]\n\n if ['help','--help'].include? ARGV[2]\n show help\n exit failed\n end\n\n # There is currently no [--filter ...
[ "0.6845138", "0.682955", "0.6801692", "0.66896826", "0.65809655", "0.65715355", "0.6490683", "0.6469171", "0.6362037", "0.63325155", "0.6292481", "0.62908846", "0.62411344", "0.6193496", "0.6136404", "0.6136037", "0.6127054", "0.61041164", "0.60990125", "0.60829663", "0.60257...
0.76942563
0
========================================================================================= $ ./cyberdojo volume rm =========================================================================================
def volume_rm # Allow deletion of a default volume. # This allows you to create custom default volumes. help = [ '', "Use: #{me} volume rm VOLUME", '', "Removes a volume created with the [#{me} volume create] command" ] vol = ARGV[2] if [nil,'help','--help'].include? vol show help exit failed end exit_unless_is_cyber_dojo_volume(vol, 'rm') run "docker volume rm #{vol}" if $exit_status != 0 puts "FAILED [volume rm #{vol}] can't remove volume if it's in use" exit failed end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n ret = qmgmt(['volume', 'delete', resource[:name]])\n out = Array.new\n ret.each_line { |l|\n out.push(' ' + l)\n }\n if ( ret.exitstatus != 0 )\n fail(\"quobyte volume delete #{resource[:name]} failed with status #{ret.exitstatus.to_s}. Output follows.\" + out.join(\"\\n\"))...
[ "0.7865445", "0.71562785", "0.69014466", "0.67364144", "0.67362696", "0.6727698", "0.6705424", "0.66121924", "0.65491056", "0.65086246", "0.6469485", "0.64405763", "0.6416325", "0.63992417", "0.6385814", "0.6303534", "0.6276301", "0.62409395", "0.62321573", "0.6213605", "0.61...
0.7651154
1
========================================================================================= $ ./cyberdojo volume pull =========================================================================================
def volume_pull help = [ '', "Use: #{me} volume pull VOLUME", '', 'Pulls all the docker images named inside the cyber-dojo volume' ] vol = ARGV[2] if [nil,'help','--help'].include? vol show help exit failed end exit_unless_is_cyber_dojo_volume(vol, 'pull') command = [ 'docker run', '--rm', '--tty', "--user=root", "--volume=#{vol}:/data:#{read_only}", '--volume=/var/run/docker.sock:/var/run/docker.sock', "#{cyber_dojo_hub}/web:#{docker_version}", "sh -c 'cd /usr/src/cyber-dojo/cli && ./volume_pull.rb /data'" ].join(space=' ') system(command) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull; end", "def get_volume()\n return(get_cmd('AG;',0.1,0.5,3).gsub(/^AG/,'').gsub(/;$/,'').to_i)\nend", "def fetch_volume_by_id\n vol = storage_api.find_by_id(volume_id)\n data = vol.body.fetch(\"volume\")\n @name = data.fetch('display_name')\n @volume_type = data.fetch('volu...
[ "0.64978135", "0.63532764", "0.63464457", "0.6197382", "0.61853695", "0.61475164", "0.606009", "0.603484", "0.5953611", "0.573497", "0.570758", "0.5685409", "0.56713295", "0.5666276", "0.5658976", "0.56523544", "0.560495", "0.5597921", "0.55848", "0.5581547", "0.556794", "0...
0.77412784
0
Allows you to attach a listener that accepts the created job (which has a useful job_id field). This is useful for recording a job ID persistently before you begin batch work (i.e. start modifying the salesforce database), so if the load process you are writing needs to recover, it can be aware of previous jobs it started and wait for them to finish.
def on_job_created(&block) @listeners[:job_created] << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n interface.add_new_job_listener(self)\n end", "def start\n interface.add_new_job_listener(self)\n end", "def record_job(job_json)\n job = JSON.parse(job_json)\n processing_jobs.create!(\n :account_id => account_id,\n ...
[ "0.6758493", "0.6758493", "0.6204391", "0.61469245", "0.595604", "0.59354687", "0.58921534", "0.5882724", "0.5857593", "0.5817491", "0.5764012", "0.5762483", "0.56788224", "0.56343603", "0.56140906", "0.55958074", "0.558978", "0.5584405", "0.55800825", "0.55635726", "0.555312...
0.73519635
0
We're really an array. We swear!
def method_missing(m, *args, &block) self.to_a.send m, *args, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array?\n false\n end", "def array?(item)\n item.is_a?(Array)\n end", "def __array__; self; end", "def array?\n false\n end", "def returns_array?\n true\n end", "def array?\n value&.is_a?(Array)\n end", "def returns_array?\n true\n end", "def...
[ "0.7325143", "0.731974", "0.728423", "0.72462523", "0.7237629", "0.7218187", "0.7138658", "0.7126627", "0.71246904", "0.71246904", "0.7053896", "0.7050514", "0.70376354", "0.6996002", "0.69832945", "0.6966359", "0.6898526", "0.68818253", "0.6864665", "0.6853551", "0.6761297",...
0.0
-1
In the event of a tie: Highest ranking card at the top of the sequence wins.
def comparer_methods super + [ :min_rank ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end", "def tie_breaker_cards\n matched = self.matched_cards\n sorted = @cards.sort.reverse\n # sorted so the card with highest value is first \n if five_of_a_kind? \n # All cards break the tie\n ...
[ "0.7342422", "0.7073065", "0.7052118", "0.7051302", "0.6945214", "0.6929667", "0.6888874", "0.68515146", "0.67931986", "0.6705846", "0.66058344", "0.6581559", "0.6573646", "0.65641254", "0.6558619", "0.65416425", "0.6507286", "0.65065646", "0.6499011", "0.64841187", "0.648082...
0.0
-1
Add a request (API object) to batch
def << req raise ArgumentError.new("argument should be an instance of Diffbot::APIClient::GenericAPI") unless req.is_a?(Diffbot::APIClient::GenericAPI) @list << req end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_request( request )\n @thePosts << request\n end", "def add_request(request)\n requests << request\n true\n end", "def batch_create(request = nil, manifest: nil, items: nil, **opt)\n self.request = request ||= pre_flight(manifest, items, **opt)\n self.start_time = request[:...
[ "0.69505984", "0.6852873", "0.6816558", "0.6741807", "0.6560005", "0.65364385", "0.64592576", "0.6433923", "0.62163174", "0.6155841", "0.6152654", "0.61412096", "0.61411595", "0.6132737", "0.6117577", "0.6096208", "0.60543114", "0.5996252", "0.5984472", "0.5959678", "0.594820...
0.6506785
6
Further exploration with zip
def multiply_list_zip(array1,array2) array1.zip(array2).map {|element| element.reduce(:*)} # array 1's element would be spread out into three arrays, 3,5 and 7 being the first elements. Zip then iterates through the argument # and mergers these elements into array1 one by one. The documentation then states if a block is given it invoked for EACH ARRAY, so in this case # the combined arrays we have now created. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zip(*rest) end", "def test_0300_zip\n @@log.debug \"test_0300_zip starts\" if @@log.debug?\n assert_respond_to(@list, :zip, \"test_0300_zip_respond\")\n # Basic example\n a = [1]\n b = [2,3]\n c = [4,5,6]\n ta = @list.zip(a, b, c)\n #\n te = [[@aen, 1, 2, 4], \n [@bsb, nil...
[ "0.7778387", "0.68498844", "0.68337524", "0.67696965", "0.67696536", "0.6569666", "0.6542337", "0.6497158", "0.64898837", "0.6480811", "0.64553034", "0.64518684", "0.64500314", "0.6413858", "0.63971937", "0.639074", "0.63869286", "0.63819975", "0.6375687", "0.6355257", "0.633...
0.57535756
48
Returns the given string unescaped. See the "Logging > Nonprintable characters" section in HAProxy documentation.
def unescape(string) string.gsub(/#[[:xdigit:]]{2}/) do |match| match[1..-1].to_i(16).chr end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_unprintable_characters(s)\n s.tr(8204.chr, \"\")\nend", "def unescape(string)\n string.is_a?(String) ? string.gsub(/\\n|\\r/, \"\") : string\n end", "def remove_nonprintable\n gsub(/[^[:print:]\\n\\t]/i, '')\n end", "def unescape(string)\n \"\\\"#{string}\\\"\".undump\n end", ...
[ "0.7379509", "0.7003302", "0.6750514", "0.6705682", "0.64984244", "0.6497861", "0.6343268", "0.6336039", "0.63255036", "0.6260806", "0.62292373", "0.62266177", "0.61973006", "0.61847883", "0.61642426", "0.6094663", "0.6092739", "0.6078029", "0.60523933", "0.6012545", "0.59715...
0.600817
21
Converts the value of an accept_date field to a Time object.
def parse_accept_date(string) parts = string.split(/[\/:.]/) Time.local(*parts.values_at(2, 1, 0, 3..6)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepted_date_time=(value)\n @accepted_date_time = value\n end", "def accepted_date_time\n return @accepted_date_time\n end", "def to_time\n return self.to_i.to_time if self =~ DIGIT_ONLY_REGEX\n if self =~ US_DATE_REGEX\n Time.pars...
[ "0.6977994", "0.64472353", "0.6083102", "0.6002853", "0.59228677", "0.5916261", "0.5907152", "0.5849504", "0.576029", "0.5745835", "0.574527", "0.55687726", "0.5558864", "0.5558081", "0.554975", "0.55393803", "0.5529871", "0.55263627", "0.5503998", "0.5499917", "0.54936457", ...
0.49171776
100
Converts a captured headers string to an Array.
def decode_captured_headers(string) string.split('|', -1).map! { |header| unescape(header) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_array\n hash = get_headers \n arr = []\n hash.each do |k, v|\n\tv.each do |i|\n\tarr << k + \"=\" + i\n\tend\nend\n arr\nend", "def headers_from_array(arr)\n clear_headers\n arr = arr.split(\"\\r\\n\\r\\n\").first if arr.class == String\n arr.each do |line|\n next if (line.em...
[ "0.703389", "0.68228275", "0.6637026", "0.65060157", "0.6489471", "0.64845294", "0.64399105", "0.63763016", "0.63403124", "0.63145477", "0.63145477", "0.6218634", "0.6180902", "0.6131345", "0.6073011", "0.60691416", "0.6025443", "0.5994925", "0.59728396", "0.5859533", "0.5825...
0.7107035
1
apply() applies this selector to a node set, returning the resulting node(s)
def apply( node ) return node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply( node )\n bug( \"you must override Selector.apply()\" )\n end", "def apply( nodes )\n nodes = nodes.to_a\n results = nodes\n difference = nodes\n until difference.empty?\n step_results = @selector.apply( difference )\n differenc...
[ "0.66601545", "0.64154595", "0.6065036", "0.5784437", "0.57756865", "0.54986745", "0.54721534", "0.54504275", "0.54338425", "0.5379179", "0.53335434", "0.5299764", "0.5279307", "0.5256526", "0.5197164", "0.5193304", "0.51319337", "0.50820297", "0.50318766", "0.502184", "0.500...
0.6695583
0
assign() for self assignment, we need help; because nodes don't know their parent, we can't actually affect the change directly; instead, we set the ASN usurper, and leave ASN.commit() to do the patch up
def assign( search_nodes, result_nodes ) return super unless target? update(search_nodes) do |node| node.usurper = result_nodes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent=(parent_node); end", "def parent=(parent_node); end", "def parent=(other); end", "def on_assign(node)\n reset_assignment_value\n value_stack.add_stack\n end", "def parent=(obj); end", "def coursenode_assignmentnode(res2, child)\n res2['directory'] = child.get_directory\n ins...
[ "0.6804454", "0.6804454", "0.67807", "0.6258756", "0.62358046", "0.6040949", "0.6011162", "0.5990504", "0.5940112", "0.5925864", "0.59229577", "0.5913215", "0.58682567", "0.58682567", "0.58682567", "0.58682567", "0.58682567", "0.5850792", "0.57658243", "0.572131", "0.5706517"...
0.517961
89
update() an internal routine that encapsulates the common functionality needed to use this Selector for update work
def update( search_nodes ) if has_target_predicate? then search_nodes.each do |node| if node.slot_filled?(@slot_name) then unless @target_predicate.apply(node[@slot_name].to_a).empty? yield( node ) end end end else search_nodes.each do |node| yield( node ) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update() end", "def update ; end", "def update\n \n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update\n # Not generally used\n end", "def update\n # Not gener...
[ "0.71479994", "0.70060945", "0.6830604", "0.67938995", "0.67938995", "0.67938995", "0.67938995", "0.67938995", "0.67938995", "0.67938995", "0.67938995", "0.66593814", "0.66593814", "0.6632417", "0.6588756", "0.6588756", "0.6574683", "0.6524907", "0.64788467", "0.6473403", "0....
0.0
-1
go Executes the query returns LiteralResult a wrapper for the search results
def go captured = query_by_referrer return captured if captured.found? default_ordered_query end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n # build the query string\n # run the query\n # return the results\n end", "def query_result(**args)\n solr_service.query_result(build, **args)\n end", "def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.colle...
[ "0.7323687", "0.681167", "0.6775319", "0.66252273", "0.6583636", "0.6581239", "0.6569499", "0.6485346", "0.6452613", "0.6442163", "0.6427986", "0.6379311", "0.63543785", "0.6335833", "0.6288873", "0.62706095", "0.6247185", "0.6246871", "0.62231237", "0.62059677", "0.6192346",...
0.0
-1
Public: Updates a Ticket in FogBugz Returns boolean indicating whether or not the Ticket was persisted
def save !update_case.has_key?("error") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ticket.update(ticket_params)\n\n end", "def update\n if current_user.id == @ticket.user_id || ProjectUser.verify_role(current_user.id, @project, 'developer')\n if params[:ticket][:status] == 'closed'\n # Unless doesn't work, but if! does for some reason?\n if !ProjectUser....
[ "0.7075008", "0.69759566", "0.6900604", "0.6900604", "0.6899547", "0.68989575", "0.6887619", "0.6887619", "0.6887619", "0.6887619", "0.6887619", "0.68726313", "0.686913", "0.68513954", "0.6850062", "0.684869", "0.684869", "0.68477166", "0.6843562", "0.68401426", "0.682231", ...
0.0
-1
Public: Creates a new Ticket based on passed attributes and persists it to Fogbugz attrs hash of Ticket attributes Returns a new Ticket
def create(attrs) if attrs.has_key? :description warn "Fogbugz Case does not handle description" end options = translate attrs, :title => :sTitle, :priority => :ixPriority, :assignee => :ixPersonAssignedTo, :project_id => :ixProject new_case = api.command(:new, options) options.merge!(:ixBug => new_case["case"]["ixBug"]) self.new options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ticket(params = {})\n Ticket.create(self, params)\n end", "def create(params)\n ticket = Tessera::Otrs::Ticket.new(params[:ticket]).to_hash\n article = Tessera::Otrs::Article.new(params[:article]).to_hash\n attachment = if params[:attachment] && params[:attachment].is_a?(H...
[ "0.7747452", "0.6945511", "0.6942958", "0.69121987", "0.67621434", "0.67238426", "0.66958165", "0.6636592", "0.65551955", "0.6541369", "0.6526149", "0.6513416", "0.64901674", "0.6467038", "0.6467038", "0.6433461", "0.63950604", "0.63902", "0.6387986", "0.63662726", "0.6357388...
0.59570676
65
Public: Finds Tickets based on a hash of attributes project_id ID of the project the tickets belong to attributes hash of Ticket attributes to use when searching Returns an array of matching Tickets
def find_by_attributes(project_id, attributes = {}) search_by_attribute(self.find_all(project_id), attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end", "def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end", "def find_tickets(...
[ "0.7127366", "0.7060546", "0.69178826", "0.6719761", "0.6519268", "0.6456936", "0.6405557", "0.64035344", "0.63723797", "0.6313196", "0.6277238", "0.61540866", "0.6114577", "0.61130935", "0.6103761", "0.61005586", "0.59171915", "0.58814967", "0.5873627", "0.5807041", "0.57795...
0.5233525
51
Public: Finds all Tickets belonging to a project project_id ID of Project to fetch Tickets for Returns an array of Tickets
def find_all(project_id) query = "project:=#{project_id}" cols = %w(dtLastUpdated ixBug sStatus sTitle sLatestTextSummary ixProject sProject sPersonAssignedTo sPriority).join(',') api.command(:search, :q => query, :cols => cols).collect do |ticket| self.new ticket[1]["case"] end.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end", "def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end", "def tickets()\n ...
[ "0.8186321", "0.7989205", "0.7292086", "0.72084427", "0.7192272", "0.7144361", "0.7023476", "0.6636827", "0.6624961", "0.64781344", "0.6378727", "0.63545233", "0.6350541", "0.6283819", "0.6247126", "0.6247126", "0.6247126", "0.6247126", "0.6247126", "0.6247126", "0.6247126", ...
0.66266304
8
Private: Shortcut for accessing Fogbugz API instance Returns Fogbugz API wrapper object
def api TaskMapper::Provider::Fogbugz.api end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api\n TaskMapper::Provider::Fogbugz.api\n end", "def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b8...
[ "0.7762242", "0.7042285", "0.6563517", "0.65257937", "0.6236395", "0.62154925", "0.6197963", "0.61913455", "0.6171996", "0.6154027", "0.60924584", "0.6088912", "0.60846514", "0.5924184", "0.591459", "0.591459", "0.5894217", "0.58888674", "0.58715916", "0.5849171", "0.5847214"...
0.7682219
2
Private: Shortcut for accessing Fogbugz API instance Returns Fogbugz API wrapper object
def api TaskMapper::Provider::Fogbugz.api end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api\n TaskMapper::Provider::Fogbugz.api\n end", "def api\n TaskMapper::Provider::Fogbugz.api\n end", "def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n for...
[ "0.7682961", "0.7682961", "0.70419866", "0.6563051", "0.65245533", "0.62355727", "0.6215915", "0.61968285", "0.61906075", "0.61714756", "0.61533237", "0.6092402", "0.6088986", "0.6083813", "0.5923803", "0.5913553", "0.5913553", "0.58943206", "0.5889345", "0.5871025", "0.58483...
0.77630323
0
Private: Updates Fogbugz Case in Fogbugz Returns updated case
def update_case api.command :edit, to_case_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end", "def create_or_update_case(feature, parent_case = nil)\n old_attachments = []\n\n parameters = {\n sTitle: feature.name,\n sEven...
[ "0.7139557", "0.6857494", "0.67728275", "0.66847235", "0.66847235", "0.6637263", "0.66363126", "0.6605919", "0.65485656", "0.6347041", "0.6343665", "0.63300556", "0.63281345", "0.6291381", "0.6260999", "0.62322074", "0.61884075", "0.6182646", "0.61819303", "0.61790425", "0.61...
0.7373121
0
Private: Converts Ticket to Fogbugz Case for use when updating Case via API Returns a hash
def to_case_hash { :ixBug => id, :sTitle => title } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_ticket(ticket)\n fields = []\n fields << ticket['id']\n fields << ticket['status']\n fields << ticket['subject']\n fields << get_component(ticket['custom_fields'])\n fields << clean_text(ticket['description'], 5)\n fields << get_user_name(ticket['requester_id'])\n ...
[ "0.6015627", "0.57627153", "0.5679114", "0.5646849", "0.5531624", "0.55173254", "0.53820366", "0.5291586", "0.5237896", "0.5234413", "0.52162", "0.5168233", "0.50967395", "0.5076714", "0.5013058", "0.50030804", "0.4998394", "0.49882782", "0.4976785", "0.49710226", "0.4960525"...
0.5715616
2
when saved, a file is split into chunks with the following requirements A. Each of the chunks is named with the sha of its content. B. The file is named with the sha of its content C. The file lists the chunks its made of. D. An adler directory is updated with the reference of the chunks
def test_store_file #emulate the saving of a file whose content is 'test content' @writer.save_file('test content') #we expect three chunks for expected_chunks = ['test ', 'conte', 'nt'] expected_chunks_sha = expected_chunks.map{|s| ComputeSHADigest s} #A. Each of the chunk is named with the sha on its content expected_chunks_sha.each{|sha| assert( @ioservice.exists? :chunk, sha )} #B. The filename is retrieved from the sha of the whole string file_sha = ComputeSHADigest 'test content' assert( @ioservice.exists?(:file, file_sha), "file not found: #{file_sha} in #{@ioservice.store[:file]}" ) #C. The file lists all its chunks @ioservice.read_elem(:file, file_sha) do |c| c.each_line.zip(expected_chunks_sha).each{ |l, sha| assert_equal(l.strip, sha) } end #D. the adlers directory should be filled with the adler32 code of each chunk CheckChunksInAdlerDirectory( @adlers, expected_chunks ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_splited_part(zip_file, partial_zip_file_name, zip_file_size, szip_file_index, segment_size, segment_count); end", "def chunk(file_name, prefix, chunksize = 1_073_741_824)\n File.open(file_name\"r\") do |f|\n until f.eof?\n File.open(\"#{prefix}_#{\"%05d\"%(f.pos/chunksize)}.txt\",\"w\") do |fc|...
[ "0.66069794", "0.63819015", "0.6312199", "0.61628807", "0.60527945", "0.5902103", "0.5734337", "0.5718231", "0.56422997", "0.55895823", "0.55892223", "0.54797614", "0.5440361", "0.5380231", "0.53789425", "0.53715587", "0.5365633", "0.5340018", "0.5335716", "0.5282279", "0.525...
0.64926106
1
check that a same file is not stored twice
def test_no_duplicated_file #emulate the saving of a file whose content is 'test content' @writer.save_file('test content') #an exception should be raised by ioservice if file is attempted to be saved twice assert_nothing_thrown do @writer.save_file('test content') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def already_stored?\n !file_uniqueness\n end", "def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exac...
[ "0.78644377", "0.7141948", "0.7022745", "0.68293506", "0.6816571", "0.6777013", "0.66742957", "0.6665063", "0.6635987", "0.6629165", "0.66233206", "0.6598193", "0.6598193", "0.65877014", "0.6507532", "0.64849436", "0.64064527", "0.64006424", "0.6342413", "0.6238458", "0.62367...
0.65201795
14
When something is added at the end, all the full existing chunks are reused
def test_reuse_existing_chunks_when_append CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt'] CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reuse_existing_chunks_when_prepend\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'a new test content', ['a new', ' ', 'test ', 'conte', 'nt']\n end", "def append_queue\n if free_space > 0 \n free_blo...
[ "0.71136314", "0.6811389", "0.6487453", "0.63042635", "0.6271669", "0.61752576", "0.61128914", "0.6016184", "0.59229547", "0.5909456", "0.57401544", "0.57401544", "0.5711156", "0.56965065", "0.5622255", "0.5622255", "0.5622255", "0.5619329", "0.5609445", "0.5597237", "0.55940...
0.75094116
0
when something is added at the beginning, all the full existing chunks are reused
def test_reuse_existing_chunks_when_prepend CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt'] CheckFile @writer, @ioservice, @adlers, 'a new test content', ['a new', ' ', 'test ', 'conte', 'nt'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end", "def add(chunk)\n if chunk.full_chunk?\n @chunks[chun...
[ "0.7177806", "0.6609853", "0.6422074", "0.6190774", "0.60896546", "0.5950836", "0.59035337", "0.5858389", "0.58377206", "0.58377206", "0.5808672", "0.5759759", "0.57495934", "0.5720551", "0.5671632", "0.5633452", "0.56172466", "0.5604962", "0.56021214", "0.55881464", "0.55529...
0.7507271
0
test save with funny char
def test_exotic_char CheckFile @writer, @ioservice, @adlers, "J'espère que ça va marcher", "J'espère que ça va marcher".bytes.each_slice(@chunkSize).to_a.map{|a| a.pack('C*')} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n ConsoleGlitter.escape(\"s\")\n end", "def write_to_disk\n if @params and errors.empty?\n unless DiskWriter.save_textfile(@old_location, self.location, self.contents)\n errors.add(\"Write to disk failed:\", \"check for invalid characters in '#{self.location}'\")\n throw(:a...
[ "0.619361", "0.6099045", "0.5809216", "0.5762555", "0.576243", "0.5735529", "0.56535786", "0.5632213", "0.55245054", "0.55245054", "0.54943734", "0.5481706", "0.54587394", "0.54587394", "0.5425676", "0.5420517", "0.5403541", "0.5396913", "0.5386988", "0.53623706", "0.53623706...
0.6681962
0
test that chunks are reused if possible in a single save
def test_reuse_single_file CheckFile @writer, @ioservice, @adlers, 'test tests test ', ['test ', 'tests', ' ', 'test '] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end", "def test_reuse_existing_chunks_when_prepend\n CheckFile @writ...
[ "0.7280976", "0.70450926", "0.5759455", "0.57587314", "0.5740955", "0.5677437", "0.5666324", "0.5666324", "0.556692", "0.5508822", "0.5502131", "0.5483559", "0.54794127", "0.54491895", "0.5446638", "0.54160845", "0.538678", "0.5374471", "0.5359461", "0.5306936", "0.5290686", ...
0.5382451
17
test a more complicated case where chunks should be reused
def test_reuse_single_file2 CheckFile @writer, @ioservice, @adlers, 'try with try with', ['try w', 'ith ', 'try w', 'ith'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reuse_existing_chunks_when_prepend\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'a new test content', ['a new', ' ', 'test ', 'conte', 'nt']\n end", "def test_0900_chunk\n @@log.debug \"test_0900_chunk starts\" if ...
[ "0.7111465", "0.67383045", "0.6709689", "0.67064005", "0.67064005", "0.66966504", "0.6480198", "0.6420431", "0.61722076", "0.6031122", "0.6031122", "0.6019802", "0.6019592", "0.59731174", "0.5929808", "0.58299136", "0.5815501", "0.58149874", "0.57944113", "0.5757867", "0.5746...
0.5231456
61
When a tree is saved: A. the tree file is named with the sha of its content B. the tree file stores the list of the file in it C. each file is normaly saved
def test_save_tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storeTree(inTree, filename)\n File.open(filename, \"w\") do |file|\n file.puts YAML::dump(inTree)\n end\n end", "def save_path_tree\n file = File.open(DATA_STORE, 'w')\n file.write path_tree.dump.to_json\n file.close\n end", "def save_hashes\n @storage.save_hash_tre...
[ "0.64106363", "0.63570917", "0.6314763", "0.60909194", "0.603289", "0.602521", "0.59784293", "0.5954609", "0.59007466", "0.5863738", "0.5828076", "0.5781941", "0.577882", "0.576617", "0.57591856", "0.57278883", "0.57113636", "0.56846803", "0.56611633", "0.55395055", "0.549001...
0.54602915
23
========================================================================================================= Separate methods for quiz questionnaire ========================================================================================================= View a quiz questionnaire
def view_quiz @questionnaire = Questionnaire.find(params[:id]) @participant = Participant.find(params[:pid]) #creating an instance variable since it needs to be sent to submitted_content/edit render :view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questions = get_questions\n @answers\n @count = -1\n @total_questions\n @new_quiz = Quiz.new\n end", "def view_quiz\n @questionnaire = Questionnaire.find(params[:id])\n @participant = Participant.find_by_id(params[:pid]) #creating an instance variable since it needs to be sent t...
[ "0.75456136", "0.7263283", "0.7181319", "0.71634144", "0.71592253", "0.71343815", "0.7077878", "0.7068398", "0.7068398", "0.7068398", "0.704416", "0.7041188", "0.703839", "0.703686", "0.7034626", "0.6996436", "0.6994688", "0.69931734", "0.69399494", "0.69312733", "0.6925771",...
0.72761625
1
define a new quiz questionnaire method invoked by the view
def new_quiz valid_request=true @assignment_id = params[:aid] #creating an instance variable to hold the assignment id @participant_id = params[:pid] #creating an instance variable to hold the participant id assignment = Assignment.find(@assignment_id) if !assignment.require_quiz? #flash error if this assignment does not require quiz flash[:error] = "This assignment does not support quizzing feature." valid_request=false else team = AssignmentParticipant.find(@participant_id).team if team.nil? #flash error if this current participant does not have a team flash[:error] = "You should create or join a team first." valid_request=false else if assignment.has_topics? && team.topic.nil?#flash error if this assignment has topic but current team does not have a topic flash[:error] = "Your team should have a topic first." valid_request=false end end end if valid_request @questionnaire = Object.const_get(params[:model]).new @questionnaire.private = params[:private] @questionnaire.min_question_score = 0 @questionnaire.max_question_score = 1 render :new_quiz else redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quiz\n end", "def create_quiz_questionnaire\n create_questionnaire\n end", "def new_quiz\n @questionnaire = Object.const_get(params[:model]).new\n @questionnaire.private = params[:private]\n @questionnaire.min_question_score = 0\n @questionnaire.max_question_score = 1\n @participant_id ...
[ "0.7677077", "0.74242634", "0.7331367", "0.7032842", "0.70093507", "0.68291557", "0.6825268", "0.6825268", "0.67953235", "0.6755578", "0.6613819", "0.6602317", "0.65977603", "0.6569758", "0.6535151", "0.6535151", "0.6535151", "0.6535151", "0.6501104", "0.64952946", "0.6466948...
0.6785072
9
seperate method for creating a quiz questionnaire because of differences in permission
def create_quiz_questionnaire valid = valid_quiz if valid.eql?("valid") create_questionnaire else flash[:error] = valid.to_s redirect_to :back end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_quiz_questionnaire\n create_questionnaire\n end", "def create_questionnaire\n\n @questionnaire = Object.const_get(params[:questionnaire][:type]).new(params[:questionnaire])\n\n if @questionnaire.type == \"QuizQuestionnaire\" #checking if it is a quiz questionnaire\n participant_id = par...
[ "0.7897601", "0.7501515", "0.7403573", "0.7266644", "0.72099024", "0.71171844", "0.71104497", "0.7106334", "0.70619726", "0.6953774", "0.6934844", "0.6914081", "0.68823755", "0.6860595", "0.6855735", "0.68445885", "0.6761288", "0.6761188", "0.67550564", "0.6740952", "0.672148...
0.7123384
5
edit a quiz questionnaire
def edit_quiz @questionnaire = Questionnaire.find(params[:id]) if !@questionnaire.taken_by_anyone? render :edit else flash[:error] = "Your quiz has been taken by some other students, editing cannot be done any more." redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_quiz\n\n @questionnaire = Questionnaire.find(params[:id])\n render :edit\n end", "def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] if @questionnaire == nil\n if params['save']\n @questi...
[ "0.78736377", "0.7705088", "0.7496314", "0.74926126", "0.7429192", "0.7319658", "0.7226312", "0.72018594", "0.7053109", "0.70383626", "0.69802076", "0.6976677", "0.69575685", "0.69298786", "0.68901175", "0.6888413", "0.6854092", "0.6836597", "0.6788975", "0.6783555", "0.67776...
0.6835008
18
save an updated quiz questionnaire to the database
def update_quiz @questionnaire = Questionnaire.find(params[:id]) redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] if @questionnaire == nil if params['save'] @questionnaire.update_attributes(questionnaire_params) for qid in params[:question].keys @question = Question.find(qid) @question.txt = params[:question][qid.to_sym][:txt] @question.save @quiz_question_choices = QuizQuestionChoice.where(question_id: qid) i=1 for quiz_question_choice in @quiz_question_choices choose_question_type(i, quiz_question_choice) i+=1 end end end redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if self.valid?\n return false\n else\n QUIZ.execute(\"UPDATE questions SET question = '#{@question}' WHERE id = #{@id};\")\n end\n end", "def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:quest...
[ "0.7704281", "0.76687604", "0.7614883", "0.75466186", "0.736566", "0.7299445", "0.6883573", "0.6839848", "0.66819066", "0.66391426", "0.662807", "0.6601551", "0.65679485", "0.6503789", "0.6503784", "0.6454465", "0.6451807", "0.64460045", "0.6445716", "0.6412378", "0.6399056",...
0.75679433
3
GET /messages list of users you have had message encounters with
def index raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on? @messages = Message.get_message_list(current_user) render json: @messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages_from user\n backend.messages_page(user).messages\n end", "def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend", "def list_of_messages()\n\t\t\n\t\t#Create a new request\n\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@...
[ "0.7299288", "0.72869104", "0.7123604", "0.712256", "0.7096278", "0.70948744", "0.7084978", "0.70153713", "0.7003086", "0.6950845", "0.6942538", "0.6929815", "0.6920845", "0.6918929", "0.6874944", "0.68563616", "0.68385607", "0.6810919", "0.67887604", "0.67701995", "0.6712138...
0.7117326
4
GET /messages/conversation/:user_id list messages you have had with another user Needs to mark all messages as read
def conversation @messages = Message.get_conversation(current_user, params[:user_id]) render json: @messages, each_serializer: MessageConversationSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.whe...
[ "0.7628869", "0.75682914", "0.7340077", "0.72378355", "0.717201", "0.7155813", "0.71218157", "0.7099798", "0.7064991", "0.703641", "0.6975814", "0.6950426", "0.69329643", "0.69103104", "0.689679", "0.6885737", "0.6867392", "0.68490905", "0.6760762", "0.67348397", "0.66528404"...
0.68029016
18
Never trust parameters from the scary internet, only allow the white list through.
def post_message_params params.require(:message).permit(:body, :recipient_user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
initialize new cash register instance
def initialize(discount=0) @total = 0 @discount = discount @items = [] @last_transaction = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(discount = 0) #new optionally takes an employee discount on initialization\n @total = 0 #SETS AN INSTANCE VARIABLE @TOTAL ON INITIALIZATION TO ZERO\n @discount = discount # CashRegister ::new optionally takes an employee discount on initialization\n @items = [] #returns an array contain...
[ "0.6509862", "0.6349476", "0.6268034", "0.6241197", "0.62274337", "0.619365", "0.618544", "0.6175208", "0.6150307", "0.61391604", "0.6098538", "0.60733455", "0.60699993", "0.60544527", "0.60501355", "0.5993032", "0.59788656", "0.58794343", "0.5857411", "0.58511317", "0.582456...
0.0
-1
adding new item to cash register instance adds to total, adds items to an array, and tracks last transaction in a hash
def add_item(item, price, quantity=1) @total += (price * quantity) @items.fill(item, @items.size, quantity) @last_transaction = {item => (price * quantity)} @last_qty = quantity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item (title, price, quantity = 1)\n # adds purchase price to total\n @total += price * quantity\n # Adds proper quanity of item to cart\n count = 0\n while count < quantity\n @items << title\n count += 1\n end\n # keeps track of last_added item\n @last_transaction[:item] = titl...
[ "0.72258765", "0.68470055", "0.6771469", "0.6748451", "0.67401516", "0.66924566", "0.6625887", "0.6622018", "0.65900964", "0.6563566", "0.6519667", "0.65079874", "0.6494941", "0.6486597", "0.6476313", "0.6451452", "0.64410144", "0.6406616", "0.6404375", "0.6401386", "0.639000...
0.7257366
0
returns new total w/ discount applied + message
def apply_discount @total *= (1 - (discount * 0.01)) if discount == 0 return "There is no discount to apply." else return "After the discount, the total comes to $#{@total.to_i}." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_discount\n if @discount == 0\n \"There is no discount to apply.\"\n else\n @discounted_price = (self.total * @discount * 0.01)\n @total -= @discounted_price\n \"After the discount, the total comes to $#{@total.to_i}.\"\n end\n end", "def apply_discount\n # checks if there is ...
[ "0.8136538", "0.80670786", "0.80542064", "0.79802155", "0.7979578", "0.79795504", "0.7958708", "0.79484594", "0.7940084", "0.7886445", "0.78285795", "0.77942383", "0.77931917", "0.77696216", "0.7764497", "0.7706728", "0.76481175", "0.763304", "0.759868", "0.7479528", "0.74374...
0.79163975
9
returns array w/ all added items
def items @items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_items\r\n list = Array.new\r\n items.each{ |item| list.push(item)}\r\n list\r\n end", "def get_items\r\n @arr.to_a\r\n end", "def make_item_list\n @data = $game_party.all_items.select {|item| include?(item)}\n @data.push(nil) if include?(nil)\n end", "def items\n ...
[ "0.70425993", "0.6816972", "0.6651816", "0.65886414", "0.6553055", "0.6532963", "0.6430804", "0.6429881", "0.6422382", "0.6417038", "0.64005536", "0.6303324", "0.6296054", "0.62805456", "0.6274694", "0.6268957", "0.62522864", "0.6240065", "0.6224634", "0.62211615", "0.6208977...
0.0
-1
updates total with items voided also updates items array with the last added removed
def void_last_transaction @items.slice!(@items.length-@last_qty, @items.length) @total -= @last_transaction.values[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_total\n tot = 0\n self.line_items.each do |li|\n tot += li.total\n end\n self.item_total = tot\n end", "def update_total\n self.total = self.line_items.reload.map(&:total).inject(:+).to_f\n end", "def update(items)\n # clear!\n self.items.each do |i|\n number = ...
[ "0.6825899", "0.6741231", "0.6679843", "0.66447496", "0.66257375", "0.6625242", "0.6590345", "0.6522727", "0.63197327", "0.6281329", "0.6275104", "0.6265877", "0.6256093", "0.6254553", "0.6254553", "0.60918605", "0.6070158", "0.6051017", "0.60231215", "0.6017169", "0.5976218"...
0.5645086
81
start ssl connection over existing tcpserver socket
def start(io) # start SSL negotiation ssl = OpenSSL::SSL::SSLSocket.new(io, @ssl_context) # connect to server socket ssl.accept # make sure to close also the underlying io ssl.sync_close = true # return as new io socket return ssl end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(io)\n # start SSL negotiation\n ssl = OpenSSL::SSL::SSLSocket.new(io, @ctx)\n # connect to server socket\n ssl.accept\n # make sure to close also the underlying io\n ssl.sync_close = true\n # return as new io socket\n return ssl\n end", "def start(io)\n #...
[ "0.7794769", "0.7794769", "0.7715263", "0.75440913", "0.7469398", "0.7426566", "0.7267545", "0.72429603", "0.7201536", "0.71997315", "0.718864", "0.7178205", "0.710683", "0.7022352", "0.6986863", "0.6928714", "0.6906046", "0.68722165", "0.6851468", "0.6822239", "0.6768816", ...
0.7836249
0
find a better way to sort, not really gonna work with this (possibly sort.by)
def find_teams(league) teams = [] league.each do |team| teams << team[:home_team] teams << team[:away_team] end uniq_teams = teams.uniq! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stable_sort_by(list); end", "def bigSorting(unsorted)\n\nend", "def sort_entries; end", "def sort_entries=(_arg0); end", "def sort a\r\n sort_rec a, []\r\nend", "def sort a\r\n sort_rec a, []\r\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def mot...
[ "0.76663804", "0.74764556", "0.7401979", "0.6937885", "0.6924298", "0.6924298", "0.69090354", "0.69090354", "0.6856841", "0.6837796", "0.6810996", "0.6786145", "0.67693406", "0.67565703", "0.67565703", "0.67565703", "0.6746215", "0.67314345", "0.6727324", "0.67243105", "0.670...
0.0
-1
apply some form of assignment with counting index from above (similar to cash register stuff) each team must increment whether win or lose (to be able to sort by wins and losses)
def games(meeting, record) meeting.each do |play| if play[:home_score].to_i > play[:away_score].to_i record[play[:home_team]]["W"] += 1 record[play[:away_team]]["L"] += 1 else play[:home_score].to_i < play[:away_score].to_i record[play[:away_team]]["W"] += 1 record[play[:home_team]]["L"] += 1 end end record end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n yes = 1\n no = 0\n Team.all.each do |team|\n team.matches_won = 0\n team.matches_played = 0\n team.save\n end\n\n Match.all.each do |match|\n if match.winner != nil\n if match.team1 == match.winner\n winner_team = Team.find_by_id(match.team1)\n ...
[ "0.69255877", "0.6921832", "0.684883", "0.6677194", "0.6636549", "0.6626307", "0.6529275", "0.6506562", "0.64514625", "0.6441589", "0.6436975", "0.64307785", "0.64294165", "0.64294165", "0.6406639", "0.63885665", "0.6370099", "0.6370099", "0.6339386", "0.63222283", "0.6306005...
0.635054
18
here's where the problem is (too many "teams") per ruby doc must set value to nil first
def team_select(rankings, team) which_team = nil rankings.each do |squad, record| if squad == team which_team = record end end which_team end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teamMemberNull \n \"teamMemberNull\" \n end", "def team_name\n self.team == nil ? \"\" : self.team.name\n end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def seeded_teams\n raise 'Not Implemented'\n end", "def cr...
[ "0.6976652", "0.6760137", "0.66828823", "0.66828823", "0.66828823", "0.66828823", "0.66828823", "0.66828823", "0.65528", "0.6525773", "0.6436899", "0.64116186", "0.64112914", "0.6335967", "0.6278817", "0.6274347", "0.6210974", "0.6187325", "0.6145864", "0.61205935", "0.606110...
0.0
-1
just grabs team whether they're home or away
def history(points, franchise) points.select do |game| game[:home_team] == franchise || game[:away_team] == franchise end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_a_team?\n !team.nil?\n end", "def home_or_away(team_name)\n game_hash[team_name][:status]\nend", "def unknown?\n home_team.nil? && away_team.nil?\n end", "def team_by_name(team_name)\n game_hash[:home].has_value?(team_name) ? game_hash[:home] : game_hash[:away]\n end", "def underd...
[ "0.74025136", "0.73247683", "0.72621953", "0.7255744", "0.71175635", "0.7105282", "0.7098272", "0.7076492", "0.7028028", "0.6957928", "0.683459", "0.6798574", "0.6782553", "0.67339087", "0.6712164", "0.6706998", "0.66466796", "0.6637259", "0.6619452", "0.6613861", "0.65859944...
0.0
-1
Preview this email at
def unlock_instructions CustomMailer.unlock_instructions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
Preview this email at
def confirmation_instructions CustomMailer.confirmation_instructions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
return true if the current user has already rated the other user
def rating?(user) rates.find_by(user_id: user.id, rating_id: id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rated_by?(user)\n rating && rating.user_ratings.exists?(:user_id => user)\n end", "def rated_by?(user)\n ratings.where(user_id: user.id).exist?\n end", "def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if u...
[ "0.7204734", "0.71171266", "0.7009953", "0.6993899", "0.6932868", "0.6845935", "0.6583768", "0.6580198", "0.65206873", "0.65004987", "0.6467047", "0.6439141", "0.6439141", "0.6309899", "0.62901086", "0.6275504", "0.62464267", "0.61768514", "0.6161292", "0.6134051", "0.6129952...
0.6059493
25
Test 2: Empty groups, empty description, no media
def test02_post_open_news_EmptyGDM login $user_1_email, $master_password $browser.goto($patch_media) sleep 2 assert $post_now.exists? $post_now.fire_event("onclick") assert $post_now.exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parser_handles_empty_simple_content\n simple_content_assert nil, nil\n simple_content_assert nil, ''\n end", "def print_group(group)\n puts \"Name: \" + group.name\n puts \"Description: \" + (group.description.nil? ? \"None\" : group.description)\n puts \"Status: \" + group.status\n puts \"Hr...
[ "0.6116683", "0.60720485", "0.6045338", "0.5920101", "0.588386", "0.5783575", "0.5782394", "0.5755139", "0.5713789", "0.57085055", "0.5696538", "0.5687124", "0.56804806", "0.5657587", "0.56305", "0.56286055", "0.56242806", "0.5603301", "0.5543483", "0.5540844", "0.5537754", ...
0.0
-1
Test 3: Empty groups, empty description, populated media
def test03_post_open_news_EmptyGDM login $user_1_email, $master_password $browser.goto($patch_media) sleep 2 assert $post_media_button.exists? $post_media_button.click file_upload "GlacierBasinTrailMtRainier.JPG" $post_now.fire_event("onclick") assert $post_now.exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test03_MediaAllFields\n\t\tloginPost\n\t\t$browser.goto($patch_media)\n\t\t\t\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"pictures of hiking mr. rainier #{random}.\")\n \t\t\t\tpostGroupPop\n \t\t\t\tpostGroupPop2\n\t\t\t\t$post_media_button.click\n\t\t\t\t$p...
[ "0.621615", "0.6207188", "0.61272883", "0.59761477", "0.59362775", "0.5917642", "0.5912377", "0.58794636", "0.58792645", "0.5844373", "0.5810699", "0.5773535", "0.5735547", "0.5667927", "0.56647646", "0.5631786", "0.56185323", "0.5614461", "0.55711484", "0.5565385", "0.555052...
0.5395855
30
Test 4: Empty groups, populated description, populated media
def test04_post_open_news_EmptyGPopDM login $user_1_email, $master_password $browser.goto($patch_media) sleep 2 assert $post_media_description.exists? $post_media_description.set("Media Description #{random}.") $post_media_button.click file_upload "GlacierBasinTrailMtRainier.JPG" $post_now.fire_event("onclick") assert $post_now.exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test03_MediaAllFields\n\t\tloginPost\n\t\t$browser.goto($patch_media)\n\t\t\t\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"pictures of hiking mr. rainier #{random}.\")\n \t\t\t\tpostGroupPop\n \t\t\t\tpostGroupPop2\n\t\t\t\t$post_media_button.click\n\t\t\t\t$p...
[ "0.6135544", "0.6088162", "0.6019473", "0.592721", "0.5784978", "0.5718239", "0.5716423", "0.57144636", "0.5696722", "0.56958914", "0.5684804", "0.56783617", "0.56330377", "0.56108385", "0.5594785", "0.55879605", "0.5554714", "0.55505776", "0.5523801", "0.5511623", "0.5498376...
0.56265634
13
Test 5: Populated group, empty description, no media
def test05_post_open_news_EmptyDMPopG login $user_1_email, $master_password $browser.goto($patch_media) sleep 2 assert $post_pick_group.exists? repostGroupPop $post_now.fire_event("onclick") assert $post_now.exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_group(group)\n puts \"Name: \" + group.name\n puts \"Description: \" + (group.description.nil? ? \"None\" : group.description)\n puts \"Status: \" + group.status\n puts \"Href: \" + group.href\nend", "def test_initialize_group\r\n \ttest_group = ProspectorGroup.new\r\n \ttest_group.intialize_grou...
[ "0.6571844", "0.6249539", "0.618921", "0.6072438", "0.5932298", "0.5918369", "0.5862924", "0.5860587", "0.58422035", "0.58410794", "0.5837634", "0.5801118", "0.5771843", "0.5769351", "0.57549065", "0.57511306", "0.57511306", "0.57511306", "0.57490784", "0.57428426", "0.574167...
0.5643465
24
Operation that the IP currently points to
def op sequence[ip] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip; end", "def ip; end", "def check_ip; end", "def regist_ip\n puts 'Registering IP address of this node'\n\n sock = TCPSocket.open($leader_ip)\n sock.write(\"regist\")\n ret_ip = sock.gets\n sock.close\n return ret_ip\n end", "def ip\n @actions << :ip\n self.class.mocked_i...
[ "0.645203", "0.645203", "0.64207983", "0.6293085", "0.626267", "0.60952765", "0.6078643", "0.6076898", "0.6049108", "0.6030761", "0.6026945", "0.599994", "0.598811", "0.59868735", "0.59730214", "0.59614176", "0.59614176", "0.59614176", "0.5916549", "0.5894968", "0.5894968", ...
0.64821863
0
Access memory at the provided location
def [](loc) sequence[loc] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(off, sz=4096); Ragweed::Wrap32::read_process_memory(@h, off, sz); end", "def get_object(offset)\n io = to_shm_io\n io.seek(offset)\n Marshal.load(io)\n end", "def read_memory(address)\n # nes.memory.readWord(address)\n # Memory Manager readWord above\n # return read(ad...
[ "0.6399281", "0.63791585", "0.63005406", "0.62971354", "0.61796755", "0.6171931", "0.61365575", "0.61267996", "0.6123963", "0.6122663", "0.6115358", "0.610928", "0.61025006", "0.6041607", "0.6029811", "0.59960794", "0.5906712", "0.5814971", "0.5803863", "0.5787122", "0.571533...
0.0
-1
Write memory at the provided location
def []=(loc, val) sequence[loc] = val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write!\n ensure_mode(:privileged)\n exec('write memory')\n end", "def write(memory, address, process)\n memory[address, process.memory_blocks] = Concurrent::Array.new(process.memory_blocks, process.id)\n end", "def write_to(offset,args)\r\n\t\t\tif !@rw\r\n\t\t\t\traise \"The file #{@filen...
[ "0.7013797", "0.6935818", "0.6615015", "0.65895456", "0.6540519", "0.6462389", "0.63741934", "0.6300883", "0.62062633", "0.61951685", "0.6165523", "0.6135923", "0.6135923", "0.6135178", "0.6064887", "0.60578775", "0.60098433", "0.60010594", "0.5993549", "0.5973125", "0.597291...
0.0
-1
Read the provided number of instruction args. Omits the current operation.
def args(count) sequence[ip+1, count] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(count)\n resp = sequence[ip+1, count]\n puts ([opcode] + resp).inspect\n resp\n end", "def args(count)\n resp = count.times.map { |i| read(ip + 1 + i) }\n\n puts(([opcode] + resp).inspect) if debug\n\n resp\n end", "def parse(args)\n @args = args\n @instructio...
[ "0.66800547", "0.66115946", "0.6391388", "0.6336367", "0.6197972", "0.594532", "0.594532", "0.5940319", "0.5894053", "0.58464044", "0.58305585", "0.5786359", "0.57703453", "0.5749989", "0.5704644", "0.56823015", "0.5678692", "0.5678692", "0.56578594", "0.5650234", "0.5626782"...
0.6173161
5
Increment the instruction pointer by `count`
def increment(count) @ip += count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incr_count\n @count ||= 0\n @count += 1\n end", "def increment(att, count = 1)\n key[:counters].call(\"HINCRBY\", att, count)\n end", "def add_to_count\n @count += 1\n end", "def next_instruction\n inst = @program[@current_inst]\n @current_inst += 1\n inst\n end...
[ "0.6813269", "0.6762807", "0.6594867", "0.6569928", "0.6567397", "0.63058823", "0.62714237", "0.61310047", "0.61190856", "0.6071661", "0.6053236", "0.5995766", "0.59712267", "0.59497184", "0.5948654", "0.59271514", "0.59042454", "0.58976644", "0.5873836", "0.58130646", "0.574...
0.7579032
2
Assign the instruction pointer to the provided location
def jump(loc) @ip = loc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jump(x)\n @memory_position = x\n end", "def on(instruction, arguments, &bloc)\n @instructions[instruction] = [arguments, bloc]\n end", "def jump(address)\n @pc = address\n end", "def set_jump_for(position)\n at = position.at\n code = position.object\n return unless code.nex...
[ "0.6128202", "0.587118", "0.5754626", "0.5651612", "0.5630579", "0.5609524", "0.55176514", "0.54754156", "0.54529804", "0.54029834", "0.53694016", "0.5329408", "0.5328008", "0.5300557", "0.5297072", "0.5297072", "0.5253452", "0.523424", "0.5206441", "0.5199096", "0.51965857",...
0.635694
2
GET /options/new GET /options/new.xml
def new @option = OptionModel.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @option } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n end", "def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n e...
[ "0.7570545", "0.7570545", "0.74550205", "0.701233", "0.6894441", "0.68835485", "0.68835485", "0.68163115", "0.6813543", "0.6754595", "0.67398703", "0.67339754", "0.6731938", "0.65230775", "0.65215486", "0.6495427", "0.6408086", "0.63814545", "0.6369065", "0.63475317", "0.6323...
0.73395056
3
POST /options POST /options.xml
def create @option = OptionModel.new(params[:option_model]) saved = @option.save session[:option_model] = @option.to_hash respond_to do |format| if saved format.html { redirect_to(@option) } format.xml { render :xml => @option, :status => :created, :location => @option } else format.html { render :action => "new" } format.xml { render :xml => @option.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post options\n rest_request({ method: :post }.merge(options))\n end", "def post options\n rest_request({ method: :post }.merge(options))\n end", "def options!\n request! :options\n end", "def options\n\t\t# we don't support sending a payload in options' body.\n\t\treq = Net::HTTP::Opt...
[ "0.66542524", "0.66542524", "0.6446557", "0.6011126", "0.5971675", "0.5816911", "0.5788307", "0.5736625", "0.56720096", "0.5657573", "0.5641129", "0.564042", "0.5603561", "0.55975896", "0.55861926", "0.55861926", "0.55861926", "0.55861926", "0.55861926", "0.55861926", "0.5586...
0.0
-1
and returns an Array with the same number of elements, and each element has the running total from the original Array.
def running_total(arr) new_arr = [] running_total = arr[0] arr.each_with_index do |element, index| new_arr.push(running_total) running_total = running_total + arr[index + 1].to_s.to_i end new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_total(array)\r\n new_arr = []\r\n total = 0\r\n array.map do |x|\r\n total += x\r\n new_arr << total\r\n end\r\n new_arr\r\n end", "def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total <...
[ "0.8644924", "0.85115325", "0.84803355", "0.8399224", "0.83926857", "0.83744156", "0.8360413", "0.8355934", "0.8341929", "0.8339863", "0.82941985", "0.82936525", "0.8277946", "0.8268809", "0.82534724", "0.82292014", "0.8227137", "0.8213202", "0.81834996", "0.81821924", "0.818...
0.8123076
30
indexes the array elemens by a block
def index_by map { |n| [yield(n), n] }.to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_each_with_index(arr)\n \n\n for element in arr\n index = arr.index(element)\n yield(element, index)\n end\n \n \nend", "def each_byte_with_index\n\t\t@array.each_with_index { |a,i| yield a,i }\n\tend", "def each(&block_)\n @indexes.each(&block_)\n end", "def index(element); end", ...
[ "0.6711639", "0.668588", "0.6576321", "0.6517592", "0.6486002", "0.6432336", "0.6432336", "0.63813215", "0.6275402", "0.6251584", "0.62025326", "0.6141902", "0.61359894", "0.61329776", "0.610723", "0.60900164", "0.60785735", "0.60785735", "0.6078277", "0.60780054", "0.6073401...
0.0
-1
counts the number of times the argument is present as a subarray as list in the array
def subarray_count(subarray) each_cons(subarray.length).count(subarray) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_count(array)\n\nend", "def count_elements(array)\n\nend", "def count_positive_subarrays(arr) \n return arr.count{|ele| ele.sum > 0}\nend", "def count_positive_subarrays(two_d_arr)\n #debugger\n # ([[-2, 5], [1, -9, 1], [4, 7]]).count(*(any args))\n two_d_arr.count{ |subarr| subarr.sum...
[ "0.7792966", "0.7725135", "0.7427933", "0.73195374", "0.7199882", "0.7183751", "0.71461487", "0.70884186", "0.7065079", "0.7054021", "0.7024071", "0.6965469", "0.6928716", "0.6916114", "0.6912451", "0.6910643", "0.6863588", "0.68600655", "0.68514043", "0.681722", "0.68087673"...
0.83554095
0
counts how many times an element is present in an array
def occurences_count Hash.new(0).tap do |result| each { |item| result[item] += 1 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_elements(array)\n\t# My attempt:\n\t# hash = {}\n\t# array.each do |e|\n\t# \thash[e] = 1\n\t# end\n\t# new_array = []\n\t# hash.each do |animal, count|\n\t# \tnew_array = hash.select{|animal2, count2| animal2 == animal}\n\t# end\n\t# new_array\n\n\t# Stack Overflow:\n\tcounts = Hash.new(0) # sets defaul...
[ "0.81561077", "0.80567336", "0.80441225", "0.80303264", "0.80174536", "0.79930115", "0.7985508", "0.79849", "0.79320467", "0.7910068", "0.7881951", "0.787101", "0.783135", "0.781528", "0.780535", "0.780194", "0.7773519", "0.7746347", "0.7745694", "0.7695702", "0.7679753", "...
0.0
-1
maps each element to the number of occurences in the original array
def densities map { |n| count n } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_count(arr)\n fre = {}\n fre.default = 0\n arr.each { |el| fre[el] += 1 }\n return fre\nend", "def count_elements(array)\n array.group_by(&:itself).map { |key, value| key.merge(count: value.length)} # counts number of times occur\nend", "def count_occurrences(array)\n\toccurences = {}\n\n\tarra...
[ "0.8055612", "0.7852904", "0.7741645", "0.7730528", "0.77238196", "0.76910156", "0.7637037", "0.76022387", "0.7561815", "0.7542652", "0.7519835", "0.75107825", "0.7494289", "0.74699837", "0.7463726", "0.7438153", "0.7430159", "0.74193585", "0.741881", "0.74098176", "0.735316"...
0.0
-1
Get a single release asset = Examples github = Github.new github.repos.releases.assets.get 'owner', 'repo', 'id'
def get(*args) params = arguments(args, required: [:owner, :repo, :id]).params get_request("/repos/#{owner}/#{repo}/releases/assets/#{id}" , params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n repo = assets_repo\n @v_asset = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_asset }\n end\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def get_asset(id)\r\n ...
[ "0.70067394", "0.69598156", "0.6759065", "0.6752624", "0.66346973", "0.6596524", "0.65734065", "0.655549", "0.6503357", "0.6477614", "0.62979877", "0.6269648", "0.6209054", "0.6209054", "0.61817837", "0.61773974", "0.6174258", "0.6151368", "0.61507773", "0.60510087", "0.60262...
0.7887219
0
Return paths based off Rails default plus some customization. These paths are Ecrire's, not the users's theme. For the user's paths, look at Ecrire::Theme::Engine.paths
def paths @paths ||= begin paths = super paths.add 'config/routes.rb', with: 'routes.rb' paths.add 'config/locales', with: 'locales', glob: "**/*.{rb,yml}" paths end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths\n @paths ||= begin\n paths = super\n paths.add 'config/secrets', with: Ecrire::Theme.path + 'secrets.yml'\n paths.add 'config/database', with: Ecrire::Theme.path + 'secrets.yml'\n paths.add 'config/routes.rb', with: 'routes.rb'\n paths.add 'config/locales', wi...
[ "0.71200037", "0.69200456", "0.68518096", "0.685117", "0.68304205", "0.6652521", "0.65689915", "0.6420999", "0.63978094", "0.6230695", "0.61454517", "0.6057452", "0.6049732", "0.6005849", "0.59851974", "0.5984927", "0.59672743", "0.59381944", "0.5921982", "0.5906433", "0.5888...
0.66247696
6
reply send location message
def reply_send_location(event) client.reply_message(event["replyToken"], { type: "template", altText: I18n.t("chat.line_bot.service.send_location"), template: { type: "buttons", text: I18n.t("chat.line_bot.service.send_location"), actions: [ { type: "uri", label: I18n.t("chat.line_bot.service.set_location"), uri: "line://nv/location" } ] } }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_location(bot, message)\n buttons = [\n Telegram::Bot::Types::InlineKeyboardButton.new(\n text: 'przystanek', \n callback_data: {\n 'type' => 'bus',\n 'lat' => message.text, \n 'lng' => message.text\n }.to_json\n ),\n Telegram::Bot::Types::InlineKeyboardButt...
[ "0.6639069", "0.64361334", "0.63614446", "0.6064309", "0.5987063", "0.58139586", "0.5801013", "0.5735889", "0.570898", "0.57033324", "0.5689853", "0.5686033", "0.56789947", "0.5631206", "0.56280404", "0.5619926", "0.5616567", "0.5597107", "0.5597107", "0.5592948", "0.5584025"...
0.7803032
0