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 |
|---|---|---|---|---|---|---|
POST /opinion_reports POST /opinion_reports.json | def create
if OpinionReport.where(opinion_report_params).count > 0
render json: {
status: "Error",
message: "Ya se ha enviado un reporte sobre esta opinión"
}.to_json
else
@opinion_report = OpinionReport.new(opinion_report_params)
if @opinion_report.save
render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @opinion_reports = OpinionReport.all\n end",
"def opinion_report_params\n params.require(:opinion_report).permit(:opinion_id, :reason, :user_id)\n end",
"def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params... | [
"0.6828106",
"0.63153374",
"0.6295352",
"0.612353",
"0.6093642",
"0.60286754",
"0.59918565",
"0.599123",
"0.5990987",
"0.59480035",
"0.5918481",
"0.5915681",
"0.59105617",
"0.5905141",
"0.5903417",
"0.58701444",
"0.5860024",
"0.58498853",
"0.58251554",
"0.5784668",
"0.5775127... | 0.7281066 | 0 |
PATCH/PUT /opinion_reports/1 PATCH/PUT /opinion_reports/1.json | def update
respond_to do |format|
if @opinion_report.update(opinion_report_params)
format.html { redirect_to @opinion_report, notice: 'Opinion report was successfully updated.' }
format.json { render :show, status: :ok, location: @opinion_report }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n... | [
"0.6662384",
"0.6468669",
"0.6466897",
"0.62971467",
"0.62910783",
"0.62250257",
"0.62184453",
"0.61896753",
"0.61696917",
"0.61493486",
"0.6149035",
"0.6149035",
"0.6134327",
"0.6105999",
"0.61057854",
"0.6097116",
"0.60599715",
"0.60589784",
"0.60562",
"0.6043677",
"0.60436... | 0.7180212 | 0 |
DELETE /opinion_reports/1 DELETE /opinion_reports/1.json | def destroy
@opinion_report.destroy
respond_to do |format|
format.html { redirect_to opinion_reports_url, notice: 'Opinion report was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|... | [
"0.7349504",
"0.7219695",
"0.72195554",
"0.721269",
"0.71301913",
"0.71294814",
"0.71294814",
"0.71294814",
"0.7114345",
"0.71045244",
"0.7088226",
"0.7034202",
"0.70226806",
"0.7017514",
"0.7002945",
"0.69912595",
"0.69706774",
"0.6966951",
"0.69663113",
"0.69604194",
"0.694... | 0.7651813 | 0 |
GET /vlan_details/1 GET /vlan_details/1.xml | def show
@vlan_detail = VlanDetail.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @vlan_detail }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @vlan }\n end\n end",
"def show\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml ... | [
"0.8188131",
"0.812569",
"0.71993154",
"0.7125191",
"0.7082284",
"0.6987521",
"0.67301327",
"0.6497025",
"0.6448811",
"0.6446775",
"0.6425056",
"0.6403707",
"0.63576996",
"0.63509965",
"0.6331887",
"0.632852",
"0.63061804",
"0.6302211",
"0.62804914",
"0.6268851",
"0.62382466"... | 0.82618773 | 0 |
GET /vlan_details/new GET /vlan_details/new.xml | def new
@vlan_detail = VlanDetail.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @vlan_detail }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @vlan }\n end\n end",
"def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vlan }\n end\n end",
"... | [
"0.84023374",
"0.83642495",
"0.7765211",
"0.7657264",
"0.761953",
"0.7365833",
"0.7212881",
"0.7149883",
"0.7146596",
"0.6963858",
"0.6804152",
"0.67895174",
"0.6749218",
"0.6649486",
"0.6633858",
"0.66127497",
"0.6602427",
"0.6585634",
"0.65559876",
"0.65298617",
"0.65255934... | 0.83645254 | 1 |
POST /vlan_details POST /vlan_details.xml | def create
@vlan_detail = VlanDetail.new(params[:vlan_detail])
respond_to do |format|
if @vlan_detail.save
flash[:notice] = 'VlanDetail was successfully created.'
format.html { redirect_to(@vlan_detail) }
format.xml { render :xml => @vlan_detail, :status => :created, :location =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vlan = Vlan.new(vlan_params)\n\n respond_to do |format|\n if @vlan.save\n flash[:notice] = 'VLAN was successfully created.'\n format.html { redirect_to(admin_vlans_path) }\n format.xml { render xml: @vlan, status: :created, location: @vlan }\n else\n forma... | [
"0.73366696",
"0.7254835",
"0.7098234",
"0.69306386",
"0.68697053",
"0.6854008",
"0.6651302",
"0.65985614",
"0.65504575",
"0.64670604",
"0.64436704",
"0.6296945",
"0.6204243",
"0.60897243",
"0.5982654",
"0.59227705",
"0.5909971",
"0.5901296",
"0.58853257",
"0.5863771",
"0.586... | 0.7650778 | 0 |
PUT /vlan_details/1 PUT /vlan_details/1.xml | def update
@vlan_detail = VlanDetail.find(params[:id])
respond_to do |format|
if @vlan_detail.update_attributes(params[:vlan_detail])
flash[:notice] = 'VlanDetail was successfully updated.'
format.html { redirect_to(@vlan_detail) }
format.xml { head :ok }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n if @vlan.update_attributes(params[:vlan])\n flash[:notice] = 'Vlan was successfully updated.'\n format.html { redirect_to(@vlan) }\n format.xml { head :ok }\n else\n format.html { render :action =>... | [
"0.7309595",
"0.72106314",
"0.68898517",
"0.67382944",
"0.67142093",
"0.6565873",
"0.64978397",
"0.64828444",
"0.64793855",
"0.64776397",
"0.64325446",
"0.6369396",
"0.6363444",
"0.6289484",
"0.6250942",
"0.62075704",
"0.6194882",
"0.6158836",
"0.61440533",
"0.5988808",
"0.59... | 0.74717534 | 0 |
DELETE /vlan_details/1 DELETE /vlan_details/1.xml | def destroy
@vlan_detail = VlanDetail.find(params[:id])
@vlan_detail.destroy
respond_to do |format|
format.html { redirect_to(vlan_details_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @vlan = Vlan.find(params[:id])\n @vlan.destroy\n\n respond_to do |format|\n format.html { redirect_to(vlans_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hq_vlan = HqVlan.find(params[:id])\n @hq_vlan.destroy\n \n respond_to do |format|\n for... | [
"0.78283495",
"0.74942267",
"0.7375414",
"0.70161873",
"0.6958906",
"0.68342835",
"0.6643369",
"0.65767473",
"0.6422847",
"0.6399574",
"0.6328427",
"0.63230187",
"0.63037944",
"0.62984455",
"0.62906283",
"0.6274453",
"0.62638825",
"0.62597704",
"0.6246578",
"0.62443775",
"0.6... | 0.7998813 | 0 |
GET /enqueues GET /enqueues.json | def index
@enqueues = Enqueue.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @enqueue = Enqueue.new(enqueue_params)\n\n respond_to do |format|\n if @enqueue.save\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }\n format.json { render :show, status: :created, location: @enqueue }\n else\n format.html { rend... | [
"0.6399622",
"0.636724",
"0.6155865",
"0.60852784",
"0.6017635",
"0.5988283",
"0.59550303",
"0.59520835",
"0.5918499",
"0.5909206",
"0.58986527",
"0.589833",
"0.5821724",
"0.5819036",
"0.58142185",
"0.5810027",
"0.5805604",
"0.57812464",
"0.57745177",
"0.57744515",
"0.5727791... | 0.739622 | 0 |
POST /enqueues POST /enqueues.json | def create
@enqueue = Enqueue.new(enqueue_params)
respond_to do |format|
if @enqueue.save
format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }
format.json { render :show, status: :created, location: @enqueue }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_params\n params.require(:enqueue).permit(:title, :text, :type, :category, :user_id)\n end",
"def index\n @enqueues = Enqueue.all\n end",
"def enqueue(item)\n end",
"def enqueue( * )\n\t\t# No-op\n\tend",
"def enqueue(*args); end",
"def create\n arg = params[:email]\n counte... | [
"0.6499383",
"0.64600056",
"0.6225681",
"0.6139643",
"0.61385083",
"0.61261934",
"0.6082269",
"0.60621554",
"0.6009469",
"0.6001736",
"0.5975336",
"0.5963701",
"0.5955417",
"0.59343475",
"0.58794236",
"0.58474815",
"0.582951",
"0.57697004",
"0.5758289",
"0.57346964",
"0.56814... | 0.7116463 | 0 |
PATCH/PUT /enqueues/1 PATCH/PUT /enqueues/1.json | def update
respond_to do |format|
if @enqueue.update(enqueue_params)
format.html { redirect_to @enqueue, notice: 'Enqueue was successfully updated.' }
format.json { render :show, status: :ok, location: @enqueue }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\... | [
"0.6018225",
"0.59883356",
"0.59556013",
"0.595523",
"0.5952416",
"0.5952416",
"0.5952416",
"0.58493733",
"0.5830232",
"0.58256",
"0.5823589",
"0.58192915",
"0.57849896",
"0.5715887",
"0.5679859",
"0.5672567",
"0.5659781",
"0.5650481",
"0.56400955",
"0.56372046",
"0.5631617",... | 0.72399914 | 0 |
DELETE /enqueues/1 DELETE /enqueues/1.json | def destroy
@enqueue.destroy
respond_to do |format|
format.html { redirect_to enqueues_url, notice: 'Enqueue was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteQueue( queue_id)\n params = Hash.new\n params['queue_id'] = queue_id\n return doCurl(\"delete\",\"/queue\",params)\n end",
"def destroy\n @wait_queue.destroy\n respond_to do |format|\n format.html { redirect_to wait_queues_url, notice: \"Wait queue was successfully destroyed.\" }\n... | [
"0.68569595",
"0.68183833",
"0.67979604",
"0.6727158",
"0.6689218",
"0.66470677",
"0.6625463",
"0.65813184",
"0.65781456",
"0.6554075",
"0.6530053",
"0.65290856",
"0.64452493",
"0.64413023",
"0.643709",
"0.64357966",
"0.6433246",
"0.6397519",
"0.63841176",
"0.6346085",
"0.634... | 0.76331973 | 0 |
the itinerary edit page is THE MAIN INTERFACE for attendee registration so... this page has mission creeped and is a bit messy it functions like a 'new' page for line_items and transactions NOTE: the itinerary isn't responsible for creating, updating, or destroying either of those resources though it also acts like an ... | def edit
@itinerary = Itinerary.find(params[:id])
authorize! :update, @itinerary
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\titinerary = Itinerary.find(params[:id])\n\tend",
"def index\n redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface\n end",
"def edit\n \n end",
... | [
"0.72200865",
"0.6515793",
"0.6459003",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
"0.6328116",
... | 0.66953987 | 1 |
FORCE to implement content_for in controller | def view_context
super.tap do |view|
(@_content_for || {}).each do |name,content|
view.content_for name, content
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n ... | [
"0.75203246",
"0.7484351",
"0.73812956",
"0.73812956",
"0.73812956",
"0.72570103",
"0.7173389",
"0.7173389",
"0.7173389",
"0.7066237",
"0.690314",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.68770504",
"0.... | 0.75152975 | 1 |
The tuition calculated indicator is always S09 and TCALC | def tuition_calculated?
type_code == '+S09' && reason_code == 'TCALC'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tupe\n if @tupe_flag == 'Y'\n @tupe =\n if @supplier_name\n @subtotal3 * @rate_card.data['Variances'][@supplier_name]['TUPE Risk Premium (DA %)'].to_f\n else\n @subtotal3 * @framework_rates['M148']\n end\n else\n 0\n end\n end",
... | [
"0.65868026",
"0.60269016",
"0.5877031",
"0.5797632",
"0.57933867",
"0.56945443",
"0.56872433",
"0.5684176",
"0.5627982",
"0.55986583",
"0.5549551",
"0.5544073",
"0.5522585",
"0.5487636",
"0.5468708",
"0.54627633",
"0.54601943",
"0.5440606",
"0.542751",
"0.54165375",
"0.53750... | 0.64559186 | 1 |
PATCH/PUT /admin/weeks/1 PATCH/PUT /admin/weeks/1.json | def update
respond_to do |format|
if @admin_week.update(admin_week_params)
format.html { redirect_to @admin_week, success: 'Week was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_week }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @week = Week.find(params[:id])\n\n respond_to do |format|\n if @week.update_attributes(params[:week])\n format.html { redirect_to @week, :notice => 'Week was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit... | [
"0.65777916",
"0.65333056",
"0.63889223",
"0.62320113",
"0.6217546",
"0.6187142",
"0.6168561",
"0.6111102",
"0.61026907",
"0.6030845",
"0.6017585",
"0.601497",
"0.6009933",
"0.59970903",
"0.5955447",
"0.59453326",
"0.59129137",
"0.59023345",
"0.58936507",
"0.58565253",
"0.583... | 0.6930342 | 0 |
DELETE /admin/weeks/1 DELETE /admin/weeks/1.json | def destroy
@admin_week.destroy
respond_to do |format|
format.html { redirect_to admin_weeks_url, success: 'Week was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @day_week.destroy\n respond_to do |format|\n format.html { redirect_to day_weeks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @week = Week.find(params[:id])\n # @week.destroy\n\n respond_to do |format|\n format.html { redirect_to weeks_ur... | [
"0.7387031",
"0.7379276",
"0.7358234",
"0.7358234",
"0.7345342",
"0.7119358",
"0.7119252",
"0.70316577",
"0.69931716",
"0.6991566",
"0.6968955",
"0.6897956",
"0.6897389",
"0.6879026",
"0.6860818",
"0.68506145",
"0.676406",
"0.67487353",
"0.67425764",
"0.6689473",
"0.66772103"... | 0.762575 | 0 |
Creates a new factory with all the subclasses of base added to it as matchers. | def factory
raise RuntimeError unless defined? @subclasses
MessageFactory.new @subclasses.map(&:matcher)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extended(base)\n base.matchers.concat(matchers)\n end",
"def child_factories; end",
"def instantiate_subclasses(klass); end",
"def inherited(base)\n base.send :create_dynamic_classes\n super\n end",
"def inherited(base)\n klasses << base\n end",
"def new(*a, &b)\n ... | [
"0.5896407",
"0.58151835",
"0.55468345",
"0.5459844",
"0.54579604",
"0.5338063",
"0.52701664",
"0.52432096",
"0.5086458",
"0.5024644",
"0.49408376",
"0.49070334",
"0.4905335",
"0.48628333",
"0.485909",
"0.4857042",
"0.4857042",
"0.48550758",
"0.48424715",
"0.48307174",
"0.482... | 0.6463484 | 0 |
Creates a value and mask that can be used to match the first byte of a message. == Usage The following example illustrates how the value and mask are intended to be used. value, mask = status_value_and_mask 0x42 & mask == value => true if STATUS == 0x40 value, mask = status_value_and_mask 3 0x42 & mask == value => fals... | def status_value_and_mask(channel = nil)
if channel
validate_channel channel
[(self::STATUS & self::STATUS_MASK) + (channel & CHANNEL_MASK),
self::STATUS_MASK + CHANNEL_MASK]
else
[self::STATUS, self::STATUS_MASK]
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_value_v1(value)\n # Int masks for one and zero chars\n ones_mask = @mask.chars.map { |c| c == \"1\" ? \"1\" : \"0\" }.join.to_i(2)\n zeros_mask = @mask.chars.map { |c| c == \"0\" ? \"1\" : \"0\" }.join.to_i(2)\n\n result = (ones_mask | value) & ~zeros_mask\n\n if DEBUG\n puts \" ... | [
"0.6243042",
"0.5804736",
"0.57224923",
"0.5657368",
"0.55966294",
"0.5487266",
"0.53218156",
"0.5168772",
"0.5157935",
"0.5147742",
"0.51307285",
"0.50201744",
"0.4992241",
"0.4992241",
"0.49884808",
"0.49825266",
"0.49813023",
"0.494457",
"0.494457",
"0.49407294",
"0.487402... | 0.6877293 | 0 |
The klass matcher is the most generic `Matcher` for the message class and is cached to avoid duplication. By default the default `Matcher` uses the value and mask returned by `status_value_and_mask` to match messages. Subclasses that need different behaviour can pass a block to be forwarded directly to the matcher (see... | def klass_matcher(&block)
return @klass_matcher if defined?(@klass_matcher)
unless block_given?
val, mask = status_value_and_mask
block = proc { |d| (d[0] & mask) == val }
end
@klass_matcher = Matcher.new(self, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] >= 120\n end\n end",
"def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] < 120\n end\n end",
"def matcher(key, value)\n i... | [
"0.7424613",
"0.73864794",
"0.54925275",
"0.5213161",
"0.50020134",
"0.49349326",
"0.48404106",
"0.48026842",
"0.47157714",
"0.46928883",
"0.4668136",
"0.45988646",
"0.45614588",
"0.45614588",
"0.45548847",
"0.4536644",
"0.45190725",
"0.45190725",
"0.45090806",
"0.44982448",
... | 0.81724775 | 0 |
Constructs a Valkyrie::Persistence::CustomQueryContainer using this query service | def custom_queries
@custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def initialize\n super(\"query\")\n end",
"def initialize(query={})\n @query = query\n end",
"def initialize(query)\n @query = query \n end",
"def initialize(query)\n @query = query\n end",
"def build(attrs = {}... | [
"0.62247634",
"0.6179609",
"0.61784935",
"0.6026644",
"0.6021266",
"0.5903643",
"0.5809702",
"0.5671776",
"0.5641182",
"0.56119287",
"0.56032777",
"0.55961984",
"0.55961984",
"0.5592445",
"0.5534292",
"0.55183417",
"0.55100566",
"0.55097336",
"0.55021995",
"0.5476193",
"0.544... | 0.8073523 | 0 |
Parse out _str_ and return two Time objects. It will return nil if one of the times are corrupt (like 13th month) or missing. It will also look at context if no end time is given so: 2008 becomes 20080101 00:00:00 20081231 23:59:59 200801 becomes 20080101 00:00:00 20080131 23:59:59 20080101 becomes 20080101 00:00:00 20... | def parse(str)
match_data = str.match(DATE_REGEXP)
# Oh my god, I hate this shit. Basically it prepares dates for
# Time.parse consuming because it's so stupid and ignorant it wants
# to make me puke :(
from = extract_time_string_from_match_data(match_data)
to = extract_time_string_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_parsing str\n Time.parse(str) if str && str != \"<null>\"\n end",
"def parse_times(str)\n \tstr.delete(' ')\n \ttimes = []\n \tsuccess = true\n \tstr.split(',').each do |t|\n \t pt = parse_time(t)\n \t if pt\n \t \ttimes << pt\n \t else\n \t \traise \"unable to parse time #{t}\"\n ... | [
"0.7274767",
"0.65754855",
"0.6502847",
"0.64645815",
"0.62937933",
"0.62896746",
"0.62896746",
"0.62896746",
"0.6259417",
"0.62309694",
"0.6205177",
"0.61774254",
"0.61242664",
"0.61092573",
"0.61092573",
"0.61092573",
"0.61092573",
"0.61092573",
"0.61092573",
"0.61092573",
... | 0.6699145 | 1 |
Extract context from match data. For example if user enters just 2008 it will return :year. Return value meanings: :year: end range should be years end :month: end range should be months end :nothing: nothing should be done with end range | def extract_context_from_match_data(m, offset=0)
year, month, day, hour, minute, second = \
extract_pieces_from_match_data(m, offset)
if year and month and day and hour and minute and second
:nothing
elsif year and month and day and hour and minute
:minute
elsif year and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term\n return nil unless start_time\n case start_time.mon\n when 1..3 # Lent term\n return month_range( start_time.year, 1, 3 )\n when 4..6 # Easter term\n return month_range( start_time.year, 4, 6 )\n when 7..9 # Long vac.\n return month_range( start_time.year, 7, 9 )\n ... | [
"0.5681878",
"0.55291873",
"0.54597914",
"0.53294075",
"0.53150725",
"0.5312115",
"0.5310349",
"0.52532923",
"0.52528447",
"0.51866615",
"0.51760566",
"0.51282996",
"0.508316",
"0.50603604",
"0.5035899",
"0.5003991",
"0.49374774",
"0.49357435",
"0.49126983",
"0.49019644",
"0.... | 0.6747188 | 0 |
Derive from this waypoint's location, its opposite location and its left & right locations. These will be determined to make 'rotation' easier. Example: For a location east 10, north 1 oppositie location is: west 10, south 1 right location is: east 1, south 10 left location is: west 1, north 10. | def location_changed!
east = location.east_units
west = location.west_units
north = location.north_units
south = location.south_units
# NOTE: expectation is 1 of the paired directions will be zero.
calculate_location_opposite east: east, west: west, north: north, south: south
calculate_loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_location_right east:, west:, north:, south:\n self.location_right = {}\n if east.zero? && north.zero?\n location_right[:west] = south\n location_right[:north] = west\n elsif east.zero? && south.zero?\n location_right[:east] = north\n location_right[:north] = west\n els... | [
"0.70908403",
"0.6990884",
"0.66217375",
"0.6384931",
"0.6233099",
"0.617369",
"0.6073762",
"0.59224135",
"0.5917899",
"0.5903764",
"0.58580405",
"0.57399726",
"0.5735009",
"0.5721882",
"0.5700005",
"0.56951934",
"0.5689652",
"0.56895316",
"0.5688678",
"0.5688303",
"0.5660922... | 0.7117434 | 0 |
Example: For a location east 10, north 1 oppositie location is: west 10, south 1 | def calculate_location_opposite east:, west:, north:, south:
self.location_opposite = {}
if east.zero?
location_opposite[:east] = west
else
location_opposite[:west] = east
end
if north.zero?
location_opposite[:north] = south
else
location_opposite[:south] = north
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n ... | [
"0.6988844",
"0.67001283",
"0.6687246",
"0.66694206",
"0.65815085",
"0.6473859",
"0.63812053",
"0.63083404",
"0.63045985",
"0.6291671",
"0.6269261",
"0.6262504",
"0.6179521",
"0.61734277",
"0.61674803",
"0.61533666",
"0.6059062",
"0.6059062",
"0.6059062",
"0.6036644",
"0.6027... | 0.69202095 | 1 |
Example: For a location east 10, north 1 right location is: east 1, south 10 | def calculate_location_right east:, west:, north:, south:
self.location_right = {}
if east.zero? && north.zero?
location_right[:west] = south
location_right[:north] = west
elsif east.zero? && south.zero?
location_right[:east] = north
location_right[:north] = west
elsif west.zero?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_location_left\n self.location_left = {}\n if location_right.key? :east\n location_left[:west] = location_right[:east]\n else\n location_left[:east] = location_right[:west]\n end\n\n if location_right.key? :north\n location_left[:south] = location_right[:north]\n else\... | [
"0.6966873",
"0.68311363",
"0.6594091",
"0.6567964",
"0.64203787",
"0.6311611",
"0.6224666",
"0.61903715",
"0.61848915",
"0.61588734",
"0.6136917",
"0.60667384",
"0.60667384",
"0.60667384",
"0.6020196",
"0.59962046",
"0.59773296",
"0.5973496",
"0.59495157",
"0.59431916",
"0.5... | 0.7431923 | 0 |
Example: For a location east 10, north 1 left location is: west 1, north 10. NOTE: location left is opposite from location right | def calculate_location_left
self.location_left = {}
if location_right.key? :east
location_left[:west] = location_right[:east]
else
location_left[:east] = location_right[:west]
end
if location_right.key? :north
location_left[:south] = location_right[:north]
else
location_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_changed!\n east = location.east_units\n west = location.west_units\n\n north = location.north_units\n south = location.south_units\n\n # NOTE: expectation is 1 of the paired directions will be zero.\n calculate_location_opposite east: east, west: west, north: north, south: south\n ... | [
"0.7180343",
"0.69969976",
"0.67336714",
"0.6691611",
"0.66659105",
"0.6658387",
"0.6472062",
"0.6142473",
"0.614056",
"0.6109168",
"0.6064806",
"0.6058206",
"0.6030131",
"0.60280156",
"0.601265",
"0.59770083",
"0.59219563",
"0.5883541",
"0.5868157",
"0.58477896",
"0.5840435"... | 0.74215484 | 0 |
POST /bankets POST /bankets.json | def create
@banket = Banket.new(banket_params)
respond_to do |format|
if @banket.save
format.html { redirect_to @banket, notice: 'Banket was successfully created.' }
format.json { render :show, status: :created, location: @banket }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.succe... | [
"0.6535218",
"0.6401779",
"0.62633854",
"0.62352747",
"0.6176619",
"0.6160421",
"0.6114946",
"0.6091957",
"0.6049036",
"0.6025356",
"0.5973933",
"0.59646356",
"0.5947393",
"0.5908161",
"0.5889099",
"0.58485776",
"0.58447814",
"0.58068705",
"0.57958186",
"0.57835853",
"0.57462... | 0.6947752 | 0 |
PATCH/PUT /bankets/1 PATCH/PUT /bankets/1.json | def update
respond_to do |format|
if @banket.update(banket_params)
format.html { redirect_to @banket, notice: 'Banket was successfully updated.' }
format.json { render :show, status: :ok, location: @banket }
else
format.html { render :edit }
format.json { render json: @ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n format.html { redirect_to @bank, notice: 'Bank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.6450134",
"0.6434901",
"0.6401177",
"0.631454",
"0.63131493",
"0.62878984",
"0.6270798",
"0.62674767",
"0.62448066",
"0.624004",
"0.62303656",
"0.62303656",
"0.6225549",
"0.6207581",
"0.62047094",
"0.618524",
"0.6171994",
"0.6157234",
"0.614989",
"0.6133582",
"0.61241424",... | 0.6604139 | 0 |
DELETE /bankets/1 DELETE /bankets/1.json | def destroy
@banket.destroy
respond_to do |format|
format.html { redirect_to bankets_url, notice: 'Banket was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank.destroy\n respond_to do |format|\n format.html { redirect_to banks_url, notice: '... | [
"0.724147",
"0.72099483",
"0.7140855",
"0.7108241",
"0.702999",
"0.6937988",
"0.6930966",
"0.6911572",
"0.6898664",
"0.68749624",
"0.6872276",
"0.68690807",
"0.6868805",
"0.6855764",
"0.6849086",
"0.68477905",
"0.68477905",
"0.6846234",
"0.68058443",
"0.67974794",
"0.67872834... | 0.7363097 | 0 |
COUNTER TO IGNORE THE 'puts stringsHash[:total_days]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER | def getTotalDays(eventName)
counter = 0
total_days_check = ""
@totalDays = ""
while total_days_check != 'y' || total_days_check != "exit"
if counter == 0
puts @@stringsHash[:total_days]
end
counter += 1
total_days = gets.str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countPresents(days)\n\tcount = sum = 0\n\tdays.times do\n\t\tcount += 1\n\t\tcountdown = count\n\t\tcount.times do\n\t\t\t#puts \"Adding #{countdown} to #{sum}\"\n\t\t\tsum += countdown\n\t\t\tcountdown -= 1\n\t\tend\n\tend\n\tputs \"after #{days} days of christmas you'd receive #{sum.to_s} presents!\"\nend",
... | [
"0.55449504",
"0.5464194",
"0.5410608",
"0.53638107",
"0.5330613",
"0.52116936",
"0.5118696",
"0.5083235",
"0.5075419",
"0.50424284",
"0.50354594",
"0.5028951",
"0.5008341",
"0.4965378",
"0.49121645",
"0.49115393",
"0.48953375",
"0.48889992",
"0.48869395",
"0.48756734",
"0.48... | 0.6000548 | 0 |
COUNTER TO IGNORE THE 'puts stringsHash[:band_num]' THE SECOND TIME THROUGH IF 'n' IS SELECTED BY USER | def getBandNum(eventName)
counter = 0
band_num_check = ""
@bandNum = ""
while band_num_check != 'y' || band_num_check != "exit"
if counter == 0
puts @@stringsHash[:band_num]
end
counter += 1
band_num = gets.strip
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_count_experiment\n @letters_two.dump\n lines = @letters_two.xlate(@line_count_map)\n lines << @extra_digits\n lines.flatten!\n lines.dump('append')\n lines.chunk(2).to_i.collect { |d| d.to_s(5) }.dump(:from_base_5).to_i.to_letter\nend",
"def main\n results = {}\n strings = Hash.new(Array.new... | [
"0.5538354",
"0.5352194",
"0.50657946",
"0.49728096",
"0.496525",
"0.49447787",
"0.49235386",
"0.4869195",
"0.48553243",
"0.48549515",
"0.48541936",
"0.4850281",
"0.4849404",
"0.48452908",
"0.48217136",
"0.48202857",
"0.48188376",
"0.48031962",
"0.48030567",
"0.48015586",
"0.... | 0.5766622 | 0 |
true if pattern matches request path and http method matches request method | def matches?(req)
pattern.match(req.path) && req.request_method.downcase == http_method.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(req)\n @pattern.match?(req.path) && @http_method.to_s.downcase == req.request_method.downcase\n end",
"def matches?(req)\n req.path =~ pattern && http_method == req.request_method.downcase.to_sym\n end",
"def matches?(req)\n match_method = req.request_method.downcase.to_sym == @http_m... | [
"0.8694062",
"0.8691883",
"0.86916023",
"0.8680453",
"0.8507347",
"0.84543496",
"0.84454685",
"0.8444336",
"0.84255177",
"0.84204125",
"0.84002584",
"0.7951292",
"0.76980054",
"0.70834005",
"0.70634305",
"0.7055721",
"0.7008742",
"0.6931867",
"0.6877601",
"0.67988724",
"0.678... | 0.8767666 | 0 |
Uses model's publisher's country_codes to determine how to validate zip | def validates_zip_code_according_to_publisher(*config)
validates_each(:zip_code, *config) do |model, attr, zip|
if zip.present?
valid = false
if model.publisher
model.publisher.country_codes.each do |country_code|
regex = postal_code_regex(country_code)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_zip_code(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n regex = postal_code_regex(model.country_code)\n if regex.present?\n unless regex =~ zip\n model.errors.add(attr, I18n.t(\"activerecord.errors.mes... | [
"0.7138594",
"0.66672224",
"0.65053076",
"0.6392671",
"0.6359189",
"0.6359189",
"0.63049567",
"0.62893486",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.6233901",
"0.62141407",
"0.61871076",
"0.61671257",
"0.61671257",
"0.6137648",
"0.60821",
"0.6071982... | 0.8111252 | 0 |
If there's no country code at all, pretend us If there is a country code, the regex might still be nil.... | def postal_code_regex(country_code)
return us_regex if country_code.nil?
Country.postal_code_regex(country_code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_country_code?\n country_code.nil?\n end",
"def drop_country(affi_string)\n found_ctry = get_country_any(affi_string)\n dropped_country = affi_string.gsub(found_ctry,\"\").strip\n return dropped_country\nend",
"def phone_number_with_country_code; end",
"def has_valid_postal_code_pattern\n ... | [
"0.6206724",
"0.6167595",
"0.6135322",
"0.61207247",
"0.61026204",
"0.608198",
"0.60280263",
"0.60259247",
"0.6023773",
"0.5996231",
"0.59501666",
"0.59468794",
"0.5934802",
"0.59014714",
"0.5863764",
"0.5859394",
"0.5856711",
"0.5856711",
"0.5839878",
"0.5838371",
"0.5837967... | 0.74367326 | 0 |
Uses the model''s country code to determine how to validate zip | def validates_zip_code(*config)
validates_each(:zip_code, *config) do |model, attr, zip|
if zip.present?
regex = postal_code_regex(model.country_code)
if regex.present?
unless regex =~ zip
model.errors.add(attr, I18n.t("activerecord.errors.messages.invali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_zip_code_according_to_publisher(*config)\n validates_each(:zip_code, *config) do |model, attr, zip|\n if zip.present?\n valid = false\n if model.publisher\n model.publisher.country_codes.each do |country_code|\n regex = postal_code_regex(coun... | [
"0.72119874",
"0.6951393",
"0.6922878",
"0.68609256",
"0.6722515",
"0.66517246",
"0.66517246",
"0.64409167",
"0.6356393",
"0.6340032",
"0.6340032",
"0.6303804",
"0.626417",
"0.62593275",
"0.6254714",
"0.61897707",
"0.6180971",
"0.61758363",
"0.6165169",
"0.6156843",
"0.615495... | 0.74451184 | 0 |
remove episodes that are found in plex | def thetvdb_missing_plex_found(show,season,episode)
plex_has = false
# remove shows that we have
if $plex.episodes.has_key? show
if $plex.episodes[show].has_key?(season.to_i)
if $plex.episodes[show][season.to_i].has_key?(episode.to_i)
plex_has = true
end
end
end
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune\n @set.clear\n end",
"def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end",
"def remove_idea_events(events)\n events.d... | [
"0.5777581",
"0.57602966",
"0.5732618",
"0.5636568",
"0.55728316",
"0.549267",
"0.54691",
"0.5452294",
"0.54078877",
"0.5385365",
"0.53606415",
"0.5344986",
"0.53356004",
"0.5295978",
"0.5294535",
"0.5268267",
"0.5239667",
"0.52054423",
"0.5203759",
"0.52014816",
"0.52011436"... | 0.5839707 | 0 |
Delete the character from the line positioned at the given index. | def delete_character(index = nil)
Vedeu::Editor::Line.coerce(Vedeu::Editor::Delete
.from(line, index, size))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_character\n @lines = lines.delete_character(y, x - 1)\n\n left\n\n refresh\n end",
"def delete_at index=@curpos\n return -1 if !@editable \n char = @buffer.slice!(index,1)\n #$log.debug \" delete at #{index}: #{@buffer.length}: #{@buffer}\"\n @modified = t... | [
"0.7387134",
"0.727514",
"0.68795305",
"0.67943084",
"0.67259914",
"0.66502255",
"0.6592625",
"0.65758944",
"0.6533846",
"0.64526546",
"0.63957214",
"0.6304025",
"0.62773126",
"0.6252403",
"0.61952895",
"0.6143449",
"0.6099605",
"0.6082346",
"0.60375226",
"0.5959847",
"0.5958... | 0.88591933 | 1 |
Insert the character on the line positioned at the given index. | def insert_character(character, index = nil)
return self unless character
Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert
.into(collection, character, index, size))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_character(character, index = nil)\n return self unless character\n\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert\n .into(line, character, index, size))\n end",
"def insert_character(character)\n return self if character.is_a?(Symbol)\n\n... | [
"0.81417227",
"0.68893707",
"0.68169624",
"0.6811781",
"0.6556482",
"0.64879465",
"0.6456418",
"0.64364827",
"0.6368418",
"0.627979",
"0.627979",
"0.62780356",
"0.62682813",
"0.6233469",
"0.622108",
"0.6200869",
"0.61653554",
"0.61573774",
"0.61566377",
"0.61483425",
"0.61094... | 0.79030144 | 1 |
Given a string containing digits from 29 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. | def letter_combinations(digits)
map = "- - abc def ghi jkl mno pqrs tuv wxyz".split
charsets = digits.chars.map { |d| map[d.to_i].chars }
digits == "" ? [] : [''].product(*charsets).map(&:join)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_combinations(digits)\n dictionary = {\n '1' => [],\n '2' => ['a', 'b', 'c'],\n '3' => ['d', 'e', 'f'],\n '4' => ['g', 'h', 'i'],\n '5' => ['j', 'k', 'l'],\n '6' => ['m', 'n', 'o'],\n '7' => ['p', 'q', 'r', 's'],\n '8' => ['t', 'u', 'v'],\n ... | [
"0.75101686",
"0.70532066",
"0.6991677",
"0.68580794",
"0.6789314",
"0.66761273",
"0.647862",
"0.63912565",
"0.63720846",
"0.63053834",
"0.63027745",
"0.62978005",
"0.6269583",
"0.62526387",
"0.6237471",
"0.62358636",
"0.6178465",
"0.61221075",
"0.6112744",
"0.60967153",
"0.6... | 0.7655314 | 0 |
Given an array nums and a value val, remove all instances of that value inplace and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array inplace with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond the new le... | def remove_element(nums, val)
nums.each_with_index do |num, i|
if num == val
nums[i] = nil
end
end
nums.compact!
nums.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_element(nums, val)\n nums.delete(val)\n nums.length\nend",
"def remove_element(nums, val)\n return 0 if nums.empty? || (nums.size == 1 && nums[0] == val)\n start = 0\n nums.each_with_index do |num, index|\n if num != val\n nums[start] = num\n start += 1\n ... | [
"0.75248563",
"0.7453051",
"0.7308791",
"0.72617537",
"0.71683663",
"0.7139942",
"0.70382595",
"0.70364654",
"0.69365734",
"0.6657233",
"0.64814603",
"0.6362131",
"0.6325264",
"0.63187855",
"0.63075316",
"0.62714183",
"0.62675685",
"0.6225266",
"0.61950064",
"0.61876684",
"0.... | 0.7503756 | 1 |
When Car.new is called, this method is run Therefore, for this class, you must pass in 2 variables (make and model) when creating a new instance of it | def initialize(make, model)
@make = make
@model = model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(make, model) #these 2 - make, model - are parameters\n @wheels = 4\n @make = make\n @model = model\n end",
"def initialize (make, model, miles, type, color, year, used)\n\t\t@make = make\n\t\t@model = model\n\t\t@miles = miles\n\t\t@type = type\n\t\t@color = color\n\t\t@yea... | [
"0.7462219",
"0.74188995",
"0.7416475",
"0.7096926",
"0.7058828",
"0.699908",
"0.6884808",
"0.68580717",
"0.6783581",
"0.65512407",
"0.6504456",
"0.6503432",
"0.649938",
"0.64527065",
"0.64387816",
"0.64365804",
"0.64203185",
"0.63744015",
"0.6346392",
"0.63099277",
"0.627434... | 0.8067318 | 0 |
puppet version to use (env var) | def puppet_version
"PUPPET_VERSION=2.7.19"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_puppet_version\n version = nil\n installed = self.is_in_path?('puppet')\n\n if installed\n raw = self.run('puppet --version')\n version = raw.match(/([\\d\\.]*)\\s/) ? $1 : nil\n else\n version = nil\n end\n\n version\n end",
"def puppet_gem_version\n Gem::Version... | [
"0.77366716",
"0.75111145",
"0.7426613",
"0.6920203",
"0.68346065",
"0.68346065",
"0.67788976",
"0.6649844",
"0.66149205",
"0.6544868",
"0.6436166",
"0.64218706",
"0.6409458",
"0.63958323",
"0.6390239",
"0.63891894",
"0.6389179",
"0.6388214",
"0.6361351",
"0.63382107",
"0.632... | 0.7795586 | 0 |
TODO: Don't mark loans as realised if they have futher recoveries. | def realise_loans!
loan_ids = realised_recoveries.map {|recovery| recovery.loan.id }.uniq
Loan.find(loan_ids).each do |loan|
loan.realised_money_date = Date.today
loan.modified_by = creator
loan.update_state!(Loan::Realised, LoanEvent::RealiseMoney, creator)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lost?\n # Fill this in\n end",
"def lost?\n @life <=0\n end",
"def can_recover?\n self.lapsed? and not self.blacklisted\n end",
"def before_recover\n end",
"def after_recover\n end",
"def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @partie... | [
"0.61238754",
"0.586809",
"0.5839576",
"0.57865703",
"0.57289475",
"0.56945395",
"0.56651825",
"0.56275135",
"0.56142366",
"0.5609703",
"0.5602296",
"0.5602296",
"0.5572648",
"0.555517",
"0.55207175",
"0.55205977",
"0.55090857",
"0.54991937",
"0.5486099",
"0.5473138",
"0.5462... | 0.6668867 | 0 |
create a before hook that applies the received validator class to input. will abort request with validation error if invalid | def validate_input(validator_klass, options = {})
unless validator_klass.include?(ActiveModel::Validations)
raise ArgumentError, "validator class should be an ActiveModel::Validator"
end
before lambda { |_rack_env, env|
validator = validator_klass.new(env[:input])
validator.valid? || twir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_validation\n\n end",
"def _before_validation\n end",
"def pre_validation\n\n\n end",
"def valid_before; end",
"def validate(validator, *args); validation_chain.validate(validator, *args); end",
"def before_validation_callback\n end",
"def validate\n errors.clear\n self... | [
"0.66816926",
"0.66270715",
"0.6571829",
"0.6496052",
"0.6409451",
"0.63899034",
"0.6354531",
"0.6337416",
"0.6267571",
"0.62459946",
"0.6219813",
"0.60915405",
"0.60897195",
"0.6066178",
"0.6064134",
"0.6025313",
"0.6014526",
"0.5984107",
"0.5984107",
"0.5984107",
"0.5967430... | 0.7508325 | 0 |
used when constructing service to apply handler's configured service hooks | def configure_hooks(hook_type, service)
unless VALID_HOOKS.include?(hook_type)
raise ArgumentError, "unknown twirp hook type received: #{hook_type}"
end
existing_hooks = instance_variable_get("@#{hook_type}_hooks")
return if existing_hooks.nil?
existing_hooks.values.each do |hook|
serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def around_hooks; end",
"def initialize\n RESTRack::CONFIG[:SERVICE_NAME] = self.class.to_s.split('::')[0].to_sym\n @request_hook = RESTRack::Hooks.new if RESTRack.const_defined?(:Hooks)\n end",
"def setup_handler\n end",
"def InitializeHooks\n end",
"def initialize (service_name, applicatio... | [
"0.6502253",
"0.6396917",
"0.6394521",
"0.6332797",
"0.63215667",
"0.62992376",
"0.6215813",
"0.62039936",
"0.6109727",
"0.60925716",
"0.6084907",
"0.60590404",
"0.60432065",
"0.60090166",
"0.59969884",
"0.5986942",
"0.59840745",
"0.5965312",
"0.5955509",
"0.5950327",
"0.5939... | 0.64143836 | 1 |
creates a wrapped lambda for received hook config and registers it to hooks. method can be a Proc or name of instance or class method on the handler. options :if and :unless are respected here. | def define_hook(hooks, method, options)
hook_name = options[:name] || method
if hook_name.is_a?(Proc)
raise ArgumentError, "name option required when using proc for method"
end
hooks[hook_name] = lambda do |*args|
env = args.find { |arg| arg.is_a?(Hash) && arg.key?(:input) }
return if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hook_before_method(method, hook, opts = {})\n return false if method == hook\n _add_hooked_method(:before, hook, method)\n original = instance_method(method)\n @_defining_hook = true\n define_method(method) do |*args, &block|\n if opts[:send_args] || opts[:send_arg] || opts[:mo... | [
"0.5898352",
"0.58222187",
"0.5811574",
"0.5774951",
"0.5753875",
"0.5734096",
"0.5689229",
"0.5668453",
"0.56216305",
"0.5612948",
"0.5568042",
"0.5564686",
"0.55522984",
"0.5540169",
"0.55165267",
"0.54720986",
"0.5443501",
"0.54318047",
"0.5412243",
"0.5387317",
"0.5386871... | 0.7049262 | 0 |
add a single item to a set of item_ids to the matrix | def add_single(set_id, item_id, other_item_ids)
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item item\n @items << item\n @@all_items << item\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end",
"def add(item)\n self[... | [
"0.66346425",
"0.660644",
"0.65769356",
"0.6545511",
"0.63007885",
"0.6297965",
"0.62868166",
"0.62660927",
"0.6261452",
"0.62398696",
"0.621355",
"0.616932",
"0.61385965",
"0.612757",
"0.61253935",
"0.60932016",
"0.60859704",
"0.6074837",
"0.60625565",
"0.606239",
"0.6042797... | 0.6693372 | 0 |
calculate all similarities to other items in the matrix for item1 | def similarities_for(item1)
# return => [ ["item23", 0.6], ["item42", 0.23], (...) ]
raise "implemented in subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similarity_by_euclidean_for_items(item1, item2, list)\n common_users = find_common_users(item1, item2, list)\n \n result = 0.0\n return result if common_users.size < 1\n \n common_users.each do |u|\n result += (u.rating_for(item1.id) - u.rating_for(item2.id))*... | [
"0.71388024",
"0.6949338",
"0.6805654",
"0.6531122",
"0.631466",
"0.6265979",
"0.6025418",
"0.5986484",
"0.5955019",
"0.595329",
"0.5891528",
"0.5864645",
"0.58561486",
"0.58153576",
"0.57817435",
"0.5746806",
"0.5706811",
"0.5704644",
"0.5701195",
"0.5653002",
"0.5647565",
... | 0.73868406 | 0 |
embed video, calculates embed iframe by urls from various simple formats, but not accept iframe code | def parse_video
# standard
unless /\A\s*(?<width>\d+)x(?<height>\d+)\s+(?<url>.+)\z/ =~ content
env.warn 'can not parse \video content, should be "#{WIDTH}x#{HEIGHT} #{URL}"'
return
end
case url
when /youtu\.?be/
# NOTE merging them into one regexp fails (because l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_video\r\n\tvid_host = self.video_url.sub(/^https?\\:\\/\\//, '').sub(/^www./,'').split('/')[0]\r\n\tif vid_host == 'youtube.com' or vid_host == 'youtu.be'\r\n\t\tyoutube_embed(self.video_url)\r\n\telsif vid_host == 'player.vimeo.com' or vid_host == 'vimeo.com'\r\n\t\tvimeo_embed(self.video_url)\r\n\tend\... | [
"0.7036487",
"0.68915516",
"0.6817374",
"0.6730852",
"0.67027116",
"0.66616917",
"0.664561",
"0.6611145",
"0.66080594",
"0.65695906",
"0.6552747",
"0.65445626",
"0.64981824",
"0.6455144",
"0.6370712",
"0.6362068",
"0.6353784",
"0.63133764",
"0.6311673",
"0.6299641",
"0.629882... | 0.691994 | 1 |
Define a single reference into _pool_ from _data_ beginning at _start_ | def initialize(pool, data, start, name=nil)
super(name)
@tag = data.u1(start)
@enclosing_pool = pool
@first_index = data.u2(start+1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool; end",
"def pool; end",
"def initialize(pool, data, start, name=nil)\r\n super(pool, data, start, name)\r\n @size = 5\r\n\r\n @second_index = data.u2(start+3)\r\n end",
"def pool\n @pool.dup\n end",
"def pool \n @pool\n end",
"def redis_pool=(_arg0);... | [
"0.65071964",
"0.65071964",
"0.63829106",
"0.63288057",
"0.6131492",
"0.6096813",
"0.59680426",
"0.5910591",
"0.58648056",
"0.58329535",
"0.57922256",
"0.5724876",
"0.56921107",
"0.5683031",
"0.56414473",
"0.5563892",
"0.5551784",
"0.5540265",
"0.55348533",
"0.5520624",
"0.55... | 0.71042734 | 0 |
Get a reference _ref_ from the +enclosing_pool+ | def get(ref)
@enclosing_pool[ref].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool\n @pool.dup\n end",
"def weak_ref_value(o)\n if o && o.weakref_alive?\n o\n end\n end",
"def pool \n @pool\n end",
"def pool\n @pool\n end",
"def ref\n return self if @closed\n ::Libuv::Ext.ref(handle)\n self\n ... | [
"0.6327182",
"0.60461324",
"0.6011201",
"0.5982237",
"0.58152574",
"0.5814085",
"0.5759991",
"0.5725847",
"0.5711285",
"0.56558347",
"0.5642864",
"0.5624329",
"0.5615926",
"0.5596941",
"0.5596941",
"0.5551657",
"0.5545457",
"0.55419296",
"0.55370665",
"0.5534037",
"0.55324346... | 0.77133334 | 0 |
Returns all relationships that are manytoone for this model. Used to find the relationships that require properties in any Repository. Example: class Plur include DataMapper::Resource def self.default_repository_name :plur_db end repository(:plupp_db) do has 1, :plupp end end This resource has a manytoone to the Plupp ... | def many_to_one_relationships
relationships unless @relationships # needs to be initialized!
@relationships.values.collect do |rels| rels.values end.flatten.select do |relationship| relationship.child_model == self end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relationships\n model.relationships(repository.name)\n end",
"def relationships\n @relationships ||= Relationship.from_associations(self, associations)\n end",
"def relationships\n return [] if empty?\n\n map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, \"../#{pivo... | [
"0.7674651",
"0.66676754",
"0.63822305",
"0.63748515",
"0.6187852",
"0.613318",
"0.61046165",
"0.60388786",
"0.58650494",
"0.58530086",
"0.5817168",
"0.577327",
"0.57594293",
"0.57555413",
"0.5707714",
"0.5689091",
"0.5683943",
"0.56767297",
"0.56575596",
"0.56518126",
"0.565... | 0.68165123 | 1 |
POST /food_products POST /food_products.json | def create
@food_product = FoodProduct.new(food_product_params)
respond_to do |format|
if @food_product.save
format.html { redirect_to @food_product, notice: 'Food product was successfully created.' }
format.json { render :show, status: :created, location: @food_product }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @food_product = FoodProduct.new(food_product_params)\n\n respond_to do |format|\n if @food_product.save\n format.html { redirect_to @food_product, notice: \"Food product was successfully created.\" }\n format.json { render :show, status: :created, location: @food_product }\n ... | [
"0.7275234",
"0.7096893",
"0.6948125",
"0.6941118",
"0.6929887",
"0.6896571",
"0.68398184",
"0.68259233",
"0.68062246",
"0.6765456",
"0.67191714",
"0.6716081",
"0.6653273",
"0.6620721",
"0.66092646",
"0.6593801",
"0.65681094",
"0.6561806",
"0.6544878",
"0.65330684",
"0.650225... | 0.7284388 | 0 |
DELETE /food_products/1 DELETE /food_products/1.json | def destroy
@food_product.destroy
respond_to do |format|
format.html { redirect_to food_products_url, notice: 'Food product was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @food_product.destroy\n respond_to do |format|\n format.html { redirect_to food_products_url, notice: \"Food product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
... | [
"0.72047395",
"0.72025514",
"0.71572655",
"0.71572655",
"0.7142773",
"0.71215916",
"0.71050525",
"0.70933443",
"0.7082751",
"0.7052677",
"0.7011949",
"0.70056254",
"0.69896096",
"0.6960052",
"0.69495416",
"0.6920785",
"0.6920785",
"0.6920785",
"0.6913939",
"0.69056326",
"0.68... | 0.7205989 | 0 |
POST /components or /components.json | def create
@component = Component.new(component_params)
respond_to do |format|
if @component.save
format.html { redirect_to @component, notice: "Component was successfully created." }
format.json { render :show, status: :created, location: @component }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @component = service.components.new(component_params)\n\n if @component.save\n render json: @component, status: :created, location: @component\n else\n render json: @component.errors, status: :unprocessable_entity\n end\n end",
"def create\n flash[:notice] = 'The component ... | [
"0.7546477",
"0.66862917",
"0.6500564",
"0.6288414",
"0.6229747",
"0.6143371",
"0.6063302",
"0.6036099",
"0.60085887",
"0.59940445",
"0.598912",
"0.5938024",
"0.5937408",
"0.5909762",
"0.5889818",
"0.5868632",
"0.5840807",
"0.5839643",
"0.5777752",
"0.5724854",
"0.57138485",
... | 0.6787954 | 1 |
PATCH/PUT /components/1 or /components/1.json | def update
respond_to do |format|
if @component.update_attributes(component_params)
format.html { redirect_to @component, notice: "Component was successfully updated." }
format.json { render :show, status: :ok, location: @component }
else
format.html { render :edit, status: :unpr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @component = service.components.find_by!(slug: params[:id])\n\n if @component.update(component_params)\n head :no_content\n else\n render json: @component.errors, status: :unprocessable_entity\n end\n end",
"def update\n flash[:notice] = 'The component was successfully upda... | [
"0.72437364",
"0.6452081",
"0.64208704",
"0.64208704",
"0.64128953",
"0.6381774",
"0.62361735",
"0.6213064",
"0.62038606",
"0.62038606",
"0.6178921",
"0.6157307",
"0.61453146",
"0.6131692",
"0.60130215",
"0.6004166",
"0.5989117",
"0.5945427",
"0.5940296",
"0.59374315",
"0.593... | 0.6679688 | 1 |
Placeholder for ack received. You must override hsdq_request in your HsdqXxx class | def hsdq_ack(message, context); placeholder; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end",
"def ack(msg_info)\n end",
"def hsdq_send_ack(message)\n hsdq_send(message.merge(type: :ack))\n end",
"def req_ack(clk_e,req,ack,port)\n ... | [
"0.7028409",
"0.658635",
"0.65078974",
"0.63730556",
"0.63401514",
"0.63015056",
"0.6200988",
"0.6188497",
"0.61433804",
"0.61350363",
"0.6123512",
"0.60782903",
"0.6040169",
"0.5986932",
"0.59699655",
"0.59630936",
"0.59562784",
"0.59536606",
"0.5950276",
"0.592767",
"0.5919... | 0.7449846 | 0 |
Placeholder for callback received. You must override hsdq_request in your HsdqXxx class | def hsdq_callback(message, context); placeholder; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end",... | [
"0.6535027",
"0.64699954",
"0.6435503",
"0.6331204",
"0.6268352",
"0.62193644",
"0.6136512",
"0.5965365",
"0.59640306",
"0.59458804",
"0.591139",
"0.5845023",
"0.58422947",
"0.5837795",
"0.5830636",
"0.582171",
"0.5798763",
"0.5781419",
"0.5761212",
"0.5753158",
"0.5753158",
... | 0.7942339 | 0 |
Placeholder for feedback received. You must override hsdq_request in your HsdqXxx class | def hsdq_feedback(message, context); placeholder; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hsdq_callback(message, context); placeholder; end",
"def hsdq_send_feedback(message)\n hsdq_send(message.merge(type: :feedback))\n end",
"def hsdq_ack(message, context); placeholder; end",
"def hsdq_error(message, context); placeholder; end",
"def hsdq_send_request(message)\n hsdq_... | [
"0.67383987",
"0.6363598",
"0.6160989",
"0.59689695",
"0.595466",
"0.5917709",
"0.5901353",
"0.58158934",
"0.5809793",
"0.57807577",
"0.57217646",
"0.5672317",
"0.56591624",
"0.56588054",
"0.565498",
"0.56109685",
"0.55991304",
"0.5583421",
"0.5541239",
"0.549523",
"0.5431828... | 0.8023943 | 0 |
Placeholder for error received. You must override hsdq_request in your HsdqXxx class | def hsdq_error(message, context); placeholder; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error\n @error_response\n end",
"def connection_error(error, req, text = T.unsafe(nil)); end",
"def request_error( err_str )\n case err_str\n when \"MAINTENANCE COMPANY NOT SPECIFIED\"\n return \"יש לבחור חברת אחזקה\";\n else\n return translate( \"QUERY_E... | [
"0.6218071",
"0.62142265",
"0.61370933",
"0.61193824",
"0.6116165",
"0.6082611",
"0.60430026",
"0.6030907",
"0.60243493",
"0.60064536",
"0.60064536",
"0.60064536",
"0.60064536",
"0.60064536",
"0.60064536",
"0.60064536",
"0.59876335",
"0.59619504",
"0.5928889",
"0.59055",
"0.5... | 0.8026948 | 0 |
If there is no context this method is used instead of pull_burst | def pull_burst_only(burst_p)
[burst_p.call, nil]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_burst(burst_p, burst_context_p)\n cx_data.multi do\n burst_p.call\n burst_context_p.call\n end\n end",
"def get_burst(spark, _options={})\n # get the context parameters\n context_h = spark[:context]\n\n burst_p = -> { cx_data.hget hsdq_key(spark), burst_key(spar... | [
"0.6811905",
"0.557157",
"0.51338893",
"0.47984928",
"0.46801764",
"0.4668408",
"0.46215606",
"0.46159634",
"0.4613274",
"0.46123788",
"0.46123788",
"0.45138147",
"0.44802356",
"0.4468857",
"0.44554564",
"0.4449934",
"0.44464165",
"0.4433477",
"0.44118798",
"0.43884322",
"0.4... | 0.62543994 | 1 |
Call whitelisted? to verify the the topic and task are legit. | def check_whitelist(spark, options)
begin
whitelisted?(spark, options) ? true : (raise ArgumentError.new("Illegal argument in topic or task"))
rescue => e
reject_spark spark, e
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelisted?(spark, options)\n valid_topic?(spark, options) && valid_task?(spark, options)\n end",
"def whitelisted?(request)\n false\n end",
"def can_be_blacklisted?\n !self.blacklisted?\n end",
"def task_available\n return unless task\n\n validate_task_has_no_pending\n vali... | [
"0.65914893",
"0.6058476",
"0.60472053",
"0.6020961",
"0.5945337",
"0.58393544",
"0.5823831",
"0.57127124",
"0.5674508",
"0.56393725",
"0.56154907",
"0.56102693",
"0.5594485",
"0.5544983",
"0.5516038",
"0.55117995",
"0.5505832",
"0.54988116",
"0.5498231",
"0.5495662",
"0.5485... | 0.6660271 | 0 |
updating the locationerror and itemerror after deleting records from the upload screen | def update_errormaintenance
case self.upload_filename
when 'Location.csv'
location_error = Locationerror.destroy_all(uploadfile_id: self.id)
when 'Item.csv'
item_error = Itemerror.destroy_all(uploadfile_id: self.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reprocess\n ids = params[:id]\n errorExists = false\n ids.each do |id|\n itemerror = Itemerror.find(id.to_i)\n error = is_row_valid itemerror \n if error.blank?\n \n itemHash = {:client_id => itemerror.attribute1, \n :item_nu... | [
"0.63751537",
"0.58743423",
"0.5806554",
"0.57207894",
"0.569172",
"0.5683614",
"0.5657516",
"0.5617872",
"0.5604993",
"0.55403167",
"0.55263066",
"0.5513364",
"0.5510752",
"0.55032307",
"0.5493465",
"0.54803884",
"0.5459021",
"0.54234034",
"0.54214585",
"0.54098827",
"0.5398... | 0.72084194 | 0 |
def logger= Wrap SizedQueuepush with a timer metric. | def push(*args)
@metric_queue_write.time do
super(*args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_time_updates\n @log.debug(\"Pushing timelogs.\")\n @ob.static(:Timelog, :push_time_updates, {:oata => self})\n end",
"def queue_time\n NotImplementedError\n end",
"def send_timer_message(topic, tag, body, timer, key = '')\n @producer.send_timer_message(topic, tag, body, timer.t... | [
"0.60173494",
"0.5971506",
"0.5854686",
"0.58236337",
"0.5822852",
"0.5727988",
"0.57177424",
"0.56765884",
"0.56610304",
"0.56102896",
"0.5589174",
"0.55890787",
"0.5575735",
"0.5575735",
"0.5575735",
"0.5575735",
"0.55646974",
"0.5550715",
"0.5498783",
"0.5464265",
"0.54569... | 0.73045415 | 0 |
=begin rdoc Return level of nesting for this Scope. Note that this is recursive calling Parentnesting. =end | def nesting
@parent ? @parent.nesting + 1 : 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level\n case\n when root? then 0\n when depth_column_could_be_used? then depth\n when parent_association_loaded? then parent.level + 1\n # @todo move it adapters\n else ancestors.size\n end\n end",
"def level\n return 0 if root?\n\n @parent.level + 1\... | [
"0.75401276",
"0.75121593",
"0.74023145",
"0.7244222",
"0.72277987",
"0.7158171",
"0.7113225",
"0.7089794",
"0.70424134",
"0.6976919",
"0.6938359",
"0.69357014",
"0.6877372",
"0.6877372",
"0.6855419",
"0.6836558",
"0.6804442",
"0.6766529",
"0.67595685",
"0.6721652",
"0.671457... | 0.77564746 | 0 |
=begin rdoc Return list of symbols defined in this scope. If recurse is true, all child scopes are included as well. =end | def symbols(names_only=false, recurse=false)
symtab = recurse ? @children.map { |c| c.symbols(names_only, true)
}.flatten : []
names_only ? @symtab.keys.concat(symtab) : @symtab.values.concat(symtab)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbols() @symbols end",
"def symbols\n @symbol_set.symbols\n end",
"def namespaces(recurse=false)\n symbols(false, recurse).map { |s| s.namespace }.sort.uniq\n end",
"def get_symbols\n\t\treturn @symbols\n\tend",
"def scopes\n @scope.scopes\n end",
"def find_scopes\n beg... | [
"0.59482014",
"0.5947744",
"0.58883786",
"0.5883107",
"0.58507305",
"0.5771868",
"0.5759235",
"0.56927687",
"0.5626161",
"0.5608084",
"0.5599274",
"0.5589726",
"0.55891174",
"0.5549639",
"0.5541664",
"0.5518219",
"0.5476042",
"0.54557234",
"0.54118705",
"0.5394323",
"0.537701... | 0.68184316 | 0 |
=begin rdoc Return a list of all namespaces defined in this scope. If recurse is true, all child scopes are included as well. =end | def namespaces(recurse=false)
symbols(false, recurse).map { |s| s.namespace }.sort.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespaces\n root ? root.collect_namespaces : {}\n end",
"def namespaces(name = nil)\n find_children_of_type(\"Namespace\", name)\n end",
"def get_namespaces\n @paths.keys\n end",
"def namespaces\n root ? root.namespaces : {}\n end",
"def namespaces_list(trac... | [
"0.6608163",
"0.63307005",
"0.6328688",
"0.6302396",
"0.62484294",
"0.60767066",
"0.6074819",
"0.6070898",
"0.60553",
"0.59742683",
"0.5966621",
"0.596532",
"0.58927965",
"0.5837362",
"0.58171564",
"0.57937944",
"0.5710635",
"0.5691525",
"0.56797403",
"0.5676827",
"0.5676827"... | 0.77889705 | 0 |
=begin rdoc Return number of symbols defined in this scope. =end | def num_symbols
@symtab.keys.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size() @symbols.size end",
"def count\n @symbols.count\n end",
"def num_sym_assumptions()\n count = 0\n for hop in @hops\n count += 1 if hop.type == :sym or hop.type == \"sym\"\n end\n count\n end",
"def symbol_ref\n @symbols += 1\n end",
"def total_documented... | [
"0.80281717",
"0.7972307",
"0.66729957",
"0.6554171",
"0.65375775",
"0.64984596",
"0.64677846",
"0.6394975",
"0.6370103",
"0.6336157",
"0.6294522",
"0.6276931",
"0.61802554",
"0.6163487",
"0.6130694",
"0.6120605",
"0.6105579",
"0.60652995",
"0.60208327",
"0.60191417",
"0.5999... | 0.8217561 | 0 |
=begin rdoc Define a symbol for function 'name' at location 'value' in scope. =end | def define_func(name, value, namespace=nil)
define(CodeSymbol.new name, value, namespace)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(name, value)\n @symbols[to_name(name)] = value\n value.name = name if Function === value\n value\n end",
"def symfun name\n Symbolic.check_name name\n fs = SymbolicFunction.new(name)\n meta_def name do\n fs\n end\n fs\n end",
"def define_func... | [
"0.6376007",
"0.6342895",
"0.61895347",
"0.6139959",
"0.607645",
"0.59908056",
"0.59749603",
"0.59721446",
"0.5943563",
"0.59186906",
"0.5851679",
"0.582243",
"0.5819515",
"0.5779738",
"0.5768328",
"0.57683176",
"0.57570684",
"0.57507247",
"0.57507247",
"0.5733522",
"0.572135... | 0.7363207 | 0 |
=begin rdoc Resolve name to a Symbol object. This recurses to Parentresolve if necessary. =end | def resolve(name)
#FIXME: how to handle namespace
@symtab[name] || (parent ? parent.resolve(name) : nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve!(name)\n raise UnresolvedSymbol if not resolve(name) \n end",
"def resolve_symbol(resolver, sym, ctx)\n if found = find_symbol(sym.to_sym, ctx)\n resolve_lexically(resolver, found, ctx)\n found\n elsif dynamic = resolver.resolve_symbol(sym)\n dynamic\n else... | [
"0.75862575",
"0.6875471",
"0.6781045",
"0.6502915",
"0.64977247",
"0.6454168",
"0.6378003",
"0.6367195",
"0.63647264",
"0.6291669",
"0.6250075",
"0.6243137",
"0.61793715",
"0.6076152",
"0.6032398",
"0.601106",
"0.60109335",
"0.5996333",
"0.5954126",
"0.59341013",
"0.5931122"... | 0.7643453 | 0 |
=begin rdoc Resolve name to a Symbol object, raising an UnresolvedSymbol error if the symbol is not defined. This recurses to Parentresolve if necessary. =end | def resolve!(name)
raise UnresolvedSymbol if not resolve(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(name)\n #FIXME: how to handle namespace\n @symtab[name] || (parent ? parent.resolve(name) : nil)\n end",
"def resolve_symbol(resolver, sym, ctx)\n if found = find_symbol(sym.to_sym, ctx)\n resolve_lexically(resolver, found, ctx)\n found\n elsif dynamic = resolver.... | [
"0.7561216",
"0.7144447",
"0.6465142",
"0.6414068",
"0.6355232",
"0.6293653",
"0.6159137",
"0.6137376",
"0.6115174",
"0.60982543",
"0.60907495",
"0.60878026",
"0.60678154",
"0.6013621",
"0.60131776",
"0.6002441",
"0.5997742",
"0.59965545",
"0.5977611",
"0.59694564",
"0.592306... | 0.8311625 | 0 |
Using the Ruby language, have the function SymmetricTree(strArr) take the array of strings stored in strArr, which will represent a binary tree, and determine if the tree is symmetric (a mirror image of itself). The array will be implemented similar to how a binary heap is implemented, except the tree may not be comple... | def symmetric_tree(arr)
rows = Hash.new([])
n = 0
until arr.empty?
(2**n).times { rows[n] += [arr.shift] }
n += 1
end
rows.values.each do |row|
return false unless row == row.reverse
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isTreeSymmetric(t)\n return true if t.nil?\n return sym?(t.left, t.right)\nend",
"def is_symmetric(root)\n return true if root.nil?\n\n stack = []\n stack << root.left if root.left\n stack << root.right if root.right\n\n until stack.empty?\n return false unless stack.size.even?\n\n right = ... | [
"0.76344705",
"0.7289066",
"0.72687614",
"0.7133568",
"0.71197224",
"0.70306444",
"0.6889006",
"0.68572754",
"0.68020713",
"0.66402566",
"0.6397494",
"0.63641757",
"0.6351757",
"0.6246554",
"0.5997706",
"0.5786831",
"0.5756023",
"0.5700338",
"0.5629166",
"0.5627084",
"0.56096... | 0.78964055 | 0 |
GET /diningts GET /diningts.json | def index
@diningts = Diningt.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dices = Dice.all\n\n render json: @dices\n end",
"def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n en... | [
"0.62330526",
"0.6204509",
"0.6182461",
"0.6148789",
"0.61273634",
"0.60521287",
"0.60411656",
"0.59897697",
"0.5979209",
"0.59673804",
"0.5957402",
"0.59309524",
"0.59278667",
"0.58980876",
"0.5897708",
"0.58862567",
"0.58832157",
"0.5840625",
"0.58361256",
"0.5822054",
"0.5... | 0.64167345 | 0 |
POST /diningts POST /diningts.json | def create
@diningt = Diningt.new(diningt_params)
respond_to do |format|
if @diningt.save
format.html { redirect_to @diningt, notice: 'Diningt was successfully created.' }
format.json { render :show, status: :created, location: @diningt }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def ... | [
"0.5908641",
"0.58811843",
"0.57162154",
"0.56615084",
"0.56588924",
"0.5652193",
"0.5630965",
"0.5581175",
"0.5578508",
"0.5555963",
"0.5536668",
"0.5527933",
"0.55238193",
"0.54983556",
"0.5497054",
"0.5462751",
"0.5457966",
"0.54449415",
"0.54132146",
"0.54127806",
"0.5405... | 0.6290197 | 0 |
choose the correct book layout | def books_layout
if params[:action] == 'show'
'reading'
elsif params[:action] == 'edit' || params[:action] == 'new'
'writing'
else
'application'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def book_pages\n\t\t@book = {\n\t\t\t\t\"sketch\" =>\n\t\t\t\t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| ----- |\n\t\t\t\t| / _ \\\\ |\n\t\t\t\t| / | | \\\... | [
"0.61108327",
"0.5933449",
"0.57440704",
"0.570697",
"0.56774646",
"0.56319666",
"0.5630188",
"0.56156915",
"0.560078",
"0.55663633",
"0.5564099",
"0.5556548",
"0.5556548",
"0.5526127",
"0.5516367",
"0.55161184",
"0.55047596",
"0.54790866",
"0.54705864",
"0.54630667",
"0.5447... | 0.6880656 | 0 |
The ShareThis widget defines a bunch of attributes you can customize. Facebook seems to ignore them (it uses title and description meta tags instead). MySpace, however, only works if you set these attributes. | def sharethis_options(post)
content_tag :script, :type=>"text/javascript" do
<<-eos
SHARETHIS.addEntry({
title:'#{escape_javascript(post.title)}',
content:'#{escape_javascript(truncate_words(post.post, 75, '...' ))}'
}, {button:true});
eos
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_button(options={})\n %(\n <fb:share-button class=\"meta\">\n #{SHARE_META_OPTIONS.select {|o| options.keys.include?(o) }.collect {|o| %(<meta name=\"#{o}\" content=\"#{options[o]}\" />)}.join(\"\\n\") }\n #{SHARE_LINK_OPTIONS.select {|o| options.keys.include?(o) }.collect {|o| %(<... | [
"0.6164924",
"0.5774608",
"0.5755568",
"0.5733232",
"0.572383",
"0.5587251",
"0.5515964",
"0.54684615",
"0.5434264",
"0.54263157",
"0.54180944",
"0.537928",
"0.5374398",
"0.5374354",
"0.53705394",
"0.5350056",
"0.53472424",
"0.5346767",
"0.5313958",
"0.5299231",
"0.52656925",... | 0.6146092 | 1 |
builds up a template header with given informatations | def buildup_template_header(basename, hash)
header = []
type = hash[:type] || :script
header << filename_for(basename, type)
header << ""
description = hash[:description] || "no description"
header << teardown_to_oneline(description)
header << ""
date = hash[:date] || Tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_header(keys_template)\n header = ''\n names = []\n keys = deep_copy(keys_template)\n\n keys.each { |key|\n begin\n if @config.header_mappings.any? { |k| k.include? key }\n\n header_label = key\n\n @config.header_mappings.each { |k, v|\n if header_label... | [
"0.7156262",
"0.67640334",
"0.67077214",
"0.6619542",
"0.6611294",
"0.64873326",
"0.6458695",
"0.6441575",
"0.64270765",
"0.64014536",
"0.6365368",
"0.6335823",
"0.63165736",
"0.62995416",
"0.62925225",
"0.62826335",
"0.62714285",
"0.62425524",
"0.6222881",
"0.61947244",
"0.6... | 0.73268914 | 0 |
Generate initial map that only consist of wall | def generate_initial_map
for _ in 0...@height
temp = []
for _ in 0...@width
temp.push(@WALL)
end
@map.push(temp)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_map\n map = make_random_map\n map = add_borders(map)\n map = ensure_adjacent_rooms(map)\nend",
"def generate(north_west_corner,south_east_corner)\n\t\tn_y,n_x=north_west_corner.position\n\t\ts_y,s_x=south_east_corner.position\n\t\tsplit_point=Point.new(rand(n_y+2..s_y-2),rand(n_x+2..s_x-2),'wall'... | [
"0.76886547",
"0.6959513",
"0.69321233",
"0.6839378",
"0.6772527",
"0.67149854",
"0.6600952",
"0.6551186",
"0.6462697",
"0.6415269",
"0.63727856",
"0.63697803",
"0.6306374",
"0.6298288",
"0.6279866",
"0.627709",
"0.6257782",
"0.6238615",
"0.6180258",
"0.6159204",
"0.6156977",... | 0.8666017 | 0 |
Clear unnecessary wall tht only have < 2 surrounding wall | def clear_small_wall
for row_i in 1...@height - 1
for column_i in 1...@width - 1
total_wall = count_adjacent_wall(row_i, column_i)
if @map[row_i][column_i] == @WALL
if total_wall < 2
@map[row_i][column_i] = @FLOOR
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_extra_walls\n a_count_number = $cells.length/2/5\n while a_count_number > 0 do\n cell_index = rand(0..$cells.length/2)\n remove_walls($cells[cell_index], $cells[cell_index+1])\n a_count_number -= 1\n end\n end",
"def input_remove_wall2\n # The mouse needs to b... | [
"0.732075",
"0.69721377",
"0.69222367",
"0.68305147",
"0.6526889",
"0.64435136",
"0.6385868",
"0.6376257",
"0.63558066",
"0.63275766",
"0.6321259",
"0.62610716",
"0.6236823",
"0.6193693",
"0.6174106",
"0.61476016",
"0.6131723",
"0.6089886",
"0.6089272",
"0.60892004",
"0.60845... | 0.80407876 | 0 |
Put user on given coordinate | def put_user(coord)
x_position = coord[0]
y_position = coord[1]
if !((0 < x_position && x_position < @width - 1) && (0 < y_position && y_position < @height - 1))
raise RangeError.new("User coordinate out of map size bound")
end
for row in [-1, 0, 1]
for co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end",
"def place_at(x, y)\n\t\t@x = x\n\t\t@y = y\n\t\tcoords\n\tend",
"def at(*coordinates)\n position.coordinates = coordinates\n end",
"def update\n ... | [
"0.65855575",
"0.6493982",
"0.6444826",
"0.639282",
"0.63071984",
"0.62104",
"0.6171253",
"0.6163389",
"0.61334705",
"0.61031675",
"0.6080396",
"0.6057807",
"0.6008821",
"0.59542906",
"0.593535",
"0.589696",
"0.58684963",
"0.5863087",
"0.5862918",
"0.58574045",
"0.58562094",
... | 0.75476843 | 0 |
Joining the cave rooms | def join_rooms
all_caves = populate_caves
for cave in all_caves.keys()
join_points(all_caves[cave][0])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_room(id)\n @rooms.join id\n end",
"def join\n payload = { \"id\" => id }.to_json\n data = client.post \"#{api_prefix}/user/#{client.user.id}/rooms\", payload\n\n self\n end",
"def room\n end",
"def join\n @room = OnlineMeetingRoom.find_by_id(params[:id])\n ... | [
"0.6929115",
"0.65493333",
"0.6470753",
"0.6353431",
"0.629946",
"0.6285749",
"0.62440854",
"0.6226542",
"0.6131227",
"0.6118975",
"0.61099356",
"0.59364444",
"0.5933658",
"0.59272385",
"0.5920061",
"0.589729",
"0.5849205",
"0.5842395",
"0.5831786",
"0.57516813",
"0.5740848",... | 0.7822134 | 0 |
Find the nearest path to user from the given coordinate It will return the shortest path to the user | def shortest_path_to_user(start_coord)
queue = Queue.new
queue << [start_coord]
seen = Set.new([start_coord])
while queue
begin
path = queue.pop(non_block = true)
rescue ThreadError
return nil
end
x, y = path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_step_to_shortest_path(from_x, from_y, to_x, to_y)\n move = shortest_path(from_x, from_y, to_x, to_y)&.first\n return nil unless move\n if move[0] == from_x && move[1] == from_y + 1\n return 'S'\n elsif move[0] == from_x && move[1] == from_y - 1\n return 'N'\n elsif move[0] == from... | [
"0.7033883",
"0.6896861",
"0.68080926",
"0.66212493",
"0.6564974",
"0.65628564",
"0.65618485",
"0.64153",
"0.64108837",
"0.63817585",
"0.6262553",
"0.6261021",
"0.6248313",
"0.6236319",
"0.6222654",
"0.6213536",
"0.6202141",
"0.62017614",
"0.6198533",
"0.61870044",
"0.6156369... | 0.7334569 | 0 |
Find the nearest driver from given coordinate It will return a hash about the nearest driver coordinate, driver object, and the shortest route to the driver | def nearest_driver(coord_from)
queue = Queue.new
queue << [coord_from]
seen = Set.new([coord_from])
while queue
begin
path = queue.pop(non_block = true)
rescue ThreadError
return nil
end
x, y = path[-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearest_driver(map,user)\n driver_pos=[]\n\n for i in 0..map.length-1\n for j in 0..map.length-1\n if map[i][j] == \" D \"\n driver_pos << [i,j]\n end\n end\n end\n @driver_pos=driver_pos\n\n nearest_driver_position = driver_pos[0]\n distance = driver_pos[0].z... | [
"0.6496551",
"0.6214725",
"0.59901685",
"0.5965178",
"0.5848656",
"0.58154273",
"0.56944966",
"0.5630501",
"0.55432105",
"0.55432105",
"0.55278695",
"0.5414297",
"0.5389519",
"0.53645104",
"0.5308795",
"0.5308255",
"0.5300886",
"0.5296709",
"0.52879435",
"0.5269035",
"0.52503... | 0.77339447 | 0 |
Put an object randomly on map floor | def put_random(object)
while true
random_row = rand(1...@height - 1)
random_column = rand(1...@width - 1)
if @map[random_row][random_column] == @FLOOR
@map[random_row][random_column] = object
return [random_column, random_row]
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_oject_randomly(object)\n while is_wall?(object.location)\n object.location_x = 1 + rand(width - 1)\n\n object.location_y = 1 + rand(height - 1)\n end\n\n objects << object\n end",
"def create_random_world\n randomize_terrain\n randomize_entities\n end",
"def rand_location\n... | [
"0.77853715",
"0.71777976",
"0.6342371",
"0.6325588",
"0.6325415",
"0.62598896",
"0.6256992",
"0.62299323",
"0.6205703",
"0.6198474",
"0.615919",
"0.6149883",
"0.6089877",
"0.6063938",
"0.6052327",
"0.60449165",
"0.6035289",
"0.60232246",
"0.60132855",
"0.60106415",
"0.600774... | 0.77610946 | 1 |
Delete driver from the map | def delete_driver(driver_coord)
@drivers.delete_if do |driver|
driver["coord"] == driver_coord
end
x, y = driver_coord
@map[y][x] = @FLOOR
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mind_map.destroy\n end",
"def destroy\n\t\t\t\trespond_with Driver.destroy(params[:id])\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def delete_maps\n own_maps.each do | map |\n ... | [
"0.6448386",
"0.64195776",
"0.61932623",
"0.61932623",
"0.60951954",
"0.6063446",
"0.6034535",
"0.60285723",
"0.60175073",
"0.6015528",
"0.600267",
"0.59961265",
"0.598021",
"0.59604883",
"0.59193075",
"0.58729386",
"0.58729386",
"0.58729386",
"0.5870536",
"0.5807259",
"0.579... | 0.74614185 | 0 |
Omniauth callback handler when using force_authentication | def auth_callback
current_user
omniauth_origin = session[:omniauth_origin]
session.delete(:omniauth_origin)
redirect_to omniauth_origin || '/'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.n... | [
"0.7225204",
"0.70925313",
"0.7067971",
"0.70650685",
"0.7060526",
"0.7015651",
"0.6954364",
"0.69541097",
"0.693902",
"0.6821414",
"0.6720906",
"0.6704461",
"0.6691844",
"0.66876256",
"0.6672339",
"0.6670314",
"0.66494757",
"0.66198695",
"0.6615188",
"0.6559628",
"0.6507348"... | 0.72212446 | 1 |
Extract omniauth credentials from the request environment | def omniauth_credentials
if omniauth_hash = request.env['omniauth.auth']
{
provider: omniauth_hash['provider'],
uid: omniauth_hash['uid'],
email: omniauth_hash['info']['email'],
name: omniauth_hash['info']['name'],
}
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n... | [
"0.7366053",
"0.7366053",
"0.7366053",
"0.7366053",
"0.7366053",
"0.7366053",
"0.73515856",
"0.7265247",
"0.71680605",
"0.7126297",
"0.7126297",
"0.7086515",
"0.70861953",
"0.70861953",
"0.7060423",
"0.69462854",
"0.6922967",
"0.6922967",
"0.6918792",
"0.6902276",
"0.6902276"... | 0.7681923 | 0 |
Load Erector library if not already loaded. | def require_engine
return if defined? ::Erector
require_library 'erector'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_engine\n return if defined? ::Erubius\n require_library('erubis')\n end",
"def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end",
"def load_libs; end",
"def set_up_libraries\n R.eval <<-EOR\n suppressMessages(library(R... | [
"0.5841934",
"0.5740633",
"0.5573599",
"0.5430756",
"0.52505094",
"0.52422917",
"0.5194662",
"0.51029646",
"0.50986636",
"0.5083197",
"0.5039686",
"0.501193",
"0.5003072",
"0.49959105",
"0.49949673",
"0.49933836",
"0.49916852",
"0.4976375",
"0.49466842",
"0.4939017",
"0.49390... | 0.71635115 | 0 |
Return user answer for a multichoice question as a label (a, b, c, etc.) | def answerLabel(question)
if question.input.is_a? org.concord.otrunk.ui.OTChoice
return choiceLabel(question.input, currentChoice(question.input))
else
return questionAnswer(question)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answerLabel(question) \n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n \treturn choiceLabel(question.input, question.input.currentChoice)\n else\n \treturn questionAnswer(question)\n end\nend",
"def answer_humanized\n I18n.t(yes_no ? 'answer.yes' : 'answer.no')\n end",
"def quiz_answer(... | [
"0.7392411",
"0.7106858",
"0.6932624",
"0.6832072",
"0.6832072",
"0.6797069",
"0.6797069",
"0.6786185",
"0.67309624",
"0.6581796",
"0.6561078",
"0.6543467",
"0.6503193",
"0.6447206",
"0.6398252",
"0.6356411",
"0.6338861",
"0.6326042",
"0.62931013",
"0.6218933",
"0.62185794",
... | 0.7352631 | 1 |
Go through the IMAP server and checks for new neurons to be added | def checkbrainmailbox
#Check if token is present
logger.info params["token"]
if APP_CONFIG['token_action'].to_s == params["token"]
#Start the actual work
imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)
imap.authenticate('LOGIN', A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_new_noti\n Settings.Repos.each do |repo|\n notis = @git_client.repository_events(repo.url)\n next if notis.empty?\n\n puts \"New Notification in #{repo.display_name}\"\n\n notis.each do |noti|\n event = launcher.git_client.get(noti.subject.latest_comment_url)\n next u... | [
"0.5470487",
"0.53915864",
"0.5303326",
"0.5292831",
"0.52482986",
"0.51993287",
"0.5161401",
"0.5074733",
"0.5057677",
"0.50561756",
"0.50456345",
"0.50015026",
"0.49745363",
"0.4970481",
"0.49572054",
"0.49408963",
"0.4931937",
"0.49265385",
"0.49256727",
"0.49048698",
"0.4... | 0.58153826 | 0 |
GET /corpora/1 GET /corpora/1.json | def show
@corpus = Corpus.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @corpus }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @corps = Corp.all\n end",
"def index\n @corps = Corp.all\n end",
"def index\n @corporacions = Corporacion.all\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def show\n @corporation = Corporation.find(params[:... | [
"0.63682646",
"0.63682646",
"0.6187487",
"0.6061551",
"0.6040779",
"0.5997402",
"0.5980911",
"0.59593886",
"0.5917118",
"0.58336353",
"0.58187544",
"0.5816938",
"0.57974803",
"0.57595223",
"0.5748102",
"0.5740932",
"0.5708466",
"0.5701271",
"0.56954104",
"0.5657736",
"0.56491... | 0.64728695 | 0 |
GET /corpora/new GET /corpora/new.json | def new
@corpus = Corpus.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @corpus }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @corporation = Corporation.new\n @page_header = \"Добавление новой Корпорации\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation }\n end\n end",
"def create\n @corp = Corp.new(corp_params)\n\n respond_to do |format|\n if... | [
"0.73843336",
"0.6983767",
"0.6911128",
"0.69019794",
"0.68982935",
"0.6896339",
"0.6708909",
"0.67025316",
"0.6695764",
"0.6655364",
"0.665283",
"0.665283",
"0.66286016",
"0.66286016",
"0.66286016",
"0.66286016",
"0.66286016",
"0.66286016",
"0.66286016",
"0.66286016",
"0.662... | 0.72877485 | 1 |
DELETE /corpora/1 DELETE /corpora/1.json | def destroy
@corpus = Corpus.find(params[:id])
@corpus.destroy
respond_to do |format|
format.html { redirect_to corpora_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @corp.destroy\n respond_to do |format|\n format.html { redirect_to corps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @corporation = Corporation.find(params[:id])\n @corporation.destroy\n\n respond_to do |format|\n format.html { redirect_to... | [
"0.7190633",
"0.70271176",
"0.69689596",
"0.69452494",
"0.6680206",
"0.66241443",
"0.65317476",
"0.64834005",
"0.6455675",
"0.6441667",
"0.6404749",
"0.6391204",
"0.6389134",
"0.6384927",
"0.6384014",
"0.6383476",
"0.6383429",
"0.6368701",
"0.6366622",
"0.63661397",
"0.636000... | 0.7091533 | 1 |
param row is the row of the center block param col is the column of the center block return the Block array that represents the rotated Tetromino | def getRotatedBlocks(row, col)
return [
Block.new(row, col),
Block.new(row + 1, col),
Block.new(row, col + 1),
Block.new(row - 1, col + 1)
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUnrotatedBlocks(row, col)\n return [\n Block.new(row, col),\n Block.new(row + 1, col),\n Block.new(row + 1, col + 1),\n Block.new(row, col - 1)\n ]\n end",
"def getOrientation(row, col)\n case (@orientation_index)\n when 0\n return [\n Block.new(row, col),\n ... | [
"0.708242",
"0.68828505",
"0.63537157",
"0.63379335",
"0.6247654",
"0.6221967",
"0.61549836",
"0.61509883",
"0.61347663",
"0.613227",
"0.61099595",
"0.60264665",
"0.6019819",
"0.59984267",
"0.5970503",
"0.5955721",
"0.5879156",
"0.58720636",
"0.5844844",
"0.58140105",
"0.5813... | 0.75202084 | 0 |
param row is the row of the center block param col is the column of the center block return the Block array that represents the unrotated Tetromino | def getUnrotatedBlocks(row, col)
return [
Block.new(row, col),
Block.new(row + 1, col),
Block.new(row + 1, col + 1),
Block.new(row, col - 1)
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRotatedBlocks(row, col)\n return [\n Block.new(row, col),\n Block.new(row + 1, col),\n Block.new(row, col + 1),\n Block.new(row - 1, col + 1)\n ]\n end",
"def getOrientation(row, col)\n case (@orientation_index)\n when 0\n return [\n Block.new(row, col),\n ... | [
"0.73055553",
"0.66456926",
"0.5919547",
"0.5773488",
"0.5728293",
"0.5726664",
"0.5687911",
"0.5665346",
"0.56508815",
"0.560746",
"0.56044793",
"0.5598201",
"0.55916965",
"0.5584476",
"0.5560859",
"0.5537131",
"0.5534976",
"0.5510539",
"0.5491537",
"0.54808533",
"0.54772776... | 0.7448116 | 0 |
Called to remove the +fd+ from the poller and delete any callbacks | def deregister(fd:)
delete_from_selector(fd: fd)
delete_callbacks(fd: fd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_handler_remove\n rl_callback_handler_remove\n @rl_callback_handler = nil\n end",
"def delete_from_selector(fd:)\n register(\n fd: fd,\n request: nil,\n filter: Constants::EVFILT_READ,\n flags: Constants::EV_DELETE\n )\n\n register... | [
"0.65609103",
"0.65216446",
"0.6316601",
"0.61804414",
"0.61397696",
"0.60827285",
"0.6033023",
"0.5963925",
"0.58836204",
"0.5881828",
"0.58782107",
"0.5863964",
"0.58273953",
"0.5819471",
"0.5809038",
"0.5796241",
"0.57951945",
"0.5778471",
"0.57656646",
"0.57610416",
"0.57... | 0.75666076 | 0 |
GET /inputs GET /inputs.json | def index
@inputs = Input.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @inputs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end",
"def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")\n end",
"def index\n extras = ActiveModel::Type::Boolean.new.cast(params[:include_extras])\n\n render json: InputSerializer.collection(\n Inp... | [
"0.7268673",
"0.71775204",
"0.6979958",
"0.6778529",
"0.67656505",
"0.67656505",
"0.67656505",
"0.6466062",
"0.63928616",
"0.61085516",
"0.61053497",
"0.60878766",
"0.6046454",
"0.6024347",
"0.601983",
"0.59806585",
"0.597283",
"0.5961404",
"0.5907694",
"0.58553725",
"0.58506... | 0.7307782 | 0 |
GET /inputs/new GET /inputs/new.json | def new
@input = Input.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @input }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @input = Input.new params[:input]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @input }\n end\n end",
"def new\n @mathematical_model_input = MathematicalModelInput.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.69438607",
"0.6797679",
"0.66080827",
"0.65670073",
"0.6530532",
"0.6480315",
"0.6480315",
"0.6480315",
"0.6480315",
"0.6480315",
"0.64662695",
"0.6349722",
"0.6348676",
"0.63486654",
"0.6338843",
"0.63232005",
"0.6322248",
"0.63023686",
"0.63023686",
"0.63023686",
"0.6288... | 0.7644047 | 0 |
DELETE /inputs/1 DELETE /inputs/1.json | def destroy
@input = Input.find(params[:id])
@input.destroy
respond_to do |format|
format.html { redirect_to inputs_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @input.destroy\n respond_to do |format|\n format.html { redirect_to inputs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.html { redirect_to(inputs_url) }\n... | [
"0.7309403",
"0.70451075",
"0.6997988",
"0.6997988",
"0.6997988",
"0.6887394",
"0.65374714",
"0.652305",
"0.65057194",
"0.6461966",
"0.6441626",
"0.640747",
"0.64021426",
"0.63745564",
"0.63741076",
"0.6368931",
"0.6332445",
"0.6304461",
"0.6283431",
"0.6283336",
"0.62789583"... | 0.737331 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.