query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2 values |
|---|---|---|---|---|---|---|
PUT /admin/kpi_templates/1 PUT /admin/kpi_templates/1.json | def update
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
if @admin_kpi_template.update_attributes(params[:admin_kpi_template])
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_templa... | [
"0.6677234",
"0.6605227",
"0.6563711",
"0.6366431",
"0.63474077",
"0.6313986",
"0.6302278",
"0.6235642",
"0.62329364",
"0.6221428",
"0.61613137",
"0.6146442",
"0.613878",
"0.60881495",
"0.60746276",
"0.6053903",
"0.60427064",
"0.6026944",
"0.60222507",
"0.59898096",
"0.597725... | 0.72135085 | 0 |
DELETE /admin/kpi_templates/1 DELETE /admin/kpi_templates/1.json | def destroy
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
@admin_kpi_template.destroy
respond_to do |format|
format.html { redirect_to admin_kpi_templates_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.htm... | [
"0.81895006",
"0.7716338",
"0.76344776",
"0.7569155",
"0.75441825",
"0.7424844",
"0.72418547",
"0.72326523",
"0.7227562",
"0.719766",
"0.71947485",
"0.71778405",
"0.7172795",
"0.7161264",
"0.7155254",
"0.7136468",
"0.71360016",
"0.71345735",
"0.7133789",
"0.7114048",
"0.71082... | 0.81072366 | 1 |
GET /inventory_plans GET /inventory_plans.json | def index
@inventory_plans = InventoryPlan.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def index\n respond_with(@plans = Plan.all)\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.... | [
"0.77916926",
"0.7543112",
"0.73146963",
"0.7312528",
"0.72711605",
"0.71513766",
"0.71465814",
"0.71465814",
"0.7105246",
"0.70671",
"0.70236224",
"0.6997769",
"0.69931203",
"0.6962248",
"0.68519205",
"0.68396896",
"0.6816712",
"0.6749482",
"0.6733172",
"0.67094934",
"0.6641... | 0.76079214 | 1 |
POST /inventory_plans POST /inventory_plans.json | def create
@inventory_plan = InventoryPlan.new(inventory_plan_params)
respond_to do |format|
if @inventory_plan.save
format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully created.' }
format.json { render :show, status: :created, location: @inventory_plan }
else
format.html { render :new }
format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @pl... | [
"0.69540006",
"0.6920647",
"0.66802293",
"0.66406375",
"0.6632244",
"0.6624152",
"0.6624152",
"0.6559901",
"0.6514302",
"0.6496677",
"0.6468147",
"0.6465878",
"0.6451604",
"0.6436096",
"0.64128935",
"0.63685995",
"0.6365216",
"0.63586235",
"0.63254756",
"0.63206035",
"0.63140... | 0.7369263 | 0 |
PATCH/PUT /inventory_plans/1 PATCH/PUT /inventory_plans/1.json | def update
respond_to do |format|
if @inventory_plan.update(inventory_plan_params)
format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_plan }
else
format.html { render :edit }
format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n ... | [
"0.6997916",
"0.6967389",
"0.6940506",
"0.69102645",
"0.69102645",
"0.67818505",
"0.67738014",
"0.67738014",
"0.67738014",
"0.67738014",
"0.67738014",
"0.6761353",
"0.6700652",
"0.6686706",
"0.6659432",
"0.66178185",
"0.65859526",
"0.6580674",
"0.657027",
"0.6568275",
"0.6558... | 0.70350343 | 0 |
GET /answer_respondents GET /answer_respondents.json | def index
@answer_respondents = AnswerRespondent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def answers\n request('answers')\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def answer_respondent_params\n params.... | [
"0.73055446",
"0.71295285",
"0.68813956",
"0.6850379",
"0.671438",
"0.67118245",
"0.6680594",
"0.663625",
"0.6592341",
"0.6578443",
"0.6578443",
"0.6578443",
"0.6578443",
"0.6513747",
"0.64961135",
"0.6478164",
"0.64075536",
"0.6404816",
"0.6389788",
"0.6372988",
"0.63352245"... | 0.81594193 | 0 |
POST /answer_respondents POST /answer_respondents.json | def create
@answer_respondent = AnswerRespondent.new(answer_respondent_params)
respond_to do |format|
if @answer_respondent.save
format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }
format.json { render :show, status: :created, location: @answer_respondent }
else
format.html { render :new }
format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end",
"def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end",
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def create\n @answe... | [
"0.7431237",
"0.7284853",
"0.7212755",
"0.66907847",
"0.66442853",
"0.6495077",
"0.6491485",
"0.64622796",
"0.64386237",
"0.6377557",
"0.63708645",
"0.63708645",
"0.6366774",
"0.6341342",
"0.63385785",
"0.6307716",
"0.6262253",
"0.6255723",
"0.62530404",
"0.62362015",
"0.6229... | 0.73354363 | 1 |
PATCH/PUT /answer_respondents/1 PATCH/PUT /answer_respondents/1.json | def update
respond_to do |format|
if @answer_respondent.update(answer_respondent_params)
format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }
format.json { render :show, status: :ok, location: @answer_respondent }
else
format.html { render :edit }
format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @que... | [
"0.7230572",
"0.7226345",
"0.71595407",
"0.71509564",
"0.7144758",
"0.7116835",
"0.7072119",
"0.70406055",
"0.7026399",
"0.7025212",
"0.7024132",
"0.6972862",
"0.6972862",
"0.6963989",
"0.6931329",
"0.69256085",
"0.69256085",
"0.69256085",
"0.69216883",
"0.6917072",
"0.691536... | 0.7575017 | 0 |
DELETE /answer_respondents/1 DELETE /answer_respondents/1.json | def destroy
@answer_respondent.destroy
respond_to do |format|
format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n f... | [
"0.77064997",
"0.7694547",
"0.76218575",
"0.76218575",
"0.7612169",
"0.7564523",
"0.75546277",
"0.75546277",
"0.75343424",
"0.7522176",
"0.74898523",
"0.7467054",
"0.742865",
"0.74270797",
"0.74086344",
"0.73985296",
"0.73985296",
"0.73985296",
"0.73985296",
"0.73985296",
"0.... | 0.8105654 | 0 |
Set default values if nothing has input for max and backup student | def default_values
self.max_student ||= 0
self.backup_student ||= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_init\n self[:max] ||= DEFAULT_MAX #will set the default value only if it's nil\n self[:current] ||= DEFAULT_ZERO\n self[:percentage] ||= DEFAULT_ZERO\n end",
"def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_... | [
"0.6815649",
"0.65635794",
"0.6395689",
"0.61816514",
"0.61816514",
"0.6142738",
"0.6057108",
"0.6021825",
"0.6011223",
"0.5986865",
"0.595286",
"0.595286",
"0.5946054",
"0.591463",
"0.5899782",
"0.58350366",
"0.58257866",
"0.57821053",
"0.5771473",
"0.57642305",
"0.5763239",... | 0.83218783 | 0 |
show how many seats available, show full if left 0 | def seats_available
available = total_student - UserEvent.joined_students_count(self.id)
if available > 0
available
else
"FULL"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seats_available_over_total\n\t\t\"#{seats_available} / #{total_student}\"\n\tend",
"def remaining_seats\n auditorium.seating_capacity - tickets.count\n end",
"def total_seats_left\n [self.house_capacity - vouchers.size, 0].max\n end",
"def seats_available?\n (capacity - total_enrollments) > 0\... | [
"0.7427944",
"0.7204475",
"0.7068076",
"0.7061295",
"0.7044148",
"0.6988808",
"0.6986715",
"0.69829905",
"0.6982625",
"0.6860024",
"0.66717607",
"0.63720167",
"0.6363908",
"0.6338503",
"0.62845594",
"0.6258467",
"0.6226915",
"0.6166556",
"0.6139675",
"0.605597",
"0.60485965",... | 0.7476062 | 0 |
determine if an event is expired | def is_expired?
self.event_date < DateTime.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_expired?(date)\n # The event will expires 2 hours after is date\n Time.parse(date).to_f < Time.now.to_f - 2.hours.to_i\n rescue TypeError\n true\n end",
"def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end",
"def is_expired?\n (!end_time.nil? and e... | [
"0.8028491",
"0.79227525",
"0.7835721",
"0.77996075",
"0.77374166",
"0.77341044",
"0.77300525",
"0.77004135",
"0.7689028",
"0.76824254",
"0.76695436",
"0.7639126",
"0.7635659",
"0.761576",
"0.76122284",
"0.7599086",
"0.75877947",
"0.75784826",
"0.75738645",
"0.7571503",
"0.75... | 0.8490823 | 0 |
validate end time cannot be earlier than start time | def end_time_cannot_be_earlier_than_start_time
if end_time && start_time
if end_time < start_time
errors.add(:end_time, "End time should not be earlier than start time.")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end",
"def validate_temporal_sanity\n errors.add(:end_time, \"Must be after Start Time.\") unless self.start_time < self.end_time\n end",
"def... | [
"0.8695012",
"0.8549378",
"0.8511056",
"0.8485147",
"0.84669256",
"0.84273964",
"0.8292079",
"0.8291583",
"0.8275534",
"0.82208645",
"0.82175106",
"0.8195104",
"0.8145219",
"0.8094738",
"0.8056562",
"0.7952406",
"0.79493713",
"0.794894",
"0.7847506",
"0.7829597",
"0.7771807",... | 0.85964435 | 1 |
GET /prod_cotis GET /prod_cotis.json | def index
@prod_cotis = ProdCoti.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|... | [
"0.61314243",
"0.60986084",
"0.5985435",
"0.59629595",
"0.5894719",
"0.58706814",
"0.58565897",
"0.5829874",
"0.5815771",
"0.57987326",
"0.5790425",
"0.579011",
"0.5754944",
"0.5737547",
"0.57159364",
"0.56977683",
"0.56970215",
"0.56858516",
"0.567605",
"0.5672296",
"0.56291... | 0.68760175 | 0 |
POST /prod_cotis POST /prod_cotis.json | def create
@prod_coti = ProdCoti.new(prod_coti_params)
respond_to do |format|
if @prod_coti.save
format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }
format.json { render :show, status: :created, location: @prod_coti }
else
format.html { render :new }
format.json { render json: @prod_coti.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prod_coti_params\n params.require(:prod_coti).permit(:cod_cotiza, :cod_producto)\n end",
"def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n ... | [
"0.6184822",
"0.60576785",
"0.5955267",
"0.59391475",
"0.58430254",
"0.5840807",
"0.5837428",
"0.58315563",
"0.5775817",
"0.5759948",
"0.5754532",
"0.5739815",
"0.57256734",
"0.57157534",
"0.5685645",
"0.56800354",
"0.5679995",
"0.5676887",
"0.5661198",
"0.5647367",
"0.563832... | 0.6901862 | 0 |
PATCH/PUT /prod_cotis/1 PATCH/PUT /prod_cotis/1.json | def update
respond_to do |format|
if @prod_coti.update(prod_coti_params)
format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }
format.json { render :show, status: :ok, location: @prod_coti }
else
format.html { render :edit }
format.json { render json: @prod_coti.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @cotiz_clo_mul.update(cotiz_clo_mul_params)\n format.html { redirect_to @cotiz_clo_mul, notice: 'Cotiz clo mul was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotiz_clo_mul }\n else\n format.html { render ... | [
"0.64031595",
"0.6370816",
"0.6341285",
"0.6326131",
"0.62558997",
"0.625389",
"0.6234354",
"0.621671",
"0.6194457",
"0.61910784",
"0.61684775",
"0.6134126",
"0.6115542",
"0.6115483",
"0.6103449",
"0.610302",
"0.6086102",
"0.6083888",
"0.6047131",
"0.60440755",
"0.60432106",
... | 0.7189997 | 0 |
DELETE /prod_cotis/1 DELETE /prod_cotis/1.json | def destroy
@prod_coti.destroy
respond_to do |format|
format.html { redirect_to prod_cotis_url, notice: 'Prod coti was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"... | [
"0.7181901",
"0.7046368",
"0.6710193",
"0.6703705",
"0.66804236",
"0.6603741",
"0.65819955",
"0.6579261",
"0.65738744",
"0.6564295",
"0.65524226",
"0.65429926",
"0.65280515",
"0.6522569",
"0.6521582",
"0.6521582",
"0.6521582",
"0.6521582",
"0.6518832",
"0.6507469",
"0.6502180... | 0.71944636 | 0 |
progress goal see for testing if an internal or external goal | def is_internal?
return (self.goal_type % 2) == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end",
"def in_progress?\n return false unless status\n status.match(/^Generated on/).nil?\n end",
"def calculate_and_change_status\n return @status.not_a_plan! if !ta... | [
"0.60204583",
"0.5907031",
"0.5829508",
"0.5744864",
"0.5739279",
"0.5726153",
"0.5700277",
"0.568418",
"0.568418",
"0.568418",
"0.56838703",
"0.567169",
"0.56065136",
"0.5596979",
"0.5580879",
"0.5560432",
"0.5547503",
"0.5541333",
"0.5537678",
"0.5529024",
"0.5528989",
"0... | 0.62596583 | 0 |
sets goal to ABANDONED and calls remove on children | def remove_act
# outdent children in case remove_act doesn't delete
self.children.each do |child|
if child.type != 'GoalTracker'
child.outdent
child.remove_act
end
end
# check if parent should update completeness
old_parent = self.parent
self.state = Activity::ABANDONED
self.save!
# refresh parent completeness
if !old_parent.nil?
old_parent.is_complete?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself... | [
"0.7147326",
"0.7066963",
"0.6505253",
"0.647531",
"0.6440399",
"0.6432944",
"0.6367749",
"0.636337",
"0.635204",
"0.6335101",
"0.62772447",
"0.626488",
"0.6210802",
"0.62064195",
"0.61856765",
"0.61571175",
"0.61485565",
"0.6145143",
"0.61316776",
"0.61258465",
"0.6104825",
... | 0.7523682 | 0 |
add CD object to the array variable, $cd_arr | def add_cd(a_cd)
$cd_arr << a_cd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add obj\n\t\t\t@objs2 += [obj] \n\t\tend",
"def added(array)\nend",
"def addComplexObject(var_Object)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"addig object [\" + var_Object.to_s() + \"] to the array list\")\n \n if(!var_Object.is_a?(SBAStore::SBAComplexObject))\n raise SBA... | [
"0.57683146",
"0.55001056",
"0.54594797",
"0.5423005",
"0.5422432",
"0.5346832",
"0.52584606",
"0.5093057",
"0.5051827",
"0.5028648",
"0.5023771",
"0.50144297",
"0.49987257",
"0.49938908",
"0.49835676",
"0.4971274",
"0.49583435",
"0.49470288",
"0.48972076",
"0.48884988",
"0.4... | 0.7951346 | 0 |
prints data from the array to screen in human readable yaml format | def show_data
puts $cd_arr.to_yaml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end",
"def to_yaml() end",
"def yaml_display(env, \n options = {}, \n colors = DbAgile::Core::Schema::STATUS_TO_COLOR, \n ... | [
"0.70132124",
"0.66674596",
"0.665657",
"0.6487097",
"0.63716704",
"0.63599616",
"0.633203",
"0.633203",
"0.6286116",
"0.6279139",
"0.6245281",
"0.62150383",
"0.6193655",
"0.616709",
"0.6161458",
"0.6160394",
"0.61015743",
"0.60969007",
"0.60808796",
"0.6066709",
"0.6015362",... | 0.7932858 | 0 |
Wraps a block catching errors and logging / replying to the source, when they happen before reraising them | def wrapping_errors(response=nil, &block)
begin
yield if block_given?
rescue StandardError => e
"Oh noes, #{e.message}".tap do |message|
log.error message
response.reply message if response
end
e.backtrace.each { |t| e.debug t }
raise e
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _catch_warden(&block); end",
"def wrap_stream_error_handling\n error_context = capture_context\n proc do |csv|\n yield(csv)\n rescue StandardError => e\n CaptureError.log_error(e)\n CaptureError.capture(e, error_context)\n raise e\n end\n end",
"def on_err... | [
"0.6871378",
"0.6762409",
"0.6728202",
"0.6627646",
"0.6582039",
"0.6582039",
"0.6582039",
"0.65709674",
"0.64903224",
"0.64901906",
"0.64554197",
"0.64539593",
"0.643978",
"0.641213",
"0.6408639",
"0.6383421",
"0.63664514",
"0.63662905",
"0.6315504",
"0.6315504",
"0.6308859"... | 0.6880621 | 0 |
Fetches info about a single user | def fetch_user(id)
client.user(id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def info\n\t@user = User.find(params[:id])\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n ... | [
"0.78311265",
"0.7762366",
"0.7651086",
"0.7634371",
"0.7530107",
"0.7524838",
"0.74918705",
"0.7440991",
"0.7420561",
"0.7377862",
"0.73730254",
"0.73653746",
"0.73544115",
"0.73365146",
"0.73365146",
"0.7333228",
"0.73302364",
"0.7320437",
"0.7291734",
"0.7289717",
"0.72435... | 0.7795002 | 1 |
Consumes an input array and returns a balanced binary tree. | def build_tree(input_array)
sorted_set = input_array.sort.uniq
build_tree_aux(sorted_set, 0, sorted_set.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_binary(arr)\n node = Node.new(arr[0])\n arr.slice(1..-1).each {|el| insert_into_tree(node, el) }\n node\nend",
"def build_tree(array)\n return nil if array.empty?\n\n mid = (array.length - 1) / 2\n node = Node.new(array[mid])\n node.left = build_tree(array[0...mid])\n node.right =... | [
"0.7178468",
"0.7052835",
"0.6953921",
"0.69506204",
"0.6894124",
"0.68749267",
"0.68042964",
"0.6784026",
"0.67772186",
"0.67171127",
"0.66846347",
"0.66815245",
"0.6665387",
"0.6660863",
"0.6652068",
"0.66337943",
"0.65953887",
"0.65851086",
"0.6578991",
"0.65423375",
"0.65... | 0.7092395 | 1 |
POST /barks or /barks.json | def create
@bark = current_user.barks.build(bark_params)
respond_to do |format|
if @bark.save
format.html { redirect_to root_path, notice: "Bark was successfully created." }
format.json { render :show, status: :created, location: @bark }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @bark.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format.... | [
"0.64246625",
"0.6424445",
"0.6054478",
"0.5923874",
"0.5910778",
"0.59107625",
"0.5903337",
"0.5902356",
"0.5887644",
"0.5884899",
"0.585661",
"0.58294487",
"0.5823725",
"0.57541114",
"0.5738117",
"0.57277936",
"0.5719391",
"0.56941056",
"0.5692517",
"0.5685203",
"0.56814486... | 0.68822765 | 0 |
PATCH/PUT /barks/1 or /barks/1.json | def update
respond_to do |format|
if @bark.update(bark_params)
format.html { redirect_to @bark, notice: "Bark was successfully updated." }
format.json { render :show, status: :ok, location: @bark }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @bark.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.66103864",
"0.6525338",
"0.6412469",
"0.63037306",
"0.6233765",
"0.62271506",
"0.62136483",
"0.62129813",
"0.61933815",
"0.61432594",
"0.6134164",
"0.61065763",
"0.6066356",
"0.6062231",
"0.6054456",
"0.60389256",
"0.6028534",
"0.6025036",
"0.6017557",
"0.60162574",
"0.601... | 0.67966646 | 0 |
takes a string preposistion and turns it into a 2d array ands of ors with id numbers + depending on negation | def string_to_internal(preposition)
temp_kb =Array.new
#string input of format literal_name LOGICAL_PREPOSISTION
preposition_array = preposition.split
next_negated = false
sentence = []
preposition_array.each do |word|
#####################################3
# puts " word: " + word
#don't need to handle "or" as long as it is in right format, will look to "and" and the end as limiters
if (word == "AND" || word == "and")
temp_kb << sentence
sentence = []
elsif(word == "NOT" || word == "not")
next_negated = true
elsif(word == "OR" || word =="or")
else
temp = @name_hash[word]
#add variable if doesnt exist
if(temp == nil)
temp_var = Literalzs.new(word,@total_variables)
@id_array.push(temp_var)
@name_hash[word] = @total_variables
temp = @total_variables
@total_variables+=1
end
if(next_negated)
temp = temp.to_i * -1
#########################################################3333
#puts " temp negated, now is: " + temp.to_s
next_negated = false
end
sentence << temp
end
end
#need to grab last sentence since it wont be ended with and
temp_kb << sentence
return temp_kb
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contain_all_rots(strng, arr)\n array = strng.chars\n number = 0\n result = []\n (array.size - 1).times do \n array.rotate!\n result << array\n end\n result.map! {|y| y.join(\"\")}\n # result.all?{|x| arr.include?(x)}\nend",
"def convert_to_ar(str)\n bgn = 0\n cur = st... | [
"0.5680787",
"0.5576906",
"0.5546782",
"0.554677",
"0.5517356",
"0.5515137",
"0.54760414",
"0.54503244",
"0.5427184",
"0.5394476",
"0.53865373",
"0.53825337",
"0.53650457",
"0.536414",
"0.53584665",
"0.53492194",
"0.5336559",
"0.5335094",
"0.5331078",
"0.53201073",
"0.5318915... | 0.613412 | 0 |
turns the propositions to CNF(if needed) | def toCNF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cnf\n r = []\n @table.each {|inputs, output|\n return output.to_s if inputs.empty?\n next if output\n term = []\n each_input(inputs) {|name, input|\n if input\n term << \"!#{name}\"\n else\n term << name\n end\n }\n if term.length == 1\... | [
"0.57956314",
"0.54493576",
"0.5425205",
"0.5412952",
"0.5344363",
"0.52897114",
"0.5277667",
"0.5216268",
"0.5154754",
"0.5138244",
"0.5109283",
"0.5085626",
"0.50761646",
"0.5060717",
"0.5031964",
"0.5017147",
"0.49444252",
"0.49179173",
"0.4911493",
"0.48964894",
"0.487549... | 0.60784334 | 0 |
the way this is designed, it short circuts. so sometimes when it should say false it will say indeterminant for the whole knowledgebase returns false, true, or indetermninant as 1,1,0 (in current encoding) alike with the assignment list and literal class assignment must be parallel array to id nums (may want to use hashes instead) | def satisfiable_assignment?(assignment)
sentence_eval = 1
index = 0
while(sentence_eval == 1 && index < @kb.size)
sentence_eval = 0
all_false = true
##############################################3
# puts "kb is: " + @kb.to_s
# puts "the assignments are : " + assignment.to_s
@kb[index].each do |id|
################################################33
# puts " the atom to check : " + id.to_s
temp_id = id
if(temp_id >0)
assign = assignment[temp_id - 1]
###################################################
# puts "the atom is : " + id.to_s
# puts "the variable is assigned to: " + assignment[temp_id-1].to_s
# puts "which evaluates to: " + assign.to_s
else
assign = assignment[temp_id*-1 -1].to_i * -1
###################################################
# puts "the atom is : " + id.to_s
# puts "the variable is assigned to: " + (assignment[temp_id*-1 - 1] - 1).to_s
# puts "which evaluates to: " + assign.to_s
end
if(assign==1)
sentence_eval = 1
all_false = false
break
elsif(assign == 0)
all_false = false
end
end
if(all_false)
sentence_eval = -1
end
index+=1
end
return sentence_eval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignment_intialize\n\t\tif(@puret and @puref)\n\t\t\treturn false\n\t\tend\n\t\tif(@num_negative == 0 or @puret)\n\t\t\t@assignments = [1]\n\t\telsif(@num_positive == 0 or @puref)\n\t\t\t@assignments = [-1]\n\t\telsif(@best_guess <0)\n\t\t\t@assignments = [-1,1]\n\t\telse\n\t\t\t@assignments = [1,-1]\n\t\ten... | [
"0.6625051",
"0.6095803",
"0.5790214",
"0.56934625",
"0.56818473",
"0.55996346",
"0.55899537",
"0.5428367",
"0.5428367",
"0.5428367",
"0.5427513",
"0.53843915",
"0.5354882",
"0.5267769",
"0.5261744",
"0.52563506",
"0.52499795",
"0.5246493",
"0.5193265",
"0.5193265",
"0.517964... | 0.631583 | 1 |
Create a function with two arguments that will return a list of length (n) with multiples of (x). Assume both the given number and the number of times to count will be positive numbers greater than 0. Return the results as an array (or list in Python or Haskell.) Examples: count_by(1,10) should return [1,2,3,4,5,6,7,8,9,10] count_by(2,5) should return [2,4,6,8,10] | def count_by(x, n)
a=[]
y=0
n.times {y+=x; a<<y}
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_by(x, n)\n (1..n).map{|i| i*x}\nend",
"def counts(n)\n divisors = Array.new\n (1..n).each do |n|\n single_divisors = count n\n divisors.push(single_divisors)\n end\n divisors\n end",
"def multiples_of( x, xmax )\n ct = x\n nums = []\n while ct <= xmax\n nums << ct\n c... | [
"0.8004699",
"0.70162845",
"0.6892011",
"0.68776846",
"0.6769908",
"0.67528325",
"0.6590494",
"0.6569084",
"0.65532243",
"0.6551252",
"0.65417355",
"0.64793026",
"0.6461403",
"0.64416224",
"0.6372089",
"0.6347995",
"0.6330729",
"0.63219327",
"0.6292802",
"0.6268252",
"0.62589... | 0.7754079 | 1 |
GET /tipocuenta GET /tipocuenta.json | def index
@tipocuenta = Tipocuentum.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.70758057",
"0.6861703",
"0.6858581",
"0.6765908",
"0.6765908",
"0.66960454",
"0.6654463",
"0.6627065",
"0.6605445",
"0.6594997",
"0.6522421",
"0.6487479",
"0.648541",
"0.64729357",
"0.64467347",
"0.6401073",
"0.63894105",
"0.63742113",
"0.6358471",
"0.63532233",
"0.6353223... | 0.6875919 | 1 |
Calls mattermost using the default Mattermost URL from the configuration data is a hash containing the data to send. Note that channel, username, and icon_url are reserved url is the Mattermost URL defined above. This can be overridden for debugging header is the default headers. This shouldn't need modified, but it's nice to have | def call_mattermost (data = {}, url = [Config['Mattermost']['url'], 'hooks', Config['Mattermost']['webhook_code']].join('/'), header = {content_type: :json, accept: :json})
if !data.has_key?(:login_id)
payload = data.merge(Config['DefaultPayload'])
else
payload = data
end
# Just in case, though we may not need text
unless payload.has_key?(:text) or payload.has_key?(:attachments)
payload['text'] = 'This was triggered on: ' + Time.now.strftime("%d/%m/%Y %H:%M") #Feel free to change this
end
response = RestClient.post url, payload.to_json, {content_type: :json, accept: :json}
return response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_data(push_params)\n # Push URI\n push_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/push\")\n\n # Post to API to set up tile\n push_response = Net::HTTP.post_form(push_uri, push_params)\nend",
"def send_message(mes,token,user_id)\n #Open a direct message\n options = {\n token: toke... | [
"0.5465588",
"0.542814",
"0.53797555",
"0.53797555",
"0.53348374",
"0.51957387",
"0.49491575",
"0.48877075",
"0.4883532",
"0.48634773",
"0.4846544",
"0.48428428",
"0.48361412",
"0.48356918",
"0.48224252",
"0.4820484",
"0.48077616",
"0.47950903",
"0.4787078",
"0.47738805",
"0.... | 0.72075117 | 0 |
upload_file moves the file to the webserver from the config file filename: The full path of the image file video_filename: Used to generate a unique MD5 hash for each image file | def upload_file (filename, video_filename)
# new filename is the md5 of the old filename, plus "jpg"
new_filename = Digest::MD5.hexdigest video_filename
new_filename += '.jpg'
FileUtils.mv(filename, [Config['WebServer']['webroot'], Config['WebServer']['preview_dir'], new_filename].join('/'))
return [Config['WebServer']['url'], Config['WebServer']['preview_dir'], new_filename].join('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(file)\n logger.info 'Downloading video...'\n path = file.download.path\n movie = FFMPEG::Movie.new(path)\n @mp4_path = encode('mp4', movie, '-vcodec libx264 -strict -2')\n @webm_path = encode('webm', movie, '-vcodec libvpx -acodec libvorbis -f webm -deadline realtime -s 640x480'... | [
"0.70270765",
"0.6648143",
"0.6634276",
"0.65686625",
"0.63425255",
"0.6336181",
"0.631758",
"0.62717307",
"0.6266716",
"0.61908865",
"0.61814225",
"0.61228365",
"0.6119716",
"0.6118708",
"0.6082119",
"0.60702676",
"0.60483265",
"0.60462517",
"0.60237974",
"0.59999603",
"0.59... | 0.8131492 | 0 |
Generates previews for each movie file in the transcode directory filename: The full path of the video file to output options: allows you to pass the following values for configuration. If not set they'll be pulled from your config framegrab_grid: (string) Something like '5x6' or '2x4' to specify the size of the grid framegrab_interval: (integer) The interval at which to grab frames in seconds. If set to zero it will determine it based on grid size and duration framegrab_height: (integer) The height of the generated frames in pixels. | def generate_previews(filename, options = {})
framegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid']
framegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval']
framegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height']
base_filename = File.basename(filename)
filesize = File.size(filename)
file_info = Mediainfo.new filename
if framegrab_interval.to_i == 0
total_images = 1
framegrab_grid.split('x').each do |x|
total_images *= x.to_i
end
framegrab_interval = file_info.duration / total_images
end
count = 0
units = ['bytes', 'KB', 'MB', 'GB', 'TB']
loop do
break if filesize < 1024.0
count += 1
filesize /= 1024.0
end
pretty_filesize = filesize.round(2).to_s + ' ' + units[count]
duration = file_info.duration
remainder = 0
count = 0
units = ['sec','min','h']
loop do
break if duration < 60
count += 1
remainder = duration % 60
duration /= 60
end
pretty_duration = duration.round(0).to_s + ' ' + units[count]
if remainder > 0
pretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1]
end
command = "ffmpeg -loglevel panic -y -i \"#{filename}\" -frames 1 -q:v 1 -vf \"select='isnan(prev_selected_t)+gte(t-prev_selected_t\," + framegrab_interval.to_s + ")',scale=-1:" + framegrab_height.to_s + ",tile=" + framegrab_grid + "\" '/tmp/video_preview.jpg'"
# puts command
if system(command)
# # Now that the preview is generated, post it to Mattermost
if !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename))
call_mattermost({:text => "We ran into a problem uploading the file. Have someone look at this!"})
else
message = "\n\n"
message+= "|#{base_filename}|[(preview)](#{uploaded_file_url})|\n"
message+= "|-|-:|\n"
message+= "|File Size| **#{pretty_filesize}**|\n"
message+= "|Duration| **#{pretty_duration}**|\n"
message+= "|Format| **#{file_info.format}**|"
actions = Config['FileOperations']
attachments_actions = []
actions.keys.each do |key|
action_hash = {
'name': key,
'integration': {
'url': [Config['Webhook']['url'], 'run-command'].join('/'),
'context': {
'command': key,
'filename': File.realpath(filename)
}
}
}
attachments_actions.push(action_hash)
end
attachments = [
{
"text": message,
"actions": attachments_actions
}]
payload = {:attachments => attachments}
call_mattermost(payload)
end
else
Log.error "There was an error running the command: #{command}"
call_mattermost({:text => "### DANGER WILL ROBINSON\nERROR"})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_compilation\n puts \"Generating compilation\"\n get_selected_vines\n pathArray = [];\n @selected_vines.each do |vid|\n vine = Vine.find(vid)\n pathArray.push vine.path\n end\n if pathArray.count > 0\n return outputFile = execut... | [
"0.60002273",
"0.58840054",
"0.58810204",
"0.57090247",
"0.5693331",
"0.5655191",
"0.5628516",
"0.56282556",
"0.5576697",
"0.5517942",
"0.54917055",
"0.5438951",
"0.54197395",
"0.54037774",
"0.5365946",
"0.5324334",
"0.52558136",
"0.52532005",
"0.5248448",
"0.5240166",
"0.521... | 0.80225223 | 0 |
Runs the command defined in the config file input_filename: The full path of the file you want to run the command on file_operation: One of the defined file operations in the config file | def run_command(input_filename, file_operation)
Log.info "Inside run_command"
if !Config['FileOperations'].key?(file_operation)
return "#{file_operation} isn't a valid preset"
end
transcode_settings = Config['FileOperations'][file_operation]
Log.info transcode_settings.to_s
begin
if !transcode_settings.key?('command')
return "#{file_operation} doesn't have a command"
end
command_template = transcode_settings['command']
filename = File.basename(input_filename)
base_filename = File.basename(input_filename, File.extname(input_filename))
if transcode_settings.key?('location')
output_filename = [transcode_settings['location'], base_filename].join('/')
else
output_filename = [Config['WebServer']['webroot'], Config['WebServer']['transcode_dir'], base_filename].join('/')
end
command = command_template % {input_filename:input_filename, output_filename: output_filename}
Log.info command
# Update the channel to let them know what's happening
call_mattermost({:text => "Running command #{file_operation} on file #{filename}"})
if system(command)
if transcode_settings.key?('text')
output_text = transcode_settings['text'] % {input_filename:input_filename, output_filename: output_filename}
else
output_text = "Finished running command #{file_operation} on file #{filename}"
end
call_mattermost({:text => output_text})
else
call_mattermost({:text => "ERROR: Could not run command #{file_operation} on file #{filename}"})
end
rescue Exception => e
Log.error e.to_s
return 'There was an error'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def run(filename, options) end",
"def run(config_file)\n load_options_from_file(config_file)\n check_options\n output = %x[ #{@binary} #{config_file} ]\n output\n end",
"def run_file(filename, pre... | [
"0.6529169",
"0.6030414",
"0.5856169",
"0.5741992",
"0.5705901",
"0.5705548",
"0.56950265",
"0.55987614",
"0.558795",
"0.5523257",
"0.54516935",
"0.5441318",
"0.53969586",
"0.5386397",
"0.53860337",
"0.5376245",
"0.53733194",
"0.53602606",
"0.5351467",
"0.5345632",
"0.5338001... | 0.73074967 | 0 |
The position of the data dictionary header within the page. | def pos_data_dictionary_header
pos_page_body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_header\n @position - 2\n end",
"def header_position\n C.archive_read_header_position archive\n end",
"def pos_index_header\n pos_page_body\n end",
"def offset\n fil_header[:offset]\n end",
"def local_header_offset; end",
"def pos_partial_page_header\n pos_fil_header... | [
"0.77962977",
"0.7534069",
"0.71625656",
"0.69582975",
"0.69355947",
"0.6839482",
"0.659235",
"0.6557365",
"0.6500078",
"0.64648426",
"0.6379584",
"0.6372833",
"0.6348647",
"0.6330062",
"0.62297636",
"0.62297636",
"0.61918914",
"0.61702305",
"0.61660814",
"0.6159254",
"0.6136... | 0.80084866 | 0 |
The size of the data dictionary header. | def size_data_dictionary_header
((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_size\n TYPE_SIZE\n end",
"def d_size\n uint64(header, 'size') / @blockSize\n end",
"def size\n @data ? @data.size : header.sh_size\n end",
"def header_size\n 12\n end",
"def size\n self.data.keys.size\n end",
"def size\n @data.bytesize\n ... | [
"0.8326364",
"0.8231278",
"0.821332",
"0.7950296",
"0.7906167",
"0.7841435",
"0.77830505",
"0.77472657",
"0.7738898",
"0.77322656",
"0.772482",
"0.772482",
"0.7649034",
"0.7637968",
"0.7603028",
"0.7592744",
"0.7592744",
"0.7592744",
"0.75760883",
"0.7490768",
"0.7485302",
... | 0.87241167 | 0 |
GET /krishes GET /krishes.json | def index
@krishes = Krish.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.64235795",
"0.6413217",
"0.63505614",
"0.63149554",
"0.6259184",
"0.61902434",
"0.6148827",
"0.61450493",
"0.613017",
"0.61261714",
"0.6111282",
"0.61100954",
"0.602197",
"0.59770715",
"0.5976871",
"0.5969935",
"0.5937085",
"0.5936833",
"0.5933155",
"0.5927539",
"0.5918369... | 0.72551185 | 0 |
POST /krishes POST /krishes.json | def create
@krish = Krish.new(krish_params)
respond_to do |format|
if @krish.save
format.html { redirect_to @krish, notice: 'Krish was successfully created.' }
format.json { render action: 'show', status: :created, location: @krish }
else
format.html { render action: 'new' }
format.json { render json: @krish.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @kraj = Kraj.new(params[:kraj])\n\n respond_to do |format|\n if @kraj.save\n format.html { redirect_to @kraj, notice: 'Kraj was successfully created.' }\n format.json { render json: @kraj, status: :created, location: @kraj }\n else\n format.html { render action: \"... | [
"0.5828118",
"0.58169323",
"0.57454354",
"0.57131404",
"0.5639105",
"0.56224394",
"0.56178004",
"0.56003463",
"0.5546556",
"0.5528062",
"0.550135",
"0.5460965",
"0.54601884",
"0.54574925",
"0.545331",
"0.5448933",
"0.54423964",
"0.54073685",
"0.53977144",
"0.53930813",
"0.539... | 0.61175925 | 0 |
DELETE /krishes/1 DELETE /krishes/1.json | def destroy
@krish.destroy
respond_to do |format|
format.html { redirect_to krishes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @kisalli = Kisalli.find_by_key(params[:id])\n @kisalli.destroy\n\n respond_to do |format|\n format.html { redirect_to kisallis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kid.destroy\n ... | [
"0.71626604",
"0.6889966",
"0.6877485",
"0.68562984",
"0.68514127",
"0.68434036",
"0.6829869",
"0.68237877",
"0.6818874",
"0.67722005",
"0.673912",
"0.6737086",
"0.67237496",
"0.67152166",
"0.670024",
"0.66985",
"0.6692994",
"0.66918",
"0.66726756",
"0.6667808",
"0.6665582",
... | 0.7293339 | 0 |
Toggle guest access on or off | def toggle_guest_access
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_access?\n guest_access == :can_join\n end",
"def toggle_admin\n do_toggle_role :admin\n end",
"def guest?\n false\n end",
"def guest_access=(guest_access)\n client.api.set_room_guest_access(id, guest_access)\n tinycache_adapter.write(:guest_access, guest_access)\n ... | [
"0.6607076",
"0.6488401",
"0.6369919",
"0.6237322",
"0.62227607",
"0.6190604",
"0.61766887",
"0.61213094",
"0.61032784",
"0.60904926",
"0.6074536",
"0.60504216",
"0.60217774",
"0.60018927",
"0.59932137",
"0.59780246",
"0.5976769",
"0.5957458",
"0.59057647",
"0.5886336",
"0.58... | 0.835637 | 0 |
Get the url for guest access | def guest_url
if guest_access_enabled?
"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}"
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end",
"def guest\n allow [:show]\n end",
"def redirect_guest\... | [
"0.79203606",
"0.63214844",
"0.63024205",
"0.61987704",
"0.6108481",
"0.6091542",
"0.6039268",
"0.603794",
"0.6015924",
"0.600454",
"0.5999916",
"0.5993426",
"0.5954002",
"0.5941162",
"0.59177375",
"0.5915073",
"0.59030753",
"0.58932114",
"0.5879106",
"0.58500963",
"0.5849586... | 0.7852773 | 1 |
The invite code use for guest | def guest_invite_code
load
@active_token_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_invite_code\n self.invite_code = generate_token\n end",
"def invitee_string\n\t\n\tend",
"def ensure_invite_code!\n self.invite_code ||= \"thiscord.gg/\"+SecureRandom.uuid[0..5]\n end",
"def invite\n \n end",
"def invite_code\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:to... | [
"0.76387304",
"0.754709",
"0.72436905",
"0.72416025",
"0.6952381",
"0.6828545",
"0.6672465",
"0.6549126",
"0.6514559",
"0.64977175",
"0.64647174",
"0.64445704",
"0.6424634",
"0.6411214",
"0.63947904",
"0.6377739",
"0.63747996",
"0.63674206",
"0.6337006",
"0.6308173",
"0.62807... | 0.82367903 | 0 |
Change the name of the room | def name=(name)
connection.post("/room/#{@id}.json", :body => { :room => { :name => name } })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name=(name)\n tinycache_adapter.write(:name, name)\n client.api.set_room_name(id, name)\n name\n end",
"def set_room(room_name)\n @room = find_room_by_name(room_name)\n end",
"def new_name(new_name)\n @name = new_name\n end",
"def name\n name = \"Store Room\"\n end... | [
"0.74344593",
"0.7372264",
"0.6911815",
"0.6841977",
"0.68415135",
"0.6718905",
"0.66798884",
"0.6624731",
"0.659215",
"0.6544838",
"0.64946675",
"0.6442982",
"0.64412916",
"0.64101684",
"0.63888556",
"0.63838935",
"0.63838935",
"0.63493305",
"0.63428617",
"0.63157773",
"0.63... | 0.7658218 | 0 |
GET /tuberculoses GET /tuberculoses.json | def index
@tuberculoses = Tuberculose.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tacks = Tack.all\n\n render json: @tacks\n end",
"def retrieve_tubes\n show do\n title \"Retrieve tubes and spin down\"\n \n timer initial: { hours: 0, minutes: 15, seconds: 0}\n \n check \"After timer finishes, retrieve all #{operations.length} tubes f... | [
"0.61899436",
"0.6043484",
"0.5980227",
"0.59198403",
"0.59156847",
"0.5898723",
"0.5896654",
"0.5896654",
"0.5885377",
"0.5875285",
"0.58730227",
"0.58651614",
"0.5865042",
"0.5772566",
"0.5762172",
"0.5761809",
"0.5741422",
"0.5711907",
"0.56627285",
"0.56610477",
"0.565933... | 0.70785415 | 0 |
GET /pharmas GET /pharmas.json | def index
@pharmas = Pharma.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phlog }\n end\n end",
"def show\n @pharm = Pharm.find(params[:id])\n end",
"def show\n\t\t@pharmacy = Pharmacy.find(params[:id])\n\n\t\trespond_to do |forma... | [
"0.6479799",
"0.6422723",
"0.6421849",
"0.6397673",
"0.63839346",
"0.63242126",
"0.62848365",
"0.6218878",
"0.6213666",
"0.6208553",
"0.62017393",
"0.6198759",
"0.61778975",
"0.6164403",
"0.616128",
"0.6150613",
"0.61449045",
"0.6138376",
"0.61362934",
"0.6135968",
"0.6135760... | 0.68925804 | 0 |
POST /pharmas POST /pharmas.json | def create
@pharma = Pharma.new(pharma_params)
respond_to do |format|
if @pharma.save
format.html { redirect_to @pharma, notice: 'Pharma was successfully created.' }
format.json { render :show, status: :created, location: @pharma }
else
format.html { render :new }
format.json { render json: @pharma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pharm = Pharm.new(pharm_params)\n @pharm.user_id = current_user.id\n\n respond_to do |format|\n if @pharm.save\n format.html { redirect_to @pharm, notice: 'Pharm was successfully created.' }\n format.json { render :show, status: :created, location: @pharm }\n else\n ... | [
"0.66720706",
"0.66034615",
"0.6332219",
"0.61596787",
"0.61153233",
"0.5994991",
"0.59933317",
"0.5993134",
"0.595828",
"0.5924629",
"0.5921499",
"0.5913209",
"0.5893331",
"0.5881247",
"0.58505136",
"0.5849291",
"0.5835567",
"0.5826907",
"0.5820701",
"0.5779027",
"0.577251",... | 0.6895389 | 0 |
PATCH/PUT /pharmas/1 PATCH/PUT /pharmas/1.json | def update
respond_to do |format|
if @pharma.update(pharma_params)
format.html { redirect_to @pharma, notice: 'Pharma was successfully updated.' }
format.json { render :show, status: :ok, location: @pharma }
else
format.html { render :edit }
format.json { render json: @pharma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pharm = Pharm.find(params[:id])\n respond_to do |format|\n if @pharm.update(pharm_params)\n format.html { redirect_to @pharm, notice: 'Pharm was successfully updated.' }\n format.json { render :show, status: :ok, location: @pharm }\n else\n format.html { render :e... | [
"0.6336532",
"0.6231755",
"0.6189727",
"0.61738074",
"0.61282563",
"0.60966814",
"0.6094203",
"0.6090823",
"0.6073731",
"0.6050702",
"0.60389566",
"0.60285115",
"0.6013566",
"0.5987759",
"0.594626",
"0.5922043",
"0.5915093",
"0.5915093",
"0.59119517",
"0.59048057",
"0.5882333... | 0.62516516 | 1 |
GET /message_outs GET /message_outs.json | def index
@message_outs = MessageOut.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end",
"def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\... | [
"0.70113707",
"0.63836396",
"0.62472916",
"0.6224572",
"0.6138406",
"0.6136233",
"0.61274123",
"0.6113622",
"0.6110786",
"0.60970414",
"0.60852665",
"0.60795325",
"0.60603845",
"0.60270935",
"0.6025916",
"0.60208464",
"0.6019969",
"0.6019969",
"0.60160685",
"0.6008911",
"0.60... | 0.7497711 | 0 |
POST /message_outs POST /message_outs.json | def create
@message_out = MessageOut.new(message_out_params)
respond_to do |format|
if @message_out.save
format.html { redirect_to @message_out, notice: 'Message out was successfully created.' }
format.json { render :show, status: :created, location: @message_out }
else
format.html { render :new }
format.json { render json: @message_out.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_for... | [
"0.6903816",
"0.62890893",
"0.6182434",
"0.61759156",
"0.61600614",
"0.60449153",
"0.59814",
"0.5951197",
"0.59417355",
"0.5921014",
"0.5870418",
"0.58613354",
"0.58505166",
"0.5814998",
"0.58123255",
"0.5808695",
"0.5763554",
"0.57243544",
"0.56838673",
"0.565115",
"0.564581... | 0.69519955 | 0 |
PATCH/PUT /message_outs/1 PATCH/PUT /message_outs/1.json | def update
respond_to do |format|
if @message_out.update(message_out_params)
format.html { redirect_to @message_out, notice: 'Message out was successfully updated.' }
format.json { render :show, status: :ok, location: @message_out }
else
format.html { render :edit }
format.json { render json: @message_out.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outmessage = Outmessage.find(params[:id])\n\n respond_to do |format|\n if @outmessage.update_attributes(params[:outmessage])\n format.html { redirect_to @outmessage, :notice => 'Outmessage was successfully updated.' }\n format.json { head :ok }\n else\n format.htm... | [
"0.67088276",
"0.6356212",
"0.6294603",
"0.6271096",
"0.6247161",
"0.6242197",
"0.62195915",
"0.6139679",
"0.6108608",
"0.60467696",
"0.60067254",
"0.60018533",
"0.59900767",
"0.59868795",
"0.5872337",
"0.5866814",
"0.5856719",
"0.5856719",
"0.585349",
"0.5833102",
"0.5822631... | 0.6683412 | 1 |
DELETE /message_outs/1 DELETE /message_outs/1.json | def destroy
@message_out.destroy
respond_to do |format|
format.html { redirect_to message_outs_url, notice: 'Message out was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outmessage = Outmessage.find(params[:id])\n @outmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to outmessages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_mes... | [
"0.74307024",
"0.72257817",
"0.7157802",
"0.71205676",
"0.70943093",
"0.70638305",
"0.7058172",
"0.7005902",
"0.6969792",
"0.69227165",
"0.6911765",
"0.6890537",
"0.68778795",
"0.68778795",
"0.6865568",
"0.6826625",
"0.6826625",
"0.68194973",
"0.68002",
"0.6778614",
"0.677827... | 0.7323805 | 1 |
GET /submission/1 GET /submission/1.xml | def show
@submission = Submission.find(params[:id])
respond_to do |format|
format.html # show.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def index\n @submissions = Submission.find(:all)\n\n respond_to do |format|\n format.html # index.haml\n f... | [
"0.7128289",
"0.685183",
"0.66381526",
"0.65334976",
"0.6471589",
"0.63435775",
"0.6316685",
"0.6315651",
"0.6210698",
"0.61896497",
"0.61896497",
"0.61862713",
"0.61342084",
"0.60995966",
"0.6079903",
"0.60533637",
"0.5961079",
"0.5909505",
"0.58529884",
"0.5845093",
"0.5830... | 0.6941431 | 1 |
GET /submission/new GET /submission/new.xml | def new
@submission = Submission.new
respond_to do |format|
format.html # new.haml
format.xml { render :xml => @submission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @submission_comment = SubmissionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @submission_comment }\n end\n end",
"def create\n @submission = Submission.new(params[:submission])\n\n respond_to do |format|\n if @submissi... | [
"0.74332213",
"0.7074458",
"0.7019172",
"0.69804245",
"0.69463885",
"0.69345796",
"0.69345796",
"0.6921083",
"0.69173825",
"0.69098866",
"0.6890191",
"0.68783003",
"0.687734",
"0.686037",
"0.68561286",
"0.68555546",
"0.6855061",
"0.68489915",
"0.684102",
"0.68381727",
"0.6835... | 0.7942215 | 0 |
POST /submission POST /submission.xml | def create
@submission = Submission.new(params[:submission])
respond_to do |format|
if @submission.save
flash[:notice] = 'Submission was successfully created.'
format.html { redirect_to(submission_path(@submission)) }
format.xml { render :xml => @submission, :status => :created, :location => @submission }
else
format.html { render :action => "new" }
format.xml { render :xml => @submission.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('... | [
"0.7185427",
"0.6769586",
"0.6536815",
"0.6521938",
"0.6394957",
"0.638802",
"0.63349056",
"0.63217914",
"0.626405",
"0.6262381",
"0.6243754",
"0.6222123",
"0.62183017",
"0.618068",
"0.61588675",
"0.6127506",
"0.6119407",
"0.6106426",
"0.6095596",
"0.6095596",
"0.60903686",
... | 0.70729274 | 1 |
DELETE /submission/1 DELETE /submission/1.xml | def destroy
@submission = Submission.find(params[:id])
@submission.destroy
respond_to do |format|
format.html { redirect_to(submission_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n respond_to do |format|\n format.html { redirect_to(submissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submission = Submission.find(params[:id])\n @submission.destroy\n\n res... | [
"0.7380481",
"0.7380481",
"0.7380481",
"0.69005835",
"0.68519807",
"0.67469066",
"0.67363787",
"0.6726497",
"0.6726497",
"0.67259705",
"0.66746765",
"0.6673411",
"0.666435",
"0.666435",
"0.666435",
"0.6600906",
"0.6573058",
"0.654463",
"0.6509483",
"0.64563006",
"0.64297146",... | 0.74571323 | 0 |
The +MessageOptions+ defined for this message. | def options
message_descriptor_proto.options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options(args = nil)\r\n if args\r\n @_message.options.merge!(args)\r\n else\r\n @_message\r\n end\r\n end",
"def default_message_options\n @default_message_options ||= {type: 'message'}\n end",
"def generate_options(message)\n {\n raw_message: ... | [
"0.7453573",
"0.7247541",
"0.7049129",
"0.664804",
"0.6534514",
"0.6418044",
"0.6415079",
"0.6415079",
"0.6415079",
"0.640184",
"0.6399006",
"0.6393965",
"0.6392944",
"0.6391486",
"0.63879585",
"0.63874835",
"0.6385375",
"0.6385375",
"0.63793576",
"0.63530993",
"0.63530993",
... | 0.7984034 | 0 |
The extension ranges defined for this message | def extension_range
message_descriptor_proto.extension_range
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n extension_ranges << range\n end",
"def extensions(range)\n @extension_tag = range\n end",
"def range_extensio... | [
"0.72202086",
"0.72202086",
"0.7183523",
"0.6975689",
"0.67840195",
"0.6592586",
"0.6405685",
"0.6001918",
"0.5968311",
"0.59562844",
"0.594816",
"0.59000134",
"0.5830478",
"0.58039474",
"0.5792925",
"0.57710093",
"0.5681345",
"0.56523645",
"0.56175786",
"0.56175786",
"0.5617... | 0.82498056 | 0 |
returns a Reputation::Threshold instance and validates based on self action and sender | def threshold
@threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = ... | [
"0.69859254",
"0.64288294",
"0.6358009",
"0.58064383",
"0.5729089",
"0.5695526",
"0.5599671",
"0.5571309",
"0.5392161",
"0.53439987",
"0.5334644",
"0.5311986",
"0.5274186",
"0.5268406",
"0.5155847",
"0.51414645",
"0.5139207",
"0.5122872",
"0.5109536",
"0.5108959",
"0.5102317"... | 0.8527558 | 0 |
is this action defined as a reputation action | def action_defined?
# ReputationThreshold.action_defined?(self.action, self.tier)
!self.action_points.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reputation_threshold_action\n :offer_reward\n end",
"def action_defined?(action, tier=nil)\n if tier && !tier.accept_default_reputation_threshold\n if rate = tier.find_reputation_threshold_action_points(action)\n return !!rate.points\n end\n end\n respond_to?(action.... | [
"0.73953027",
"0.70862067",
"0.6136532",
"0.61103255",
"0.6049808",
"0.60334575",
"0.600791",
"0.5976963",
"0.5958899",
"0.59512293",
"0.5941366",
"0.59375584",
"0.5880065",
"0.584357",
"0.58298135",
"0.58221287",
"0.58221287",
"0.58019215",
"0.5797781",
"0.5728047",
"0.56945... | 0.7302406 | 1 |
returns the threshold points that are defined for certain action either in database or globally | def action_points
@threshold_action_points_cache ||= ReputationThreshold.action_points(self.action, self.tier)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n ... | [
"0.71479875",
"0.6933815",
"0.6827573",
"0.63600874",
"0.6338986",
"0.6283388",
"0.62192",
"0.61403847",
"0.59998006",
"0.5992386",
"0.5949395",
"0.5902614",
"0.58541006",
"0.5770324",
"0.57589537",
"0.56442285",
"0.5610904",
"0.5608768",
"0.5544826",
"0.5541749",
"0.5540912"... | 0.7490711 | 0 |
is a sender assigned? | def sender?
!!self.sender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sender?\n !!self.sender\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def sender? usr\n usr.id == user_id\n end",
"def sent?\n sender_id.present?\n end",
"def sen... | [
"0.76944166",
"0.76186776",
"0.76186776",
"0.76186776",
"0.761215",
"0.7483794",
"0.70083576",
"0.6990902",
"0.6962058",
"0.6909903",
"0.6815898",
"0.67791086",
"0.6705199",
"0.6705199",
"0.6694272",
"0.653331",
"0.653331",
"0.65278137",
"0.64955354",
"0.64868957",
"0.6459753... | 0.79234743 | 0 |
produces an html href to the faq pages | def link_to_faq(text, options={})
html = "<a"
html += " class=\"#{options[:class]}\"" if options[:class]
html += " href=\"/faq\""
html += ">"
html += text
html += "</a>"
html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faq_url\n WALLSOME_SITE_BASE_URL + \"/faq.html\"\n end",
"def faqs\n end",
"def faqs\n end",
"def faq\n end",
"def faq\n end",
"def render\n <<-HTML\n <div class=\"relative\">\n <a href=\"#{url}\"class=\"#{position_classes}f6 link dim br2 ph3 pv2 dib white bg-bl... | [
"0.7262702",
"0.6984959",
"0.6984959",
"0.63352615",
"0.63352615",
"0.6328134",
"0.6242769",
"0.6170071",
"0.6164575",
"0.6066346",
"0.6018735",
"0.59769714",
"0.59391046",
"0.5923673",
"0.59150124",
"0.58892757",
"0.5856246",
"0.57082224",
"0.57082224",
"0.57062006",
"0.5692... | 0.7102768 | 1 |
Defines a singleton_method in the receiver. The method parameter can be a Proc or Method object. If a block is specified, it is used as the method body. This block is evaluated using instance_eval. | def define_singleton_method(symbol, method)
# TODO
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_singleton_method name, &body\r\n singleton_class = class << self; self; end\r\n singleton_class.send(:define_method, name, &body)\r\n end",
"def define_and_call_method(method, &block)\n self.class.send(:define_method, method, block)\n send method\n end",
"def ensure_method(name, ... | [
"0.65705115",
"0.6448794",
"0.59842664",
"0.5925674",
"0.5833038",
"0.5671119",
"0.56663966",
"0.56383723",
"0.56275105",
"0.5615008",
"0.56046265",
"0.55882794",
"0.55846226",
"0.5533319",
"0.55091405",
"0.5500842",
"0.5488578",
"0.5486694",
"0.54477465",
"0.54208934",
"0.54... | 0.6649878 | 0 |
Edit a particular Address in the database | def edit_address(edited_address)
address = Address.find(edited_address.uid)
address.attributes = edited_address.attributes
address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend",
"def edit\n\t@address=Address.new\n\t@address=Address.find(params[:id])\nend",
"def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address... | [
"0.7819367",
"0.77717304",
"0.7608921",
"0.75805825",
"0.75805825",
"0.75251263",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.75176305",
"0.74903965",
"0.7477694",
... | 0.8174226 | 0 |
Delete a particular Address from the database | def delete_address(address)
address.delete!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @address = Address.find(params[:address_id])\n end",
"def delete_address(id)\n delete(\"addresses/#{id}\")\n end",
"def delete\n @carddav_backend.delete_address_book(@address_book_info['id'])\n end",
"def delete_address\n @mailing_list_address.destroy if @ok\n r... | [
"0.8295874",
"0.8109702",
"0.76348406",
"0.756122",
"0.7521462",
"0.73788595",
"0.73546976",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7353126",
"0.7342045",
"0.73061633",
"0.7299389",
"0.7290487",
"0.72902477",
"0.72712773",
"0.7260513",
"0.724764",
"0.7227744",
"0.72251207"... | 0.84705895 | 0 |
Cleanse Address through third party service using SOA pattern (psuedocode) | def cleanse_address(address)
cleansed_address = SOAAddressCleanser.cleanse_address(address)
cleansed_address.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end",
"def clean_for_com... | [
"0.6242082",
"0.60627574",
"0.5978242",
"0.5943953",
"0.59070307",
"0.59070307",
"0.5906608",
"0.5845295",
"0.57819074",
"0.5777708",
"0.5678787",
"0.5667282",
"0.56634676",
"0.5639671",
"0.5619848",
"0.56121933",
"0.5599824",
"0.5592019",
"0.55840635",
"0.5571092",
"0.556978... | 0.7425036 | 0 |
Validate zipcode through third party service using SOA pattern (psuedocode) | def validate_zip(address)
return SOAZipValidator(address.city, address.zipcode)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zipvalidate(postcode)\n !!postcode.match(/\\A[1-46][\\d]{5}\\z/)\nend",
"def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end",
"def check_zipcode_validity\n\t\tif (zip_code =~ /\\d{5}/) == 0\n\t\t\t#zip_code.length == 5 and \n\t\t\t# !zip_... | [
"0.7463366",
"0.7298691",
"0.72607654",
"0.72205293",
"0.7136198",
"0.7124995",
"0.68900555",
"0.68285197",
"0.67880523",
"0.6695647",
"0.6690848",
"0.6675632",
"0.65642965",
"0.64860547",
"0.6445737",
"0.63939327",
"0.6359967",
"0.63279116",
"0.6292299",
"0.6266898",
"0.6217... | 0.7341014 | 1 |
Nathan Tests def run_tests root = BinaryTreeNode.new(50) left = root.insert_left(30) right = root.insert_right(80) left_left = left.insert_left(20) left_right = left.insert_right(40) right_left = right.insert_left(70) right_right = right.insert_right(90) assert_true(root) root = BinaryTreeNode.new(50) left = root.insert_left(30) right = root.insert_right(80) left_left = left.insert_left(20) left_right = left.insert_right(60) right_left = right.insert_left(70) right_right = right.insert_right(90) assert_false(root) end def assert_true(value) p binary_search_tree?(value) ? "Pass" : "Fail" end def assert_false(value) p binary_search_tree?(value) ? "Fail" : "Pass" end run_tests Interview Cake Tests | def run_tests
desc = 'valid full tree'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(30)
right = tree.insert_right(70)
left.insert_left(10)
left.insert_right(40)
right.insert_left(60)
right.insert_right(80)
result = binary_search_tree?(tree)
assert_true(result, desc)
desc = 'both subtrees valid'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(30)
right = tree.insert_right(80)
left.insert_left(20)
left.insert_right(60)
right.insert_left(70)
right.insert_right(90)
result = binary_search_tree?(tree)
assert_false(result, desc)
desc = 'descending linked list'
tree = BinaryTreeNode.new(50)
left = tree.insert_left(40)
left_left = left.insert_left(30)
left_left_left = left_left.insert_left(20)
left_left_left.insert_left(10)
result = binary_search_tree?(tree)
assert_true(result, desc)
desc = 'out of order linked list'
tree = BinaryTreeNode.new(50)
right = tree.insert_right(70)
right_right = right.insert_right(60)
right_right.insert_right(80)
result = binary_search_tree?(tree)
assert_false(result, desc)
desc = 'one node tree'
tree = BinaryTreeNode.new(50)
result = binary_search_tree?(tree)
assert_true(result, desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Nod... | [
"0.7259953",
"0.70194036",
"0.68536365",
"0.68166846",
"0.6759323",
"0.6732959",
"0.67094165",
"0.6514451",
"0.65119976",
"0.65034074",
"0.6474655",
"0.64682364",
"0.6380666",
"0.6340369",
"0.63395727",
"0.6327768",
"0.6322519",
"0.6321463",
"0.62482226",
"0.6245848",
"0.6242... | 0.83192563 | 0 |
=> Delete customer from db | def delete()
sql = "DELETE from customers WHERE id = $1"
values = [@id]
SqlRunner.run(sql, values)
# => Deleting customer record, nothing to return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @customer.destroy\n end",
"def destroy\n @customer.destroy\n redirect_to customers_url\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @c... | [
"0.8091326",
"0.7685374",
"0.7660621",
"0.7566509",
"0.7473403",
"0.7435382",
"0.73416096",
"0.73031926",
"0.72650564",
"0.72642577",
"0.7258824",
"0.7249436",
"0.7246636",
"0.71850663",
"0.7167352",
"0.7138773",
"0.7124898",
"0.7124898",
"0.71205467",
"0.7119648",
"0.7109989... | 0.79741013 | 1 |
=> Display all the films a particular customer has bought ticket for | def films()
sql = "SELECT films.* FROM films INNER JOIN tickets ON tickets.film_id = films.id WHERE customer_id = $1"
values = [@id]
film_data = SqlRunner.run(sql, values)
return Film.map_items(film_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers_for_film()\n sql = \"SELECT name FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE film_id = $1 ORDER BY name\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def films()\n sql... | [
"0.70514375",
"0.69678015",
"0.69102687",
"0.68326306",
"0.6825748",
"0.68093425",
"0.67934924",
"0.6775241",
"0.66688496",
"0.6593604",
"0.65885574",
"0.6540881",
"0.6534333",
"0.65192235",
"0.649704",
"0.6430018",
"0.6391056",
"0.6298964",
"0.62578",
"0.62064695",
"0.614608... | 0.71264905 | 0 |
Given an account type, set the account_params_key. | def account_params_key
@account_params_key ||= Account.config.account_type_to_param(account_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_account_type\n @account_type = AccountType.find(params[:id])\n end",
"def accounttype_params\n params.require(:accounttype).permit(:name, :description, :key)\n end",
"def register_account_type_params\n if params[:account][:account_type]\n params.require(:account).require(:account_ty... | [
"0.7022764",
"0.69546366",
"0.6658146",
"0.66553295",
"0.66403574",
"0.6585411",
"0.65810865",
"0.6462391",
"0.64344263",
"0.6424918",
"0.64217556",
"0.6405559",
"0.6390779",
"0.6322264",
"0.6296023",
"0.6167764",
"0.615584",
"0.6148411",
"0.6143317",
"0.6137606",
"0.6114785"... | 0.76216143 | 0 |
Applies strong_param rules to the passed in params based on the current `action`. Assumes params are guarenteed to be an instantiated `ActionController::Parameters` object. Silently returns an empty params hash if the `account_params_key` is missing. | def account_params
return ActionController::Parameters.new unless params.key?(account_params_key)
permitted = send("account_params_for_#{action}")
params.require(account_params_key).permit(*permitted)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n @account_params ||= params.require(:account).except(:user)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).... | [
"0.6255454",
"0.6014911",
"0.5959547",
"0.5919349",
"0.59032226",
"0.5898747",
"0.58598787",
"0.57777226",
"0.5776317",
"0.57508504",
"0.57365084",
"0.5727238",
"0.57134247",
"0.5712519",
"0.56805354",
"0.5678277",
"0.56631446",
"0.56222606",
"0.5593027",
"0.5592583",
"0.5591... | 0.74400306 | 0 |
Simply assigns the strong_params to the account new/persisted account object. | def assign_params
account.assign_attributes(account_params)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_params\n params.fetch(:account, {}).permit(:current_password, :password, :password_confirmation)\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def account_params\n params.require(:account).permit... | [
"0.6963002",
"0.6961664",
"0.69106436",
"0.6848165",
"0.6837659",
"0.67944485",
"0.6761268",
"0.6687412",
"0.6679951",
"0.6677307",
"0.667075",
"0.6654123",
"0.6640671",
"0.6635405",
"0.66181237",
"0.6611523",
"0.6599604",
"0.65879446",
"0.65874106",
"0.65801793",
"0.6571076"... | 0.7993425 | 0 |
Sets the `action` which is used to load the proper set of account_params. The action should always get set before `account_params` is called. | def set_action(action)
@action = action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def action=(action)\n validator = EnumAttributeValidator.new('String', [\"None\", \"GeneratePreSignedUploadUrl\", \"GeneratePreSignedDownloadUrl\", \"CompleteImportProcess\", \"MarkImportFailed\", \"PreCache\", \... | [
"0.6679395",
"0.65982026",
"0.6566531",
"0.6449901",
"0.6434612",
"0.62735105",
"0.62001806",
"0.6197067",
"0.61663985",
"0.6137422",
"0.61278105",
"0.61094934",
"0.6081423",
"0.60546964",
"0.60503405",
"0.5999909",
"0.5964624",
"0.59615743",
"0.5939661",
"0.5900196",
"0.5887... | 0.66290647 | 1 |
Given an account, set the account_type. Only used for `update`. | def set_account_type
@account_type = account.class.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type=(account_type)\n validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n unless validator.valid?(account_type)\n fail ArgumentError, \"invalid value for \\\"account_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @account_type = account_type\... | [
"0.7769743",
"0.7734451",
"0.77227294",
"0.7722503",
"0.7311412",
"0.70600116",
"0.7044634",
"0.690822",
"0.6901016",
"0.6747927",
"0.66774553",
"0.6595702",
"0.65805143",
"0.64787865",
"0.6453682",
"0.6411728",
"0.6408398",
"0.6379682",
"0.6379682",
"0.63513744",
"0.62595695... | 0.8263673 | 0 |
Build the owner account_user. Only used for `build`. | def build_account_users
account.account_users.build(
user_id: owner_user.id,
user_role: "Owner",
created_by: current_user.id,
)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_user(attributes = {}, options = {})\n @provider_user.build_record(attributes, options)\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def make_owner(user, org)\n associate_in_groups(user, org, [\"admins\", \"billing-admins\", \"us... | [
"0.67366105",
"0.6534766",
"0.6529248",
"0.63094616",
"0.62501216",
"0.62178934",
"0.62178934",
"0.6211486",
"0.6205372",
"0.6155081",
"0.6086903",
"0.60621643",
"0.60589343",
"0.60346043",
"0.59902084",
"0.5987126",
"0.5974206",
"0.5943992",
"0.5923644",
"0.5850913",
"0.5793... | 0.7838152 | 0 |
Set the affiliate_id if the account type supports affiliates, the affiliate param is present, and the affiliate exists. Also ensure affiliate_other gets wiped out if the affiliate_id does not point to `Other`. | def set_affiliate
if affiliate.present?
account.affiliate_id = affiliate.id
account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil
else
account.affiliate_id = account.affiliate_other = nil
end
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n ... | [
"0.71535945",
"0.67755854",
"0.6702551",
"0.65431345",
"0.64234036",
"0.64234036",
"0.62347305",
"0.6205583",
"0.6086611",
"0.5946735",
"0.5888641",
"0.58612424",
"0.5811037",
"0.57084227",
"0.5680665",
"0.5662318",
"0.5533677",
"0.55099297",
"0.5326219",
"0.5311682",
"0.5283... | 0.8225072 | 0 |
Set the facility if the account type is scoped to facility. | def set_facility
return unless account.per_facility? && facility&.id
account.account_facility_joins.build(facility: facility)
account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_facility_type\n @facility_type = FacilityType.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:id])\n en... | [
"0.6779261",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.65848863",
"0.6562685",
"0.6315417",
"0.63153106",
"0.6217873",
"0.6120958",
"0.60601026",
"0.60302186",
"0.60097283",
"0.5844239",
"0.58384955",
"0... | 0.73396176 | 0 |
return the bank activity for the specified date | def activity(date)
main_ledger_account.activity(date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(date)\n ledger_entries.for_date(date).sum(:debit) - ledger_entries.for_date(date).sum(:credit)\n end",
"def get_account_activity(start_date, end_date, options = {})\n submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))\n end",
"def activities_... | [
"0.69148326",
"0.6866681",
"0.6711",
"0.6711",
"0.6511803",
"0.6454644",
"0.64540946",
"0.62788147",
"0.62519133",
"0.6086539",
"0.6069161",
"0.6055967",
"0.5982076",
"0.5918181",
"0.5872746",
"0.5864139",
"0.58433294",
"0.5812383",
"0.5749635",
"0.5742037",
"0.56973827",
"... | 0.82403153 | 0 |
return daily balances for a date range... | def daily_balances(start_date, end_date)
LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(date = Time.now)\n total = 0\n\n transactions.sort_by(&:transaction_at).each do |transaction|\n break if transaction.transaction_at.end_of_day > date.end_of_day\n\n total += transaction.adjusted_amount\n end\n\n total\n end",
"def balance(date=Date.tomorrow)\n ledger_entries... | [
"0.7316175",
"0.7285797",
"0.6791438",
"0.6625377",
"0.6614883",
"0.65106344",
"0.62950295",
"0.6216034",
"0.6122384",
"0.6084558",
"0.6074286",
"0.6066016",
"0.60606134",
"0.603537",
"0.6014007",
"0.60114545",
"0.5963322",
"0.59528744",
"0.5940237",
"0.5928822",
"0.59189856"... | 0.85685986 | 0 |
Add errors if name_is_valid? returns false | def name_is_valid
errors.add(:name,'Invalid empty string for name.') unless name_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def name_invalid\n errors.add(:name, :unknown)\n end",
"def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > ... | [
"0.8849024",
"0.81621915",
"0.78472495",
"0.7818782",
"0.780932",
"0.76998484",
"0.76245207",
"0.76146877",
"0.7571461",
"0.7513229",
"0.7502683",
"0.7485334",
"0.7476541",
"0.74586964",
"0.7434845",
"0.7434845",
"0.738939",
"0.73345906",
"0.73150057",
"0.7263868",
"0.7228135... | 0.8818862 | 1 |
Tests if the name of course is not nil and is a string and returns true or false. | def name_is_valid?
return false unless not_nil_and_string(self.name)
return self.name.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name?\n @name.is_a?(String) && !@name.empty?\n end",
"def valid?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !n... | [
"0.7013948",
"0.67589116",
"0.6693198",
"0.6693198",
"0.6693198",
"0.6618374",
"0.6543606",
"0.6467556",
"0.6462177",
"0.64107823",
"0.64037585",
"0.63744503",
"0.6357518",
"0.63415873",
"0.63144195",
"0.6290922",
"0.6275527",
"0.6272617",
"0.62617624",
"0.624366",
"0.6232078... | 0.70330954 | 1 |
Add errors if start_time_is_valid? return false | def start_time_is_valid
errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate sta... | [
"0.7999102",
"0.7996796",
"0.7843696",
"0.77276343",
"0.7530397",
"0.7518192",
"0.75014573",
"0.7498077",
"0.7456445",
"0.7414144",
"0.73869014",
"0.7364325",
"0.73481107",
"0.7343726",
"0.73241955",
"0.7321338",
"0.7305339",
"0.7286456",
"0.72858655",
"0.72568065",
"0.724898... | 0.8787081 | 0 |
Tests if start_time of course is not nil and a string and returns true or false. | def start_time_is_valid?
return false unless not_nil_and_string(self.start_time)
return self.start_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_start_time?\n !start_time.blank?\n end",
"def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end",
"def start_time_present?\n if start_time.blank?\n errors.add('start_time',\"Please select appointment time\")\n end\n... | [
"0.7924206",
"0.7236668",
"0.71151656",
"0.69725066",
"0.6866959",
"0.67938334",
"0.6708347",
"0.66759753",
"0.6662058",
"0.6644632",
"0.6598933",
"0.6592477",
"0.6556836",
"0.64680177",
"0.6377812",
"0.636196",
"0.6350664",
"0.6345295",
"0.6282905",
"0.6227318",
"0.6182376",... | 0.8072464 | 0 |
Adds errors if end_time_is_valid? returns false | def end_time_is_valid
errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def ends_after... | [
"0.8372728",
"0.80865073",
"0.7941235",
"0.7939686",
"0.76964194",
"0.7666876",
"0.76550233",
"0.76165175",
"0.75892025",
"0.7441538",
"0.74052954",
"0.74022347",
"0.7362591",
"0.7358371",
"0.73036015",
"0.72367185",
"0.7205526",
"0.71653897",
"0.71572155",
"0.71463424",
"0.7... | 0.89177924 | 0 |
Tests if end_time of course is not nil and a string and returns true or false | def end_time_is_valid?
return false unless not_nil_and_string(self.end_time)
return self.end_time.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time_is_valid\n errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?\n end",
"def ended?\n end_time < Time.now.utc\n end",
"def end_time_defined?(time)\n if time.empty?\n '24:00'\n else\n time\n end\n end",
"def check_end_tim... | [
"0.75151235",
"0.7071533",
"0.7012782",
"0.69998944",
"0.69763255",
"0.68621856",
"0.67484266",
"0.6702217",
"0.66968906",
"0.6653403",
"0.65554947",
"0.65447974",
"0.6541156",
"0.65404207",
"0.6499381",
"0.6482098",
"0.6481419",
"0.64493936",
"0.64316547",
"0.6426057",
"0.63... | 0.8366072 | 0 |
Adds errors if number_of_classes_is_valid? returns false | def number_of_classes_is_valid
errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid?\n return ((self.number_of_classes != nil) and (self.number_of_classes > 0))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def validate!\n validations.each do |name, attributes|\n valid ... | [
"0.7522681",
"0.7069296",
"0.67471296",
"0.656553",
"0.64563817",
"0.6422648",
"0.6338168",
"0.62567747",
"0.62289953",
"0.61848646",
"0.6147791",
"0.605664",
"0.60460085",
"0.6029689",
"0.58844614",
"0.58604866",
"0.5849429",
"0.58055294",
"0.5799057",
"0.57950073",
"0.57642... | 0.85071665 | 0 |
Tests if number_of_classes for course is not nil and is greater than 0 and returns true or false. | def number_of_classes_is_valid?
return ((self.number_of_classes != nil) and (self.number_of_classes > 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def number_of_classes_is_valid\n errors.... | [
"0.6785777",
"0.6499839",
"0.6447862",
"0.60926414",
"0.60425615",
"0.6017673",
"0.601499",
"0.59928703",
"0.5950029",
"0.59366846",
"0.59196985",
"0.59128827",
"0.582566",
"0.57868314",
"0.57623893",
"0.573326",
"0.5698248",
"0.5665097",
"0.5654583",
"0.5654574",
"0.5652654"... | 0.8152797 | 0 |
Adds errors if days_of_week_are_valid? returns false | def days_of_week_are_valid
errors.add(:days_of_week, "The days of the week are invalid.") unless days_of_week_are_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def holiday_cannot_be_on_weekends\n if (self.date.strftime(\"%u\") == \"6\" or self.date.strftime(\"%u\") == \"7\")\n errors.add(:date, \"Holiday should not be on weekends\")\n end\n end",
"def holiday_cannot_be_on_weekends\n if (self.date.cwday == 6 or self.date.cwday == 7)\n errors.add(... | [
"0.7174689",
"0.7134445",
"0.6684376",
"0.6663943",
"0.6574682",
"0.64387727",
"0.64259505",
"0.6385372",
"0.6326706",
"0.63082343",
"0.6243195",
"0.62150246",
"0.6198207",
"0.6071262",
"0.59911764",
"0.5979931",
"0.59618443",
"0.59327656",
"0.59267604",
"0.59069324",
"0.5903... | 0.90779454 | 0 |
Tests that none of the days for course are nil and that the days's values are either true or false and returns true or false. | def days_of_week_are_valid?
if (self.sunday == nil); return false; end
if (self.monday == nil); return false; end
if (self.tuesday == nil); return false; end
if (self.wednesday == nil); return false; end
if (self.thursday == nil); return false; end
if (self.friday == nil); return false; end
if (self.saturday == nil); return false; end
if ((self.sunday != true) and (self.sunday != false)); return false; end
if ((self.monday != true) and (self.monday != false)); return false; end
if ((self.tuesday != true) and (self.tuesday != false)); return false; end
if ((self.wednesday != true) and (self.wednesday != false)); return false; end
if ((self.thursday != true) and (self.thursday != false)); return false; end
if ((self.friday != true) and (self.friday != false)); return false; end
if ((self.saturday != true) and (self.saturday != false)); return false; end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if !@day.nil? && @day > 7\n return false if !@day.nil? && @day < 1\n true\n end",
"def perfectDayChecker day\n\t\t\t# If all five prayers were performed\n\t\t\tif day[:fajr] == 2 && day[:zuhr] == 2 && day[:asr] == 2 && day[:maghrib] == 2 && day[:isha] == 2\n\t\t\t \ttr... | [
"0.6718847",
"0.6342332",
"0.6290253",
"0.6216907",
"0.6163219",
"0.61618423",
"0.61407477",
"0.61189467",
"0.610051",
"0.6086731",
"0.59891325",
"0.5977873",
"0.5975071",
"0.5947247",
"0.5933533",
"0.5908023",
"0.5903136",
"0.5901139",
"0.5900149",
"0.58926564",
"0.5793009",... | 0.70101815 | 0 |
Adds errors if class_min_is_valid? returns false | def class_min_is_valid
errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def validate!\n validations.each do |name, attribu... | [
"0.7651848",
"0.7138",
"0.6872949",
"0.686868",
"0.65987456",
"0.6569817",
"0.65232015",
"0.6440607",
"0.6436913",
"0.6407076",
"0.63661844",
"0.6311979",
"0.6305959",
"0.62571955",
"0.62362486",
"0.6199062",
"0.6176973",
"0.6117106",
"0.6106732",
"0.6089589",
"0.60867894",
... | 0.84453946 | 0 |
Tests that class_min is not nil or that the class_max has not been set. It checks that the class_min is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_min_is_valid?
if ((self.class_min == nil) or (self.class_max == nil)); return false; end
return ((self.class_min > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_max_is_valid?\n if ((self.class_max == nil) or (self.class_min == nil)); return false; end\n return ((self.class_max > 0) and (self.class_max >= self.class_min))\n end",
"def between_min_max?(value, min, max) # TODO Repetido en concern/Methods\n return true if value >= min and value <= max\n ... | [
"0.8976752",
"0.7068911",
"0.69315034",
"0.6750686",
"0.66466933",
"0.65867406",
"0.65733033",
"0.64799",
"0.6456605",
"0.6378076",
"0.6349214",
"0.63116854",
"0.6307662",
"0.6287422",
"0.6140929",
"0.61234784",
"0.61009705",
"0.60757023",
"0.6066163",
"0.6064067",
"0.5995531... | 0.894168 | 1 |
Adds errors if class_max_is_valid? returns false | def class_max_is_valid
errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_classes_is_valid\n errors.add(:number_of_classes, 'Invalid number of classes') unless number_of_classes_is_valid?\n end",
"def class_min_is_valid\n errors.add(:class_min,'Invalid class min value.') unless class_min_is_valid?\n end",
"def class_max_is_valid?\n if ((self.class_max == nil... | [
"0.76212156",
"0.7602966",
"0.7227967",
"0.66246027",
"0.64286155",
"0.64081997",
"0.6334596",
"0.6237823",
"0.6090215",
"0.6060761",
"0.59815574",
"0.5877955",
"0.58717567",
"0.58577055",
"0.58097744",
"0.58062315",
"0.57630754",
"0.5756526",
"0.575159",
"0.57459027",
"0.569... | 0.89256746 | 0 |
Tests that class_max is not nil or that the class_min has not been set. It checks that the class_max is greater than 0 and that the class_max is greater than the class_min. It returns true or false. | def class_max_is_valid?
if ((self.class_max == nil) or (self.class_min == nil)); return false; end
return ((self.class_max > 0) and (self.class_max >= self.class_min))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_min_is_valid?\n if ((self.class_min == nil) or (self.class_max == nil)); return false; end\n return ((self.class_min > 0) and (self.class_max >= self.class_min))\n end",
"def class_max_is_valid\n errors.add(:class_max,'Invalid class max value.') unless class_max_is_valid?\n end",
"def betw... | [
"0.8701463",
"0.7271286",
"0.68165153",
"0.6568958",
"0.64566576",
"0.64448696",
"0.6411269",
"0.63438433",
"0.62115705",
"0.6198311",
"0.6154437",
"0.6086009",
"0.6051319",
"0.6032028",
"0.5990534",
"0.59790343",
"0.5978076",
"0.5970896",
"0.5964176",
"0.5936864",
"0.5927225... | 0.914462 | 0 |
Adds errors if fee_per_meeting_is_valid? returns false | def fee_per_meeting_is_valid
errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_m... | [
"0.79279375",
"0.74114054",
"0.7103139",
"0.6207525",
"0.6129603",
"0.60691947",
"0.59894615",
"0.59121746",
"0.58904517",
"0.58663905",
"0.5836151",
"0.5826796",
"0.5826259",
"0.5804788",
"0.57486326",
"0.57260144",
"0.5715971",
"0.5714275",
"0.57007545",
"0.5699851",
"0.569... | 0.91105443 | 0 |
Tests that the fee_per_meeting for course is not nil and greater than or equal to 0 and returns true or false. | def fee_per_meeting_is_valid?
return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting... | [
"0.7554179",
"0.6729728",
"0.6571799",
"0.6494584",
"0.64643955",
"0.623191",
"0.60558814",
"0.6021846",
"0.5957028",
"0.5939857",
"0.59163016",
"0.5915074",
"0.59145695",
"0.5905023",
"0.5884392",
"0.5862706",
"0.5860865",
"0.5856659",
"0.5826776",
"0.5820091",
"0.5798362",
... | 0.8527851 | 0 |
Adds errors if fee_for_additional_materials returns false | def fee_for_additional_materials_is_valid
errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid?\n return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))\n end",
"def total_fee_is_valid\n errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?\n end",
"def fee_per_meeting_is_valid\n error... | [
"0.7586528",
"0.7028197",
"0.6256086",
"0.60872483",
"0.58942425",
"0.58825755",
"0.5809041",
"0.5793246",
"0.5720905",
"0.56903046",
"0.56727296",
"0.55360746",
"0.55143297",
"0.5492163",
"0.5482173",
"0.5459941",
"0.54315907",
"0.5414651",
"0.53672326",
"0.5363375",
"0.5329... | 0.89261824 | 0 |
Tests that fee_for_additional_material for course is not nil and greater than or equal to 0 and returns true or false. | def fee_for_additional_materials_is_valid?
return ((self.fee_for_additional_materials != nil) and (self.fee_for_additional_materials >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_fee_is_valid?\n return ((self.total_fee != nil) and (self.total_fee >= 0))\n end",
"def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end",
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee... | [
"0.761037",
"0.714761",
"0.70305824",
"0.67311174",
"0.672941",
"0.6692722",
"0.6377599",
"0.6359446",
"0.63240474",
"0.6311671",
"0.6284458",
"0.6261357",
"0.6254491",
"0.62404966",
"0.61201787",
"0.6103666",
"0.6011824",
"0.5986649",
"0.5969618",
"0.58939934",
"0.58906364",... | 0.8457905 | 0 |
Adds errors if total_fee_is_valid? returns false | def total_fee_is_valid
errors.add(:total_fee,'The total fee is invalid.') unless total_fee_is_valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_for_additional_materials_is_valid\n errors.add(:fee_for_additional_materials, 'The fee for additional materials is invalid.') unless fee_for_additional_materials_is_valid?\n end",
"def fee_per_meeting_is_valid\n errors.add(:fee_per_meeting, 'The fee per meeting is invalid.') unless fee_per_meeting... | [
"0.7769707",
"0.77040637",
"0.75535625",
"0.6664327",
"0.6526046",
"0.6336517",
"0.62817496",
"0.61141074",
"0.61026436",
"0.6056936",
"0.60406977",
"0.60235614",
"0.6018698",
"0.6001351",
"0.5959651",
"0.5934791",
"0.5877435",
"0.58740693",
"0.586765",
"0.58670926",
"0.58668... | 0.913758 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.