query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Update properties of this object | def update!(**args)
@debug_name = args[:debug_name] if args.key?(:debug_name)
@kg_id = args[:kg_id] if args.key?(:kg_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@confidence = args[:confidence] if args.key?(:confidence)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012568",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.67404634",
"0.6709981",
"0.6709981",
"0.66964126",
"0.66964126",
"0.66964126",
"0.66964126",
"0.6619218",
"0.6570895",
"0.6539287",
"0.6517026",
"0.63946927",
"0.63901657",
"0.63901657",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@confidence = args[:confidence] if args.key?(:confidence)
@contexts = args[:contexts] if args.key?(:contexts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@confidence = args[:confidence] if args.key?(:confidence)
@contexts = args[:contexts] if args.key?(:contexts)
@topicality_score = args[:topicality_score] if args.key?(:topicality_score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@subject = args[:subject] if args.key?(:subject)
@type = args[:type] if args.key?(:type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@is_redundant = args[:is_redundant] if args.key?(:is_redundant)
@score = args[:score] if args.key?(:score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012568",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.67404634",
"0.6709981",
"0.6709981",
"0.66964126",
"0.66964126",
"0.66964126",
"0.66964126",
"0.6619218",
"0.6570895",
"0.6539287",
"0.6517026",
"0.63946927",
"0.63901657",
"0.63901657",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@family_safe_v1_score = args[:family_safe_v1_score] if args.key?(:family_safe_v1_score)
@mild_hate_harass_v1_score = args[:mild_hate_harass_v1_score] if args.key?(:mild_hate_harass_v1_score)
@mild_hate_harass_v2_score = args[:mild_hate_harass_v2_score] if args.key?(:mild_hate_harass_v2_score)
@model_scores = args[:model_scores] if args.key?(:model_scores)
@severe_hate_harass_v1_score = args[:severe_hate_harass_v1_score] if args.key?(:severe_hate_harass_v1_score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@classifier = args[:classifier] if args.key?(:classifier)
@model = args[:model] if args.key?(:model)
@score = args[:score] if args.key?(:score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
GET /next_steps/1 GET /next_steps/1.json | def show
@next_step = NextStep.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @next_step }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @next_steps = NextStep.all\n end",
"def new\n @next_step = NextStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @next_step }\n end\n end",
"def next\n lesson.steps.where(\"id > ?\", id).first\n end",
"def create\n @next_s... | [
"0.72209376",
"0.7204593",
"0.70125777",
"0.68550575",
"0.6807475",
"0.6789787",
"0.67294616",
"0.6563896",
"0.6504906",
"0.6435558",
"0.6370497",
"0.63663703",
"0.6289836",
"0.6289836",
"0.6289836",
"0.62815815",
"0.62797683",
"0.62682706",
"0.62659305",
"0.62606466",
"0.624... | 0.7322935 | 0 |
GET /next_steps/new GET /next_steps/new.json | def new
@next_step = NextStep.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @next_step }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end",
"def new\n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end",... | [
"0.80434316",
"0.78671676",
"0.78147703",
"0.7738996",
"0.75183713",
"0.7453568",
"0.74037206",
"0.7380192",
"0.72851354",
"0.7264663",
"0.7254498",
"0.71271",
"0.71259516",
"0.71006644",
"0.6981884",
"0.6963919",
"0.6963136",
"0.69616574",
"0.6959748",
"0.691943",
"0.6872429... | 0.84220564 | 0 |
POST /next_steps POST /next_steps.json | def create
@next_step = NextStep.new(params[:next_step])
respond_to do |format|
if @next_step.save
format.html { redirect_to :back, notice: 'Next step was successfully created.' }
format.json { render json: @next_step, status: :created, location: @next_step }
else
format.html { render action: "new" }
format.json { render json: @next_step.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @next_step = NextStep.new(next_step_params)\n\n respond_to do |format|\n if @next_step.save\n format.html { redirect_to @next_step, notice: 'Next step was successfully created.' }\n format.json { render :show, status: :created, location: @next_step }\n else\n forma... | [
"0.76629436",
"0.68641573",
"0.6859643",
"0.6521011",
"0.6511051",
"0.650551",
"0.6499436",
"0.6479451",
"0.64515024",
"0.6369089",
"0.6356702",
"0.63350827",
"0.62834764",
"0.6281527",
"0.62502885",
"0.6211652",
"0.6203689",
"0.6199082",
"0.6124946",
"0.61022395",
"0.6099911... | 0.76334774 | 1 |
PUT /next_steps/1 PUT /next_steps/1.json | def update
@next_step = NextStep.find(params[:id])
respond_to do |format|
if @next_step.update_attributes(params[:next_step])
format.html { redirect_to :back, notice: 'Next step was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @next_step.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @next_step.update(next_step_params)\n format.html { redirect_to @next_step, notice: 'Next step was successfully updated.' }\n format.json { render :show, status: :ok, location: @next_step }\n else\n format.html { render :edit }\n for... | [
"0.7438796",
"0.7019576",
"0.6864578",
"0.6777728",
"0.6752029",
"0.67349803",
"0.6685593",
"0.66482747",
"0.6630209",
"0.6536631",
"0.65266085",
"0.6514461",
"0.64758193",
"0.6405493",
"0.6405493",
"0.638757",
"0.63719636",
"0.63457733",
"0.6272581",
"0.6226771",
"0.6226402"... | 0.75372356 | 0 |
DELETE /next_steps/1 DELETE /next_steps/1.json | def destroy
@next_step = NextStep.find(params[:id])
@next_step.destroy
respond_to do |format|
format.html { redirect_to next_steps_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @next_step.destroy\n respond_to do |format|\n format.html { redirect_to next_steps_url, notice: 'Next step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |fo... | [
"0.75748545",
"0.740388",
"0.73916805",
"0.73252904",
"0.7290736",
"0.72196895",
"0.7148557",
"0.7133352",
"0.7092498",
"0.7079621",
"0.7079621",
"0.7079621",
"0.7079621",
"0.7030582",
"0.6995174",
"0.6988697",
"0.6971101",
"0.6967595",
"0.6943885",
"0.6940216",
"0.69275445",... | 0.77682877 | 0 |
Case Status Report Frequency Once a week Monday Contents SUID/participant ID Address (broken out into separate fields for Address 1, Address 2, City, State and zip) Phone Number Person Name (broken out into separate fields for First and Last) Date and Time of the next scheduled call attempt Date and Time of last call attempt Last Call Outcome PPG Status Instrument that is to be completed next Language we need to call in if other than English Use Used to monitor weekly flow of cases. | def case_status
default_start_date = Date.today.to_s(:db)
default_end_date = 1.week.from_now.to_date.to_s(:db)
@start_date = params[:start_date] || default_start_date
@end_date = params[:end_date] || default_end_date
if request.post?
@outfile = "case_status_report_" + Time.now.strftime("%m-%d-%Y") + ".csv"
reporter = Reports::CaseStatusReport.new(psc,
{ :start_date => @start_date, :end_date => @end_date })
csv_data = reporter.generate_report
send_data csv_data,
:type => 'text/csv; charset=iso-8859-1; header=present',
:disposition => "attachment; filename=#{@outfile}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_time_information\n ### Time information\n mark_data_time_information = Array.new\n time_information = @case_details[:case][:system][:time]\n\n mark_data_time_information << 'Answer the following about each time period present in the evidence on the system'\n time_information.each do | ke... | [
"0.5324751",
"0.53123075",
"0.5027633",
"0.4983081",
"0.49744433",
"0.49669695",
"0.49107087",
"0.49097863",
"0.48685127",
"0.4858023",
"0.48549214",
"0.48517293",
"0.4825797",
"0.482297",
"0.48208827",
"0.48044285",
"0.47995394",
"0.47929272",
"0.47925192",
"0.47916448",
"0.... | 0.49806505 | 4 |
Returns all the participants known to have a birth in the future | def upcoming_births
@pregnant_participants = Participant.upcoming_births.select { |participant| participant.known_to_be_pregnant? }.sort_by { |e| e.due_date.to_s }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def born_on_this_day_biographies\n @born_on_this_day ||= begin\n query_date = Date.today\n\n IntervieweeBiography.\n references(oral_history_content: :work).\n where(\"interviewee_biographies.json_attributes -> 'birth' ->> 'date' like '%-#{query_date.strftime(\"%m-%d\")}'\").\n... | [
"0.648469",
"0.61489",
"0.61078036",
"0.61021304",
"0.6053015",
"0.59844935",
"0.59370726",
"0.5863738",
"0.58306384",
"0.5794227",
"0.57809293",
"0.5745208",
"0.5716713",
"0.56872654",
"0.5665373",
"0.5637638",
"0.56365246",
"0.56103235",
"0.5597227",
"0.5588986",
"0.5542679... | 0.77201 | 0 |
Return all participants with the current given PpgStatus | def ppg_status
params[:page] ||= 1
default_ppg_status_code = "1"
@ppg_status_code = params[:ppg_status_code] || default_ppg_status_code
result = PpgStatusHistory.current_ppg_status.with_status(@ppg_status_code).select("distinct ppg_status_histories.*, people.last_name").joins(
"inner join participant_person_links on participant_person_links.participant_id = ppg_status_histories.participant_id
inner join people on people.id = participant_person_links.person_id"
).where("participant_person_links.relationship_code = '1'").order("people.last_name")
@ppg_statuses = result.paginate(:page => params[:page], :per_page => 20)
respond_to do |format|
format.html # index.html.haml
format.json { render :json => result.all }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_participants(response_status_number)\n\t\tmeeting_participations.where(response_status: response_status_number)\n\tend",
"def ppg_status\n participant.ppg_status.local_code if participant && participant.ppg_status\n end",
"def list_by_status(status)\n\tProject.where('client_id = ? AND status = ?',s... | [
"0.65766174",
"0.6210366",
"0.60857266",
"0.5816753",
"0.5803529",
"0.5697334",
"0.56766534",
"0.5664499",
"0.56429803",
"0.56172943",
"0.5583595",
"0.5552317",
"0.5550802",
"0.5536084",
"0.5523937",
"0.5523937",
"0.54941195",
"0.54308283",
"0.5424772",
"0.5424772",
"0.541184... | 0.6534139 | 1 |
def logout visit(HomePage) on(HomePage).logout_element.when_visible($WT).click end | def registration(login, pass, first_name, last_name)
visit(HomePage)
on(HomePage).register_element.when_visible($WT).click
on(RegisterPage).user_login_element.when_visible($WT).send_keys login
on(RegisterPage).user_password = pass
on(RegisterPage).user_password_confirmation = pass
on(RegisterPage).user_firstname = first_name
on(RegisterPage).user_lastname = last_name
on(RegisterPage).user_language = 'English'
on(RegisterPage).user_mail = login + '@dd.dd'
on(RegisterPage).submit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout\n self.logoutlink.click\n end",
"def logout\n user_name.click\n logout_link.click\n end",
"def logout\n raise AssertionError.new(\"You aren't logged in.\") if browser.link(href: '/login').present?\n browser.link(href: '/logout').click\n Watir::Wait.until(timeout: 5) { b... | [
"0.8330417",
"0.82494515",
"0.812169",
"0.7993834",
"0.779982",
"0.7786349",
"0.77761316",
"0.7734138",
"0.76926225",
"0.76620084",
"0.76566905",
"0.7511262",
"0.7478533",
"0.7448512",
"0.73957485",
"0.73930085",
"0.73757505",
"0.73752",
"0.7355576",
"0.73540664",
"0.73540664... | 0.0 | -1 |
Creates a new solr index | def create(index_name, config_set: 'data_driven_schema_configs')
checkresponse = @client.send_http(HTTP::Get.new(@client.make_uri("/#{index_name}/select")), true, ['200', '404'])
if checkresponse.code.eql?('404')
uri = @client.make_uri('/admin/cores', [
["action", "CREATE"],
["name", index_name],
["instanceDir", "mycores/" + index_name],
["configSet", config_set]
])
response = @client.send_http(HTTP::Post.new(uri), true, ['200', '500'])
if response.code.eql?('500') && !response.body.include?("Core with name '#{index_name}' already exists.")
raise "Create index failed in an unexpected way: \n\n#{response.body}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_search_index\n Tire.index self.index_name\n end",
"def create_index\n # Only create the index if it doesn't exist\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} already exists !! use #rebuild_index to rebuild the index.\") if index_exists?\n \n Me... | [
"0.77045107",
"0.73329943",
"0.7205028",
"0.7153949",
"0.7134507",
"0.71054614",
"0.7076426",
"0.6937068",
"0.6893332",
"0.6817255",
"0.6802211",
"0.6794011",
"0.67751515",
"0.6698003",
"0.66729844",
"0.6670932",
"0.66614795",
"0.663665",
"0.6627432",
"0.66058934",
"0.660192"... | 0.6508846 | 28 |
Sends an update request with a payload to solr index (without commit) | def update(index_name, payload)
uri = @client.make_uri("/#{index_name}/update/")
req = HTTP::Post.new(uri)
req.content_type = "application/json"
req.body = payload.to_json
@client.send_http(req, true, ['200'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def send_commit\n po... | [
"0.75152093",
"0.6820952",
"0.67349",
"0.67300713",
"0.6510628",
"0.6504531",
"0.65027744",
"0.6488741",
"0.6462847",
"0.6380709",
"0.63563603",
"0.6344404",
"0.6295125",
"0.624477",
"0.6226341",
"0.62230366",
"0.6185376",
"0.617855",
"0.6149269",
"0.6121493",
"0.6112324",
... | 0.72647065 | 1 |
Sends a commit request to solr | def commit(index_name)
uri = @client.make_uri("/#{index_name}/update/", [["commit", "true"]])
req = HTTP::Post.new(uri)
response = @client.send_http(req, true, ['200'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solr_commit\n Solarize::Post.execute(Solr::Request::Commit.new)\n end",
"def send_commit\n post_to_solr({},true)\n end",
"def commit\n solr_service_connection.commit\n end",
"def commit\n begin\n update_response = @streaming_update_server.commit\n rescue org.apache.solr.com... | [
"0.85861325",
"0.84891385",
"0.83493006",
"0.7888868",
"0.75154793",
"0.73230326",
"0.7127383",
"0.6911037",
"0.6902557",
"0.66627884",
"0.6577947",
"0.65687525",
"0.6560493",
"0.6560493",
"0.6560493",
"0.6473834",
"0.646547",
"0.6440451",
"0.639555",
"0.6326503",
"0.63075656... | 0.6702531 | 9 |
Deletes all contents of a solr index | def delete_data(index_name)
uri = @client.make_uri("/#{index_name}/update/")
req = HTTP::Post.new(uri)
req.content_type = 'text/xml'
req.body = '<delete><query>*:*</query></delete>'
response = @client.send_http(req, true, ['200'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def clear_index!\n search_backend.clear_index!\n end",
"def delete_tank_indexes\n tanker_config.index.delete_document(it_doc_id)\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\... | [
"0.8061086",
"0.73016584",
"0.7155156",
"0.69435275",
"0.69153285",
"0.6889667",
"0.6844211",
"0.6844211",
"0.6826922",
"0.68261904",
"0.6768662",
"0.67209864",
"0.67123824",
"0.6692491",
"0.66318244",
"0.65765303",
"0.657314",
"0.65720433",
"0.65506345",
"0.6525725",
"0.6512... | 0.6971668 | 3 |
Deletes an entire solr index | def delete_index(index_name)
uri = @client.make_uri('/admin/cores', [
["action", "UNLOAD"],
["core", index_name],
["deleteInstanceDir", "true"]
])
response = @client.send_http(HTTP::Post.new(uri), true, ['200'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def delete_tank_indexes\n tanker_config.index.delete_document(it_doc_id)\n end",
"def delete_from_index\n SearchIndex.delete_record(self)\n end",
"def delete_from_index\n SearchIndex.delete_record(self)\n end",... | [
"0.7778749",
"0.75036573",
"0.739425",
"0.739425",
"0.7354278",
"0.72241634",
"0.718036",
"0.7149904",
"0.71497047",
"0.7069948",
"0.7065461",
"0.703767",
"0.7030729",
"0.69492644",
"0.6900355",
"0.6834227",
"0.6803993",
"0.6798819",
"0.67732203",
"0.6723877",
"0.671438",
"... | 0.68620753 | 15 |
work method receives message payload in raw format in our case it is JSON encoded string which we can pass to RecentPosts service without changes | def work(raw_post)
email_params = JSON.parse(raw_post).with_indifferent_access
send_simple_message(params)
ack! # we need to let queue know that message was received
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payload; message[:payload]; end",
"def message_content\n JSON.parse(body).with_indifferent_access\n end",
"def payload\n @payload ||= JSON.parse(@message.value)\n end",
"def work(raw_post)\r\n RecentPosts.push(raw_post)\r\n ack! # we need to let queue know that message was recei... | [
"0.62684226",
"0.61347204",
"0.59667146",
"0.5939138",
"0.59370476",
"0.58858657",
"0.5837801",
"0.5779923",
"0.57681704",
"0.57567865",
"0.5672095",
"0.5659935",
"0.5655505",
"0.56294894",
"0.56294894",
"0.56185925",
"0.5607927",
"0.5583556",
"0.55175847",
"0.55152935",
"0.5... | 0.6112029 | 2 |
the name of an hourly change file which ends at +time+. | def change_file(time)
prev_time = time - Rational(1,24)
prev_time.strftime("%Y%m%d%H") + "-" + time.strftime("%Y%m%d%H") + ".osc.gz"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end",
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_curren... | [
"0.6793037",
"0.6793037",
"0.66467315",
"0.6606645",
"0.65738046",
"0.6499429",
"0.6495331",
"0.64242095",
"0.6211746",
"0.6188926",
"0.6188926",
"0.6116494",
"0.61069465",
"0.6027798",
"0.60065275",
"0.60041344",
"0.5968111",
"0.59257096",
"0.5893379",
"0.5885703",
"0.586892... | 0.73505676 | 0 |
change to the osm2pgsql directory so it can find default.style and update the postgres database. | def update_pgsql(osc)
Dir.chdir(OSM2PGSQL_DIR) do
`./osm2pgsql --append --slim -G -j -r xml -d gis -C 9999 --number-processes 5 -S /home/chentoz/Downloads/openstreetmap-carto/openstreetmap-carto.style --tag-transform-script /home/chentoz/Downloads/openstreetmap-carto/openstreetmap-carto.lua #{osc}`
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_restore\n change_ownership(\"postgres\")\n change_permissions($seven_zero_zero)\n create_symlink\n start_postgres\nend",
"def switch_database\n # switch_to_database('entire_world')\n # switch_to_database('krakow')\n\n # create_new_gis_database('new_gis')\n # CartoCSSHelper::DataFileLoader.load_... | [
"0.6124547",
"0.6107602",
"0.5938556",
"0.5897118",
"0.5597791",
"0.5592047",
"0.55885756",
"0.5545868",
"0.5545868",
"0.5509837",
"0.5508817",
"0.54963154",
"0.5490035",
"0.54853255",
"0.5442866",
"0.54260427",
"0.5350891",
"0.53335303",
"0.5328043",
"0.53093225",
"0.5247199... | 0.71936065 | 0 |
State transition tables end reduce 0 omitted reduce 1 omitted reduce 2 omitted reduce 3 omitted reduce 4 omitted | def _reduce_5(val, _values)
AST::True.new true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_unreachable_states\n queue = [starting_state].to_set\n transitions = self.each_transition.to_a.dup\n\n done_something = true\n while done_something\n done_something = false\n transi... | [
"0.605791",
"0.58252215",
"0.5779843",
"0.5664583",
"0.56555116",
"0.55968875",
"0.54634166",
"0.5462824",
"0.54216963",
"0.53569734",
"0.53448665",
"0.5337067",
"0.5327815",
"0.5327815",
"0.5327815",
"0.5327815",
"0.5311878",
"0.53009886",
"0.52940613",
"0.5281087",
"0.52629... | 0.0 | -1 |
reduce 14 omitted reduce 15 omitted reduce 16 omitted | def _reduce_17(val, _values)
AST::IntegerEqual.new val.first, val.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_13(val, _values, result); end",
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_17(val, _values, result); end",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
... | [
"0.694323",
"0.6770733",
"0.6765266",
"0.67425567",
"0.6736001",
"0.6736001",
"0.67309743",
"0.67309743",
"0.6726314",
"0.6712103",
"0.66975844",
"0.66975844",
"0.6694403",
"0.6685887",
"0.66847324",
"0.6675149",
"0.6650487",
"0.66459405",
"0.66459405",
"0.6637945",
"0.663379... | 0.0 | -1 |
Add the inventory of products | def add_inventory(sku,quantity,price)
#Instantiate a Product object
product = Product.new
product.sku = sku
product.quantity_price = quantity
product.price = price
#If the product does not have the sku just entered, insert the product into the hash
#Otherwise, find the product with the relevant sku in the hash
if !@products.has_key?(product.sku)
@products[product.sku] = product
else
existing_product = @products.fetch(product.sku)
if(product.price != existing_product.price)
calculate_exceptions(product.sku,product.quantity,product.price)
end
end#end if
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_inventory(product_name, quantity)\n @products.each do |product|\n if product.name == product_name.upcase\n product.quantity += quantity\n end\n end\n end",
"def add_inventory\n begin\n if product_params[:sku].present? && inventory_stock_params[:items_count].pre... | [
"0.7823008",
"0.7305043",
"0.72633255",
"0.7256193",
"0.7221972",
"0.7209016",
"0.7203093",
"0.7131683",
"0.70609295",
"0.7005251",
"0.7002733",
"0.6959638",
"0.69577533",
"0.6934617",
"0.6932352",
"0.69300973",
"0.6909755",
"0.68998176",
"0.68968105",
"0.68883544",
"0.686517... | 0.71817243 | 7 |
This method exists so we can simulate the existence of Devise in some of our tests. | def current_user
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devise_controller?; end",
"def setup\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end",
"def devise_modules_hook!; end",
"def enable_devise_user(view)\n without_partial_double_verification do\n allow(view).to receive(:resource) { U... | [
"0.6762428",
"0.6716148",
"0.64242005",
"0.62529206",
"0.6244064",
"0.6232341",
"0.61582255",
"0.61469156",
"0.6135988",
"0.6127566",
"0.6113493",
"0.60948026",
"0.607621",
"0.6034512",
"0.6015017",
"0.5995012",
"0.59908897",
"0.5970384",
"0.59419066",
"0.59170294",
"0.588910... | 0.0 | -1 |
Gives an instance of an OStatus::Activity that parses the fields having an activity prefix. | def activity
OStatus::Activity.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_name\n @prefix_name\n end",
"def activity_name=(value)\n @prefix_name = value\n end",
"def initialize activity\n @activity = activity\n end",
"def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end",
"... | [
"0.6184829",
"0.5677267",
"0.558432",
"0.552755",
"0.552755",
"0.5446851",
"0.51959014",
"0.51696825",
"0.5149994",
"0.50786597",
"0.4983168",
"0.48422128",
"0.48102596",
"0.4733975",
"0.4696795",
"0.4675668",
"0.4672726",
"0.46725345",
"0.4665883",
"0.46496382",
"0.46437162"... | 0.60089326 | 1 |
Returns an instance of a PortableContacts that further describe the author's contact information, if it exists. | def portable_contacts
PortableContacts.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end",
"def contacts\n @contacts ||= get_attr(:contacts).collect { |c| OpenStruct.new(c) }\n end",
"def contacts\n @contacts ||= @ab.people.map {|abperson| Macabee::Contact.new(abperson, :macabee => self)}\n end",
"def ... | [
"0.64660066",
"0.6462902",
"0.6240552",
"0.62073976",
"0.6204976",
"0.61651784",
"0.614089",
"0.6121329",
"0.6089928",
"0.6087279",
"0.60105556",
"0.59896463",
"0.5977564",
"0.591703",
"0.58911407",
"0.58729845",
"0.5871846",
"0.58616954",
"0.5843558",
"0.58356106",
"0.581812... | 0.71524274 | 0 |
Can't alter the root site unless you have a real session cookie and are not an identity assumer | def manage?
return false if assumed_identity_from_profile
!doorkeeper_token && site_admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_site_visitor\n ensure_code_cookie\n record_login(current_user) if current_user\n end",
"def remember_host!; end",
"def backdoor\n user = User.find_by_uid(\"test@user.edu\")\n session[:user_id] = user.id\n redirect_to root_url\n end",
"def handle_unverified_request\n super\n coo... | [
"0.68400806",
"0.6774294",
"0.6657538",
"0.6462965",
"0.64189225",
"0.63799345",
"0.6362007",
"0.63607246",
"0.63091606",
"0.6274467",
"0.6265144",
"0.61932445",
"0.61920565",
"0.6178331",
"0.6176888",
"0.61633855",
"0.6153656",
"0.61394995",
"0.611162",
"0.61038685",
"0.6103... | 0.0 | -1 |
POST /manpowers POST /manpowers.json | def create
@project= Project.find(params[:project_id])
@manpower = @project.create_manpower(manpower_params)
respond_to do |format|
if @manpower.save
format.html { redirect_to project_path(@project), notice: 'Manpower was successfully created.' }
format.json { render :show, status: :created, location: @manpower }
else
format.html { render :new }
format.json { render json: @manpower.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manpower_params\n params.require(:manpower).permit(:project_engineer, :materials_engineer, :project_foreman)\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @power = current_user.powers.build(power_params)\n\n respond_to do |format|\... | [
"0.6112609",
"0.6072043",
"0.600941",
"0.58892614",
"0.5766609",
"0.5586246",
"0.55286103",
"0.55120385",
"0.54883146",
"0.5472399",
"0.5445106",
"0.5397315",
"0.5387708",
"0.53586096",
"0.5351483",
"0.53505766",
"0.53420866",
"0.532617",
"0.5324217",
"0.53207946",
"0.5309586... | 0.58693594 | 4 |
PATCH/PUT /manpowers/1 PATCH/PUT /manpowers/1.json | def update
respond_to do |format|
if @manpower.update(manpower_params)
format.html { redirect_to @manpower.project, notice: 'Manpower was successfully updated.' }
format.json { render :show, status: :ok, location: @manpower }
else
format.html { render :edit }
format.json { render json: @manpower.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def update\n @manpack = Manpack.find(params[:id])\n\n respond_to do |format|\n if @manpack.update_attributes(params[:manpack])\n format.html { redirect_to @manpack, notice: 'Manpack was successfully updated.' }\n format.json { head :ok }\n e... | [
"0.6468964",
"0.63948673",
"0.61072314",
"0.6069711",
"0.6024659",
"0.60246336",
"0.60149056",
"0.60088277",
"0.598895",
"0.59578896",
"0.5956864",
"0.59454614",
"0.59390396",
"0.59387916",
"0.592641",
"0.59159034",
"0.59039885",
"0.58996296",
"0.58930534",
"0.58867157",
"0.5... | 0.64852 | 0 |
DELETE /manpowers/1 DELETE /manpowers/1.json | def destroy
@manpower.destroy
respond_to do |format|
format.html { redirect_to :back, notice: 'Manpower was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n need_admin!\n\n @manual = Manual.find(params[:id])\n @manual.destroy\n\n respond_to do |format|\n format.html { redirect_to manuals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @manpack = Manpack.find(params[:id])\n @manpack.destroy\n\n respond_to... | [
"0.66509145",
"0.64866143",
"0.64303994",
"0.6391626",
"0.6350832",
"0.63248855",
"0.63234735",
"0.6316024",
"0.6308957",
"0.6300994",
"0.6298703",
"0.6291068",
"0.62900656",
"0.62885237",
"0.6262361",
"0.6259867",
"0.6251714",
"0.62510246",
"0.6239985",
"0.62198764",
"0.6216... | 0.6445759 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_manpower
@manpower = Manpower.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def manpower_params
params.require(:manpower).permit(:project_engineer, :materials_engineer, :project_foreman)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Registers and logs in a user. | def loginuser
user = $helpers.register 'test@websyn.ca', 'testboop'
visit '/login?/settings'
fill_login
user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = s... | [
"0.7100168",
"0.6997404",
"0.69099784",
"0.6810988",
"0.68097293",
"0.67958146",
"0.6789384",
"0.67139065",
"0.671362",
"0.67023796",
"0.6646453",
"0.6641774",
"0.66396755",
"0.6618892",
"0.66124034",
"0.65918505",
"0.6586855",
"0.65721565",
"0.6549042",
"0.65476143",
"0.6536... | 0.0 | -1 |
Location is the basic name of the type of permission being accessed Valid locations: admin_cp (Admin Control Panel) user_cp (User Control Panel) view_game (View a game) edit_game (Edit a game) make_char (Make a character) view_char (View a character edit_char (Edit a character) Details contains relevant details, depending on location: user_cp: 'user_id' => ID of desired user view_game: 'game_id' => ID of desired game, 'system' => System of desired game ('fate', currently) edit_game: 'game_id' => ID of desired game, 'system' => System of desired game ('fate', currently) make_char: 'game_id' => ID of desired game, 'system' => System of desired game ('fate', currently) view_char: 'char_id' => ID of desired character, 'system' => System of desired char ('fate', currently) edit_char: 'char_id' => ID of desired char, 'system' => System of desired char ('fate', currently) | def authorized? (location, details)
# The user is obviously not authorized if they're trying to access a location that doesn't exist
if (valid_locations.include? location)
# Admins have global access
if session[:admin]
return true
else
case location
# There is no 'admin_cp' check because logged-in admins received authorization before the case statement began
# Authorization check for viewing a user's control panel/profile edit
when 'user_cp'
# If the user is logged in as the appropriate user
if logged_in? && userid(username) == details[:user_id]
return true
end
# Authorization check for viewing a game
when 'view_game'
# Gets us the game in question
case system = details[:system]
when 'fate'
game = FateGame.find(details[:game_id])
end
# Everyone is authorized to view public games
if game.is_public
return true
# If the game is not public, we have to check if they're allowed. If they aren't logged in, they aren't allowed
elsif logged_in?
# If the logged-in user is found in the list of GMs or Players for the game
auth_viewers = game.player_ids.concat(game.gms)
if auth_viewers.include? userid(username)
return true
end
end
# Authorization check for editing a game
when 'edit_game'
# No one who isn't logged in can edit a game
if (logged_in?)
# Gets us the game in question
case system = details[:system]
when 'fate'
game = FateGame.find(details[:game_id])
end
# Only GMs and Admins can edit a game
if game.gms.include? userid(username)
return true
end
end
# Authorization check for making a character for a given game
when 'make_char'
case system = details[:system]
when 'fate'
game = FateGame.find(details[:game_id])
end
if game.requires_approval
auth_character_makers = game.gms + game.player_ids
return auth_character_makers.include?(userid(username))
else
return true
end
# Authorization check for viewing a character (NOT called for viewing hidden fields like secret_notes)
when 'view_char'
# Gets us the character and game in question
case system = details[:system]
when 'fate'
char = FateCharacter.find(details[:char_id])
game = FateGame.find(char.game_id)
end
# Everyone can view a publicly-viewable character
if char.is_public
return true
# If you're not logged in you can't view a hidden character
elsif logged_in?
# Authorized viewers are game GMs and the owner of the character
auth_viewers = game.gms << char.player_id
return auth_viewers.include?(userid(username))
end
# Authorization check for editing a character (also called for viewing hidden fields like secret_notes)
when 'edit_char'
# No permission if you're not logged in
if logged_in?
# Gets us the character and game in question
case system = details[:system]
when 'fate'
char = FateCharacter.find(details[:char_id])
game = FateGame.find(char.game_id)
end
# Authorized editors are GMs and the relevant player
auth_editors = game.gms << char.player_id
return auth_editors.include?(userid(username))
end
end
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_permission?(location)\n if @logged_in_user.is_admin?\n return true\n end\n if not @logged_in_user.nil?\n groups = @logged_in_user.groups\n groups.each do |g|\n g.rights.detect {|right| \n if right.area == location\n return true\n ... | [
"0.65503615",
"0.64261764",
"0.62649685",
"0.61630005",
"0.60986364",
"0.6083584",
"0.6066625",
"0.6045206",
"0.60147816",
"0.59753186",
"0.5960799",
"0.5918652",
"0.5886033",
"0.58548754",
"0.5829808",
"0.57939416",
"0.5728486",
"0.5727094",
"0.5709505",
"0.5704901",
"0.5704... | 0.6569509 | 0 |
checks if street of current user is the same as drains street | def my_street(drain)
if user_signed_in?
return true if drain.streets.include? current_user.street
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend",
"def direction_touching_number?\n return false unless @confirmed[:street_direction] && @confirmed[:street_number]\n\n @confirmed[:street_direction].min - 1 == @confirmed[:street_number].max\n end"... | [
"0.68870056",
"0.6741652",
"0.6281622",
"0.61298037",
"0.601461",
"0.59288144",
"0.5918647",
"0.58270663",
"0.58179694",
"0.58076096",
"0.58046883",
"0.5752416",
"0.57072264",
"0.57025063",
"0.5702394",
"0.5663204",
"0.5656323",
"0.5629386",
"0.56159925",
"0.5606462",
"0.5605... | 0.72481066 | 0 |
checks if current user is the street leader of the drain's street | def iam_street_leader(drain)
if my_street(drain)
current_user.has_role(2)
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_street(drain)\n if user_signed_in?\n return true if drain.streets.include? current_user.street\n else\n false\n end\n end",
"def leader?\n member.leader?\n end",
"def leader?()\n \n return @leader.leader?\n\n end",
"def is_leader?\n level == Membership::LEVELS[:lea... | [
"0.7794585",
"0.61819",
"0.60144883",
"0.5905514",
"0.58920497",
"0.5889575",
"0.58056337",
"0.57267034",
"0.57112306",
"0.569395",
"0.5664401",
"0.56379914",
"0.56172186",
"0.56120336",
"0.56048125",
"0.5592691",
"0.5543232",
"0.5543082",
"0.55370694",
"0.55269545",
"0.55204... | 0.8328771 | 0 |
number of hours after which token will expire | def token_expiration_window
# TODO - configurable per tenant
72
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_time\n e_time = @token_manager.token_info[\"expiration\"]\n raise 'CloudTools::IAMAuth Unable to extract the retrieved expiration time.' if e_time.nil?\n raise \"CloudTools::IAMAuth Extracted expiry time #{e_time} is not an expected integer.\" unless e_time.kind_of... | [
"0.75649333",
"0.75347215",
"0.75329995",
"0.75329995",
"0.7522321",
"0.74821436",
"0.74819756",
"0.7481479",
"0.7458159",
"0.74093956",
"0.7408323",
"0.73509794",
"0.73509794",
"0.72891694",
"0.7288449",
"0.72666585",
"0.7214726",
"0.7214199",
"0.72028744",
"0.7177241",
"0.7... | 0.80177 | 0 |
Returns true if robot is already placed on the given surface (current placement information is available) | def placed?
!current_placement.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def place?(robot, direction_sym)\n true\n end",
"def placed?\n # check if we currently have everything we need for our current_position\n return !@current_position[:x].nil? && !@cu... | [
"0.7169938",
"0.69231445",
"0.68986934",
"0.6828574",
"0.66841096",
"0.66741544",
"0.6609352",
"0.65137875",
"0.6487627",
"0.646207",
"0.61693805",
"0.61541265",
"0.61296785",
"0.6114383",
"0.6110756",
"0.60918504",
"0.59241766",
"0.5924078",
"0.5905634",
"0.5899738",
"0.5882... | 0.69640785 | 1 |
This method calculates target position based on current location and direction of the robot. Will ask mobility system to move the robot one unit forward in the direction it is currently facing if it is already placed on a surface and if target destination isn't outside the surface | def move
# Do not continue if robot isn't placed
return cancel_action("Robot isn't placed on the surface yet") unless placed?
# Calculate target position. Cancel processing the method if it's outside current surface
target_position = current_placement.position.add(current_placement.direction.to_unit_vector)
return cancel_action("Robot can't drive outside the surface") unless surface.position_on_surface?(target_position)
# Set the current placement, calculate movement vector and pass it ot the mobility system.
self.target_placement = NavigationEntities::Placement.new(target_position, current_placement.direction)
mobility_system.move_by(target_position - current_placement.position)
# Current mobility system is just a placeholder, so it's always executed
if mobility_system.standby
# Update information about current location.
# TODO: Refactor this part when a real mobility system will be plugged in
update_placement(target_placement)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_pos_direct\n # We assume in this method that we're not at the target yet, since we check for the goal state elsewhere\n # Determine if we need to move sideways or up-down\n new_pos = Point.new(@pos.x, @pos.y)\n if (@target.pos.x-@pos.x).abs >= (@target.pos.y-@pos.y).abs\n # move sidewa... | [
"0.65110475",
"0.624341",
"0.6238943",
"0.62170565",
"0.6179813",
"0.6137779",
"0.611994",
"0.6090275",
"0.60862666",
"0.5973025",
"0.59561104",
"0.59440595",
"0.59345615",
"0.58942133",
"0.58654916",
"0.5858927",
"0.58509254",
"0.5817651",
"0.5807205",
"0.58032215",
"0.58016... | 0.712101 | 0 |
Places robot on the surface on (x, y) position and sets direction to one of the four main directions supported by the corresponding class. Does not allow to place robot outside the current surface. | def place(x, y, direction)
# Set target position. Cancel processing the method if it's outside current surface
target_position = NavigationEntities::Position.new(x, y)
return cancel_action("Robot can't be placed outside") unless surface.position_on_surface?(target_position)
# Set direction of the robot. Store it in the placement object.
target_direction = NavigationEntities::Direction.new(direction)
self.target_placement = NavigationEntities::Placement.new(target_position, target_direction)
# Update information about current location.
update_placement(target_placement)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n # Do not continue if robot isn't placed\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n # Calculate target position. Cancel processing the method if it's outside current surface\n target_position = current_placement.position.add(current_placement.... | [
"0.665648",
"0.6581439",
"0.6579679",
"0.650118",
"0.63800234",
"0.636457",
"0.636296",
"0.6347823",
"0.6314424",
"0.63029057",
"0.6240118",
"0.62003565",
"0.61871606",
"0.61207086",
"0.61176705",
"0.6074344",
"0.60564643",
"0.6056341",
"0.6051959",
"0.6044367",
"0.6026869",
... | 0.7544177 | 0 |
If robot is already on the current surface, rotates robot clockwise using mobility system | def right
return cancel_action("Robot isn't placed on the surface yet") unless placed?
target_direction = current_placement.direction.rotate_clockwise
rotate(target_direction)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bound... | [
"0.6828581",
"0.673093",
"0.6645086",
"0.6308786",
"0.6272837",
"0.6264185",
"0.6252203",
"0.6238775",
"0.62265897",
"0.6081505",
"0.60793287",
"0.6066859",
"0.6027496",
"0.6024305",
"0.59896374",
"0.59687203",
"0.5956467",
"0.5852576",
"0.58362675",
"0.58121115",
"0.57801026... | 0.64747345 | 3 |
If robot is already on the current surface, rotates robot counterclockwise using mobility system | def left
return cancel_action("Robot isn't placed on the surface yet") unless placed?
target_direction = current_placement.direction.rotate_counterclockwise
rotate(target_direction)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bound... | [
"0.6651339",
"0.6583405",
"0.6529853",
"0.6403084",
"0.6144444",
"0.6125342",
"0.6124799",
"0.61166275",
"0.6115381",
"0.60543907",
"0.6006566",
"0.59971166",
"0.5915173",
"0.59060305",
"0.5902403",
"0.5897936",
"0.5862718",
"0.5837645",
"0.58000046",
"0.5746799",
"0.57436216... | 0.56919074 | 22 |
authorise only the user who has created the listing to edit or delete it | def set_user_listing
# find the listing and check if that listing belongs to the loggedin user
id = params[:id]
@listing = current_user.listings.find_by_id(id)
# option1
if @listing == nil
# boot the user out
redirect_to listings_path
end
# # option2:
# if listing.user_id != current_user.id
# redirect_to listings_path
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n if @listing.user_id != current_user.id\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'You do not have permission to access this.' }\n format.json { head :no_content }\n end\n end\n end",
"def admin\n authorize! :admin, @listings\n end",
... | [
"0.7650602",
"0.7187137",
"0.7025968",
"0.7021268",
"0.70094556",
"0.697753",
"0.69625086",
"0.6946419",
"0.6864952",
"0.68631124",
"0.6861905",
"0.68549764",
"0.6804423",
"0.679534",
"0.6754961",
"0.6739786",
"0.67336345",
"0.67336345",
"0.6692494",
"0.6677702",
"0.6636274",... | 0.6231332 | 62 |
return a collection of bookmarks | def new
puts params
@topic = Topic.find(params[:topic_id])
@bookmark = Bookmark.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bookmarks\n\t\toptions = { list: true }\n\t\tresponse = self.server.run_with_json_template( :bookmarks, **options )\n\t\treturn response.map {|bk| Hglib::Repo::Bookmark.new(self, **bk) }\n\tend",
"def get_bookmarks\n @logger.debug \"Fetching bookmarks from Delicious\"\n bookmarks = []\n doc = ... | [
"0.8158243",
"0.742651",
"0.7298961",
"0.71737194",
"0.7099973",
"0.68480283",
"0.681857",
"0.6808324",
"0.6785329",
"0.6769257",
"0.6740299",
"0.66917825",
"0.6691751",
"0.6675238",
"0.6606996",
"0.6577149",
"0.6506438",
"0.64572966",
"0.643717",
"0.63729346",
"0.6369544",
... | 0.0 | -1 |
Initializes the model object | def initialize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize_model\n # let's create our new empty model\n @model = OpenStudio::Model::Model.new if @model.nil?\n end",
"def initialize(model)\n @model = model\n end",
"def... | [
"0.81120855",
"0.7909754",
"0.7754439",
"0.77019346",
"0.77019346",
"0.77019346",
"0.7168851",
"0.70291483",
"0.6954552",
"0.6940714",
"0.6938685",
"0.68826234",
"0.68738467",
"0.6849136",
"0.6839306",
"0.6793913",
"0.6752518",
"0.67466974",
"0.67466974",
"0.67466974",
"0.674... | 0.0 | -1 |
Checks the validity of the object and if all required fields are initialized | def valid?
@expression.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanityCheck\n @executor.nil? and raise \"Executor has not been initialized.\"\n @manipulator.nil? and raise \"Manipulator has not been initialized.\"\n @monitor.nil? and raise \"Monitor has not been initialized.\"\n @subject.nil? and raise \"Subject has not been initialized.\"\n end",
... | [
"0.67777264",
"0.664763",
"0.65814364",
"0.6561957",
"0.6520827",
"0.6454004",
"0.6446877",
"0.6433663",
"0.63824606",
"0.636376",
"0.63427603",
"0.63400763",
"0.633474",
"0.63214463",
"0.6306411",
"0.6268985",
"0.6260092",
"0.62417495",
"0.6227884",
"0.62223756",
"0.6218202"... | 0.0 | -1 |
market_status 1 means available for betting other status means betting is not allowed. TODO: Explore more market status in more details | def market_status
super || '0'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_market_status\n @market_status = MarketStatus.find(params[:id])\n end",
"def off_market_check\n if status == 'on market'\n self.status = 'missed'\n update_workshifter_hours_balance\n gen_next_assignment\n elsif status == 'on market (late)'\n self.status = 'blown'\n ... | [
"0.71832716",
"0.6627679",
"0.6354301",
"0.62153554",
"0.59994084",
"0.5998269",
"0.59828055",
"0.5880469",
"0.587373",
"0.5856643",
"0.576599",
"0.57371074",
"0.57091534",
"0.57076216",
"0.5694673",
"0.5641775",
"0.56389475",
"0.56154436",
"0.5570181",
"0.5566702",
"0.555309... | 0.67945665 | 1 |
The after_update callback has a second expiry method for associated classes that is not required for the destroy method since there should be no records associated with a destroyed record. | def after_update(bibl)
expire(bibl)
expire_associated(bibl)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_update(order)\n expire(order)\n expire_associated(order)\n end",
"def after_update(record)\n expire_cache_for(record)\n end",
"def after_update(record)\n expire_cache_for(record)\n end",
"def after_update(record)\n if Rails.configuration.cache_classes == true\n expire_cache_f... | [
"0.73453283",
"0.7078835",
"0.7078835",
"0.69274914",
"0.6848931",
"0.6660947",
"0.6654293",
"0.66240484",
"0.66240484",
"0.656375",
"0.6540373",
"0.6540373",
"0.6534739",
"0.6455902",
"0.64549667",
"0.6444708",
"0.64426875",
"0.6442509",
"0.6442509",
"0.64391774",
"0.6439177... | 0.73569685 | 0 |
Expire the index and show views for self | def expire(bibl)
Rails.cache.delete("views/tracksys.lib.virginia.edu" + "#{admin_bibl_path(bibl.id)}")
Rails.cache.delete("views/tracksys.lib.virginia.edu" + "#{admin_bibls_path}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_index!\n raise NotImplementedError\n end",
"def reset_views\n @views = []\n end",
"def index\n no_cache\n super\n end",
"def clear\n Log.delete_all\n render_index\n end",
"def end_view_index(new_object_path=nil)\n end_view(link_to_create(new_objec... | [
"0.6840664",
"0.65124184",
"0.6491433",
"0.62920016",
"0.62876564",
"0.62369925",
"0.6216356",
"0.62000865",
"0.6090695",
"0.6056465",
"0.6021079",
"0.60075265",
"0.5927806",
"0.59147936",
"0.587353",
"0.5856871",
"0.5841848",
"0.5815513",
"0.5805786",
"0.5795727",
"0.5791732... | 0.5778744 | 21 |
Since subordinate classes often display Bibl information in their views, we need only to expire those cached views. The classes which display Bibl information on their show views are: Customers, Units, MasterFiles, Agencies and Orders. TODO: Consider relationship between Components and Bibls for possible expiration. Subordinate classes will only be expired if either :call_number or :title are changed. Other values should not change the show views of subordinate clases. TODO: Might possible need to expire if :creator_name is changed. Currently not displayed on show views. | def expire_associated(bibl)
expirable = EXPIRABLE_FIELDS.any? do |key|
bibl.changed_attributes.include?(key)
end
if expirable
ASSOCIATED_CLASSES.each {|ac|
publish :purge_cache, ActiveSupport::JSON.encode( {:subject_class => bibl.class.name, :subject_id => bibl.id, :associated_class => "#{ac}" })
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire(bibl)\n Rails.cache.delete(\"views/tracksys.lib.virginia.edu\" + \"#{admin_bibl_path(bibl.id)}\")\n Rails.cache.delete(\"views/tracksys.lib.virginia.edu\" + \"#{admin_bibls_path}\")\n end",
"def cache_expiry\n if options[:extend_cache_life]\n (1 + options[:extend_cache_life]) * supe... | [
"0.5703365",
"0.5651088",
"0.535134",
"0.5246818",
"0.5239776",
"0.52323824",
"0.52096504",
"0.51655626",
"0.5130372",
"0.5052226",
"0.5049457",
"0.50346655",
"0.4986688",
"0.4986688",
"0.4931496",
"0.49297053",
"0.49242035",
"0.4917328",
"0.4900147",
"0.48698318",
"0.4846651... | 0.561272 | 2 |
shared content or not? | def shared?
self[:filename].nil? or self[:filename].start_with? "content/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharing \n end",
"def shared?\n sharing != 'none'\n end",
"def is_shared\n return @is_shared\n end",
"def render_sharing?\n true\n end",
"def shared?\n sharing != 'none'\n end",
"def shared?\n @shared ||= options[:shared]\n end",
"d... | [
"0.73304904",
"0.68188107",
"0.6727683",
"0.67113465",
"0.66956985",
"0.6543602",
"0.6478617",
"0.6458888",
"0.63450235",
"0.6308746",
"0.6279984",
"0.6208092",
"0.6177462",
"0.61125666",
"0.6083073",
"0.6025576",
"0.6025576",
"0.6025576",
"0.6025576",
"0.6025576",
"0.6025576... | 0.66732574 | 5 |
pages that got moved around | def initialize_items
find_printed_items
find_slug_items
find_categories
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pages\n oldpage = @current_page\n @current_page = nil\n for i in 0...pages.size\n if test_page_conditions(i)\n @current_page = i\n if oldpage != @current_page\n # Run only if the page actually changed\n @direction = current_page.graphic[:direct... | [
"0.70119464",
"0.68432075",
"0.6754078",
"0.6610432",
"0.6546029",
"0.6404415",
"0.63460547",
"0.62929326",
"0.60891974",
"0.6045814",
"0.6033012",
"0.6031019",
"0.6020891",
"0.5988339",
"0.5973549",
"0.5966854",
"0.5948746",
"0.5938046",
"0.5938046",
"0.5938046",
"0.5938046"... | 0.0 | -1 |
is this category on the main site? | def latest_category? cat
latest_article.category == cat unless latest_article.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categorizable?\n self.content_type.presence && self.site.has_plugin?(:categories) && self.accept_categories\n end",
"def is_news?\n category.sysname == 'news'\n end",
"def about_knowhow?\n category == \"knowhow\"\n end",
"def categories?\n false\n end",
"def has_categories? \n tr... | [
"0.78255194",
"0.7645353",
"0.75094247",
"0.7432693",
"0.7266592",
"0.72194684",
"0.7165636",
"0.7091916",
"0.7090733",
"0.7044028",
"0.703893",
"0.70255804",
"0.70144105",
"0.69387716",
"0.69314075",
"0.6926823",
"0.6891812",
"0.68068355",
"0.6804087",
"0.6800908",
"0.679885... | 0.62986094 | 52 |
Fetch all the issues on this project. Returns an array of Sifter::Issue objects. | def issues
Sifter.
get(api_issues_url).
fetch("issues", []).
map { |i| Sifter::Issue.new(i) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end",
"def fetch_issues()\n\n # fetch last created date\n last_creation = @kv.get(@last_creation_k) # || \"2015-05-... | [
"0.7291963",
"0.7075643",
"0.7050203",
"0.6920023",
"0.68897986",
"0.6884609",
"0.68101734",
"0.6698981",
"0.6698981",
"0.6698981",
"0.6698981",
"0.6698981",
"0.66109014",
"0.65463036",
"0.6513725",
"0.6504389",
"0.6449981",
"0.64479953",
"0.64306796",
"0.64197826",
"0.630840... | 0.7984013 | 0 |
Fetch all the milestones for this project. Returns an array of Sifter::Milestone objects. | def milestones
Sifter.
get(api_milestones_url).
fetch("milestones", []).
map { |m| Sifter::Milestone.new(m) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end",
"def milestones\n milestones = Milestone.where(project_id: project_ids_relation)\n milestones = milestones.search(query)\n milestones.reorder('updated_at DESC')\n... | [
"0.7635296",
"0.72135085",
"0.7153989",
"0.69145393",
"0.68613577",
"0.6574336",
"0.6554971",
"0.6322896",
"0.6289743",
"0.6235015",
"0.6208487",
"0.6180834",
"0.6064803",
"0.6044784",
"0.6013042",
"0.5864698",
"0.58403915",
"0.5749061",
"0.5721384",
"0.56977624",
"0.5674438"... | 0.80995643 | 1 |
Fetch all the people linked to this project. Returns an array of Sifter::Person objects. | def people
Sifter.
get(api_people_url).
fetch("people", []).
map { |p| Sifter::Person.new(p) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def people\n\t\t\t\t\tif @people.nil?\n\t\t\t\t\t\t@people = self.class.people(self.ref, self.params)\n\t\t\t\t\tend\n\t\t\t\t\treturn @people\n\t\t\t\tend",
"def get_people\n return @people\n end",
"def people\n return [] if company_id.blank? || !basecamp\n @people ||= basecamp.people(company_id)\n ... | [
"0.70830667",
"0.65306556",
"0.6515365",
"0.62743354",
"0.61131513",
"0.6058596",
"0.60328674",
"0.60328674",
"0.59277666",
"0.58868796",
"0.5839488",
"0.5807648",
"0.5802589",
"0.5802589",
"0.57340956",
"0.56891084",
"0.5686064",
"0.5674243",
"0.5672223",
"0.56169677",
"0.55... | 0.7307723 | 1 |
Returns true if there is only "_destroy" attribute available for nested models. | def has_only_destroy?(attrs)
attrs.each do |k,v|
if k !="_destroy" && !v.blank?
return false
end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_destroy_nested_attributes_record?(allow_destroy, attributes)\n ConnectionAdapters::Column.value_to_boolean(attributes.delete('_delete')) && allow_destroy\n end",
"def has_only_destroy?(attrs)\n\t attrs.each do |k,v|\n\t \tif k !=\"_destroy\" && !v.blank?\n\t \t\treturn false\n\t \t... | [
"0.7918592",
"0.74871075",
"0.74871075",
"0.7200917",
"0.7125247",
"0.7117778",
"0.71001774",
"0.7081891",
"0.6986471",
"0.686033",
"0.685858",
"0.68068296",
"0.6729904",
"0.6677177",
"0.66215384",
"0.6605168",
"0.6583882",
"0.6574735",
"0.6574735",
"0.65691185",
"0.6562192",... | 0.7588892 | 2 |
Create a new Server instance with the given ports. If no ports are given, port 80 will be used as a default | def initialize(*ports)
ports << 80 if ports.length == 0
@ports = ports
@processes = 5
@processes = ENV["WAITRESS_PROCESSES"].to_i if ENV.include? "WAITRESS_PROCESSES"
@backtrace_500 = false
@running_processes = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def create_server_socket\n if @hostname\n s = TCPServer.open(@hostname, @port)\n else\n s = TCPServer.open(@port)\n end\n @port = s.addr[1]\n\n s.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\... | [
"0.64898556",
"0.6464128",
"0.636711",
"0.63646686",
"0.6304084",
"0.62982744",
"0.6296162",
"0.6266496",
"0.6255185",
"0.62250626",
"0.6180892",
"0.61661994",
"0.61558324",
"0.61312634",
"0.61165714",
"0.60706246",
"0.60511374",
"0.60496855",
"0.60450006",
"0.6022716",
"0.60... | 0.6094413 | 15 |
Set the amount of concurrent Waitress Processes to run on this Server, per Port | def set_processes count
@processes = count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*ports)\n ports << 80 if ports.length == 0\n @ports = ports\n @processes = 5\n @processes = ENV[\"WAITRESS_PROCESSES\"].to_i if ENV.include? \"WAITRESS_PROCESSES\"\n @backtrace_500 = false\n @running_processes = []\n end",
"def concurrency=(limit)\n config('co... | [
"0.6628558",
"0.6584987",
"0.64062893",
"0.6336012",
"0.6212256",
"0.61698204",
"0.60958195",
"0.6050424",
"0.59897053",
"0.5948225",
"0.5944351",
"0.5931894",
"0.5920956",
"0.58427656",
"0.5737163",
"0.5702901",
"0.5702004",
"0.5678973",
"0.56624305",
"0.56579435",
"0.564458... | 0.7040124 | 0 |
Set or Get the ports for this server. If arguments are provided, the ports for this server will be replaced with the ones listed. If no arguments are provided, this method simply returns the ports | def ports *ports
@ports = *ports unless ports.length == 0
@ports
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ports\n return get_request(address(\"ports\"), @token)\n end",
"def ports\n # prevent original array from being changed\n @ports.dup\n end",
"def ports\n [@free_ports, @allocated_ports].flatten\n end",
"def port=(v)\n check_port(v)\n set_port(v)\n port\n end... | [
"0.7367868",
"0.7019258",
"0.63956136",
"0.63192",
"0.6293006",
"0.6266968",
"0.6251805",
"0.617706",
"0.6117174",
"0.60645664",
"0.6044688",
"0.598068",
"0.5957675",
"0.5942103",
"0.5942103",
"0.591041",
"0.58553493",
"0.584906",
"0.58456993",
"0.5802302",
"0.5787736",
"0.... | 0.7099437 | 1 |
Start the server. If arguments are provided, it will run with the ports declared in the arguments, otherwise, it will use the ports it already has set (or 80 for the default) | def run *ports
@ports = ports unless ports.length == 0
self.each do |vhost|
vhost.on_server_start self
end
@running_processes = @ports.map do |port|
launch_port(port)
end
@running_processes.flatten!
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(host, port); end",
"def main\n # Check that there was an argument supplied to the application\n if ARGV.length > 0\n # Convert the argument to an integer to be used as a port number\n port = ARGV[0].to_i\n if port < 1024 || port > 49151\n puts \"illegal port #{ARGV[0].to_i}: Choose one ... | [
"0.72013396",
"0.7007327",
"0.69921535",
"0.69291085",
"0.68739516",
"0.6861515",
"0.6766566",
"0.6753311",
"0.6715",
"0.6711042",
"0.66678995",
"0.65854126",
"0.65751034",
"0.6569387",
"0.65504247",
"0.6543568",
"0.6516592",
"0.64567953",
"0.6415227",
"0.63838845",
"0.637823... | 0.5939164 | 46 |
Join the server, blocking the current thread in order to keep the server alive. | def join
@running_processes.each { |x| x.wait }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join\n @server_thread.join if @server_thread\n end",
"def join\n @server_thread.join if @server_thread\n end",
"def join\n raise \"No http-server or http-server not running.\" if !@httpserv or !@httpserv.thread_accept\n \n begin\n @httpserv.thread_accept.join\n @httpserv.thre... | [
"0.8408234",
"0.8303335",
"0.7622549",
"0.75335556",
"0.751146",
"0.74305356",
"0.7404799",
"0.74018127",
"0.70939267",
"0.7091512",
"0.70906097",
"0.7033119",
"0.6994728",
"0.6886267",
"0.68351895",
"0.6681949",
"0.664238",
"0.6642261",
"0.66398776",
"0.66171503",
"0.6611494... | 0.5804094 | 46 |
Handle a client based on an IO stream, if you plan to serve on a nonsocket connection | def read_io io
handle_client io
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream(socket); end",
"def handle_read\n begin\n client, addr = socket.accept_nonblock\n emit(:accept, Stream.new(socket: client, address: addr))\n rescue IOError\n end\n end",
"def open_socket\n loop {\n listen_for_client\n\n # read first input line only\n ... | [
"0.6860379",
"0.6787955",
"0.6439157",
"0.63784885",
"0.6342558",
"0.62379044",
"0.6184688",
"0.6121882",
"0.6121812",
"0.6081256",
"0.607826",
"0.60450995",
"0.6003928",
"0.59066075",
"0.5883126",
"0.57909304",
"0.578405",
"0.57728857",
"0.576103",
"0.57496667",
"0.57313055"... | 0.68275917 | 1 |
Set to true to enable clients to view the 500 error backtrace | def internal_error enabled
@backtrace_500 = enabled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_errors!\n configure :production do\n error ::Exception do\n boom = env['sinatra.error']\n logger.error [\"#{boom.class} - #{boom.message}:\", *boom.backtrace].join(\"\\n \")\n response.status = 500\n content_type 'text/html'\n ... | [
"0.700284",
"0.6821429",
"0.6704803",
"0.66807026",
"0.66807026",
"0.65529156",
"0.6549896",
"0.65265405",
"0.64939934",
"0.6491762",
"0.6482098",
"0.6411188",
"0.63473123",
"0.63189393",
"0.62753004",
"0.6274505",
"0.6255917",
"0.6248284",
"0.6210665",
"0.6204865",
"0.620116... | 0.80826867 | 0 |
FIXME: Can we delete this controller? Seems like it's not used... GET /pricings GET /pricings.json | def index
@pricings = @job.pricings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @pricings = Pricing.all\n end",
"def index\n @pricings = Pricing.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @pricings\n end",
"def index\n @plunderings = Plundering.all\n ... | [
"0.7431725",
"0.7005214",
"0.6690788",
"0.66793513",
"0.6608584",
"0.6605937",
"0.6531847",
"0.65150946",
"0.64550394",
"0.64550394",
"0.6357528",
"0.62969404",
"0.62957716",
"0.6267178",
"0.62666607",
"0.62490183",
"0.62408346",
"0.6220516",
"0.6200842",
"0.61427927",
"0.612... | 0.7187837 | 1 |
GET /pricings/1 GET /pricings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def show\n @pruning = Pruning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pruning }\n end\n end",
"def index\n @pricings = Pricing.all.order(\"updat... | [
"0.7478837",
"0.67915803",
"0.67628896",
"0.66962093",
"0.6488154",
"0.63902545",
"0.63325924",
"0.61587495",
"0.61182135",
"0.6098231",
"0.6073456",
"0.6064361",
"0.60553795",
"0.60281706",
"0.60248417",
"0.6013399",
"0.5994696",
"0.5992655",
"0.5944142",
"0.5922484",
"0.592... | 0.0 | -1 |
POST /pricings POST /pricings.json | def create
@pricing = Pricing.new(pricing_params)
@pricing.job_id = @job.id
@pricing.current_status_id = @job.status_id
respond_to do |format|
if @pricing.save
@job.track 'Pricing Created', current_user, @pricing
JobMailer.pricing_created(@job.job_coordinator, current_user, @pricing, @job).deliver if @job.job_coordinator.present?
format.html { redirect_to @job, notice: 'Pricing was successfully created.' }
format.json { render :show, status: :created, location: @pricing }
else
format.html { render :new }
format.json { render json: @pricing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pruning = Pruning.new(params[:pruning])\n\n respond_to do |format|\n if @pruning.save\n format.html { redirect_to @pruning, notice: 'Pruning was successfully created.' }\n format.json { render json: @pruning, status: :created, location: @pruning }\n else\n format.... | [
"0.63434225",
"0.6273881",
"0.5882614",
"0.5847899",
"0.58154374",
"0.58146083",
"0.58103734",
"0.5804992",
"0.58024734",
"0.5796651",
"0.57824445",
"0.5651169",
"0.5633887",
"0.56298316",
"0.5629399",
"0.56250286",
"0.5610487",
"0.55892605",
"0.55814946",
"0.5568006",
"0.556... | 0.0 | -1 |
PATCH/PUT /pricings/1 PATCH/PUT /pricings/1.json | def update
respond_to do |format|
if @pricing.update(pricing_params)
format.html { redirect_to @pricing, notice: 'Pricing was successfully updated.' }
format.json { render :show, status: :ok, location: @pricing }
else
format.html { render :edit }
format.json { render json: @pricing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => ... | [
"0.6513617",
"0.6463458",
"0.6355148",
"0.6284701",
"0.62592167",
"0.6239334",
"0.6226876",
"0.61429924",
"0.61379766",
"0.6131252",
"0.61200714",
"0.61066806",
"0.6103352",
"0.6068752",
"0.6057017",
"0.60488963",
"0.6046652",
"0.6033621",
"0.60297453",
"0.59952945",
"0.59824... | 0.0 | -1 |
DELETE /pricings/1 DELETE /pricings/1.json | def destroy
@pricing.destroy
respond_to do |format|
format.html { redirect_to job_pricings_url(params[:job_id]), notice: 'Pricing was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pizzatopping.destroy\n respond_to do |format|\n... | [
"0.6958211",
"0.67508984",
"0.6685532",
"0.6669707",
"0.66653067",
"0.6619983",
"0.66123205",
"0.66045797",
"0.65930283",
"0.65773475",
"0.6557618",
"0.65439117",
"0.6542704",
"0.6517306",
"0.6516896",
"0.6516896",
"0.6516896",
"0.6516896",
"0.65158015",
"0.6515162",
"0.64988... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_pricing
@pricing = Pricing.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def pricing_params
params.require(:pricing).permit(
:non_taxable_amount,
:taxable_amount,
:tax_amount,
:pricing_category_id,
:description,
uploads_attributes: [:upload_category_id, :description, {uploads: []}])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
forward :results, :each, :empty?, :size, :slice, :[], :to_ary | def initialize(search)
@search = search
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results=(_arg0); end",
"def results=(_arg0); end",
"def results; end",
"def results; end",
"def results; end",
"def list_results(**opt)\n # May be overridden by the subclass.\n end",
"def results\n\t\t\tArray(result)\n\t\tend",
"def results\n raise NotImplementedError\n end",
"def r... | [
"0.6389657",
"0.6389657",
"0.609999",
"0.609999",
"0.609999",
"0.56568193",
"0.5620683",
"0.561432",
"0.55911744",
"0.55362815",
"0.5529498",
"0.5529482",
"0.5529482",
"0.5514142",
"0.5476682",
"0.54431796",
"0.53975415",
"0.53928256",
"0.53740644",
"0.5366607",
"0.53590417",... | 0.0 | -1 |
Returns the Elasticsearch response | def response
@response ||= search.execute!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response\n @search = RestClient.get @url\n @status_code = @search.code\n return output\n end",
"def response=(from_elasticsearch)\n @response = build_response(from_elasticsearch)\n end",
"def response\n @solr_response\n end",
"def response\n @response ||= da... | [
"0.6818697",
"0.6570573",
"0.656062",
"0.654207",
"0.6470385",
"0.64377344",
"0.63321555",
"0.6302207",
"0.6298956",
"0.6292994",
"0.6265832",
"0.6263927",
"0.6258994",
"0.62157404",
"0.62129587",
"0.6209217",
"0.61892074",
"0.6154169",
"0.612122",
"0.6093661",
"0.60889566",
... | 0.67737573 | 1 |
Returns the collection of "hits" from Elasticsearch | def results
@results ||= Results.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @hits\n end",
"def extract_hits(response)\n response[\"hits\"][\"hits\"]\n end",
"def get_elk_data(query)\n index = \"logstash-\" + Time.now.strftime(\"%Y.%m.%d\")\n url = \"/#{index}/#{@type}/_search\"\n\n req = Net::HTTP::Post.new( url, initheader = {'Content-Type' =>... | [
"0.7431543",
"0.6945823",
"0.6932085",
"0.6885368",
"0.6675206",
"0.64642984",
"0.6451699",
"0.6451699",
"0.6346892",
"0.6346892",
"0.6346892",
"0.62966555",
"0.6290347",
"0.62631303",
"0.624775",
"0.62094754",
"0.61494297",
"0.61020213",
"0.60409194",
"0.5998028",
"0.5963599... | 0.0 | -1 |
Returns the hash that was sent to ElasticSearch | def query
@query ||= search.query
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sha\n result_hash['sha']\n end",
"def index_signature\n Digest::SHA256.new(@gems.keys.sort.join(',')).to_s\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp... | [
"0.68766993",
"0.6690012",
"0.6654423",
"0.6594743",
"0.6510304",
"0.63654566",
"0.63654566",
"0.63654566",
"0.63654566",
"0.63654566",
"0.63654566",
"0.63654566",
"0.6338644",
"0.63239735",
"0.6314138",
"0.62833124",
"0.62648946",
"0.6244711",
"0.6227363",
"0.6211287",
"0.61... | 0.0 | -1 |
Returns the "took" time | def took
response['took']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time\n (1 + Time.now.to_i/10).ceil * 10\n end",
"def time_sec; Time.now.sec; end",
"def prep_time_passed\n return \"7:34\"\n end",
"def cooking_time\n end",
"def time_now_sec()\n\treturn Time.now.to_i - Date.today.to_time.to_i #Seconds since midnight\nend",
"def time_check thistime=nil\n ... | [
"0.7267915",
"0.72423375",
"0.7072865",
"0.7064362",
"0.69805026",
"0.6973894",
"0.69671714",
"0.69636244",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.69616187",
"0.6951056",
"0.69298154",
"0.69231033",
"... | 0.67887443 | 25 |
Returns whether the response timed out | def timed_out
response['timed_out']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_out?\n @timed_out\n end",
"def timed_out\n response['timed_out']\n end",
"def timeout?\n @status == :timeout\n end",
"def timed_out?\n @exception.class == TimeoutError\n end",
"def timed_out?\n @status == 'timed_out' || (@created_at + @timeout < current_ti... | [
"0.83728683",
"0.8078787",
"0.80597824",
"0.7927967",
"0.78737926",
"0.78737926",
"0.7818139",
"0.7419678",
"0.72444427",
"0.7215137",
"0.712132",
"0.70978194",
"0.69757986",
"0.6963222",
"0.6922648",
"0.67892027",
"0.6709675",
"0.67052424",
"0.66988105",
"0.66834825",
"0.663... | 0.8027616 | 3 |
Returns the statistics on shards | def shards
Hashie::Mash.new(response['_shards'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shards\n @data['shards']\n end",
"def shards\n @obj['shards']\n end",
"def shards\n Hashie::Mash.new(response['_shards'])\n end",
"def shard_count\n @obj['shard_count']\n end",
"def stats(params = {})\n response = client.get \"/_cluster/stats\", params.merge(a... | [
"0.79576683",
"0.7734038",
"0.7215613",
"0.6981806",
"0.67833483",
"0.6725822",
"0.67150795",
"0.65946573",
"0.6497365",
"0.6497365",
"0.64380133",
"0.63848907",
"0.6291129",
"0.6246736",
"0.61866385",
"0.6132732",
"0.61301464",
"0.61219454",
"0.61219454",
"0.60999954",
"0.60... | 0.71323246 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_author
@author = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
GET /topics GET /topics.json | def index
@topics = Admin::Topic.order(date: :desc).paginate(page: params[:page], per_page: 20)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(options = {})\n body = options.has_key?(:query) ? options[:query] : {}\n\n response = @client.get \"/api/topics\", body, options\n\n return response\n end",
"def all_topics\n topics = Feed.find(params[:feed_id]).topics\n render :json => topics\n end",
"def get_topics\n... | [
"0.77682394",
"0.7716166",
"0.76716393",
"0.764921",
"0.764921",
"0.7607581",
"0.7598844",
"0.74612015",
"0.7438228",
"0.7438228",
"0.7438228",
"0.74200195",
"0.7344391",
"0.7309161",
"0.73001784",
"0.72744423",
"0.7259863",
"0.72567606",
"0.72421056",
"0.7165324",
"0.7160435... | 0.6563502 | 79 |
GET /topics/1 GET /topics/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTopic id\n\n APICall(path: \"topics/#{id}.json\")\n\n end",
"def get(*topics)\n # FIXME: implement this\n end",
"def index\n @api_v1_topics = Api::V1::Topic.all\n end",
"def show\n @topic = Topic.find(params[:id])\n render 'api/v1/topics/show'\n end",
"def index\n @topi... | [
"0.79100204",
"0.752978",
"0.7478639",
"0.74760735",
"0.7353342",
"0.7353342",
"0.7353342",
"0.733868",
"0.7309574",
"0.7309574",
"0.7309574",
"0.7309574",
"0.7260803",
"0.7209662",
"0.71965647",
"0.7184025",
"0.7168444",
"0.715235",
"0.71514475",
"0.71494937",
"0.71198106",
... | 0.0 | -1 |
POST /topics POST /topics.json | def create
@topic = Admin::Topic.new(topic_params)
file = params[:admin_topic][:image] # ファイルを取得
unless file == nil
name = file.original_filename #ファイルのベース名
permits = ['.jpeg','.jpg','.gif','png']
if !permits.include?(File.extname(name).downcase)
@topic.errors.add(:image, "#{t('invaild_image')}")
render :new
elsif file.size > 10.megabyte
@topic.errors.add(:image, "#{t('too_big_image')}")
render :new
else
name = "#{@topic.date}#{File.extname(name).downcase}"
File.open("public/img/topics/#{name}", 'wb') { |f| f.write(file.read) }
@image.path = "img/topics/#{name}"
@image.save
redirect_to admin_images_path, notice: "#{t('notice.created',{model: "#{t('activerecord.models.admin/topic')}"})}"
end
else
if @topic.save
redirect_to @topic, notice: "#{t('notice.created',{model: "#{t('activerecord.models.admin/topic')}"})}"
else
render :new
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateTopic params = {}\n \n APICall(path: 'topics.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @topic = current_user.topics.build(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Top... | [
"0.7646912",
"0.72215015",
"0.7147597",
"0.71048796",
"0.69253516",
"0.69128174",
"0.6909308",
"0.6900496",
"0.68720603",
"0.68528986",
"0.68511266",
"0.6835014",
"0.6835014",
"0.68131256",
"0.6795055",
"0.67941535",
"0.6793219",
"0.6785232",
"0.6757005",
"0.67338824",
"0.673... | 0.0 | -1 |
PATCH/PUT /topics/1 PATCH/PUT /topics/1.json | def update
if params[:admin_topic][:image] != nil
file = params[:admin_topic][:image] # ファイルを取得
name = file.original_filename #ファイルのベース名
permits = ['.jpeg','.jpg','.gif','png']
if !permits.include?(File.extname(name).downcase)
@topic.errors.add(:image, 'の拡張子が正しくありません。')
render :edit
elsif file.size > 10.megabyte
@topic.errors.add(:image, 'のサイズが大きすぎます。10MBまでです。')
render :edit
else
name = "#{@topic.date}#{File.extname(name).downcase}"
File.open("public/img/topics/#{name}", 'wb') { |f| f.write(file.read) }
@topic.path = "img/topics/#{name}"
end
end
if @topic.update(topic_params)
redirect_to admin_topics_path, notice: "#{t('notice.updated',{model: "#{t('activerecord.models.admin/topic')}"})}"
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTopic id,params = {}\n \n APICall(path: \"topics/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update(params_topic)\n render json: topic, status: 200\n else\n render json... | [
"0.7385972",
"0.72638613",
"0.7235975",
"0.7106754",
"0.71053797",
"0.7086717",
"0.7035454",
"0.7000288",
"0.6989463",
"0.6969001",
"0.6918033",
"0.6902618",
"0.69013095",
"0.69013095",
"0.69013095",
"0.69013095",
"0.69013095",
"0.6858385",
"0.6852236",
"0.6794713",
"0.678513... | 0.0 | -1 |
DELETE /topics/1 DELETE /topics/1.json | def destroy
@topic.destroy
redirect_to admin_topics_url, notice: "#{t('notice.deleted',{model: "#{t('activerecord.models.admin/topic')}"})}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteTopic id\n \n APICall(path: \"topics/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @api_v1_topic.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_topics_url, notice: 'Topic was successfully destroyed.' }\n format.json { head :no_co... | [
"0.80882245",
"0.77483875",
"0.7718711",
"0.7695118",
"0.76939",
"0.767325",
"0.7624342",
"0.76194614",
"0.7606265",
"0.7606265",
"0.7606265",
"0.7606265",
"0.7606265",
"0.7606265",
"0.75579107",
"0.7512912",
"0.75068605",
"0.75068605",
"0.7487019",
"0.74806774",
"0.7463199",... | 0.6916038 | 92 |
Use callbacks to share common setup or constraints between actions. | def set_topic
@topic = Admin::Topic.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def topic_params
params.require(:admin_topic).permit(:title, :date, :game_id, :body, :path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use this method to change the base url in the configuration file so you can automate that instead of manually changing it everytime when you want to deploy the website | def change_base_url_to(url)
puts "Changing Base URL to #{url}.."
config = YAML.load_file('./config.yaml')
config['base_url'] = url
File.open('./config.yaml', 'w') do |file|
file.write(config.to_yaml)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_base_url\n $base_url = (ENV['base_url'].nil? || ENV['base_url'].empty?) ? CONFIG['default_base_url'] : ENV['base_url']\nend",
"def set_base_url(url)\n base_url = url\n end",
"def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end"... | [
"0.7845532",
"0.7616996",
"0.75371844",
"0.74058235",
"0.72033674",
"0.7171409",
"0.7164184",
"0.7077952",
"0.7075551",
"0.7037472",
"0.6949816",
"0.6933357",
"0.6933357",
"0.69325745",
"0.69269836",
"0.69226164",
"0.6859649",
"0.6854727",
"0.6837444",
"0.6830256",
"0.6815322... | 0.6474968 | 49 |
Recompile by removing the output directory and recompiling | def compile!
puts "Compiling website.."
puts %x[rm -rf output]
puts %x[nanoc compile]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recompile\n @compiled = nil\n compile\n end",
"def recompile\n unmemoize(:compile)\n compile\n end",
"def run\n require 'find'\n\n # Get compiled files\n # FIXME: requires #build_reps to have been called\n all_raw_paths = site.compiler.reps.map(&:raw_path)\n compiled_... | [
"0.78925484",
"0.7428471",
"0.63145036",
"0.6256976",
"0.62367916",
"0.6191898",
"0.6182008",
"0.6122942",
"0.6066936",
"0.596018",
"0.596018",
"0.5946813",
"0.5932332",
"0.59222364",
"0.5880459",
"0.58770186",
"0.5859209",
"0.5855951",
"0.5834373",
"0.5780552",
"0.57774895",... | 0.5881009 | 15 |
Prepares the deployment environment | def prepare!
%x[git checkout master]
unless %x[git status] =~ /nothing to commit \(working directory clean\)/
puts "Please commit your changes on the master branch before deploying!"
exit 1
end
puts "Creating and moving in to \"deployment\" branch.."
puts %x[git checkout -b deployment]
puts "Removing \"output\" directory from .gitignore.."
gitignore = File.read(".gitignore")
File.open(".gitignore", "w") do |file|
file.write(gitignore.gsub("output", ""))
end
change_base_url_to(BASE_URL)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)\n @local_env = local_environment\n end",
"def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n ... | [
"0.7854416",
"0.716899",
"0.6963667",
"0.6897151",
"0.6883221",
"0.6604209",
"0.65989554",
"0.64399326",
"0.64118904",
"0.62909156",
"0.6276987",
"0.62758446",
"0.6234075",
"0.6171824",
"0.6171824",
"0.6149578",
"0.61465997",
"0.6101835",
"0.60807157",
"0.605601",
"0.60434777... | 0.5927004 | 34 |
Moves back to the "master" branch and removes the "deployment" branch | def revert!
%x[git checkout master]
%x[git branch -D deployment]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_remote_branch\n Gitlab.delete_branch(GITLAB_DOCS_REPO, docs_branch)\n puts \"=> Remote branch '#{docs_branch}' deleted\"\nend",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end",
"def del_pr_branch(upstream, pr)\n `git checkout #{upstr... | [
"0.65013164",
"0.647334",
"0.6331507",
"0.62971276",
"0.6286837",
"0.6244811",
"0.6238575",
"0.6157786",
"0.6148607",
"0.60597867",
"0.5872756",
"0.5817269",
"0.57658017",
"0.57056934",
"0.57037026",
"0.5702156",
"0.5693086",
"0.5687689",
"0.56855243",
"0.5637075",
"0.5626367... | 0.6664314 | 0 |
Deploys the application via git to Heroku | def deploy!
puts "Adding and committing compiled output for deployment.."
puts %x[git add .]
puts %x[git commit -a -m "temporary commit for deployment"]
puts 'Deploying to Heroku..'
puts %x[git push heroku HEAD:master --force]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_heroku(name, app_url)\n deploy_loader = loader(\"Deploying and running installation of app...\", nil)\n branch_name = \"#{name}#{Time.now.strftime(\"%d-%m-%Y-%H-%M\")}\"\n url = get_stripped_url(app_url, false)\n stripped_url = get_stripped_url(app_url, true)\n @cmd.run(\"rm -rf .git\")\n @cmd.run... | [
"0.71579826",
"0.7017948",
"0.6674482",
"0.652579",
"0.63386816",
"0.62928325",
"0.6284587",
"0.6278408",
"0.6278031",
"0.6242105",
"0.6240848",
"0.61639583",
"0.6163154",
"0.6161402",
"0.6066167",
"0.6057182",
"0.6032029",
"0.6029914",
"0.6018813",
"0.60055673",
"0.59883595"... | 0.73289806 | 0 |
GET /post228s/1 GET /post228s/1.xml | def show
@post228 = Post228.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post228 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post196 = Post196.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post196 }\n end\n end",
"def show\n @post156 = Post156.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.x... | [
"0.64625955",
"0.6404714",
"0.63948685",
"0.6382449",
"0.6371166",
"0.63693124",
"0.6359341",
"0.63556087",
"0.63532364",
"0.63484436",
"0.6344434",
"0.6333708",
"0.6330074",
"0.6317445",
"0.63160217",
"0.63148",
"0.6313071",
"0.63130426",
"0.63118345",
"0.63110685",
"0.63084... | 0.657253 | 0 |
GET /post228s/new GET /post228s/new.xml | def new
@post228 = Post228.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post228 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\... | [
"0.76091754",
"0.7562553",
"0.7558096",
"0.7545368",
"0.7539777",
"0.75377095",
"0.75215393",
"0.7516615",
"0.7515717",
"0.7509708",
"0.7507919",
"0.75074285",
"0.75014573",
"0.7499618",
"0.74959385",
"0.7494691",
"0.7492714",
"0.749142",
"0.7480859",
"0.7478773",
"0.74780333... | 0.7593169 | 1 |
POST /post228s POST /post228s.xml | def create
@post228 = Post228.new(params[:post228])
respond_to do |format|
if @post228.save
format.html { redirect_to(@post228, :notice => 'Post228 was successfully created.') }
format.xml { render :xml => @post228, :status => :created, :location => @post228 }
else
format.html { render :action => "new" }
format.xml { render :xml => @post228.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully created.') }\n format.xml { render :xml => @post168, :status => :created, :location => @post168 }\n else\n ... | [
"0.61588204",
"0.60743934",
"0.59932625",
"0.5991364",
"0.5989231",
"0.59777015",
"0.5961903",
"0.5951394",
"0.5945478",
"0.5921862",
"0.59123564",
"0.59054923",
"0.5900057",
"0.5891721",
"0.58915085",
"0.58554155",
"0.58432776",
"0.58398086",
"0.5839604",
"0.5839028",
"0.583... | 0.6441563 | 0 |
PUT /post228s/1 PUT /post228s/1.xml | def update
@post228 = Post228.find(params[:id])
respond_to do |format|
if @post228.update_attributes(params[:post228])
format.html { redirect_to(@post228, :notice => 'Post228 was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post228.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def res... | [
"0.68652743",
"0.6474378",
"0.6397415",
"0.59842414",
"0.5910384",
"0.5908345",
"0.5888514",
"0.5863949",
"0.5862609",
"0.585665",
"0.58507454",
"0.5847584",
"0.58338493",
"0.58300304",
"0.581782",
"0.58171815",
"0.5813043",
"0.58057094",
"0.5788216",
"0.5787658",
"0.574755",... | 0.6181672 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.