query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
GET /success_cases/1 GET /success_cases/1.xml
def show @success_case = SuccessCase.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @success_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end", "def index\n @cases = Case.all\n\n respond_to do |format|\n format....
[ "0.6960763", "0.68474066", "0.66321915", "0.6408574", "0.6388847", "0.6146108", "0.614035", "0.61117876", "0.6077934", "0.6006697", "0.59975284", "0.5864014", "0.58488", "0.57850105", "0.5768482", "0.57328653", "0.57265514", "0.570103", "0.5697091", "0.56942356", "0.5686374",...
0.69731224
0
GET /success_cases/new GET /success_cases/new.xml
def new @success_case = SuccessCase.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @success_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end", "def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tes...
[ "0.7379976", "0.7356432", "0.7132841", "0.7100511", "0.70228857", "0.70228857", "0.70228857", "0.6960621", "0.68580955", "0.68580955", "0.68580955", "0.68343794", "0.67580044", "0.67448777", "0.67371255", "0.6714657", "0.6698058", "0.6698058", "0.669793", "0.66870165", "0.668...
0.79590297
0
POST /success_cases POST /success_cases.xml
def create @success_case = SuccessCase.new(params[:success_case]) respond_to do |format| if @success_case.save format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') } format.xml { render :xml => @success_case, :status => :created, :location => @suc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n ...
[ "0.6223572", "0.6124578", "0.6041465", "0.59874254", "0.58132744", "0.5776564", "0.57702976", "0.57531375", "0.5610341", "0.5606711", "0.5603246", "0.5596353", "0.55935186", "0.5586568", "0.55494636", "0.55362743", "0.54992384", "0.5491635", "0.54849863", "0.5481841", "0.5481...
0.6777465
0
PUT /success_cases/1 PUT /success_cases/1.xml
def update @success_case = SuccessCase.find(params[:id]) respond_to do |format| if @success_case.update_attributes(params[:success_case]) format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') } format.xml { head :ok } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n if @test_case.update_attributes(params[:test_case])\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { ren...
[ "0.64020705", "0.63010824", "0.6277032", "0.61977327", "0.6163166", "0.60461843", "0.60460335", "0.5972965", "0.5959552", "0.58750653", "0.5868366", "0.5858697", "0.58387727", "0.5832719", "0.58182806", "0.5773983", "0.57547796", "0.57533574", "0.5734928", "0.5732424", "0.571...
0.67778033
0
DELETE /success_cases/1 DELETE /success_cases/1.xml
def destroy @success_case = SuccessCase.find(params[:id]) @success_case.destroy respond_to do |format| format.html { redirect_to(success_cases_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_dele...
[ "0.7005719", "0.6901507", "0.68910986", "0.6741006", "0.66881853", "0.65945673", "0.65445304", "0.6529602", "0.6526828", "0.6489677", "0.6485505", "0.64402807", "0.63797367", "0.6323074", "0.63193613", "0.6314524", "0.6300124", "0.62943196", "0.62943196", "0.62943196", "0.628...
0.7248163
0
GET /book_pages GET /book_pages.json
def index @book_pages = @book.book_pages respond_to do |format| format.html # index.html.erb format.json { render json: @book_pages } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end", "def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n ...
[ "0.7726357", "0.7343921", "0.72196895", "0.7119161", "0.710017", "0.70552915", "0.70552915", "0.70552915", "0.70552915", "0.70552915", "0.70552915", "0.70552915", "0.6990951", "0.69235164", "0.68995583", "0.6894337", "0.68879795", "0.6860878", "0.6841784", "0.6833286", "0.674...
0.8323856
0
GET /book_pages/1 GET /book_pages/1.json
def show @book_page = @book.book_pages.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @book_page } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.80614024", "0.70933026", "0.7073454", "0.6975017", "0.6960861", "0.6908995", "0.6851252", "0.6851252", "0.6851252", "0.6851252", "0.6851252", "0.6851252", "0.6851252", "0.68386227", "0.6830326", "0.68099904", "0.6799294", "0.6797875", "0.676943", "0.67532647", "0.6724757",...
0.7899805
1
GET /book_pages/new GET /book_pages/new.json
def new @book_page = @book.book_pages.build respond_to do |format| format.html # new.html.erb format.json { render json: @book_page } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end...
[ "0.78558946", "0.777031", "0.777031", "0.777031", "0.777031", "0.777031", "0.77518016", "0.7743865", "0.7743865", "0.7714941", "0.7714616", "0.77012134", "0.76933473", "0.7639035", "0.7639035", "0.7639035", "0.7639035", "0.7639035", "0.7639035", "0.7639035", "0.7639035", "0...
0.8079944
0
POST /book_pages POST /book_pages.json
def create @book_page = @book.book_pages.build(params[:book_page]) respond_to do |format| if @book_page.save format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), notice: 'Book page was successfully created.' } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { r...
[ "0.717884", "0.6961408", "0.6532633", "0.6449121", "0.63141894", "0.62800825", "0.62715197", "0.6227736", "0.6213138", "0.6167685", "0.6164547", "0.6153755", "0.6140232", "0.6140142", "0.61047333", "0.61047333", "0.61047333", "0.61047333", "0.61047333", "0.61047333", "0.60986...
0.7337405
0
PUT /book_pages/1 PUT /book_pages/1.json
def update @book_page = @book.book_pages.find(params[:id]) respond_to do |format| if @book_page.update_attributes(params[:book_page]) format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", ...
[ "0.6517577", "0.6477979", "0.64186496", "0.63226795", "0.6307765", "0.62953144", "0.6287904", "0.62863904", "0.62825817", "0.62793595", "0.6258501", "0.62165517", "0.6196754", "0.61891025", "0.61538744", "0.61494046", "0.61468184", "0.6140256", "0.61393017", "0.6130775", "0.6...
0.7505768
0
DELETE /book_pages/1 DELETE /book_pages/1.json
def destroy @book_page = @book.book_pages.find(params[:id]) @book_page.destroy respond_to do |format| format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def destroy\n @book.destroy\n head :no_content\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_con...
[ "0.7497998", "0.7271345", "0.7245735", "0.7223038", "0.7223038", "0.7223038", "0.7223038", "0.7223038", "0.7223038", "0.7223038", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "0.7179205", "...
0.76314765
0
Remove comment from GitHub and then remove from database if successful. comment_id is unique identifier within repo scope.
def remove_comment repo, comment_id response = @@connection.delete do | request | request.url "repos/#{repo}/issues/comments/#{comment_id}" request.headers['Authorization'] = "token #{@@token}" end # look for Status: 204 No Content return if response.env[:status] != 204 # Comment ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_pull_request_comment(repo, comment_id, options = {})\n boolean_from_response(:delete, \"#{Repository.path repo}/pulls/comments/#{comment_id}\", options)\n end", "def delete_comment(user_name, repo_name, comment_id, params={})\n _update_user_repo_params(user_name, repo_name)\n ...
[ "0.7429408", "0.73979867", "0.72943497", "0.72670454", "0.72373676", "0.71700996", "0.71538055", "0.709939", "0.70149136", "0.70120627", "0.7011715", "0.6923734", "0.6894902", "0.6873935", "0.68291354", "0.6713199", "0.67110544", "0.664785", "0.66473407", "0.6607416", "0.6529...
0.8985965
0
2. I can find a list of exercises I did on a day
def exercise_on_a_day(date) #iterate through workouts and find workouts.user_id == self my_workouts = Workout.all.select do |workout| workout["user_id"] == self["id"] end # find where date == workout date workouts_for_date = my_workouts.find_all do |workouts| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact\n exercises_objs = InstExercise.where(id: exercises_ids)\n exercises_list.concat exercises_objs.collect(&:short_nam...
[ "0.69004864", "0.66495", "0.6513002", "0.6421902", "0.6390747", "0.62667465", "0.62470347", "0.62356615", "0.613157", "0.61276317", "0.6090618", "0.60681695", "0.6051292", "0.60158235", "0.60089785", "0.600201", "0.5993537", "0.5925204", "0.58687156", "0.58635896", "0.5845356...
0.67958313
1
3. I can see what muscle_groups I'm working on, ON a specific day
def muscle_groups_on_given_day(date) # exercise_name = self.exercise_on_a_day(date) my_workouts = Workout.all.select do |workout| workout["user_id"] == self["id"] end # find where date == workout date workouts_for_date = my_workouts.find_all do |workouts| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_by_day\n\n\tend", "def create_groups\n Group.create(name: \"MWF Morning\", days: [\"Monday\", \"Wednesday\", \"Friday\"], \n start_time: Time.local(2014, 8, 25, 8, 30, 0),\n end_time: Time.local(2014, 8, 25, 11, 30, 0)\n )\n Group.create(name: \"TTH Morning\", days: [\"Tuesday\", \"Thursday\...
[ "0.6002566", "0.58569956", "0.56904715", "0.5617393", "0.5524284", "0.54171973", "0.54171973", "0.54171973", "0.5362645", "0.5356421", "0.5317589", "0.52978045", "0.5297365", "0.5277178", "0.52527046", "0.5252113", "0.5245826", "0.5243614", "0.52301645", "0.5191251", "0.51689...
0.75964785
0
5. I can log my weight at the end of the week
def log_my_weight(weight) self.current_weight = weight self.save puts "Current weight #{weight}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_on_date(date)\n get_call(\"/1/user/#{@user_id}/body/log/weight/date/#{format_date(date)}.json\")\n end", "def add_demand(date, kwh)\n return 0 unless level(date) != :off_peak\n\n if kwh > 20\n p [kwh, date, level(date)]\n end\n\n super\n end", "def l...
[ "0.6330222", "0.6330165", "0.6274216", "0.6186279", "0.61630857", "0.61469686", "0.61299884", "0.6126017", "0.6092013", "0.6082499", "0.60398006", "0.6024036", "0.601397", "0.601093", "0.59977376", "0.59683645", "0.596083", "0.5955692", "0.59257203", "0.5868628", "0.58673453"...
0.6470833
0
6. I can also find out how much I lost compared to my starting weight
def weight_lost weight_fluctuate = current_weight - start_weight if current_weight < start_weight return "Down #{weight_fluctuate}. We are making progress!" else return "Up #{weight_fluctuate}. We are making gains!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_pints\n ((current_weight-14.25)/0.45).to_i > 0 ? ((current_weight-14.25)/0.45).to_i : 0\n end", "def weight_until_goal\n if weigh_ins.count > 0 && goal_weight > 0\n weigh_ins.first.current_weight - goal_weight\n elsif goal_weight > 0\n start_weight - goal_weight\n end\n end"...
[ "0.72903585", "0.71990526", "0.7162943", "0.71080804", "0.7094358", "0.706027", "0.69335914", "0.6790681", "0.6746478", "0.6721428", "0.66577303", "0.65615785", "0.65615785", "0.6550891", "0.65034646", "0.6503012", "0.64950174", "0.6450043", "0.6445826", "0.64377886", "0.6429...
0.7574595
0
8. A user can create a new exercise to add to the database
def create_new_exercise(exercise, muscle_group) Exercise.create(name: exercise, muscle_group: muscle_group) puts "Thank you for sharing!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exercise()\n\n #Gets all the information from the user\n message(\"Please enter a name for this new exercise: \")\n name = gets.chomp\n message(\"Please enter a description for \" + name)\n description = gets.chomp\n message(\"Please enter a duration (in seconds...
[ "0.74751145", "0.7390913", "0.7354178", "0.7330593", "0.70201266", "0.69600165", "0.69432503", "0.68735874", "0.68717223", "0.6845112", "0.6839777", "0.6768515", "0.6760509", "0.6731401", "0.6701907", "0.66982186", "0.66973287", "0.6657908", "0.6627169", "0.6590854", "0.65851...
0.7617992
0
7. a user can log a new workout
def log_new_workout(exercise, date) exercise_check = Exercise.search_exercise_by_name(exercise) exercise_instance = Exercise.all.find{|exercises| exercises.name == exercise} if exercise_check == "Sorry. We don't have any workouts called #{exercise}. Please return to the main menu to create this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkin\n if self.current_user == nil\n redirect_to \"/account/login\"\n end\n @workout = Workout.new\n @workout.workout_date = Time.now.to_date #.strftime(\"%x\")\n end", "def create\n @workout = Workout.new(workout_params)\n @workout.user = current_user!\n if @workout.save\n ...
[ "0.6320663", "0.62286055", "0.62044215", "0.6171314", "0.6063468", "0.60554296", "0.60316205", "0.59912103", "0.59694797", "0.5917017", "0.59159213", "0.59057707", "0.59057707", "0.587342", "0.587342", "0.5847069", "0.583834", "0.5815662", "0.5815662", "0.580446", "0.57572347...
0.7286219
0
GET /internships/1 GET /internships/1.json
def show @internship = Internship.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @internship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end", "def index\n @internships = Internship.all\n @current_user = User.find(cur...
[ "0.7740879", "0.69764984", "0.6767799", "0.67013353", "0.63916594", "0.6220732", "0.61513543", "0.61513543", "0.60837674", "0.6080233", "0.59437764", "0.592135", "0.59164244", "0.5878888", "0.56879574", "0.5631579", "0.55941236", "0.5592559", "0.55666196", "0.55666196", "0.55...
0.70109886
1
GET /internships/new GET /internships/new.json
def new @internship = Internship.new respond_to do |format| format.html # new.html.erb format.json { render json: @internship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n if User.find(current_user.id).internship_authorization\n @internship = Internship.new\n respond_with(@internship)\n else\n flash[:notice] = \"You cannot create an internship\"\n redirect_to internships_url\n end\n end", "def new\n @internships_user = InternshipsUser.new...
[ "0.73454684", "0.7180421", "0.70278883", "0.69433635", "0.68479043", "0.64587957", "0.64562577", "0.64349633", "0.6387319", "0.6384726", "0.6348978", "0.62818676", "0.6273575", "0.6244404", "0.61915636", "0.61668205", "0.61668205", "0.6164066", "0.6134938", "0.60961914", "0.6...
0.7488251
1
POST /internships POST /internships.json
def create @internship = Internship.new(params[:internship]) respond_to do |format| if @internship.save format.html { redirect_to @internship, notice: 'Internship was successfully created.' } format.json { render json: @internship, status: :created, location: @internship } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = current_user\n @internship = @user.internships.build(params[:internship])\n #@internship = Internship.new(params[:internship])\n\n respond_to do |format|\n if @internship.save\n format.html { redirect_to @internship, notice: 'Internship was successfully created.' }\n ...
[ "0.73136866", "0.6690699", "0.66506475", "0.62748206", "0.6123335", "0.6034088", "0.5963591", "0.5963591", "0.5858024", "0.58463675", "0.58346415", "0.5827366", "0.5743004", "0.5739911", "0.57243204", "0.555894", "0.54834324", "0.5419208", "0.5410784", "0.5372609", "0.5342743...
0.7115359
1
PUT /internships/1 PUT /internships/1.json
def update @internship = Internship.find(params[:id]) respond_to do |format| if @internship.update_attributes(params[:internship]) format.html { redirect_to @internship, notice: 'Internship was successfully updated.' } format.json { head :no_content } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @internship = Internship.find(params[:id])\n\n if @internship.update_attributes(params[:internship])\n flash[:notice] = 'Internship was successfully updated.'\n end\n respond_with(@internship)\n end", "def update\n @internship = Internship.find(params[:id])\n respond_to do |f...
[ "0.67898536", "0.6564102", "0.6362706", "0.63572764", "0.6338132", "0.62355536", "0.6099583", "0.5964067", "0.57670724", "0.576195", "0.57573897", "0.57526064", "0.57436526", "0.5684591", "0.56517744", "0.5623222", "0.5623222", "0.5623222", "0.55432534", "0.54426694", "0.5334...
0.68532103
1
returns an array with coordinates of the 1's
def find_ones ones_arr = [] @image.each_index do |row| @image[row].each_index do |column| if @image[row][column] == 1 ones_arr << { :x => column, :y => row } end end end return ones_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinate_array\n\t\t[latitude,longitude]\n\tend", "def coord_to_array(coordinates)\n x = coordinates[1]\n y = coordinates[0]\n conversion = ((x-1) * @size) + (y -1)\n end", "def find_ones\n ones_locations = []\n # => finding index of ROW and COL for each 1 in grid and storing as r...
[ "0.6963766", "0.69543713", "0.6941461", "0.68731517", "0.68238306", "0.6740419", "0.67121387", "0.67001784", "0.66407365", "0.66257495", "0.6544557", "0.6529268", "0.6504515", "0.6445447", "0.643228", "0.639688", "0.63561594", "0.6343164", "0.6342545", "0.63340247", "0.631005...
0.70944625
0
checks if pixel to set within bounds and sets to 1
def set_to_one(coords) if (0..@max_x).include?(coords[:x]) && (0..@max_y).include?(coords[:y]) @image[coords[:y]][coords[:x]] = 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted?(x, y)\n out_of_bounds?(x, y) || @image.color(x, y) == 0\n end", "def check_bounds\n\t\tif @x + SUB_TILE_WIDTH > @game_state.width\n\t\t\tupdate_x( -(@x + SUB_TILE_WIDTH - @game_state.width) )\n\t\telsif @x < 0\n\t\t\tupdate_x( @x.abs )\n\t\tend\n\t\tif @y + SUB_TILE_HEIGHT > @game_state.h...
[ "0.67354137", "0.6292363", "0.62778795", "0.62744015", "0.62700045", "0.6262882", "0.61338806", "0.61217105", "0.6086573", "0.60591453", "0.60400254", "0.60179925", "0.5917836", "0.59105843", "0.5884694", "0.58763045", "0.5857608", "0.58433056", "0.58242935", "0.5818207", "0....
0.6581896
1
randomly generates an image from template (random values are normally distributed with mean = characetristic , deviation = sigma)
def create_sample_image_from_template(image_template, sigma) random_characteristics = image_template.ideal_characteristics.map do |val| deviated = RandomGaussian.new(val, sigma).rand deviated = 0.0 if deviated < 0 deviated = 1 if deviated > 1 deviated end # values = image_template.id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate\n MiniMagick::Tool::Convert.new do |i|\n i.font random_font\n i.size image_size\n i.pointsize config[:font_size]\n i.fill config[:font_color]\n i.gravity \"center\"\n i.canvas config[:background]\n i.draw \"text 0,0 '#{text...
[ "0.57630605", "0.57064486", "0.5657136", "0.5654884", "0.5636625", "0.5624686", "0.5582114", "0.5519244", "0.5509578", "0.55075866", "0.54679877", "0.546257", "0.54451126", "0.5421123", "0.53978896", "0.53797156", "0.5363218", "0.5353453", "0.5342196", "0.53372324", "0.533225...
0.839465
0
Restarts the SSH service
def ssh_service_restart exec(Beaker::Command.new("stopsrc -g ssh")) exec(Beaker::Command.new("startsrc -g ssh")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_service_restart\n case self['platform']\n when /debian|ubuntu|cumulus|huaweios/\n exec(Beaker::Command.new(\"service ssh restart\"))\n when /(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/\n exec(Beaker::Command.new(\"systemctl restart sshd.serv...
[ "0.7639621", "0.72693604", "0.72511095", "0.7150708", "0.7125923", "0.71143454", "0.70740026", "0.70478565", "0.7003857", "0.6952376", "0.69177526", "0.6909844", "0.6908254", "0.68483293", "0.6836116", "0.6815306", "0.6783975", "0.67428356", "0.6728189", "0.6716245", "0.67110...
0.8223676
0
The maximum slack_before such that there is no collision with (the slack of) another reservation before the begins_at time This value could be negative, indicating that the begins_at value always collides with (the slack of) another reservation
def max_slack_before(begins_at) previous_reservation = Reservation.new(entity: self, begins_at: begins_at).previous (begins_at - previous_reservation.ends_at - previous_reservation.slack_after.minutes) / 1.minute if previous_reservation.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_slack_after(ends_at)\n next_reservation = Reservation.new(entity: self, ends_at: ends_at).next\n (next_reservation.begins_at - next_reservation.slack_before.minutes - ends_at) / 1.minute if next_reservation.present?\n end", "def prev_max() self.scheduling.prev_max end", "...
[ "0.6944257", "0.5714198", "0.5533224", "0.5465341", "0.5334713", "0.530633", "0.5301486", "0.52935106", "0.5217383", "0.5196414", "0.5178257", "0.51396817", "0.51160175", "0.5105772", "0.5103186", "0.50833255", "0.5077038", "0.50707185", "0.506407", "0.50526756", "0.5044178",...
0.79211324
0
The maximum slack_after such that there is no collision with (the slack of) another reservation after the ends_at time This value could be negative, indicating that the ends_at value always collides with (the slack of) another reservation
def max_slack_after(ends_at) next_reservation = Reservation.new(entity: self, ends_at: ends_at).next (next_reservation.begins_at - next_reservation.slack_before.minutes - ends_at) / 1.minute if next_reservation.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_slack_before(begins_at)\n previous_reservation = Reservation.new(entity: self, begins_at: begins_at).previous\n (begins_at - previous_reservation.ends_at - previous_reservation.slack_after.minutes) / 1.minute if previous_reservation.present?\n end", "def down_boundary\n Time.new - down_interv...
[ "0.677644", "0.5843807", "0.57572776", "0.5753104", "0.57078505", "0.56829065", "0.5681175", "0.5587056", "0.541402", "0.5399369", "0.5351964", "0.5346725", "0.53122896", "0.5284753", "0.5260341", "0.52282315", "0.5228178", "0.5179661", "0.51731735", "0.51653385", "0.51583165...
0.7936712
0
Set property values by an list/array (matching array index on property index) or hash (matching hash key on property name or index depending on key type)
def set_properties(*values) if values.size == 1 && values.first.is_a?(Hash) # We are dealing with a hash values.first.each do |key, index| self.set_property(key, value) end else # We are dealing with a list/array values.flatten.each_with_index do |value, index| self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(property, value); end", "def []=(key, value)\n k = key.to_s\n if value.nil?\n remove_property(k)\n elsif (Array === value)\n case value[0]\n when NilClass\n set_property(k, [].to_java(:string))\n when String\n set_property(k, value.to_j...
[ "0.63857895", "0.6379823", "0.6344935", "0.62090087", "0.6051336", "0.59849536", "0.59822863", "0.59011275", "0.58627415", "0.5824263", "0.58038026", "0.5799478", "0.5796597", "0.579442", "0.5773002", "0.57089293", "0.57089293", "0.56992245", "0.5680076", "0.5680076", "0.5680...
0.7385258
0
Returns an array 'board' of rows Each row is an array with randomly assigned values from 'colours' array
def get_board(width, height) # Create a new 2D array board = Array.new($board_height) {Array.new($board_width)} # Each element will be assigned a random value from 'colours' # That is done by choosing a random index of the 'colours' array (0...$board_height).each do |row| (0...$board_width).each do |cel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_board(width, height)\n #array with all possible colors\n colors = [:red, :blue, :green, :yellow, :cyan, :magenta]\n\n board = Array.new(height)\n (0..height-1).each do |i|\n board[i] = Array.new(width)\n (0..width-1).each do |j|\n board[i][j] = colors.sample\n end\n end\n\n return board...
[ "0.7755951", "0.77496403", "0.76519626", "0.7622318", "0.7169492", "0.696025", "0.68786216", "0.667716", "0.65812236", "0.65675664", "0.65639997", "0.64597964", "0.64535964", "0.64436233", "0.6436676", "0.6432895", "0.6426898", "0.6418176", "0.6403544", "0.63710356", "0.63389...
0.8066209
0
update_board method used to update the board after the user choose a new colours First the top left field is updated to the new colour For each neighbour field that has the same colour as the first field had before changing it, recursively update that field as well
def update_board(board,new_colour,old_colour,i,j) # Update field colour board[i][j]= new_colour # Check if there is a neighbour on top and if that neighbour has the same colour as the previous colour # If yes, then that neighbour is chosen to be updated in turn if (i-1) >=0 && board[i-1][j] == old_colou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbour_update(board,width,height,next_colour,i,j,count,first_block,finished_game_counter,current_score)\n \n #if condition checking if field at i,j has the same colour as the top-left field\n if board[i][j] == first_block\n \n #checks if it is the correct element and changes its colour, (c == j ?) ...
[ "0.7696163", "0.7116067", "0.7082177", "0.7061606", "0.6974447", "0.69378155", "0.6806526", "0.65437865", "0.65291166", "0.64986086", "0.64369404", "0.63301635", "0.629596", "0.6283609", "0.6259597", "0.6253917", "0.62289274", "0.6198834", "0.6178496", "0.61703223", "0.612284...
0.8346162
0
POST /bingos or /bingos.json
def create @bingo = Bingo.new(bingo_params) respond_to do |format| if @bingo.save format.html { redirect_to @bingo, notice: "Bingo was successfully created." } format.json { render :show, status: :created, location: @bingo } else format.html { render :new, status: :unprocess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(bin_params)\n @rest.post('save', bin_params)\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend", "def post(path, data = {})\n request 'POST...
[ "0.60138226", "0.59686786", "0.5959125", "0.59083915", "0.5904262", "0.5836802", "0.5806822", "0.5793631", "0.5792562", "0.57917786", "0.5762452", "0.57120883", "0.5661779", "0.5615058", "0.55956227", "0.5592449", "0.55892354", "0.55570793", "0.5538656", "0.55330443", "0.5530...
0.6080252
0
PATCH/PUT /bingos/1 or /bingos/1.json
def update respond_to do |format| if @bingo.update(bingo_params) format.html { redirect_to @bingo, notice: "Bingo was successfully updated." } format.json { render :show, status: :ok, location: @bingo } else format.html { render :edit, status: :unprocessable_entity } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html ...
[ "0.63641137", "0.61937726", "0.6184194", "0.61706156", "0.60791093", "0.60707104", "0.6046116", "0.60317063", "0.6023285", "0.6017018", "0.60140634", "0.6006524", "0.6001912", "0.5988944", "0.5987002", "0.5956738", "0.5949767", "0.59442556", "0.5937486", "0.59274864", "0.5908...
0.6497161
0
Return bool indicating if spec file satisfies any file in gem
def has_file_satisfied_by?(spec_file) file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_file_satisfied_by?(spec_file)\n file_paths.any? { |gem_file| RPM::Spec.file_satisfies?(spec_file, gem_file) }\n end", "def gemspec?\n !gemspecs.empty?\n end", "def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n ...
[ "0.79255515", "0.77250177", "0.7615491", "0.7449048", "0.7422652", "0.73918724", "0.73804665", "0.73491824", "0.73491824", "0.73491824", "0.7323001", "0.7234387", "0.71082455", "0.70332307", "0.69598573", "0.69517666", "0.6900563", "0.68946946", "0.68860674", "0.68841285", "0...
0.78640854
1
Download the local gem and return it as a string
def download_gem self.class.download_gem @name, @version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_gem\n self.class.download_gem @name, @version\n end", "def gem_path\n @path || downloaded_gem_path\n end", "def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end", "def downloaded_gem_path\n self.clas...
[ "0.7534541", "0.67299455", "0.67081475", "0.6692183", "0.6659706", "0.6656821", "0.6645297", "0.6597834", "0.6492952", "0.6471331", "0.6405053", "0.62191784", "0.62173826", "0.6206112", "0.6204636", "0.6111781", "0.6081143", "0.60659784", "0.60081154", "0.60081154", "0.600643...
0.74488395
1
Returns path to gem, either specified one of downloaded one
def gem_path @path || downloaded_gem_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem_path\n @path || downloaded_gem_path\n end", "def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end", "def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end", "def get_path(gemname, version_req)\n return gemname if ge...
[ "0.8079479", "0.75119436", "0.7334652", "0.7258571", "0.7078767", "0.70415556", "0.70225894", "0.69959354", "0.699445", "0.69817716", "0.69349766", "0.69349766", "0.69193554", "0.6903768", "0.68749917", "0.68707067", "0.6867492", "0.674238", "0.6721111", "0.6708973", "0.66696...
0.79183096
1
Return diff of content in this gem against other
def diff(other) require_cmd! diff_cmd out = nil begin this_dir = unpack other_dir = other.is_a?(Polisher::Gem) ? other.unpack : (other.is_a?(Polisher::Git::Repo) ? other.path : other) result = AwesomeSpawn.run("#{diff_cmd} -r #{this_dir} #{oth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_diff wA, wB\n\n # puts \"---------------------------------> generating diff for #{wA} and #{wB}\"\n # sort by magnitude of id\n # returns w1 has earlier id than w2\n wA < wB ? w1id = wA : w1id = wB\n wA < wB ? w2id = wB : w2id = wA\n\n # get refs to whole works\n w1 = Work.find(w1...
[ "0.6789137", "0.67606056", "0.6752636", "0.66995335", "0.6696369", "0.6584416", "0.65363497", "0.6480649", "0.6407898", "0.6405153", "0.63680464", "0.63475615", "0.6333311", "0.63078976", "0.63058686", "0.6257464", "0.6254554", "0.6252139", "0.6249316", "0.6248344", "0.622299...
0.7319598
0
The plane method is used to retrieve the plane of the arc. Refer to the Geom module for instructions to create a plane.
def plane end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end", "def distance_to_plane(plane)\n end", "def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end", "def add_p...
[ "0.7409262", "0.6844087", "0.6587345", "0.649445", "0.63328856", "0.62948936", "0.6240347", "0.6212489", "0.6106073", "0.609031", "0.60835725", "0.5778194", "0.5769269", "0.57184255", "0.55684406", "0.5518494", "0.5518494", "0.5484175", "0.5458743", "0.54289806", "0.5363179",...
0.70926946
1
The start_angle method is used to retrieve the angle of the start of the arc, measured from the X axis in radians.
def start_angle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_angle\n MSPhysics::Newton::Hinge.get_start_angle(@address)\n end", "def start_angle=(angle)\n MSPhysics::Newton::Hinge.set_start_angle(@address, angle)\n end", "def test_start_angle_large_angle\n start_angle = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicu...
[ "0.7077961", "0.6539086", "0.64301413", "0.6416333", "0.640749", "0.6346705", "0.62377787", "0.62319887", "0.6158887", "0.61364585", "0.60976297", "0.59716296", "0.58776385", "0.5831484", "0.57564276", "0.57015544", "0.5690798", "0.5688671", "0.56833404", "0.5678322", "0.5658...
0.7093622
0
The xaxis method is used to retrieve the X axis of the coordinate system for the curve. Note that the length of the returned vector is equal to the radius of the underlying curve.
def xaxis end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_x_axis(params = {})\n @x_axis = convert_axis_args(@x_axis, params)\n end", "def axis\n axes = Sketchup.active_model.axes\n\n axes.axes.find do |axis|\n position.on_line?([axes.origin, axis])\n end\n end", "def get_x_axis_labels\n 5\n end", "def x\n @point[0...
[ "0.62835145", "0.60586345", "0.59716743", "0.5947001", "0.5842188", "0.5832786", "0.58136344", "0.57748896", "0.5742154", "0.571066", "0.5696833", "0.5691088", "0.56574905", "0.56332403", "0.5585058", "0.5582857", "0.5582857", "0.55502814", "0.5471296", "0.5453739", "0.543304...
0.6580192
0
The yaxis method is used to retrieve the Y axis of the coordinate system for the curve. Note that the length of the returned vector is equal to the radius of the underlying curve.
def yaxis end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_y_axis(params = {})\n @y_axis = convert_axis_args(@y_axis, params)\n end", "def vector_y max_value = 1\n max_value * Math.sin(self.to_radians)\n end", "def set_y2_axis(params = {})\n @y2_axis = convert_axis_args(@y2_axis, params)\n end", "def test_yaxis_api_example\n v = nil\n ...
[ "0.6863317", "0.67769736", "0.65913993", "0.64641255", "0.646231", "0.61885643", "0.61414677", "0.60565275", "0.5988228", "0.5988228", "0.5984578", "0.59601915", "0.59322524", "0.59203273", "0.59192294", "0.59120923", "0.59009117", "0.58864105", "0.5878128", "0.58259577", "0....
0.7082605
0
Set the needed paths. install_dir: The gems will be temporarily installed into this directory. Caution: Before installing the directory will be delete. jar_dir: The directory where the JAR files will be put.
def setup(install_dir, jar_dir) @install_dir = install_dir @jar_dir = jar_dir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundle\n raise \"Paths not given! Call setup first.\" if @install_dir.nil? || @jar_dir.nil?\n gems_jar = File.join(jar_dir, 'gems.jar')\n default_options = { :generate_rdoc => false, \n :generate_ri => false,\n :install_dir => install_dir }\n FileUtils....
[ "0.67380136", "0.5933493", "0.58997345", "0.58959854", "0.5750506", "0.5717784", "0.568383", "0.5610892", "0.55940956", "0.55603445", "0.5547495", "0.55282176", "0.5518102", "0.5503688", "0.5503688", "0.5475778", "0.5475611", "0.546512", "0.5462571", "0.544692", "0.5440849", ...
0.7811157
0
Bundles the required gems into a JAR file. Before the gems are packed into the JAR, all JARs inside the gems are moved to the jar_dir.
def bundle raise "Paths not given! Call setup first." if @install_dir.nil? || @jar_dir.nil? gems_jar = File.join(jar_dir, 'gems.jar') default_options = { :generate_rdoc => false, :generate_ri => false, :install_dir => install_dir } FileUtils.rm_rf install...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bundled_gems\n return unless bundle_gems\n\n if bundle_local\n logger.trace 'Adding bundler filer to jar locally...'\n else\n logger.trace 'Adding bundler files to jar...'\n end\n\n require 'bundler'\n begin\n gemfile_path, lockfile_path ...
[ "0.7421737", "0.68111247", "0.6689431", "0.6677503", "0.64717484", "0.63810694", "0.634262", "0.6281837", "0.62714773", "0.6116783", "0.60159737", "0.5992325", "0.59511906", "0.5786924", "0.5767364", "0.5765505", "0.57531726", "0.56808", "0.55749744", "0.5507944", "0.54144675...
0.74910843
0
POST /daties POST /daties.json
def create @daty = current_user.daties.build(daty_params) respond_to do |format| if @daty.save format.html { redirect_to @daty, notice: 'Daty was successfully created.' } format.json { render :show, status: :created, location: @daty } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end", "de...
[ "0.5969446", "0.5880498", "0.5841724", "0.5801228", "0.5745463", "0.5705525", "0.5697604", "0.56937057", "0.56911564", "0.5650348", "0.5620837", "0.56168604", "0.56119776", "0.5587607", "0.55873734", "0.5577817", "0.5567594", "0.55527216", "0.55085063", "0.5497819", "0.548352...
0.6704057
0
DELETE /daties/1 DELETE /daties/1.json
def destroy @daty.destroy respond_to do |format| format.html { redirect_to daties_url, notice: 'Daty was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.jso...
[ "0.71012366", "0.69983524", "0.69983524", "0.6914332", "0.68503565", "0.6837376", "0.6819457", "0.68034667", "0.67860085", "0.6740459", "0.6704675", "0.6671048", "0.66459", "0.6619549", "0.65895253", "0.656336", "0.65559727", "0.65557826", "0.6552506", "0.65391463", "0.652338...
0.70612794
1
Prints out the coin attributes for the Coin object with terminaltable gem
def attributes table = terminal_table do |t| t.title = name.upcase t.add_row ["Price USD:", "$#{price_usd}"] t.add_row ["Price BTC:", "#{price_btc}"] t.add_row ["Market Cap USD:", "$#{market_cap_usd}"] t.add_row ["Change Last 24h:", "#{percent_change_24h}%"] t.add_row ["Last Upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_coin_names\n coin_names_arrays.each do |coin|\n coin.each do |name|\n index = name.slice!(/\\d+\\s/).strip\n table = terminal_table do |t|\n t.add_row [index, name]\n t.style = { all_separators: true, width: 60 }\n end\n puts table\n end\n y...
[ "0.70183617", "0.68653435", "0.6565183", "0.651299", "0.647336", "0.6469669", "0.63120645", "0.629826", "0.62857366", "0.6111504", "0.6110223", "0.5978575", "0.59607655", "0.59492505", "0.59262216", "0.58954006", "0.58858734", "0.588126", "0.5869724", "0.58365005", "0.5806135...
0.746819
0
Using the options build when the commandline was parsed, instantiate a new Capistrano configuration, initialize it, and execute the requested actions. Returns the Configuration instance used, if successful.
def execute! config = instantiate_configuration(options) config.debug = options[:debug] config.dry_run = options[:dry_run] config.preserve_roles = options[:preserve_roles] config.logger.level = options[:verbose] set_pre_vars(config) load_recipes(config) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_configuration(options={}) #:nodoc:\n Capistrano::Configuration.new(options)\n end", "def instantiate_configuration(options={})\n config = Capistrano::Configuration.new(options)\n config.logger = logger\n config\n end", "def execute!\n config = instantiate_conf...
[ "0.7152716", "0.6579198", "0.6338743", "0.6274714", "0.6095499", "0.59507096", "0.59278", "0.57823443", "0.5697909", "0.5646606", "0.5614647", "0.5561333", "0.55549026", "0.55056256", "0.5439381", "0.5431543", "0.5408432", "0.53939605", "0.53827214", "0.53669345", "0.5340831"...
0.66710156
1
The current_user can be found in the JWT payload; eagerly load the user's roles so they can be discriminated against
def current_user @current_user ||= User.includes(:roles).find_by(id: payload['user_id']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n @current_user ||= CurrentUser.includes(:roles).find_by(email: id_token[:email])\n end", "def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #...
[ "0.6946939", "0.6665169", "0.65388304", "0.64807844", "0.64038014", "0.63818717", "0.636937", "0.6247758", "0.62351215", "0.62340903", "0.62236655", "0.6103606", "0.6083097", "0.6069289", "0.606571", "0.6015878", "0.5993976", "0.5985258", "0.5981403", "0.5970841", "0.5966524"...
0.7442987
0
called after the user has been destroyed delete all user maps
def delete_maps own_maps.each do | map | logger.debug "deleting map #{map.inspect}" map.destroy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_users\n @users = {}\n end", "def clear_users\n @users = {}\n end", "def finalize!\n @users = nil if @users == UNSET_VALUE\n end", "def destroy\n @usermap.destroy\n respond_to do |format|\n format.html { redirect_to usermaps_url, notice: 'Usermap was su...
[ "0.71513337", "0.7066254", "0.70412266", "0.68661004", "0.6790899", "0.67540103", "0.6628399", "0.65500426", "0.65495676", "0.6542638", "0.65141034", "0.651373", "0.6508905", "0.6505024", "0.64683336", "0.6451432", "0.64459807", "0.63865954", "0.6368416", "0.63560957", "0.634...
0.7356118
1
Set meta tags for the page. See MetaTags::ViewHelperset_meta_tags for details.
def set_meta_tags(meta_tags) self.meta_tags.update(meta_tags) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_page_meta_tags\n req = self.request\n set_meta_tags_for_url_path(req.base_url, req.fullpath)\n end", "def set_meta\n meta.tap do |m|\n m.tag = [{\n system: META_SYSTEM,\n code: META_CODE,\n display: META_DISPLAY\n }]\n ...
[ "0.7819052", "0.7375335", "0.71944946", "0.673408", "0.6650074", "0.6561222", "0.6538302", "0.65313774", "0.64864284", "0.6444286", "0.64038604", "0.6388647", "0.63083726", "0.61532444", "0.6114086", "0.61054283", "0.61012495", "0.6074484", "0.6074484", "0.6043993", "0.603146...
0.816145
0
routines to add: is mysql even installed? is mysql process started? is mysql listening at all on remote node? check the cluster status on a remote node start the mysql service with the given address restart the mysql service cos the cluster is complete
def create # this routine creates the cluster - if this runs, exists? has exited false # first we check all the nodes to ensure mysql is listening, and if the # wsrep_cluster_status is primary. If one is, we'll join it. # array cluster_servers is the list of hosts to check first_node = true ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_mysql_presence(host,user,system_user)\n Net::SSH.start(host,system_user, {auth_methods: %w( publickey )}) do |ssh|\n output = ssh.exec!(\"ps -U #{user} -u #{user} u\")\n if output =~ /mysql/\n $results += 1\n # Grab the port number. This requires ruby 1.9.2+\n /port=...
[ "0.6725727", "0.6241318", "0.6231221", "0.5955846", "0.5892616", "0.5754152", "0.5713558", "0.5579522", "0.5471411", "0.5470958", "0.5350067", "0.53359824", "0.5333004", "0.5332093", "0.5330134", "0.5313745", "0.53044957", "0.52969456", "0.5276121", "0.52760583", "0.5268439",...
0.6929079
0
GET /report_orders_by_users GET /report_orders_by_users.json
def index @report_orders_by_users = ReportOrdersByUser.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_report_orders_by_user\n @report_orders_by_user = ReportOrdersByUser.find(params[:id])\n end", "def show_orders\n @user = User.find_by_sql [\"select * from users where email = ? and users.status = 'admin'\", params[:email]]\n if @user.count != 0\n @orders = UsersOrder.find_by_sql [\"sel...
[ "0.68145066", "0.6755658", "0.6679018", "0.66612995", "0.66135854", "0.65507966", "0.652272", "0.6500816", "0.6461309", "0.64477193", "0.6438078", "0.6390728", "0.63844866", "0.63711613", "0.634273", "0.63385", "0.6317462", "0.63109976", "0.63023907", "0.6298229", "0.62834126...
0.7475197
0
POST /report_orders_by_users POST /report_orders_by_users.json
def create @report_orders_by_user = ReportOrdersByUser.new(report_orders_by_user_params) respond_to do |format| if @report_orders_by_user.save format.html { redirect_to @report_orders_by_user, notice: 'Report orders by user was successfully created.' } format.json { render :show, status: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_report_orders_by_user\n @report_orders_by_user = ReportOrdersByUser.find(params[:id])\n end", "def report_orders_by_user_params\n params.require(:report_orders_by_user).permit(:date_start, :date_end, :file_path)\n end", "def index\n @report_orders_by_users = ReportOrdersByUser.all\n ...
[ "0.66577274", "0.64084363", "0.63864094", "0.5824153", "0.5812877", "0.57943356", "0.5770415", "0.5760044", "0.5687011", "0.5639972", "0.562532", "0.5625303", "0.56098807", "0.5601437", "0.5571733", "0.55702835", "0.55526996", "0.55346286", "0.5531137", "0.5522815", "0.551995...
0.67492145
0
PATCH/PUT /report_orders_by_users/1 PATCH/PUT /report_orders_by_users/1.json
def update respond_to do |format| if @report_orders_by_user.update(report_orders_by_user_params) format.html { redirect_to @report_orders_by_user, notice: 'Report orders by user was successfully updated.' } format.json { render :show, status: :ok, location: @report_orders_by_user } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_report_orders_by_user\n @report_orders_by_user = ReportOrdersByUser.find(params[:id])\n end", "def update #only patch owned reports, do not edit client/user since their ids are in the routing\n @report = Report.find_by(id: params[:id])\n if current_user == @report.user\n ...
[ "0.64363295", "0.6355397", "0.60047567", "0.5926511", "0.5862247", "0.5862247", "0.5828066", "0.57878584", "0.5785959", "0.5712101", "0.5700746", "0.57002056", "0.57001054", "0.5678302", "0.5658115", "0.56548655", "0.5648543", "0.56467175", "0.56434417", "0.5591606", "0.55872...
0.71874124
0
DELETE /report_orders_by_users/1 DELETE /report_orders_by_users/1.json
def destroy @report_orders_by_user.destroy respond_to do |format| format.html { redirect_to report_orders_by_users_url, notice: 'Report orders by user was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_reports = UserReport.find(params[:id])\n @user_reports.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_report = UserReport.find(params[:id])\n @user_report.destroy\n\n...
[ "0.69389147", "0.6922593", "0.6921318", "0.688571", "0.68740296", "0.6824981", "0.6777517", "0.6749769", "0.6729472", "0.6608752", "0.66079783", "0.66079783", "0.66079783", "0.6607709", "0.6603542", "0.65991527", "0.65624213", "0.6513876", "0.64958704", "0.6470223", "0.645544...
0.7641855
0
Returns the point offset in a 3D space
def view_offset @position + Moon::Vector3[@view.position, 0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(point3)\n (@x*point3.x)+(@y*point3.y)+(@z*point3.z)\n end", "def distance_to(point3)\n Math.sqrt(((@x-point3.x)**2)+((@y-point3.y)**2)+((@z-point3.z)**2))\n end", "def to_p\n Point3.new(@x, @y, @z)\n end", "def to_ole_point3d(pt)\n case pt\n when ole_point3d?(pt)\n ...
[ "0.6346933", "0.6281096", "0.60767937", "0.60765", "0.5999813", "0.5917599", "0.59052354", "0.5872226", "0.57737666", "0.5761197", "0.5752305", "0.57245857", "0.5684961", "0.56696993", "0.5660874", "0.5654038", "0.56280303", "0.5623192", "0.5601071", "0.55684835", "0.5563004"...
0.654384
0
Retrieve a response from the Solr endpoint for a faceted query
def get_fq_solr_response(fq) solr_url = @blacklight_context.connection_config[:url] conn = Faraday.new(url: solr_url) do |faraday| faraday.request :url_encoded # form-encode POST params faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end facet_request = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response\n @solr_response\n end", "def facet_field_response(facet_field, extra_controller_params = {})\n query = search_builder.with(search_state).facet(facet_field)\n repository.search(query.merge(extra_controller_params))\n end", "def get_facet_field_response(facet_field, req...
[ "0.7313156", "0.6917074", "0.68818057", "0.67214376", "0.67175853", "0.66293263", "0.6620243", "0.66040045", "0.65962744", "0.6509962", "0.64730144", "0.64703125", "0.64196396", "0.64146954", "0.64047676", "0.6392621", "0.6349886", "0.6235467", "0.62038237", "0.61694777", "0....
0.7855126
0
Retrieve the URL for the current Blacklight Solr core
def core_url @blacklight_context.default_index.connection.uri.to_s.gsub(%r{^.*\/solr}, '/solr') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solr_url\n @solr_url ||= @configurations[:solr_url]\n end", "def solr_url(interactive = false)\n #proto = 'http'\n #host = 'junco.lib.virginia.edu'\n #port = '8080'\n #path = [\"#{proto}://#{host}:#{port}\"]\n #path << 'solr'\n #path << '#' if interactive\n #path << 'test_core...
[ "0.7646296", "0.7452171", "0.74510896", "0.7385991", "0.7316113", "0.73108196", "0.6834491", "0.67645246", "0.6702329", "0.65297663", "0.65108895", "0.6494828", "0.64305025", "0.63882464", "0.63510615", "0.63510615", "0.63382876", "0.63382876", "0.633765", "0.6331339", "0.630...
0.85916424
0
GET /nostros/1 GET /nostros/1.xml
def show @nostro = Nostro.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @nostro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\"...
[ "0.6901335", "0.6396159", "0.6196773", "0.61746377", "0.6161963", "0.6118572", "0.61151767", "0.60900253", "0.6072972", "0.6067995", "0.60664916", "0.60654014", "0.60654014", "0.60650927", "0.60551906", "0.60236746", "0.6004392", "0.5989335", "0.59885484", "0.596438", "0.5960...
0.6946634
0
GET /nostros/new GET /nostros/new.xml
def new @nostro = Nostro.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @nostro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { rend...
[ "0.7445369", "0.72307926", "0.7074972", "0.7062118", "0.69354063", "0.6826278", "0.6825546", "0.6811856", "0.6811856", "0.6792888", "0.67503744", "0.6748164", "0.67480785", "0.6734063", "0.67285764", "0.6708153", "0.67050153", "0.67032295", "0.6697795", "0.66938704", "0.66930...
0.7582463
0
POST /nostros POST /nostros.xml
def create @nostro = Nostro.new(params[:nostro]) respond_to do |format| if @nostro.save flash[:notice] = 'Nostro was successfully created.' format.html { redirect_to(@nostro) } format.xml { render :xml => @nostro, :status => :created, :location => @nostro } else for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @nossos_servico = NossosServico.new(params[:nossos_servico])\n\n respond_to do |format|\n if @nossos_servico.save\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully created.') }\n format.xml { render :xml => @nossos_servico, :status => :c...
[ "0.6355915", "0.58120847", "0.5717723", "0.56872594", "0.56658995", "0.5664846", "0.5642912", "0.5571463", "0.5539087", "0.5535714", "0.55220515", "0.5521727", "0.5511493", "0.54980856", "0.5478035", "0.54765356", "0.5456686", "0.5408036", "0.53966355", "0.53667223", "0.53656...
0.69210804
0
DELETE /nostros/1 DELETE /nostros/1.xml
def destroy @nostro = Nostro.find(params[:id]) @nostro.destroy respond_to do |format| format.html { redirect_to(nostros_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def netdev_resxml_delete( xml )\n top = netdev_res...
[ "0.70827276", "0.68553454", "0.6797858", "0.6762885", "0.67520285", "0.66067946", "0.6577651", "0.65543896", "0.6553366", "0.6544849", "0.65077657", "0.6503192", "0.64978135", "0.6471474", "0.64684904", "0.6454236", "0.6452577", "0.6452577", "0.6452577", "0.6452577", "0.64525...
0.70654964
1
If children need to do anything special on apply, now's their chance.
def apply_children end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children\n child_check\n super\n end", "def child_condition; end", "def pre_apply_child(child_index, workitem, forget)\n\n child_fei = h.fei.merge(\n 'expid' => \"#{h.fei['expid']}_#{child_index}\",\n 'subid' => Ruote.generate_subid(h.fei.inspect))\n\n h.children << child_fei...
[ "0.61365366", "0.60137874", "0.59377193", "0.59209", "0.58969873", "0.56040144", "0.555418", "0.5551648", "0.55171067", "0.5510516", "0.54537374", "0.5450382", "0.5406335", "0.5375468", "0.53610283", "0.53539085", "0.5327885", "0.5327885", "0.53199863", "0.53199863", "0.53199...
0.69449115
0
If our object has a blueprint and a max_field equivalent of a field, offer a 'max' button. field is a sym of the field in question, input is the input field to populate.
def check_max_button(field,input) if @object.respond_to?(:blueprint) max = ("max_" + field.to_s ).to_sym if @object.blueprint.respond_to?(max) num_max = @object.send(max) maxButton = Button.new("Max") do input.text = num_max.to_s end maxButton.rect.x = input.rec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max(fields)\n view.update_many(\"$max\" => collect_operations(fields))\n end", "def max(field)\n determine(field, :>=)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max...
[ "0.6498205", "0.64209783", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.6412375", "0.63236445", "0.6245084", "0.62354696", "0.6192824", "0.60762686", "0.59653044", "0.5964481", "0.5901893", "0.5895624", "0.5878555"...
0.8649447
0
Sets the maximum number of times to retry sending the request to the API. (Default is 5) Returns self to accommodate method chaining.
def retry_at_most(max_retries) @max_retries = max_retries self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_retry\n 5\n end", "def with_max_retries(max_retries)\n @max_retries = max_retries\n self\n end", "def max_retries\n @max_retries ||= DEFAULT_MAX_RETRY_ATTEMPTS\n end", "def max_retries\n @max_retries ||= options[:max_retries] || seeds.size\n ...
[ "0.7715865", "0.73063475", "0.7090918", "0.69741553", "0.683391", "0.6830882", "0.6812935", "0.67605144", "0.66903305", "0.66903305", "0.66903305", "0.66903305", "0.66903305", "0.66903305", "0.66903305", "0.6605847", "0.6579335", "0.64517504", "0.6432092", "0.6432092", "0.642...
0.7880836
0
Changes the Serializer from the default. Returns self to accommodate method chaining.
def with_serializer(serializer) @serializer = serializer self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serializers\n self._additional_serializers # standard:disable Style/RedundantSelf\n end", "def serializer\n return @serializer if defined?(@serializer)\n\n _serializer = injected_options.fetch(:serializer, serializer_class)\n\n @serializer = instantiated_serializer_for(_serializer)\n en...
[ "0.64952856", "0.6472357", "0.6362916", "0.62180257", "0.61275965", "0.60903233", "0.60216695", "0.6013755", "0.5981057", "0.59014994", "0.59014535", "0.59014535", "0.59014535", "0.5900871", "0.5884428", "0.5879951", "0.58396655", "0.5812648", "0.5811327", "0.57906777", "0.57...
0.71685165
0
This may be useful when using a local installation of the SmartyStreets APIs. base_url is a string that defaults to the URL for the API corresponding to the Client object being built. Returns self to accommodate method chaining.
def with_base_url(base_url) @url_prefix = base_url self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(base_url)\n @base_url = base_url\n end", "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def base_url\n @client.instance_variable_get(:@base_url)\n end", "def initialize(base_url)\n @base_url = base_url\n @custom_headers = {}\n @read_wri...
[ "0.6570847", "0.6524658", "0.6348827", "0.6201443", "0.6100644", "0.6065179", "0.599167", "0.5977524", "0.5953937", "0.5859838", "0.5848456", "0.579792", "0.57902366", "0.5773273", "0.5764631", "0.5764631", "0.57203054", "0.5703709", "0.5688545", "0.5673339", "0.5672998", "...
0.68361557
0
Enables debug mode, which will print information about the HTTP request and response to $stdout. Returns self to accommodate method chaining.
def with_debug @debug = true self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug!\n @client.debug_dev = STDOUT\n end", "def set_debug(request_path, response_path)\n @debug = true\n @debug_request_path = request_path\n @debug_response_path = response_path\n end", "def toggle_debug!\n stream = @config[:debug]\n\n if stream.respond_to?(:<<)\...
[ "0.7378089", "0.6683502", "0.6538428", "0.6479609", "0.64624435", "0.6414529", "0.6286613", "0.6282566", "0.622785", "0.61583436", "0.6107006", "0.6103878", "0.609419", "0.6087524", "0.60866827", "0.6036214", "0.6030016", "0.6002313", "0.59800905", "0.5927372", "0.58904165", ...
0.71069044
1
Call given request and create matching response object
def call(request) begin response = RestClient.post(URI.escape(Config.api_url + request.operation), request.data) rescue RestClient::Unauthorized, Exception return nil end # Check response if response.code != 200 return nil end # Parse response parsed_response = JSON...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_response(connection, request); end", "def create_response(request)\n response = Response.new\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def execute!\n validate_request!\n\n build_response!\n end", "def execute!\n...
[ "0.71191156", "0.6838894", "0.6807015", "0.6728536", "0.66726595", "0.66388273", "0.660162", "0.65797234", "0.657898", "0.64859647", "0.63811564", "0.63761127", "0.6358195", "0.63533", "0.63533", "0.62757105", "0.62738806", "0.62719804", "0.6256944", "0.625419", "0.62417114",...
0.7174503
0
GET /sofas/1 GET /sofas/1.xml
def show #@sofa = Sofa.find(params[:title]) @sofa = Sofa.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @sofa } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sofa = Sofa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sofa }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitio }...
[ "0.6376844", "0.63095266", "0.62404203", "0.6221776", "0.6131507", "0.6102225", "0.603984", "0.5965827", "0.59569216", "0.59509015", "0.59358567", "0.5925079", "0.59244275", "0.5924425", "0.59165573", "0.5916318", "0.5915587", "0.59120697", "0.5907471", "0.5906915", "0.590503...
0.65925205
0
GET /sofas/new GET /sofas/new.xml
def new @sofa = Sofa.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @sofa } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_se...
[ "0.71972376", "0.6980302", "0.6849228", "0.6844881", "0.6834041", "0.6804704", "0.67847145", "0.675274", "0.67492056", "0.6741944", "0.67276746", "0.67176", "0.6688618", "0.6680484", "0.66710734", "0.66594124", "0.66594124", "0.6644803", "0.66344327", "0.662748", "0.6625676",...
0.76449263
0
POST /sofas POST /sofas.xml
def create @sofa = Sofa.new(params[:sofa]) respond_to do |format| if @sofa.save flash[:notice] = 'Sofa was successfully created.' format.html { redirect_to(@sofa) } format.xml { render :xml => @sofa, :status => :created, :location => @sofa } else format.html { rende...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sofa = Sofa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sofa }\n end\n end", "def create\n @director = Director.find(params[:director_id])\n @soaps = @director.soaps.create(soap_params)\n redirect_to director_path(@director)\...
[ "0.5876333", "0.5798304", "0.5752192", "0.5694845", "0.5578559", "0.5573724", "0.54499465", "0.5413117", "0.539831", "0.5397936", "0.53873575", "0.5383198", "0.5369998", "0.5359845", "0.5348144", "0.53442585", "0.5329538", "0.5329406", "0.53174525", "0.5299035", "0.5264957", ...
0.67419326
0
PUT /sofas/1 PUT /sofas/1.xml
def update @sofa = Sofa.find(params[:id]) respond_to do |format| if @sofa.update_attributes(params[:sofa]) flash[:notice] = 'Sofa was successfully updated.' format.html { redirect_to(@sofa) } format.xml { head :ok } else format.html { render :action => "edit" } ...
{ "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 upd...
[ "0.63454664", "0.6312509", "0.59813994", "0.5911532", "0.5816917", "0.58020943", "0.57988596", "0.5785465", "0.5752624", "0.57489586", "0.57348096", "0.5723259", "0.57054174", "0.57009804", "0.5664844", "0.56106186", "0.5598502", "0.5593297", "0.5553089", "0.5551891", "0.5535...
0.6810467
0
DELETE /sofas/1 DELETE /sofas/1.xml
def destroy @sofa = Sofa.find(params[:id]) @sofa.destroy respond_to do |format| format.html { redirect_to(sofas_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_url) }\n format.x...
[ "0.66941506", "0.66528577", "0.6651226", "0.66397965", "0.66105837", "0.6546437", "0.6528519", "0.65186894", "0.65097964", "0.6480352", "0.6449139", "0.6442919", "0.64395875", "0.6432339", "0.64100164", "0.6405228", "0.6387301", "0.6387047", "0.63758886", "0.63734746", "0.635...
0.7268784
0
Tests to see if specified dropdown group should be highlighted or not
def highlight?(dropdown_group) if dropdown_group == 'home' ["/", "/dashboard/network"].any? do | route | current_page?(route) end elsif dropdown_group == 'manage' ["/dashboard/visualconfig", "/dashboard/manage", "/dashboard/instances"].any? do | route | current_page?(route) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_choosen?\n !current_group.nil?\n end", "def group_choosen?\n !current_group.nil?\n end", "def valid_options\n selected_options.grep_v(/\\Agroup_/)\n end", "def selected?; false; end", "def selected?; false; end", "def has_selected?\n selected?\n end", "def selected?\n @se...
[ "0.664406", "0.664406", "0.6220465", "0.60187227", "0.60187227", "0.5883304", "0.5833344", "0.58275557", "0.5761715", "0.5741193", "0.5741193", "0.5739469", "0.57391363", "0.57355624", "0.5711719", "0.5709885", "0.56433284", "0.5614353", "0.55992234", "0.5528034", "0.5516902"...
0.7081927
0
Returns the current page number of the manga. This will not make any api calls and only looks at (url, referer_url).
def manga_page # http://i2.pixiv.net/img04/img/syounen_no_uta/46170939_p0.jpg # http://i1.pixiv.net/c/600x600/img-master/img/2014/09/24/23/25/08/46168376_p0_master1200.jpg # http://i1.pixiv.net/img-original/img/2014/09/25/23/09/29/46183440_p0.jpg if url =~ %r{/\d+_p(\d+)(?:_\w+)?\.#{EXT}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PageNo()\n\t\t#Get current page number\n\t\treturn @page;\n\tend", "def current_page_number\n (previous_page_number.to_i + 1).to_s\n end", "def current_page\n return unless response.headers['PaginationCurrentPage']\n response.headers['PaginationCurrentPage'].to_i\n end", "def p...
[ "0.7304405", "0.71820056", "0.7178546", "0.71626675", "0.7121461", "0.7068206", "0.699399", "0.6957431", "0.6923614", "0.68471843", "0.6816601", "0.68135417", "0.6805339", "0.6794579", "0.67805713", "0.6757622", "0.6757622", "0.67355573", "0.67122304", "0.67073494", "0.670286...
0.76781726
1
TEST CASE: CONSTANT OPERATORS. IT SHOULD CONTAIN ALL VALID OPERATORS
def test_operator_array assert_equal(OPERATORS, RomanMathmaticalOperation::OPERATORS) assert_not_equal(WRONG_OPERATORS, RomanMathmaticalOperation::OPERATORS ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\...
[ "0.6109371", "0.60394484", "0.60276", "0.59736854", "0.59708774", "0.59016097", "0.58830816", "0.5774712", "0.57667834", "0.57628566", "0.5742937", "0.57201487", "0.56682926", "0.56682926", "0.5651048", "0.5628848", "0.5625803", "0.5622729", "0.5618326", "0.56170195", "0.5600...
0.64948773
0
TEST CASE: to_num METHOD. IT SHOULD RETURN INTEGER VALUE IF VALID INPUT (ROMAN LETTER) PASSED ELSE RETURN 0
def test_to_num assert_equal(11, RomanMathmaticalOperation.new.send(:to_num,"XI")) assert_equal(0, RomanMathmaticalOperation.new.send(:to_num,"wrong")) assert_not_equal(11, RomanMathmaticalOperation.new.send(:to_num,"X")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_to_num(letter)\n \n if letter?(letter) == false\n return false\n end\n \n if letter.length != 1\n return false\n end\n \n letter = letter.downcase\n \n number = letter.ord - 96\nend", "def charToNum(letter)\n return letter.upcase.ord-65 #ensure this is uppercase???\nend", "def isN...
[ "0.74896544", "0.69001174", "0.6779687", "0.671706", "0.6653384", "0.6637102", "0.65878934", "0.6573144", "0.65723646", "0.65689117", "0.6531435", "0.6531435", "0.65034765", "0.6486525", "0.64733154", "0.64577645", "0.64381504", "0.64299333", "0.64275366", "0.6401048", "0.640...
0.7098444
1
TEST CASE: valid_input METHOD. IT SHOULD RETURN nil IF VALID(ROMAN LETTERS AND OPERATORS) INPUT PASSED ELSE RAISE EXCEPTION
def test_valid_input assert_equal(nil, RomanMathmaticalOperation.new("X", "+","V").send(:valid_input)) exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.new("X", "+",nil).send(:valid_input)} assert_equal("This X or is not valid", exception.message) exception = assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t ...
[ "0.69861555", "0.6925074", "0.67451984", "0.66084594", "0.6542202", "0.65336657", "0.6507459", "0.6500025", "0.6483599", "0.64475846", "0.64465445", "0.64450765", "0.6406952", "0.64045215", "0.6403561", "0.63759965", "0.6357122", "0.6347898", "0.6295421", "0.6267455", "0.6244...
0.73717695
0
TEST is_roman METHOD IT SHOULD RETURN TRUE IF VALID(ROMAN LETTER) INPUT PASSED ELSE RAISE EXCEPTION
def test_is_roman assert_equal(true, RomanMathmaticalOperation.is_roman("V")) exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmaticalOperation.is_roman(1)} assert_equal("Not valid input", exception.message) exception = assert_raise("RomanMathmaticalOperationError") {RomanMathmatical...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_roman?\n @input.is_a? String\n end", "def validate_roman roman_str\n\tif roman_str.scan(/^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/).empty?\n\t\tabort(\"Invalid Roman Language\")\n\tend\nend", "def roman?\r\n # Liberal definition: all Roman numeral letters\r\n self.upcase =~ ROM...
[ "0.7892943", "0.7749563", "0.7619131", "0.68940115", "0.684007", "0.66177255", "0.64185774", "0.6376377", "0.63310736", "0.6309917", "0.62908936", "0.6218004", "0.6204351", "0.6199007", "0.60995334", "0.60858107", "0.60556996", "0.60522753", "0.5950638", "0.5947665", "0.59464...
0.7864795
1
TEST OUTPUT OF THE EXPRESSION PASSED TO THE execute_expression IF VALID INPUT(ROMAN LETTERS) GIVEN IT SHOULD RETURN VALID OUTPUT(ROMAN LETTERS) ELSE RAISE EXCEPTION
def test_execute_expression assert_equal("L", RomanMathmaticalOperation.new("XL","+","X").execute_expression) assert_equal("XCIX", RomanMathmaticalOperation.new("C","-","I").execute_expression) assert_equal("X", RomanMathmaticalOperation.new("C","/","X").execute_expression) assert_equal("C", RomanMathma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end", "def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contai...
[ "0.6693422", "0.66117126", "0.64900476", "0.63006276", "0.62454975", "0.6075698", "0.6074467", "0.60278416", "0.6023764", "0.59623295", "0.5942521", "0.5932852", "0.5921831", "0.58792824", "0.5871899", "0.58626956", "0.585283", "0.582954", "0.582809", "0.5822299", "0.581865",...
0.68106925
0
Constructor == Parameters: api_key The api_key of the partner (which may be found in the api_keys section of the console) id The account id of the partner (which may be found in the settings page of the console)
def initialize(api_key = Sift.api_key, id = Sift.account_id) @api_key = api_key @id = id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(api_key, account_id, application_id)\n @api_key = api_key\n @account_id = account_id\n @application_id = application_id\n end", "def initialize(api_key:)\n @api_key = api_key\n end", "def initialize(api_key)\n @api_key = api_key\n end", ...
[ "0.7342074", "0.7273167", "0.72308403", "0.72308403", "0.72308403", "0.7206008", "0.71867144", "0.7177517", "0.7143401", "0.69721115", "0.68567795", "0.68331903", "0.68205786", "0.68150705", "0.6753521", "0.67503124", "0.6663923", "0.66201735", "0.66201735", "0.66201735", "0....
0.8104245
0
Creates a new merchant account under the given partner. == Parameters: site_url the url of the merchant site site_email an email address for the merchant analyst_email an email address which will be used to log in at the Sift Console password password (at least 10 chars) to be used to sign into the Console When success...
def new_account(site_url, site_email, analyst_email, password) reqBody = {:site_url => site_url, :site_email => site_email, :analyst_email => analyst_email, :password => password} begin http_post(accounts_url(), reqBody) rescue Exception => e puts e.message put...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_merchant email_address, merchant, bank_account_uri=nil, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :merchant => merchant,\n :bank_account_uri => bank_account_uri,\n :name => name,\n :meta => ...
[ "0.64207494", "0.6268997", "0.6245074", "0.61792254", "0.6104637", "0.60928756", "0.57629335", "0.5729927", "0.56824976", "0.5669477", "0.5658456", "0.5627027", "0.55325294", "0.5531181", "0.5525122", "0.55223644", "0.5500712", "0.5500712", "0.5370069", "0.53438497", "0.53135...
0.6580291
0
Updates the configuration which controls http notifications for all merchant accounts under this partner. == Parameters cfg A Hash, with keys :http_notification_url and :http_notification_threshold The value of the notification_url will be a url containing the string '%s' exactly once. This allows the url to be used as...
def update_notification_config(cfg) http_put(notification_config_url(), cfg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_adapter_config_policy_with_http_info(moid, adapter_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.patch_adapter_config_policy ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.conf...
[ "0.5451133", "0.5430684", "0.51907015", "0.49275866", "0.48668617", "0.48639667", "0.48468262", "0.4834718", "0.48209423", "0.47891364", "0.47743648", "0.47701105", "0.47594237", "0.4642261", "0.46319386", "0.46255252", "0.45866928", "0.4584813", "0.45711064", "0.4557157", "0...
0.6928133
0
List of games where current_user is either black or white player
def my_games return unless user_signed_in? @my_games = Game.where('white_player_id = ? or black_player_id = ?', current_user.id, current_user.id).where(winning_player_id: nil).order(:created_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def games(filters = {})\n filtered_games = filters[:game_state] ? Game.where(state: filters[:game_state]) : Game.all\n filtered_games.to_a.each_with_object([]) do |game, array|\n game.players.each do |player|\n if player.user == self &&\n (filters[:role].nil? || player.role == filters[:rol...
[ "0.66691583", "0.66007394", "0.65672666", "0.6508162", "0.6184135", "0.6184135", "0.6151068", "0.6145816", "0.6104318", "0.60371405", "0.5960701", "0.595706", "0.5941737", "0.5939897", "0.5874502", "0.57592994", "0.57563126", "0.5754423", "0.5706138", "0.5703887", "0.570007",...
0.71359545
0
Find unstarted games where the white_player_id matches the searched email address
def search_query(params) user = User.find_by(email: params) Game.where(white_player_id: user.id, black_player_id: nil).order(:created_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_games\n return unless user_signed_in?\n @my_games = Game.where('white_player_id = ? or black_player_id = ?', current_user.id, current_user.id).where(winning_player_id: nil).order(:created_at)\n end", "def in_progress_games(other_player)\n games.where(\n 'complete = ? AND (challenger_id = ? ...
[ "0.6141907", "0.6012204", "0.6012204", "0.57206005", "0.5627729", "0.55997694", "0.54813236", "0.5388144", "0.53074324", "0.5298891", "0.5242624", "0.5169554", "0.51637065", "0.51493025", "0.51374656", "0.51364565", "0.51175463", "0.50874704", "0.50781584", "0.5056534", "0.50...
0.7503585
0
rubocop:disable Metrics/AbcSize Prevent access to games_controllershow if player is not a part of that game
def own_game? return unless @game.black_player_id return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id flash[:alert] = "Sorry, you're not a player in that game" redirect_to games_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_of_game(game)\n game.player(self)\n end", "def get_winning_player\n # if one player has all the cards\n players.map{|p| @winning_player = p if p.num_cards_remaining == Deck.num_cards}\n\n # if that's not the case, take the player with the highest number of cards\n if @winning_player.bl...
[ "0.65689635", "0.6212366", "0.61340874", "0.61209697", "0.6078557", "0.60002", "0.5956228", "0.5938254", "0.59305", "0.59267", "0.59123325", "0.5900585", "0.58894366", "0.58854866", "0.5842493", "0.583254", "0.5829133", "0.5815144", "0.5793604", "0.5793427", "0.5793223", "0...
0.6233966
1
Check if game is in checkmate If so, present message indicating winner
def checkmate? return unless @game.determine_checkmate if @game.turn_number.even? @game.update(winning_player_id: @game.black_player_id) elsif game.turn_number.odd? @game.update(winning_player_id: @game.white_player_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def check_for_mate\n if @board.in_checkmate?( match.next_to_move )\n match.active = false\n match.winner = (match.next_to_move==:white ? match.playe...
[ "0.7964523", "0.7502289", "0.7472054", "0.74522895", "0.74476194", "0.74423945", "0.7427622", "0.7349794", "0.7342708", "0.7313573", "0.72916216", "0.7266836", "0.72630936", "0.72513753", "0.7229261", "0.7207654", "0.71685416", "0.7165709", "0.7163515", "0.71626735", "0.71495...
0.7670668
1
POST /admin/buildings POST /admin/buildings.json
def create @admin_building = Admin::Building.new(admin_building_params) @admin_building.user = current_user respond_to do |format| if @admin_building.save @admin_buildings = buildings(current_user) create_default_service(@admin_building) format.html { redirect_to @admin_buil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def create\n @building = Building.new(building_params)\n\n ...
[ "0.74110156", "0.70763534", "0.7066253", "0.7038686", "0.6906155", "0.6770361", "0.6710353", "0.6654732", "0.66272956", "0.6558386", "0.65341383", "0.64898944", "0.6466021", "0.64379084", "0.6423919", "0.64228255", "0.63893676", "0.63435537", "0.63275886", "0.6276221", "0.627...
0.7453756
0
PATCH/PUT /admin/buildings/1 PATCH/PUT /admin/buildings/1.json
def update respond_to do |format| if @admin_building.update(admin_building_params) @admin_buildings = buildings(current_user) format.html { redirect_to @admin_building, notice: t(:building_notice_updated) } format.json { render :show, status: :ok, location: @admin_building } f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @building.update(building_params)...
[ "0.7186808", "0.6946763", "0.6849639", "0.67995596", "0.67417", "0.6717256", "0.6663899", "0.655611", "0.6522339", "0.6391062", "0.63199264", "0.6319528", "0.63094246", "0.6290843", "0.628431", "0.62813985", "0.6265373", "0.625922", "0.6257474", "0.61512774", "0.611435", "0...
0.72366863
0
DELETE /admin/buildings/1 DELETE /admin/buildings/1.json
def destroy @admin_building.destroy respond_to do |format| format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n head :no_content\n end", "def destroy\n @building = Building.find(params[:id].to_i)\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building destroyed.' }\n f...
[ "0.748217", "0.7470972", "0.7391487", "0.7366457", "0.7358545", "0.72944933", "0.7285561", "0.7268076", "0.7263258", "0.7256532", "0.7152209", "0.7152209", "0.7103397", "0.70952666", "0.7051283", "0.70471823", "0.70373553", "0.702491", "0.6993295", "0.6980237", "0.6856659", ...
0.77981067
0
update this fetches the existing student by the id for editing in the view and updates changes to that id if there is an error preventing update, it renders the edit form again
def update set_student if @student.update_attributes(edit_params) redirect_to @student else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t@student = Student.find(params[:id])\n\n\t\tif @student.update(student_params)\n \tredirect_to @student\n \telse\n \trender 'edit'\n \tend\n\tend", "def update\n\t\t#for each student, find the student using student id\n\t\t@student = Student.find(params[:id])\n\t\t#update the student usin...
[ "0.81054056", "0.78222513", "0.77056813", "0.76945907", "0.76774395", "0.7658814", "0.76107025", "0.75962895", "0.75708747", "0.75332284", "0.7515113", "0.74779904", "0.74699485", "0.74474204", "0.74474204", "0.74474204", "0.74474204", "0.74474204", "0.74300784", "0.7425689", ...
0.8017307
1
supervisors for the student
def supervisor @supervisors = Allocation.all.order(created_at: :desc).where(student_id: current_student.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supervisors\n (self.managers + self.trustees).uniq\n end", "def students\n self.boating_tests.collect{|test| test.student} \n end", "def students\n self.course_person.all(:type => \"student\").persons\n end", "def scientist; end", "def super_sector; end", "def get_students\n reg...
[ "0.65310305", "0.6197722", "0.6101372", "0.6002916", "0.59040886", "0.5893642", "0.5866058", "0.5862979", "0.58554673", "0.5833011", "0.573758", "0.57127976", "0.5697739", "0.56645787", "0.5658557", "0.5656469", "0.5650854", "0.5648672", "0.564001", "0.56372607", "0.5637005",...
0.7407582
0
Find a named cluster by name
def named_cluster(name = context&.cluster) return nil if name.nil? clusters.find { |c| c.name == name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster(name)\n cl_obj = Com::Vmware::Vcenter::Cluster.new(vapi_config)\n\n # @todo: Use Cluster::FilterSpec to only get the cluster which was asked\n # filter = Com::Vmware::Vcenter::Cluster::FilterSpec.new(clusters: Set.new(['...']))\n clusters = cl_obj.list.select { |cluster|...
[ "0.79244137", "0.7759211", "0.75588804", "0.7558487", "0.7516298", "0.7463788", "0.7424275", "0.6801324", "0.67808205", "0.6769736", "0.66590685", "0.6637537", "0.65337664", "0.64219713", "0.6371728", "0.63393897", "0.63155484", "0.62539256", "0.6210004", "0.6196461", "0.6144...
0.8380129
0
POST /strategic_objectives POST /strategic_objectives.json
def create @strategic_objective = StrategicObjective.new(strategic_objective_params) if @strategic_objective.save flash[:success] = 'Strategic objective was successfully created.' redirect_to :back else flash[:danger] = 'Strategic objective was not created.' redirect_to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end", "def create\n @objective = Objective.new(objective_params)\n\n respond_to do |format|\n if @objective.save\n format.html { redirect_to objectives_path }\n format.json { ...
[ "0.7141633", "0.6696147", "0.66141796", "0.65129036", "0.6313385", "0.61748374", "0.59816873", "0.5840446", "0.57571137", "0.5668659", "0.55917084", "0.55910575", "0.5586883", "0.55716175", "0.55606693", "0.5555195", "0.5551683", "0.5501195", "0.54405034", "0.5418764", "0.539...
0.6860627
1
PATCH/PUT /strategic_objectives/1 PATCH/PUT /strategic_objectives/1.json
def update if @strategic_objective.update(strategic_objective_params) flash[:success] = 'Strategic objective was successfully updated.' redirect_to :back else flash[:danger] = 'Strategic objective was not updated.' redirect_to :back end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n ...
[ "0.630859", "0.6271585", "0.6247834", "0.6141951", "0.6055471", "0.59989506", "0.592237", "0.589164", "0.5882053", "0.58802307", "0.58493453", "0.5830371", "0.5816523", "0.5791737", "0.578461", "0.578281", "0.5764979", "0.57611334", "0.5744177", "0.5743729", "0.5723675", "0...
0.6559466
0
Mash uses convert_value to mashify values on input. We override it here to convert hash or array values to VividMash or AttrArray for consistency and to ensure that the added parts of the attribute tree will have the correct cache invalidation behavior.
def convert_value(value) case value when VividMash, AttrArray value when Hash VividMash.new(value, __root__, __node__, __precedence__) when Array AttrArray.new(value, __root__, __node__, __precedence__) else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_attr(key, value); end", "def process_attribute(key, value)\n return super unless key == :value\n\n @built[:value] = value\n nil\n end", "def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the va...
[ "0.59822595", "0.5768418", "0.5669697", "0.5562936", "0.5486832", "0.54643476", "0.54540086", "0.54345524", "0.5422187", "0.53767693", "0.5364814", "0.53512686", "0.5336543", "0.533401", "0.5325592", "0.5311765", "0.5310388", "0.5308666", "0.5308666", "0.5294049", "0.52517307...
0.7826414
0
Calculates actual cost from the activities claiming this project as a parent. In the even there are no activities, sets this projects' cost to 0.
def update_actual_cost cost = BigDecimal(0.00, 10) self.activities.each do |activity| cost += activity.actualCost end self.actual_cost = cost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_target_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.targetCost\n end\n self.target_cost = cost\n end", "def calculate_base_cost!\n result_obj = self.cost_matrix.reduction\n\n @base_cost = result_obj[:total_reduction]\n if(self.pa...
[ "0.67450726", "0.63078296", "0.60644835", "0.5924494", "0.58563316", "0.5701082", "0.5651934", "0.55800045", "0.55486435", "0.5510656", "0.5458906", "0.54580826", "0.54396963", "0.53864676", "0.5360783", "0.53606296", "0.5358535", "0.5349367", "0.5336859", "0.5319284", "0.531...
0.66025716
1
returns a hash of (year, zeroBigDecimal) with one year for each year this project spans.
def initialized_year_hash year_in_range = self.startDate.year year_hash = {} while year_in_range <= self.endDate.year year_hash[year_in_range] = BigDecimal(0.0, 10) year_in_range += 1 end year_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity_year_fractions_hash(activity)\n year_fractions = {}\n total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate\n range_start = activity.startDate\n while range_start.year < activity.endDate.year\n range_end = Date.new(range_start.year + 1)\n yea...
[ "0.6363502", "0.61812645", "0.61228144", "0.6122274", "0.6098065", "0.60710746", "0.60159653", "0.5984587", "0.5910871", "0.5897085", "0.5861707", "0.5777073", "0.57499504", "0.5746127", "0.5731222", "0.5730017", "0.5729096", "0.56974494", "0.56662005", "0.5659861", "0.564661...
0.7543179
0
given an activity, returns a hash of (year, fraction of activity's time) across the activity's start and end dates. Note this is inclusive of the startDate, exclusive of the endDate.
def activity_year_fractions_hash(activity) year_fractions = {} total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate range_start = activity.startDate while range_start.year < activity.endDate.year range_end = Date.new(range_start.year + 1) year_fractions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialized_year_hash\n year_in_range = self.startDate.year\n year_hash = {}\n while year_in_range <= self.endDate.year\n year_hash[year_in_range] = BigDecimal(0.0, 10)\n year_in_range += 1\n end\n year_hash\n end", "def hours_per_day(entries)\n hours_per_day = Hash.new(0.0)\n ent...
[ "0.5908708", "0.56408155", "0.54809797", "0.54439574", "0.5361603", "0.5255482", "0.5215322", "0.5178866", "0.5133617", "0.5124898", "0.51215196", "0.5097095", "0.5075578", "0.5063915", "0.49913558", "0.4982146", "0.49511474", "0.4950528", "0.49494553", "0.49253696", "0.49173...
0.8638375
0