query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
DELETE /projects/1 DELETE /projects/1.json
def destroy @project = Project.find(params[:id]) @project.destroy respond_to do |format| format.html { redirect_to projects_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7700103", "0.76993084", "0.7682566", "0.7669082", "0.765967...
0.7704753
36
If given HTML or Nokogiri, will process that. Otherwise, will automatically pull the HTML in from the provided URL.
def initialize(html: nil, url: nil, options: {}) @url = url if html @html = html.respond_to?(:to_html) ? html.to_html : html end raise ArgumentError, "must provide either :html or :url" unless html || url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadHTMLFromURL(url)\n begin\n @doc = Nokogiri::HTML(open(url))\n @url = url\n rescue\n Rails.logger.info \"RecipeParser.loadURL: unable to load URL #{url}\"\n return false\n end\n Rails.logger.info \"RecipeParser.loadURL: successfully loaded URL #{url}\"\n ...
[ "0.7113412", "0.6815075", "0.67429215", "0.6643346", "0.66254574", "0.661829", "0.6491068", "0.6481355", "0.6471519", "0.6471519", "0.6458125", "0.6435193", "0.6416936", "0.6398596", "0.639427", "0.63693464", "0.6341826", "0.6298994", "0.6286297", "0.62852865", "0.62797046", ...
0.0
-1
Centralize logic here, so we can rely on this format when parsing description from our own results down the line
def description_section(title, body) "[#{sane title}]: #{sane body}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # ...
[ "0.69169784", "0.6458712", "0.63597953", "0.630602", "0.62852865", "0.62582296", "0.62582296", "0.62463045", "0.6239733", "0.6237244", "0.62135273", "0.6205433", "0.6179059", "0.60880196", "0.6066341", "0.60633004", "0.6060133", "0.6059071", "0.60406727", "0.60343826", "0.603...
0.0
-1
GET /sanskrit_terms GET /sanskrit_terms.json
def index @sanskrit_terms = SanskritTerm.all @sanskrit_terms = SanskritTerm.order('term ASC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sanskrit_term\n @sanskrit_term = SanskritTerm.find(params[:id])\n end", "def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end", "def get_terms(params)\n send_get \"get_terms\", params\n end", "def terms\n @api_v1_pages = Api::V1::Pag...
[ "0.6639584", "0.66183674", "0.65960455", "0.63636553", "0.633737", "0.63354814", "0.6320061", "0.62674046", "0.62674046", "0.6239594", "0.620008", "0.6120596", "0.6086905", "0.6020669", "0.5987923", "0.5984068", "0.59729314", "0.58725315", "0.5802834", "0.5773058", "0.5752959...
0.69737715
0
GET /sanskrit_terms/1 GET /sanskrit_terms/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sanskrit_term\n @sanskrit_term = SanskritTerm.find(params[:id])\n end", "def index\n @sanskrit_terms = SanskritTerm.all\n @sanskrit_terms = SanskritTerm.order('term ASC')\n end", "def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pa...
[ "0.68249", "0.68125355", "0.65699303", "0.6489817", "0.6374346", "0.62115616", "0.62032616", "0.62027436", "0.617908", "0.606869", "0.606869", "0.6047305", "0.59986895", "0.5975941", "0.59693205", "0.59146076", "0.5835005", "0.581228", "0.58047616", "0.57781214", "0.56947166"...
0.0
-1
POST /sanskrit_terms POST /sanskrit_terms.json
def create @sanskrit_term = SanskritTerm.new(sanskrit_term_params) respond_to do |format| if @sanskrit_term.save format.html { redirect_to @sanskrit_term, notice: 'Sanskrit term was successfully created.' } format.json { render :show, status: :created, location: @sanskrit_term } else format.html { render :new } format.json { render json: @sanskrit_term.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanskrit_term_params\n params.require(:sanskrit_term).permit(:term, :definition)\n end", "def set_sanskrit_term\n @sanskrit_term = SanskritTerm.find(params[:id])\n end", "def terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end", ...
[ "0.71391076", "0.66094387", "0.6390714", "0.6144858", "0.61123735", "0.59726506", "0.5918575", "0.5918575", "0.59116066", "0.5890667", "0.58870816", "0.5787188", "0.5781178", "0.5723413", "0.5713378", "0.5677091", "0.5672338", "0.5614703", "0.56144637", "0.5612181", "0.558007...
0.7353951
0
PATCH/PUT /sanskrit_terms/1 PATCH/PUT /sanskrit_terms/1.json
def update respond_to do |format| if @sanskrit_term.update(sanskrit_term_params) format.html { redirect_to @sanskrit_term, notice: 'Sanskrit term was successfully updated.' } format.json { render :show, status: :ok, location: @sanskrit_term } else format.html { render :edit } format.json { render json: @sanskrit_term.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @errors = []\n term_opts = flat_term_data_to_term_opts(term_params)\n\n begin\n @term = UriService.client.update_term(@term['uri'], term_opts)\n rescue UriService::NonExistentUriError, UriService::InvalidAdditionalFieldKeyError, UriService::CannotChangeTemporaryTerm => e\n @error...
[ "0.6667367", "0.63865453", "0.6377053", "0.63620514", "0.626415", "0.62629837", "0.6236785", "0.6236619", "0.6230716", "0.6223777", "0.61599165", "0.61155516", "0.6056297", "0.6042918", "0.60270303", "0.5975685", "0.5975155", "0.591728", "0.5916242", "0.5863917", "0.58374935"...
0.7213672
0
DELETE /sanskrit_terms/1 DELETE /sanskrit_terms/1.json
def destroy @sanskrit_term.destroy respond_to do |format| format.html { redirect_to sanskrit_terms_url, notice: 'Sanskrit term was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n UriService.client.delete_term(@term['uri'])\n respond_to do |format|\n format.html { redirect_to terms_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Term has been deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_term = GoTerm.find...
[ "0.7011898", "0.6933059", "0.6817244", "0.68158793", "0.6752007", "0.6713473", "0.6668303", "0.66633373", "0.6655973", "0.6655973", "0.6655543", "0.6645018", "0.6642697", "0.6588902", "0.6573807", "0.6534731", "0.65238607", "0.651248", "0.6505011", "0.6496403", "0.64884084", ...
0.7573407
0
Use callbacks to share common setup or constraints between actions.
def set_sanskrit_term @sanskrit_term = SanskritTerm.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sanskrit_term_params params.require(:sanskrit_term).permit(:term, :definition) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
has_many :owners, class: "User", foreign_key: "restaurant_id"
def opening_hour 11 # 11am end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner\n @restaurant.owner\n end", "def owners\n self.authors.collect(&:user)\n end", "def user_list(user)\n List.find_by(restaurant: self, user: user)\n end", "def owner\n User.find_by(id: user_id)\n end", "def restaurants\n Restaurant.all.select do |restuarant|\n re...
[ "0.67898726", "0.59690976", "0.59344137", "0.58917093", "0.5746509", "0.57292235", "0.56957006", "0.56925267", "0.5628083", "0.5628083", "0.5604753", "0.55885285", "0.558499", "0.55744463", "0.5533193", "0.55237144", "0.55135024", "0.5508748", "0.54829913", "0.54823583", "0.5...
0.0
-1
def valid_signin(user) fill_in "Email",with: user.email fill_in "Password",with: user.password click_button "Sign in" end
def signin_with_invalid_email(user) fill_in "Email", with: "bogusemail@example.net" fill_in "Password", with: user.password click_button "Sign in" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_signin(user) \n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend", "def valid_signin(user)\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend", "def valid_signin(user...
[ "0.971054", "0.96920174", "0.9352493", "0.8892861", "0.86704457", "0.8668055", "0.85919696", "0.8367505", "0.8311666", "0.8288792", "0.8286354", "0.8271681", "0.82409245", "0.8229823", "0.8146016", "0.81128055", "0.81104594", "0.8068638", "0.80639666", "0.80620533", "0.796730...
0.8397655
7
you need to include what is outline in the initialize in the attr_reader
def calcuate_tax @price * 0.12 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_reader(*)\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n\t\t\n\tend", "def initialize\r\n\r\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initial...
[ "0.6725675", "0.6695298", "0.66781527", "0.65373176", "0.64942867", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.640577", "0.6402391", "0.63843346", "0.6383065", "0.6371799", "0.6371799", "0.63230...
0.0
-1
GET /taskas GET /taskas.json
def index @taskas = Taska.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tasks\n @todos = Todo.all\n render json: @todos\n end", "def show\n @task = Task.find(params[:id])\n\n render json: @task\n end", "def get_user_tasks\n render json: get_current_user.tasks\n end", "def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end", "def g...
[ "0.70924294", "0.6891517", "0.6884101", "0.6882639", "0.68616724", "0.68195796", "0.68074936", "0.6798321", "0.678328", "0.678181", "0.67335504", "0.67089987", "0.66801864", "0.66692924", "0.66689914", "0.66478217", "0.66313803", "0.66311926", "0.66311926", "0.66311926", "0.6...
0.7109265
0
GET /taskas/1 GET /taskas/1.json
def show # ada kt bawah func set_taska @admin_taska = current_admin.taskas @admintsk = @taska.admins.where.not(id: 4) @unregistered_no = @taska.kids.where(classroom_id: nil).count # #check payment status # all_unpaid = @taska.payments.where.not(name: "TASKA PLAN").where(paid: false) # all_unpaid.each do |payment| # if !payment.paid # url_bill = "#{ENV['BILLPLZ_API']}bills/#{payment.bill_id}" # data_billplz = HTTParty.get(url_bill.to_str, # :body => { }.to_json, # #:callback_url=> "YOUR RETURN URL"}.to_json, # :basic_auth => { :username => "#{ENV['BILLPLZ_APIKEY']}" }, # :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }) # #render json: data_billplz and return # data = JSON.parse(data_billplz.to_s) # if data["id"].present? && (data["paid"] == true) # payment.paid = data["paid"] # payment.save # end # end # end time = Time.now.in_time_zone('Singapore') @mth = time.month @yr = time.year psldt = time - 1.months @kid_unpaid = @taska.payments.where.not(name: "TASKA PLAN").where(paid: false) @taska_expense = @taska.expenses.where(month: @mth).where(year: @yr).order('CREATED_AT DESC') @payslips = @taska.payslips.where(mth: psldt.month, year: psldt.year) @applvs = @taska.applvs.where.not(stat: "APPROVED").where.not(stat: "REJECTED") #display expense at front #planper = time + 1.months #plan = @taska.payments.where(bill_month: planper.in_time_zone('Singapore').month).where(name: "TASKA PLAN").where(bill_year: planper.in_time_zone('Singapore').year).where(paid: true).sum(:amount) plan = @taska.payments.where(name: "TASKA PLAN").where(paid: true).where('extract(year from updated_at) = ?', @yr).where('extract(month from updated_at) = ?', @mth).sum(:amount) #START BILLS dt = Time.find_zone("Singapore").local(@yr,@mth) payment = @taska.payments.where.not(name: "TASKA PLAN") curr_pmt = payment.where(bill_month: @mth).where(bill_year: @yr) curr_pmt_paid = curr_pmt.where(paid: true) curr_pmt_unpaid = curr_pmt.where(paid: false) #CDTN_1 = current period pay early cdtn_1 = curr_pmt_paid.where("updated_at < ?", dt) #CDTN_2 = current period pay this month cdtn_2 = curr_pmt_paid.where('extract(year from updated_at) = ?', @yr).where('extract(month from updated_at) = ?', @mth) #CDTN_3 = previous period pay this month dt_lp = dt stp_lp = Time.find_zone("Singapore").local(2016,1) cdtn_3 = nil while dt_lp >= stp_lp if cdtn_3.blank? cdtn_3 = payment.where("bill_month = ? AND bill_year = ?", dt_lp.month, dt_lp.year).where('extract(year from updated_at) = ?', @yr).where('extract(month from updated_at) = ?', @mth) else tmp = payment.where("bill_month = ? AND bill_year = ?", dt_lp.month, dt_lp.year).where('extract(year from updated_at) = ?', @yr).where('extract(month from updated_at) = ?', @mth) cdtn_3 = cdtn_3.or(tmp) end dt_lp = dt_lp - 1.months end taska_payments = cdtn_1.or(cdtn_2.or(cdtn_3)) bills_paid = taska_payments.where(paid: true).sum(:amount) #start for partial #CDTN_1 All partials paid this month or previous month for current month bill cdtn_1par = 0.00 curr_pmt_unpaid.each do |pmt| if pmt.parpayms.present? cdtn_1par += pmt.parpayms.where("upd < ?", dt).sum(:amt) cdtn_1par += pmt.parpayms.where('extract(year from upd) = ?', @yr).where('extract(month from upd) = ?', @mth).sum(:amt) end end #CDTN_2 previous months bills paid partially this month cdtn_2par = 0.00 dt_lp=dt-1.months while dt_lp >= stp_lp payment.where(paid: false).where("bill_month = ? AND bill_year = ?", dt_lp.month, dt_lp.year).each do |pmt| cdtn_2par += pmt.parpayms.where('extract(year from upd) = ?', @yr).where('extract(month from upd) = ?', @mth).sum(:amt) end dt_lp -= 1.months end bills_partial = cdtn_1par + cdtn_2par #END PARTIAL #bills_paid = @taska.payments.where.not(name: "TASKA PLAN").where(paid: true).where('extract(year from updated_at) = ?', @yr).where('extract(month from updated_at) = ?', @mth).sum(:amount) #END BILLS @disp = @taska_expense.where(kind: "INCOME").sum(:cost) - @taska_expense.where(kind: "EXPENSE").sum(:cost) + bills_paid -plan-@payslips.sum(:amtepfa)+bills_partial session[:taska_id] = @taska.id session[:taska_name] = @taska.name render action: "show", layout: "dsb-admin-overview" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @task = Task.find(params[:id])\n\n render json: @task\n end", "def show\n @task = Task[params[:id]]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end", "def show\n @task = @project.tasks.find(params[:id])\n\n re...
[ "0.73819786", "0.7330911", "0.7228574", "0.71473104", "0.70943344", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7094245", "0.7068574", "0.7034387", ...
0.0
-1
GET /airportlocs GET /airportlocs.json
def index @airportlocs = Airportloc.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations\n get('locations')\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def airports\n if params['lat'] and params['lng']\n @order = params[:order] || \"distance ASC\"\n ...
[ "0.678481", "0.6686383", "0.6594728", "0.6478659", "0.6465818", "0.6382345", "0.63218427", "0.62765265", "0.6272831", "0.62068367", "0.6193629", "0.6183578", "0.6167502", "0.61583734", "0.6141624", "0.6095317", "0.6083647", "0.59868383", "0.59860724", "0.5983342", "0.5947677"...
0.73823357
0
GET /airportlocs/1 GET /airportlocs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @airportlocs = Airportloc.all\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n en...
[ "0.71991134", "0.6646003", "0.6436828", "0.6414593", "0.63855857", "0.63748646", "0.6283418", "0.62580866", "0.62498206", "0.6202682", "0.6191602", "0.61553895", "0.614807", "0.6142863", "0.61415434", "0.60945004", "0.608628", "0.607472", "0.60613763", "0.6045101", "0.601859"...
0.0
-1
POST /airportlocs POST /airportlocs.json
def create @airportloc = Airportloc.new(airportloc_params) respond_to do |format| if @airportloc.save format.html { redirect_to @airportloc, notice: 'Airportloc was successfully created.' } format.json { render :show, status: :created, location: @airportloc } else format.html { render :new } format.json { render json: @airportloc.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @airportlocs = Airportloc.all\n end", "def airportloc_params\n params.require(:airportloc).permit(:address, :latitude, :longitude)\n end", "def airport_params\n params.require(:airport).permit(:city, :code, :country, :lat, :lng, :name, :timezone)\n end", "def airports\n if ...
[ "0.643439", "0.60404766", "0.59188634", "0.5823137", "0.5777305", "0.5709968", "0.56938475", "0.56706285", "0.5643231", "0.5615572", "0.5575263", "0.5568957", "0.5563575", "0.55180097", "0.5486337", "0.5455137", "0.54414123", "0.54244596", "0.5372414", "0.53671265", "0.536616...
0.65695196
0
PATCH/PUT /airportlocs/1 PATCH/PUT /airportlocs/1.json
def update respond_to do |format| if @airportloc.update(airportloc_params) format.html { redirect_to @airportloc, notice: 'Airportloc was successfully updated.' } format.json { render :show, status: :ok, location: @airportloc } else format.html { render :edit } format.json { render json: @airportloc.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n respond_to do |format|\n if @airport.update(airport_params)\n format.html { redirect_to @airport, notice: 'Airport was successfully updated.' }\n format.json { head :no_content }\n ...
[ "0.64996773", "0.6397205", "0.63024986", "0.6195899", "0.61767066", "0.61638486", "0.61562914", "0.6132659", "0.61236787", "0.61123425", "0.61068094", "0.6105361", "0.61048794", "0.6073168", "0.6034214", "0.60287136", "0.60262936", "0.6025841", "0.60202324", "0.6019601", "0.6...
0.69543
0
DELETE /airportlocs/1 DELETE /airportlocs/1.json
def destroy @airportloc.destroy respond_to do |format| format.html { redirect_to airportlocs_url, notice: 'Airportloc was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Location.delete(params[\"id\"])\n end", "def destroy\n @airport.destroy\n respond_to do |format|\n format.html { redirect_to airports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @airport = Airport.find(params[:id])\n @airport.des...
[ "0.68428385", "0.68211627", "0.6724942", "0.6697681", "0.65622014", "0.65493685", "0.6535307", "0.6526251", "0.65256375", "0.6508935", "0.6484824", "0.64838845", "0.6452553", "0.64500654", "0.64460486", "0.6445051", "0.6428773", "0.6417913", "0.63961506", "0.6391101", "0.6384...
0.72027034
0
Use callbacks to share common setup or constraints between actions.
def set_airportloc @airportloc = Airportloc.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def airportloc_params params.require(:airportloc).permit(:address, :latitude, :longitude) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /dns_device_assocs GET /dns_device_assocs.json
def index @dns_device_assocs = DnsDeviceAssoc.all respond_to do |format| format.html # index.html.erb format.json { render json: @dns_device_assocs } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dns_device_assoc }\n end\n end", "def new\n @dns_device_assoc = DnsDeviceAssoc.new\n\n respond_to do |format|\n format.html # new.h...
[ "0.72622305", "0.6137736", "0.59939337", "0.5855667", "0.5853107", "0.5797683", "0.5776036", "0.5759609", "0.56615597", "0.5619382", "0.5590113", "0.55877376", "0.5557327", "0.5512748", "0.55050254", "0.5451867", "0.54494333", "0.5447118", "0.5444759", "0.5416515", "0.5381604...
0.7012895
1
GET /dns_device_assocs/1 GET /dns_device_assocs/1.json
def show @dns_device_assoc = DnsDeviceAssoc.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @dns_device_assoc } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dns_device_assocs = DnsDeviceAssoc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dns_device_assocs }\n end\n end", "def new\n @dns_device_assoc = DnsDeviceAssoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.700525", "0.6554484", "0.6155334", "0.5949093", "0.5807093", "0.57817143", "0.5723483", "0.56320274", "0.563097", "0.5593055", "0.55892855", "0.5575625", "0.55300623", "0.55227506", "0.5497849", "0.5490156", "0.54869086", "0.54712236", "0.5465371", "0.54494804", "0.5449480...
0.7564362
0
GET /dns_device_assocs/new GET /dns_device_assocs/new.json
def new @dns_device_assoc = DnsDeviceAssoc.new respond_to do |format| format.html # new.html.erb format.json { render json: @dns_device_assoc } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dns_device_assoc = DnsDeviceAssoc.new(params[:dns_device_assoc])\n\n respond_to do |format|\n if @dns_device_assoc.save\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully created.' }\n format.json { render json: @dns_device_assoc, status...
[ "0.73675907", "0.62805796", "0.61317086", "0.61317086", "0.61317086", "0.60622257", "0.6016388", "0.5989762", "0.59500444", "0.59477913", "0.5908444", "0.588681", "0.58819354", "0.5874643", "0.58187294", "0.58020866", "0.5782262", "0.5717814", "0.5702824", "0.56895405", "0.56...
0.7766093
0
POST /dns_device_assocs POST /dns_device_assocs.json
def create @dns_device_assoc = DnsDeviceAssoc.new(params[:dns_device_assoc]) respond_to do |format| if @dns_device_assoc.save format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully created.' } format.json { render json: @dns_device_assoc, status: :created, location: @dns_device_assoc } else format.html { render action: "new" } format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @dns_device_assoc = DnsDeviceAssoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dns_device_assoc }\n end\n end", "def show\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.h...
[ "0.5945202", "0.58718204", "0.58613527", "0.5835514", "0.5635301", "0.56121343", "0.5544474", "0.5453", "0.53900325", "0.5377151", "0.5312245", "0.52858037", "0.5280704", "0.52423364", "0.5209422", "0.51978016", "0.5176445", "0.5169187", "0.5162562", "0.515736", "0.51208365",...
0.72020674
0
PUT /dns_device_assocs/1 PUT /dns_device_assocs/1.json
def update @dns_device_assoc = DnsDeviceAssoc.find(params[:id]) respond_to do |format| if @dns_device_assoc.update_attributes(params[:dns_device_assoc]) format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dns_device_assoc = DnsDeviceAssoc.new(params[:dns_device_assoc])\n\n respond_to do |format|\n if @dns_device_assoc.save\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully created.' }\n format.json { render json: @dns_device_assoc, status...
[ "0.6410949", "0.6093063", "0.6000027", "0.5969919", "0.59570915", "0.5844015", "0.5711259", "0.5682548", "0.56028223", "0.5573605", "0.553144", "0.5472019", "0.54603803", "0.5421214", "0.5359141", "0.53455836", "0.5335287", "0.531435", "0.5301495", "0.52778953", "0.5248764", ...
0.72414017
0
DELETE /dns_device_assocs/1 DELETE /dns_device_assocs/1.json
def destroy @dns_device_assoc = DnsDeviceAssoc.find(params[:id]) @dns_device_assoc.destroy respond_to do |format| format.html { redirect_to dns_device_assocs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n forma...
[ "0.7090739", "0.6939533", "0.67710197", "0.66947246", "0.66270745", "0.66074735", "0.65771496", "0.6550256", "0.65468156", "0.65240693", "0.65240693", "0.65240693", "0.65207356", "0.6513636", "0.6486889", "0.6485093", "0.645649", "0.64302874", "0.64029133", "0.6357687", "0.63...
0.7944369
0
This demonstration code was developed while working with cocos2d, which puts the 0,0 coordinate at the bottom left. I have not tested this with other coordinate systems, like the standard iOS coordinate system where 0,0 is the top left. Additionally, the dimensions of the bounding box are hardcoded here to be 1024x768. Those dimensions can be easily changed in the find_intercept method.
def find_intercept(source, touch) # the dimensions of the screen are 1024 x 768 # Cocos2d puts the 0,0 origin at the bottom left, which is good # so, the four lines that define the borders of the screen are: bounds = { :left => { :x => 0.0 }, :right => { :x => 1024.0 }, :bottom => { :y => 0.0 }, :top => { :y => 768.0 } } intercepts = [] # check special case #1: touch is on the same spot as the source if source[:x] == touch[:x] && source[:y] == touch[:y] # this is an invalid case, so return nil return nil # check special case #2: vertical line elsif source[:x] == touch[:x] intercepts << { :x => source[:x], :y => bounds[:bottom][:y] } intercepts << { :x => source[:x], :y => bounds[:top][:y] } # check special case #3: horizontal line elsif source[:y] == touch[:y] intercepts << { :x => bounds[:left][:x], :y => source[:y] } intercepts << { :x => bounds[:right][:x], :y => source[:y] } # regular cases else # we want to define a line as y = mx + b # 1. find the slope of the line: (y2 - y1) / (x2 - x1) slope = (touch[:y] - source[:y]) / (touch[:x] - source[:x]) # 2. Substitute slope plus one coordinate (we'll use the source's coordinate) into y = mx + b to find b # To find b, the equation y = mx + b can be rewritten as b = y - mx b = source[:y] - (slope * source[:x]) # We now have what we need to create the equation y = mx + b. Now we need to find the intercepts. # left vertical intercept - we have x, we must solve for y y = slope * bounds[:left][:x] + b intercepts << { :x => bounds[:left][:x], :y => y } # right vertical intercept - we have x, we must solve for y y = slope * bounds[:right][:x] + b intercepts << { :x => bounds[:right][:x], :y => y } # bottom horizontal intercept - we have y, we must solve for x # x = (y - b) / m x = (bounds[:bottom][:y] - b) / slope intercepts << { :x => x, :y => bounds[:bottom][:y] } # top horizontal intercept - we have y, we must solve for x x = (bounds[:top][:y] - b) / slope intercepts << { :x => x, :y => bounds[:top][:y] } end bounds_filter(bounds, intercepts) directional_filter(source, touch, intercepts) # we're only ever interested in a single intercept intercepts.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box \r\n if @cached_bounding_box\r\n @cached_bounding_box.x = self.x + @_x_diff\r\n @cached_bounding_box.y = self.y + @_y_diff\r\n \r\n return @cached_bounding_box\r\n end\r\n \r\n width, height = self.size\r\n \r\n i...
[ "0.6783086", "0.65344757", "0.653171", "0.65140676", "0.6395905", "0.6383464", "0.6137995", "0.6135492", "0.6103476", "0.60663354", "0.6063332", "0.60371244", "0.5976567", "0.5949836", "0.59373593", "0.5917894", "0.5881214", "0.5878166", "0.5848338", "0.5811906", "0.5808801",...
0.58891326
16
we must determine the correct intercept based on the intended direction of the projectile
def directional_filter(source, touch, intercepts) # we must establish the direction that was intended for the touch # if the difference between the touch's x and the source's x is positive, then any intercept with an x position that # is less than the source's y position is invalid and vice versa x_delta = touch[:x] - source[:x] if x_delta >= 0 intercepts.delete_if { |intercept| intercept[:x] < source[:x] } else intercepts.delete_if { |intercept| intercept[:x] >= source[:x] } end # if the difference between the touch's y and the source's y is positive, then any intercept with a y position that # is less than the source's y position is invalid and vice versa y_delta = touch[:y] - source[:y] if y_delta >= 0 intercepts.delete_if { |intercept| intercept[:y] < source[:y] } else intercepts.delete_if { |intercept| intercept[:y] >= source[:y] } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_of_intercept(positionB, positionT, dirT, speedB, speedT)\n\n if speedB <= 0\n nil\n elsif speedT == 0\n positionT\n elsif speedB == speedT\n positionDiff = (positionB - positionT)\n positionDiffNorm = positionDiff.normalize\n scalar = positionDiffNorm.inner_product(dirT)...
[ "0.6391075", "0.6024288", "0.5782827", "0.5782827", "0.57251644", "0.5624626", "0.5585409", "0.55821", "0.5571687", "0.5542296", "0.552517", "0.5485459", "0.5438236", "0.5365786", "0.5351008", "0.5348158", "0.5315741", "0.5303273", "0.52874446", "0.52861595", "0.52861595", ...
0.4965448
39
A little hacky we need to intercept the finds, but not get too deep inside the connection
def find_every_with_cache(options) return find_every_without_cache(options) unless is_caching? prefix_options, query_options = split_options(options[:params]) path = collection_path(prefix_options, query_options) fetch(path) { find_every_without_cache(options)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end", "def find(object, parent = @base)\n raise NotImplementedError, \"Subclasses must implement public method find\"\n end", "def find\n debugger\n self.lost = false\n debugger\n e...
[ "0.56297576", "0.55668795", "0.5484565", "0.545281", "0.5406997", "0.53992945", "0.5373679", "0.53694004", "0.5290439", "0.5254615", "0.5241712", "0.5230672", "0.52261543", "0.5201084", "0.51935554", "0.5184132", "0.518309", "0.51508236", "0.51495856", "0.51466286", "0.510309...
0.0
-1
Send confirmation email to landlord
def landlord_booking_confirmed_email(student_id, landlord_id, apartment) @student = find_user(student_id) @landlord = find_user(landlord_id) @apartment = apartment mail(to: @landlord&.email, subject: 'Booking Confirmation') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def landlord_confirmation(landlord)\n @landlord = landlord\n mail to: landlord.email, subject: \"Welcome to Found!\", bcc: \"awaxman11@gmail.com; cspaik@gmail.com\"\n end", "def confirm\n @greeting = \"Hi\"\n\n mail to: \"proales@proales.com\"\n end", "def reservation_confirmation\n @greeting ...
[ "0.8601836", "0.79540586", "0.7848953", "0.78400517", "0.76253146", "0.75809747", "0.7566444", "0.7528878", "0.7505631", "0.7475776", "0.7450011", "0.7444528", "0.7435804", "0.7410372", "0.73978734", "0.7396179", "0.73925424", "0.7386814", "0.7385004", "0.7383508", "0.7359156...
0.78352064
4
This is an exception to "pure" semantic blocks See:
def test_functional_block_single_line_do_end assert_offense @cop, <<-RUBY result = [:a].map do |arg| arg end ^^ Prefer `{...}` over `do...end` for single-line blocks. RUBY end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_node; end", "def block_node; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def b...
[ "0.74085027", "0.74085027", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", ...
0.0
-1
This is an exception to "pure" semantic blocks See:
def test_procedural_block_single_line_braces assert_no_offense @cop, <<-RUBY [:a].map { puts "procedural" } RUBY end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_node; end", "def block_node; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def b...
[ "0.74085027", "0.74085027", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", ...
0.0
-1
This is an exception to "pure" semantic blocks See:
def test_procedural_block_single_line_do_end assert_offense @cop, <<-RUBY [:a].map do puts "procedural" end ^^ Prefer `{...}` over `do...end` for single-line blocks. RUBY end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_node; end", "def block_node; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def b...
[ "0.74085027", "0.74085027", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", "0.7087334", ...
0.0
-1
if no photos, do not display widget on timeline
def photos_widget if @photos.any? render partial: 'photo_panel' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photos\n return nil\n end", "def no_link_picture(instance)\n if instance.picture.present?\n image_tag(instance.picture.image.url, class: 'img-responsive')\n elsif instance.class == User\n image_tag('/images/default.png', class: 'img-responsive')\n else\n image_tag('/images/default...
[ "0.6076294", "0.56735116", "0.5669057", "0.5572114", "0.5566542", "0.5455917", "0.5455318", "0.54539704", "0.542119", "0.54109323", "0.5358944", "0.5355495", "0.5327015", "0.5317685", "0.5301475", "0.5274152", "0.5255708", "0.5219041", "0.52132785", "0.5202357", "0.5201988", ...
0.7465366
0
Priority maps have one extra precedence: priority arrays override "provides," and "provides" lines with identical filters sort by class name (ascending).
def compare_matchers(key, new_matcher, matcher) # Priority arrays come before "provides" if new_matcher[:value].is_a?(Array) != matcher[:value].is_a?(Array) return new_matcher[:value].is_a?(Array) ? -1 : 1 end cmp = super if cmp == 0 # Sort by class name (ascending) as well, if all other properties # are exactly equal if new_matcher[:value].is_a?(Class) && !new_matcher[:override] cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:value].name } if cmp < 0 Chef::Log.warn "You are overriding #{key} on #{new_matcher[:filters].inspect} with #{new_matcher[:value].inspect}: used to be #{matcher[:value].inspect}. Use override: true if this is what you intended." elsif cmp > 0 Chef::Log.warn "You declared a new resource #{new_matcher[:value].inspect} for resource #{key}, but it comes alphabetically after #{matcher[:value].inspect} and has the same filters (#{new_matcher[:filters].inspect}), so it will not be used. Use override: true if you want to use it for #{key}." end end end cmp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_priority; end", "def priority(*) end", "def priority=(*) end", "def sorted(tasks)\n tasks.sort_by {|task| task[:priority]}\nend", "def priorities\n @priorities ||= [:highest, :high, :normal, :low, :lowest]\n end", "def priority_options\n [\n {label: 'Low', value: 'low'},\n ...
[ "0.7007249", "0.6568608", "0.64073366", "0.6189134", "0.60978425", "0.6089992", "0.6074375", "0.6022429", "0.5904364", "0.57643116", "0.57643116", "0.57607216", "0.57384163", "0.5737126", "0.5714567", "0.57029045", "0.5688674", "0.56626683", "0.56609774", "0.56516683", "0.562...
0.5839214
9
GET /exercise_sets GET /exercise_sets.json
def index @exercise_sets = ExerciseSet.all respond_to do |format| format.html # index.html.erb format.json { render json: @exercise_sets } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n f...
[ "0.73280346", "0.6903886", "0.6552777", "0.6526265", "0.6526265", "0.64988345", "0.64230704", "0.6409831", "0.63407856", "0.62566555", "0.6144913", "0.60989624", "0.6044548", "0.60084516", "0.6002093", "0.6002093", "0.5996176", "0.5996176", "0.59897727", "0.59761906", "0.5961...
0.7767029
0
GET /exercise_sets/1 GET /exercise_sets/1.json
def show @exercise_set = ExerciseSet.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @exercise_set } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json...
[ "0.76704085", "0.7277389", "0.6850562", "0.6850562", "0.6818516", "0.6678353", "0.6678353", "0.6654197", "0.6654197", "0.6649044", "0.6639773", "0.6613141", "0.650916", "0.6480601", "0.6464963", "0.64087665", "0.64087665", "0.6349284", "0.630792", "0.62727726", "0.62727726", ...
0.77014786
0
GET /exercise_sets/new GET /exercise_sets/new.json
def new @exercise_set = ExerciseSet.new respond_to do |format| format.html # new.html.erb format.json { render json: @exercise_set } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exercise_set.save\n format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' }\n format.json { render json: @exercise_set, status: :created, location: @exer...
[ "0.735484", "0.7208151", "0.7208151", "0.7208151", "0.7208151", "0.7199538", "0.71498173", "0.70569736", "0.7028665", "0.69672984", "0.69083387", "0.68141407", "0.6739047", "0.670543", "0.66946703", "0.6681604", "0.66702735", "0.66586286", "0.662965", "0.662369", "0.65930647"...
0.7988277
0
POST /exercise_sets POST /exercise_sets.json
def create @exercise_set = ExerciseSet.new(params[:exercise_set]) respond_to do |format| if @exercise_set.save format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' } format.json { render json: @exercise_set, status: :created, location: @exercise_set } else format.html { render action: "new" } format.json { render json: @exercise_set.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def exercise_params\n params.require(:exercise).permit(:workout_id, :title, :sets, :reps)\n end", "def create\n @exam_se...
[ "0.6613291", "0.6462781", "0.64181966", "0.6202471", "0.6166931", "0.61541086", "0.60608953", "0.6031743", "0.60246", "0.5889377", "0.58826375", "0.5874687", "0.5842191", "0.5791036", "0.576529", "0.575718", "0.5736185", "0.57296324", "0.57029057", "0.56951547", "0.56739295",...
0.74318475
0
PUT /exercise_sets/1 PUT /exercise_sets/1.json
def update @exercise_set = ExerciseSet.find(params[:id]) respond_to do |format| if @exercise_set.update_attributes(params[:exercise_set]) format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @exercise_set.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exe...
[ "0.67134017", "0.67134017", "0.65172744", "0.650624", "0.650624", "0.650624", "0.650624", "0.650624", "0.650624", "0.650624", "0.64583075", "0.64498156", "0.64489204", "0.64489204", "0.63620716", "0.63620716", "0.63620716", "0.6273646", "0.6266225", "0.62486035", "0.62212765"...
0.71307737
0
DELETE /exercise_sets/1 DELETE /exercise_sets/1.json
def destroy @exercise_set = ExerciseSet.find(params[:id]) @exercise_set.destroy respond_to do |format| format.html { redirect_to exercise_sets_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_...
[ "0.74028516", "0.74028516", "0.73604697", "0.7339245", "0.7339107", "0.7339107", "0.7339107", "0.7339107", "0.7172909", "0.715437", "0.7123858", "0.71076113", "0.70565194", "0.7051755", "0.7050832", "0.7050832", "0.70445013", "0.6996572", "0.6971583", "0.6971452", "0.69548887...
0.8007854
0
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new if @class_id.nil? invalid_properties.push('invalid value for "class_id", class_id cannot be nil.') end if @object_type.nil? invalid_properties.push('invalid value for "object_type", object_type cannot be nil.') end invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833", "0.717024...
0.0
-1
Check to see if the all the properties in the model are valid
def valid? return false if @class_id.nil? class_id_validator = EnumAttributeValidator.new('String', ["connector.FileMessage"]) return false unless class_id_validator.valid?(@class_id) return false if @object_type.nil? object_type_validator = EnumAttributeValidator.new('String', ["connector.FileMessage"]) return false unless object_type_validator.valid?(@object_type) msg_type_validator = EnumAttributeValidator.new('String', ["OpenFile", "FileContent", "CloseFile", "DeleteFile", "ListDir", "", "PopulateRemoteTemplateFile", "GetFreeSpace"]) return false unless msg_type_validator.valid?(@msg_type) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :...
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.6618...
0.0
-1
Custom attribute writer method checking allowed values (enum).
def class_id=(class_id) validator = EnumAttributeValidator.new('String', ["connector.FileMessage"]) unless validator.valid?(class_id) fail ArgumentError, "invalid value for \"class_id\", must be one of #{validator.allowable_values}." end @class_id = class_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ...
[ "0.7088127", "0.64820594", "0.6429773", "0.6227689", "0.61418885", "0.5809922", "0.57507086", "0.5743216", "0.5736045", "0.5708027", "0.57014966", "0.56777334", "0.5601988", "0.55947953", "0.55464065", "0.55371004", "0.55344343", "0.5528221", "0.5434983", "0.54312384", "0.541...
0.0
-1
Custom attribute writer method checking allowed values (enum).
def object_type=(object_type) validator = EnumAttributeValidator.new('String', ["connector.FileMessage"]) unless validator.valid?(object_type) fail ArgumentError, "invalid value for \"object_type\", must be one of #{validator.allowable_values}." end @object_type = object_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ...
[ "0.7088127", "0.64820594", "0.6429773", "0.6227689", "0.61418885", "0.5809922", "0.57507086", "0.5743216", "0.5736045", "0.5708027", "0.57014966", "0.56777334", "0.5601988", "0.55947953", "0.55464065", "0.55371004", "0.55344343", "0.5528221", "0.5434983", "0.54312384", "0.541...
0.0
-1
Custom attribute writer method checking allowed values (enum).
def msg_type=(msg_type) validator = EnumAttributeValidator.new('String', ["OpenFile", "FileContent", "CloseFile", "DeleteFile", "ListDir", "", "PopulateRemoteTemplateFile", "GetFreeSpace"]) unless validator.valid?(msg_type) fail ArgumentError, "invalid value for \"msg_type\", must be one of #{validator.allowable_values}." end @msg_type = msg_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ...
[ "0.7088127", "0.64820594", "0.6429773", "0.6227689", "0.61418885", "0.5809922", "0.57507086", "0.5743216", "0.5736045", "0.5708027", "0.57014966", "0.56777334", "0.5601988", "0.55947953", "0.55464065", "0.55371004", "0.55344343", "0.5528221", "0.5434983", "0.54312384", "0.541...
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && class_id == o.class_id && object_type == o.object_type && msg_type == o.msg_type && path == o.path && stream == o.stream end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en...
[ "0.7291717", "0.7188103", "0.70395297", "0.7007927", "0.68874705", "0.6861532", "0.6707156", "0.6660597", "0.66147524", "0.658478", "0.6584619", "0.6580019", "0.65543133", "0.6543933", "0.65068495", "0.6479513", "0.6456241", "0.6415999", "0.6412208", "0.6412208", "0.6412208",...
0.0
-1
Calculates hash code according to all attributes.
def hash [class_id, object_type, msg_type, path, stream].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ...
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.638...
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) ConnectorFileMessageAllOf.openapi_types.each_pair do |key, type| if attributes[ConnectorFileMessageAllOf.attribute_map[key]].nil? && ConnectorFileMessageAllOf.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[ConnectorFileMessageAllOf.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[ConnectorFileMessageAllOf.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[ConnectorFileMessageAllOf.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[ConnectorFileMessageAllOf.attribute_map[key]])) end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ...
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.666...
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = IntersightClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s...
[ "0.7330926", "0.7274019", "0.72504056", "0.7245751", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", ...
0.0
-1
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "de...
[ "0.901024", "0.89506465", "0.84703195", "0.83409667", "0.8337169", "0.8337169", "0.8332247", "0.82546586", "0.8145818", "0.8144667", "0.81357557", "0.812714", "0.8093436", "0.8086725", "0.8073356", "0.8039774", "0.80308646", "0.80064154", "0.80064154", "0.80064154", "0.800641...
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} ConnectorFileMessageAllOf.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = ConnectorFileMessageAllOf.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n ...
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916",...
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @va...
[ "0.672242", "0.672242", "0.66700864", "0.66584307", "0.65890193", "0.64548075", "0.64179295", "0.64179295", "0.6384472", "0.6346933", "0.6305947", "0.6226033", "0.61538", "0.6105236", "0.6081477", "0.6081477", "0.6074215", "0.6038314", "0.60228807", "0.593782", "0.59060365", ...
0.0
-1
Block around cacheable return value identified by a key. The following options can be specified: :disable Disable caching :update Force cache update :marshal Marshal data before storing :defer Deferred cache update
def cache(key, opts = {}, &block) key = Util.md5(key) if opts[:disable] || !Config.production? yield(self) elsif @store.include?(key) && (!opts[:update] || opts[:defer]) Worker.defer { update(key, opts, &block) } if opts[:update] opts[:marshal] ? Marshal.restore(@store[key]) : @store[key] else update(key, opts, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end", "def cached_fetch(ke...
[ "0.76761377", "0.73290515", "0.7203338", "0.70791143", "0.70717114", "0.7065664", "0.70081073", "0.6979223", "0.6972479", "0.69715744", "0.69551575", "0.6931536", "0.69295365", "0.69285184", "0.69035363", "0.690274", "0.68935347", "0.6890738", "0.6873886", "0.6850135", "0.680...
0.71508634
3
Cache constructor which specifies a root directory
def initialize(root) @root = root FileUtils.mkdir_p root, :mode => 0755 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(cache_dir, data)\n @cache_dir = Path.new(cache_dir)\n @data = data\n end", "def cache_dir=(_arg0); end", "def initialize_root\n Utils.create_directory(@cache_root)\n Utils.clear_directory(@cache_root)\n end", "def cache_root\n dataroot.join('cache').tap {...
[ "0.77786994", "0.7695844", "0.7685498", "0.74300325", "0.7344163", "0.7344163", "0.73187387", "0.7311991", "0.72244644", "0.7165781", "0.6985376", "0.6915182", "0.6866536", "0.68053764", "0.668782", "0.66568476", "0.6636781", "0.6636781", "0.6624118", "0.662394", "0.6585835",...
0.0
-1
Exists the entry with key
def include?(key) File.exist?(cache_path(key)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?(key)\n\n end", "def has_key?(key); end", "def has_key?(key); end", "def contains?(key)\n @key_data.has_key?(key)\n end", "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", k...
[ "0.83907586", "0.8212301", "0.8212301", "0.80616325", "0.7988541", "0.7968155", "0.79420656", "0.79387814", "0.793358", "0.7925389", "0.7898418", "0.7861517", "0.7853616", "0.7818008", "0.78174615", "0.78050476", "0.7777239", "0.77569354", "0.77385", "0.7712478", "0.77099395"...
0.0
-1
Read entry with key
def [](key) File.read(cache_path(key)) rescue Errno::ENOENT nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_entry(key, options)\n @hash[key]\n end", "def read(key)\n perform_read(:read, key)\n end", "def read_key; end", "def underbang_reader(key); end", "def read_entry(key, **options)\n deserialize_entry(read_serialized_entry(key, **options), **options)\n end", ...
[ "0.8039924", "0.77884203", "0.7744884", "0.76313704", "0.75420994", "0.74189484", "0.7363422", "0.7345576", "0.7330333", "0.7293262", "0.72221684", "0.7205414", "0.71767724", "0.7175382", "0.7165281", "0.7111955", "0.70843154", "0.70527726", "0.6972071", "0.69415635", "0.6939...
0.6069429
93
Write entry content with key.
def []=(key, content) temp_file = File.join(root, ['tmp', $$, Thread.current.object_id].join('-')) File.open(temp_file, 'wb') do |dest| if content.respond_to? :to_str dest.write(content.to_str) else content.each {|s| dest.write(s) } end end path = cache_path(key) File.unlink path if File.exist?(path) FileUtils.mkdir_p File.dirname(path), :mode => 0755 FileUtils.mv temp_file, path rescue File.unlink temp_file rescue nil ensure content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(key, content)\n set(key.to_s, content.to_json)\n end", "def write(key, value, options = {})\n entry = ::Elephas::Entry.ensure(value, key, options)\n entry.refresh\n @data[key] = entry\n entry\n end", "def write_entry(key, entry, **options)\n raise Not...
[ "0.7937786", "0.7400819", "0.7359779", "0.7323497", "0.7299714", "0.7187159", "0.70756745", "0.6982058", "0.69055176", "0.67163146", "0.671367", "0.65826005", "0.65572095", "0.6554928", "0.6513895", "0.64506495", "0.64506495", "0.6418178", "0.64005166", "0.6388105", "0.636270...
0.6151468
37
Delete entry with key
def delete(key) File.unlink cache_path(key) rescue Errno::ENOENT end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete_entry(key, **options); end", "def delete_key(key)\n end", "def delete(key)\n\n end", "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement'...
[ "0.8695062", "0.8695062", "0.8695062", "0.8695062", "0.8695062", "0.85190153", "0.84952843", "0.84448034", "0.8231672", "0.8183083", "0.81517106", "0.81178886", "0.808543", "0.79877204", "0.7849554", "0.78188163", "0.78020155", "0.7800656", "0.77854115", "0.7781705", "0.77808...
0.0
-1
GET /users GET /users.xml
def index @users = User.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users\n self.class.get('/users')\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n en...
[ "0.7657926", "0.76263535", "0.7490723", "0.7470033", "0.74069935", "0.7387062", "0.7248585", "0.72448206", "0.721343", "0.7211573", "0.71998477", "0.71764135", "0.71337295", "0.71337295", "0.71337295", "0.7132803", "0.7132208", "0.7130947", "0.7115423", "0.70905775", "0.70857...
0.7210826
10
GET /users/1 GET /users/1.xml
def show @user = User.find(params[:id], :include => [:timesheets, :leave_requests]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def index\n @users = User.all\n render :xml ...
[ "0.7207758", "0.71160614", "0.7054628", "0.70484746", "0.6916555", "0.6916146", "0.6915502", "0.6890011", "0.68641984", "0.68633956", "0.6853434", "0.68511736", "0.68511736", "0.68511736", "0.6828291", "0.68280435", "0.68278646", "0.68065727", "0.6801009", "0.6786165", "0.676...
0.0
-1
GET /users/new GET /users/new.xml
def new @user = User.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end"...
[ "0.77330446", "0.7697235", "0.7628986", "0.75933844", "0.7592385", "0.75490505", "0.7536828", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", "0.7508645", ...
0.7530958
8
POST /users POST /users.xml
def create @user = User.new(params[:user]) respond_to do |format| if @user.save flash[:notice] = 'User was successfully created.' format.html { redirect_to(@user) } format.xml { render :xml => @user, :status => :created, :location => @user } else format.html { render :action => "new" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def CreateUser params = {}\n \n ...
[ "0.71678036", "0.6338476", "0.6224363", "0.61548346", "0.6088076", "0.6079892", "0.60536397", "0.60094374", "0.5940851", "0.59352076", "0.59313804", "0.59236705", "0.59006655", "0.58788294", "0.5857175", "0.58492076", "0.58427423", "0.58262956", "0.58248377", "0.5821217", "0....
0.5792528
22
PUT /users/1 PUT /users/1.xml
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :a...
[ "0.6635185", "0.6546547", "0.6365357", "0.6259716", "0.6222739", "0.62200224", "0.6171894", "0.6131896", "0.61308634", "0.61273426", "0.6110778", "0.6106035", "0.61059886", "0.60566944", "0.603521", "0.603402", "0.6016474", "0.6012614", "0.6003888", "0.59783655", "0.59716195"...
0.5980906
19
DELETE /users/1 DELETE /users/1.xml
def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to(users_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n @user = ...
[ "0.7177572", "0.7172003", "0.70611066", "0.70607454", "0.7031703", "0.70033735", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", "0.6912414", ...
0.69609874
6
Parameters to be used in API request
def body_parameters(params = {}) nil if params.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_parameters; end", "def request_params; end", "def query_parameters; end", "def request_parameters\n {:email => @email, :receiverid => @receiverid, :amt => @amt,\n :uniqueid => @unique, :note => @note}.reject{|k,v| v.nil? }\n end", "def query_parameters\n end", "de...
[ "0.7982301", "0.7720295", "0.7408321", "0.7286794", "0.71560067", "0.7112844", "0.70557743", "0.7000641", "0.69759434", "0.69759434", "0.69063985", "0.68421245", "0.68394905", "0.6790971", "0.6790971", "0.6790971", "0.6790971", "0.6790971", "0.6790971", "0.6790971", "0.679097...
0.0
-1
Complete URL with query parameters
def api_url api_key? ? base_url.concat(api_query_parameter) : base_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_with_params\n url + \"/?\" + URI.encode_www_form(@options[:request_params])\n end", "def get_full_url(req_params)\n full_url=self.url\n\n if self.input_params.size>0\n full_url+=\"?\"\n\n self.input_params.each do |param|\n #puts \"name:\"+param.name+\"->value:\"+param.valu...
[ "0.6986375", "0.68977034", "0.68738747", "0.68064815", "0.679391", "0.6771429", "0.6647405", "0.6619623", "0.6606683", "0.6586634", "0.6563319", "0.655761", "0.6538613", "0.6474076", "0.6422775", "0.6419572", "0.6410329", "0.6407151", "0.638932", "0.6387668", "0.6366937", "...
0.0
-1
Predicate method for checking if the API key exists
def api_key? ENV.has_key?("#{sub_klass.upcase}_URL_KEY") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_api_key(key_value)\n\n if Key.find_by_key_value(key_value).nil?\n\n redirect_to unauthorized_key_path\n\n return false\n\n end\n\n return true\n\n end", "def exists?\n username && api_key\n end", "def api_key?\n key = CoreExtensions::String.new api_key.to_s\n key...
[ "0.77408063", "0.7725814", "0.7624328", "0.7540276", "0.7534287", "0.7470282", "0.7454164", "0.74463224", "0.7411491", "0.73402125", "0.73024213", "0.7299012", "0.72581106", "0.7194451", "0.7179128", "0.71064126", "0.71044827", "0.7093334", "0.7039947", "0.6945791", "0.692886...
0.7133957
15
Sets URL to be used in request
def url=(new_url) @url = sanitize_url(new_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_url\n @url = DEFAULT_URL\n end", "def set_url\n url 'set'\n end", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\...
[ "0.8170303", "0.7972048", "0.79417944", "0.79417944", "0.79417944", "0.79417944", "0.79417944", "0.78874075", "0.76674986", "0.7606209", "0.749349", "0.747098", "0.7460131", "0.744202", "0.73861533", "0.7373652", "0.7343998", "0.7313363", "0.7296489", "0.728883", "0.7281289",...
0.670438
82
Method for generating QR codes or charts
def generate_chart_url(new_url, image_size = {}) fail "#{__method__} not implemented" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr_code\n @patient = Patient.find(params[:id])\n @record_url = vacc_rec_patient_url(@patient)\n @qr = RQRCode::QRCode.new(@record_url, size: 10, level: :h)\n @png = @qr.as_png(\n bit_depth: 1,\n border_modules: 4,\n color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n color: 'black',\n ...
[ "0.74059933", "0.7346808", "0.7152381", "0.7113418", "0.7101134", "0.7081578", "0.70665973", "0.69892174", "0.69508237", "0.6942414", "0.674206", "0.6706471", "0.65521544", "0.6544218", "0.652432", "0.64810693", "0.6478405", "0.64631873", "0.644057", "0.64294606", "0.6404463"...
0.0
-1
Helper method that yields into the other response structure methods
def response_options(&block) yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response!; end", "def process_response(obj)\n end", "def each(&block)\n # Actual implementation is in PageableResponse::Extension\n end", "def response_parser; end", "def response_metadata=(_); end", "def parse(response)\n\nend", "def each(&block)\n @response.each(&block)\n ...
[ "0.6704464", "0.66783607", "0.6536513", "0.6471458", "0.624867", "0.6132967", "0.60425323", "0.6023128", "0.6023128", "0.59755856", "0.597532", "0.5945634", "0.59274256", "0.5915902", "0.5915902", "0.59131384", "0.59131384", "0.5909089", "0.59055096", "0.5891343", "0.58869463...
0.59526634
11
Defines collection_key in response
def collection(new_collection) self.collection_key = new_collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_key(key)\n @_collection_key = key.to_sym\n end", "def collection_name; end", "def collection_name; end", "def collection_name; end", "def get_collection_key(args)\n\tapi_url = \"#{base_url}/#{args[:collection]}/#{args[:key]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend"...
[ "0.7511173", "0.673096", "0.673096", "0.673096", "0.66949403", "0.6579311", "0.64802647", "0.64432275", "0.6429378", "0.63815796", "0.6329948", "0.6249872", "0.6242686", "0.617771", "0.61701477", "0.61701477", "0.6169773", "0.6169773", "0.61296314", "0.6114793", "0.6109225", ...
0.6787506
1
Defines url_key in response
def short_url(short_url_key) self.url_key = short_url_key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key=(url)\n write_attribute(:key, (CGI.unescape(url) rescue nil))\n end", "def url\n URI.escape(\"#{protocol}#{host}/#{path_prefix}#{key}\")\n end", "def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}#{env.url.path.sub(/\...
[ "0.69527185", "0.66203976", "0.6504968", "0.6394269", "0.6350943", "0.6280144", "0.62752265", "0.62522566", "0.62522566", "0.62174815", "0.61688673", "0.6129543", "0.6114425", "0.60956955", "0.6095016", "0.60753065", "0.60753065", "0.6004054", "0.59495574", "0.58946437", "0.5...
0.6215869
10
Defines error_key in response
def error(new_error_key = 'error') self.error_key = new_error_key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_errors\n key(\"errors\")\n end", "def error_key\n self.class.error_key\n end", "def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end", "def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end", ...
[ "0.758156", "0.736208", "0.73354876", "0.73354876", "0.72732806", "0.69339323", "0.68587387", "0.6855757", "0.68392307", "0.6785906", "0.678491", "0.678491", "0.6783905", "0.67683965", "0.67503715", "0.6737597", "0.6732852", "0.672015", "0.670697", "0.66906583", "0.66577023",...
0.7353458
2
END OF LANDING Profile Router
def profileRouter @measurements_progress = if current_spree_user.profile.body_measurement.nil? 0 else 100 end @lifestyle_progress = if current_spree_user.profile.lifestyle.nil? 0 else 100 end @info_progress = if current_spree_user.profile.info.nil? 0 else 100 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def router; end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n\n end", "def profile\n \n end", "def profile; end", "def profile; end", "def profile\n\n # redirect to kpass where they ...
[ "0.66046965", "0.6530206", "0.6530206", "0.6530206", "0.6530206", "0.6530206", "0.6530206", "0.6485125", "0.6358185", "0.62581784", "0.62581784", "0.6167585", "0.6127837", "0.60929984", "0.603066", "0.603066", "0.603066", "0.603066", "0.603066", "0.603066", "0.603066", "0.6...
0.60557
14
End of profile router Main Store
def store @preference = ProfileSpec.new @item = Spree::LineItem.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end\n end", "def end\n end", "def finish\r\n #\r\n end", "def finish()\n #This is a stub, used for indexing\n end", "def finalize_flow!\n redirect!(custom_session['return_to'])\n teardown_flow\n throw(:warden)\n end", "def finish\n #\...
[ "0.6313331", "0.6000883", "0.5940267", "0.59277356", "0.5912429", "0.5909932", "0.5904078", "0.5901696", "0.5854479", "0.58260584", "0.58256996", "0.579241", "0.579241", "0.5787623", "0.5787623", "0.5787623", "0.5747019", "0.5717258", "0.5717258", "0.5717258", "0.5713453", ...
0.0
-1
End of main store Customer Dashboard
def customer @orders = Spree::Order.where(user_id: current_spree_user.id, state: 'complete').where.not(shipment_state: 'shipped', state: 'returned').order(created_at: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end\n end", "def end\n end", "def exit\n\t\t@view.display_exit\t\n\tend", "def footer\n end", "def end\n end", "def end\n end", "def at_exit\n\n\t\tend", "def start\n destroy_session_customer\n end", "def endPage()\n @device.endPage() ;\n end", "def end; end", "def en...
[ "0.6558566", "0.63169116", "0.62496877", "0.62056947", "0.61670136", "0.61670136", "0.61209387", "0.5970573", "0.5943383", "0.5936583", "0.5936583", "0.5936583", "0.5917163", "0.59095615", "0.59079504", "0.5902774", "0.5891235", "0.5870163", "0.58645254", "0.5803357", "0.5778...
0.0
-1
End of Customer Dashboard Vendor Dashboard
def vendor @shipments = Spree::Shipment.where(stock_location_id: current_spree_user.stock_locations.first.id, state: "pending").joins(:order).where(spree_orders: {state: 'complete'}).order(created_at: :asc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end\n end", "def end\n end", "def end\n end", "def end\n end", "def footer\n end", "def endPage()\n @device.endPage() ;\n end", "def at_end; end", "def end; end", "def end; end", "def end; end", "def at_exit\n\n\t\tend", "def goodbye\n puts \"Thank you for using the ...
[ "0.64394766", "0.61562943", "0.60322744", "0.60322744", "0.59984714", "0.5969971", "0.58570665", "0.58044595", "0.58044595", "0.58044595", "0.5736805", "0.5690024", "0.5662393", "0.56583494", "0.56279284", "0.5622035", "0.5606002", "0.5567342", "0.5564724", "0.5564724", "0.55...
0.0
-1
End of vendor dashboard Stylist Dashboard
def stylist end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end\n end", "def end_special_list\n end", "def end\n end", "def end_special_list_item\n end", "def end\n\t\t\t# Give an extra line below the output for the shell to prompt on.\n\t\t\tadd_bar(nil)\n\n\t\t\tNcurses.endwin\n\t\tend", "def end\n end", "def end\n end", "def at_end; e...
[ "0.6072342", "0.5922611", "0.5799174", "0.5787508", "0.5642635", "0.56328803", "0.56328803", "0.5544962", "0.54913414", "0.5481084", "0.5420466", "0.5420007", "0.53737324", "0.53737324", "0.53737324", "0.53620297", "0.5306082", "0.52845657", "0.525427", "0.5252272", "0.523974...
0.0
-1
built in Arrayzip and Arrayflatten methods
def interleave(arr1, arr2) arr1.zip(arr2).flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interzip(array1, array2)\n array1.zip(array2).flatten\nend", "def zip_and_flatten(array1,array2)\t\n\t\t(array1.zip(array2)).flatten(1).reject{|x| x.nil?}\n\tend", "def zip(first, second)\n first.zip(second).flatten\nend", "def zip first, second\n first.zip(second).flatten()\nend", "def my_zip(*...
[ "0.81092566", "0.7955254", "0.7798346", "0.7743819", "0.7720862", "0.7592449", "0.74371326", "0.742615", "0.74030644", "0.7330398", "0.7310764", "0.7276968", "0.7267329", "0.72665983", "0.7253579", "0.7248979", "0.72389024", "0.7230834", "0.7205722", "0.718583", "0.7181103", ...
0.7106819
34
Course solution identical to my logic, just uses one of the built in methods (Arrayeach_with_index) to do the looping instead & therefore doesn't have the same concern about running too many loops, infinite looping, etc.
def interleave(array1, array2) result = [] array1.each_with_index do |element, index| result << element << array2[index] end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_each_with_index\n i = 0\n while i < self.length\n yield(self[i], i)\n i += 1\n end\n self\n end", "def my_each_with_index\n i = 0\n while i < self.length\n yield self[i], i\n i += 1\n end\n self\n end", "def each_with_index(arr)\n arr.size.times do |i|\n ...
[ "0.6488348", "0.6470029", "0.64411765", "0.64363307", "0.6399233", "0.63840306", "0.6341854", "0.63185257", "0.6307057", "0.6236511", "0.62299967", "0.6195064", "0.618803", "0.61691946", "0.61601496", "0.61531085", "0.61081105", "0.6103526", "0.60875493", "0.60811085", "0.607...
0.0
-1
...then control is transferred here return
def find(array, target) array.each_with_index do |element,index| return index if (element == target) end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proceed!; end", "def proceed!; end", "def returns; end", "def done?; true end", "def return(&block); end", "def continue; end", "def continue; end", "def done?; end", "def continue?; end", "def done; end", "def yield; end", "def success; end", "def success; end", "def begin; end", "...
[ "0.67562884", "0.67562884", "0.67481893", "0.6593381", "0.6572398", "0.6546384", "0.6546384", "0.6483112", "0.64663863", "0.6386235", "0.6361063", "0.62727237", "0.62727237", "0.62614805", "0.6185981", "0.6180386", "0.6180386", "0.6173116", "0.6170133", "0.6169206", "0.616920...
0.0
-1
This function is used in the ideas views. It calculates the overall originality score, given the vote scope of 'rate_originality', by taking an average across all such votes. The "else" is necessary because without it, when an idea doesn't have ratings, this method would end up dividing by zero, and no one likes dividing by zero.
def current_originality_rating if self.get_upvotes(:vote_scope => 'rate_originality').size > 0 self.get_likes(:vote_scope => 'rate_originality').sum(:vote_weight) / self.get_upvotes(:vote_scope => 'rate_originality').size else "no ratings yet" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overall_rating\n \tend\n \tif num_of_ratings > 0\n \t\treturn total_score / num_of_ratings\n \telse\n \t\treturn 0\n \tend\n end", "def average_rating\n r...
[ "0.6900167", "0.6804252", "0.68010396", "0.67792", "0.6762182", "0.67016494", "0.66401154", "0.66401154", "0.6634484", "0.66316795", "0.6525435", "0.6518228", "0.65058106", "0.64567566", "0.64566004", "0.6445986", "0.6431911", "0.6428237", "0.639556", "0.6393277", "0.63877887...
0.74501294
0
GET /mailings GET /mailings.json
def index @mailings = Mailing.order(sort_column + " " + sort_direction) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mailings = Mailing.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mailings }\n end\n end", "def index\n @email_listings = EmailListing.all\n\n respond_to do |format|\n format.html # index.html.erb\...
[ "0.7634684", "0.7021119", "0.6887139", "0.67313194", "0.66965693", "0.6579719", "0.64699334", "0.64699334", "0.6467178", "0.6444665", "0.6417666", "0.6415087", "0.6412686", "0.6345306", "0.6332816", "0.63300747", "0.63225806", "0.6287977", "0.6241723", "0.6216744", "0.6189129...
0.0
-1
GET /mailings/1 GET /mailings/1.json
def show # @mailing = Mailing.all # @total_cost = @mailing.cost_print + @mailing.cost_postage + @mailing.cost_service # @unit_total_cost = @total_cost / @mailing.quantity_sent # @unit_service_cost = @mailing.cost_service / @mailing.quantity_sent # @unit_print_cost = @mailing.cost_print / @mailing.quantity_sent # @unit_postage_cost = @mailing.cost_postage / @mailing.quantity_sent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mailing_by_id(id)\n get(\"/mailings/#{id}\")\n end", "def index\n @mailings = Mailing.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mailings }\n end\n end", "def show\n @mailer = Mailer.find(para...
[ "0.7385595", "0.73338604", "0.675623", "0.6692886", "0.6577932", "0.6569516", "0.65639216", "0.64722705", "0.64204824", "0.63576823", "0.63388073", "0.6282277", "0.6251416", "0.62329143", "0.61724967", "0.6168595", "0.6168595", "0.61421025", "0.6141549", "0.61330074", "0.6125...
0.0
-1
POST /mailings POST /mailings.json
def create @mailing = Mailing.new(mailing_params) respond_to do |format| if @mailing.save format.html { redirect_to @mailing, notice: 'Mailing was successfully created.' } format.json { render :show, status: :created, location: @mailing } else format.html { render :new } format.json { render json: @mailing.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"info@ourcompany.com\",\n :subject => \"New Job Posted!\"\n )\n \n end", ...
[ "0.6107348", "0.606523", "0.595672", "0.5892067", "0.57954305", "0.57668626", "0.5752275", "0.57174873", "0.56935805", "0.5661476", "0.5623712", "0.5613894", "0.5613066", "0.55678695", "0.556088", "0.55494696", "0.55264795", "0.5517877", "0.54971534", "0.549363", "0.5476165",...
0.568888
9
PATCH/PUT /mailings/1 PATCH/PUT /mailings/1.json
def update respond_to do |format| if @mailing.update(mailing_params) format.html { redirect_to @mailing, notice: 'Mailing was successfully updated.' } format.json { render :show, status: :ok, location: @mailing } else format.html { render :edit } format.json { render json: @mailing.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_mailing(id, params = {})\n put(\"/mailings/#{id}\", params)\n end", "def patch!\n request! :patch\n end", "def update\n @mailbox = Mailbox.find(params[:id])\n\n respond_to do |format|\n if @mailbox.update_attributes(params[:mailbox])\n format.html { redirect_to mail...
[ "0.66753954", "0.65117353", "0.63834476", "0.6342383", "0.63039356", "0.6281067", "0.6221939", "0.6209692", "0.6197112", "0.6174886", "0.6164192", "0.61607325", "0.6133551", "0.61078674", "0.6105", "0.6055312", "0.60510385", "0.59889036", "0.5988096", "0.59763217", "0.5969084...
0.6002842
17
DELETE /mailings/1 DELETE /mailings/1.json
def destroy @mailing.destroy respond_to do |format| format.html { redirect_to mailings_url, notice: 'Mailing was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mail.destroy\n respond_to do |format|\n format.html { redirect_to mails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailing = Mailing.find(params[:id])\n @mailing.destroy\n\n respond_to do |format|\n format.html { redirect_to mailings_ur...
[ "0.73956716", "0.7147046", "0.7099111", "0.70523316", "0.70063114", "0.70010775", "0.6986366", "0.6986366", "0.6970475", "0.69099", "0.6890882", "0.6871643", "0.6864419", "0.6859044", "0.6856199", "0.6840319", "0.68395513", "0.6835267", "0.6830443", "0.6825454", "0.6816375", ...
0.68666345
13
Use callbacks to share common setup or constraints between actions.
def set_mailing @mailing = Mailing.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def mailing_params params.require(:mailing).permit(:name, :drop, :date_extra, :who, :what, :quantity_sent, :group_1, :group_2, :group_3, :group_4, :group_5, :data_name, :art_name, :msi_note, :note_1, :note_2, :note_3, :complete, :boolean_1, :integer_1, :cost_service, :cost_postage, :cost_print, :msi_art, :msi_data, :msi_invoice, :people_report, :note_4, :estimate_quanity, :estimate_cost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Added SHOW_COMMAND because DEBUG is also used by other libraries like bundler and it shows its internal debugging logging also.
def show_command? ENV['DEBUG'] || ENV['SHOW_COMMAND'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCommandLineDebugShort\n # Make sure we don't break debug\n lDebugMode = debug_activated?\n begin\n executeSlave( [ '-d' ] )\n rescue Exception\n activate_log_debug(lDebugMode)\n raise\n end\n activate_l...
[ "0.6819245", "0.6532089", "0.6472383", "0.637671", "0.6345814", "0.6345814", "0.6345814", "0.6238709", "0.6212306", "0.61990595", "0.61908376", "0.6180033", "0.61796695", "0.61634177", "0.607934", "0.6077874", "0.6067471", "0.60558236", "0.6031414", "0.598428", "0.59831893", ...
0.7541091
0
Astute use special virtual node for deployment tasks, because any task must be connected to node. For task, which play synchronization role, we create virtual_sync_node
def support_virtual_node(deployment_tasks) deployment_tasks['virtual_sync_node'] = deployment_tasks['null'] deployment_tasks.delete('null') deployment_tasks.each do |node_id, tasks| tasks.each do |task| task['requires'].each do |d_t| d_t['node_id'] = 'virtual_sync_node' if d_t['node_id'].nil? end task['required_for'].each do |d_t| d_t['node_id'] = 'virtual_sync_node' if d_t['node_id'].nil? end end end deployment_tasks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n params[:deployment_id] = Deployment.find_key(params[:deployment]).id if params.has_key? :deployment\n params[:deployment_id] ||= Deployment.system\n params.require(:name)\n params.require(:deployment_id)\n default_net = nil\n Node.transaction do\n @node = Node.create!(params.per...
[ "0.5657759", "0.5404943", "0.5371493", "0.5288839", "0.5261581", "0.5234249", "0.5213693", "0.5151606", "0.5147029", "0.51360315", "0.5071682", "0.5032099", "0.501745", "0.4999152", "0.49985006", "0.49865827", "0.49766302", "0.49728447", "0.49426797", "0.49234945", "0.4908158...
0.7857077
0
Removes nodes which failed to provision
def remove_failed_nodes(deployment_info) uids = get_uids_from_deployment_info deployment_info required_uids = critical_node_uids(deployment_info) available_uids = detect_available_nodes(uids) offline_uids = uids - available_uids if offline_uids.present? # set status for all failed nodes to error nodes = (uids - available_uids).map do |uid| {'uid' => uid, 'status' => 'error', 'error_type' => 'provision', 'error_msg' => 'Node is not ready for deployment: '\ 'mcollective has not answered' } end @ctx.report_and_update_status( 'nodes' => nodes, 'error' => 'Node is not ready for deployment' ) # check if all required nodes are online # if not, raise error missing_required = required_uids - available_uids if missing_required.present? error_message = "Critical nodes are not available for deployment: " \ "#{missing_required}" raise Astute::DeploymentEngineError, error_message end end return remove_offline_nodes( uids, available_uids, deployment_info, offline_uids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_failed_nodes(deployment_info, pre_deployment, post_deployment)\n uids = get_uids_from_deployment_info deployment_info\n required_nodes = deployment_info.select { |node| node[\"fail_if_error\"] }\n required_uids = required_nodes.map { |node| node[\"uid\"]}\n\n available_uids = detect_...
[ "0.70573246", "0.6999569", "0.66729325", "0.65517545", "0.61717", "0.6154723", "0.6132044", "0.6100802", "0.609735", "0.60830647", "0.5955199", "0.5941919", "0.5923259", "0.589323", "0.5892617", "0.5870222", "0.58001983", "0.57969236", "0.57776266", "0.5724138", "0.5705338", ...
0.7413712
0
client An instance of Gitlab::GithubImport::Client. project An instance of Project.
def import(client, project) # In extreme cases it's possible for a clone to take more than the # import job expiration time. To work around this we schedule a # separate job that will periodically run and refresh the import # expiration time. RefreshImportJidWorker.perform_in_the_future(project.id, jid) importer = Importer::RepositoryImporter.new(project, client) return unless importer.execute counter.increment ImportBaseDataWorker.perform_async(project.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(project, client: GitlabClient)\n @project = project\n @client = client\n end", "def initialize(project, token: nil)\n @project = project\n @client = GithubImport\n .new_client_for(project, token: token, parallel: false)\n end", "def initialize(project, cl...
[ "0.71797293", "0.7036171", "0.70038486", "0.66063565", "0.64524364", "0.6354469", "0.63301235", "0.6277859", "0.62456805", "0.6171885", "0.6115293", "0.6044211", "0.6044211", "0.6003202", "0.5897842", "0.5897842", "0.58928394", "0.5891802", "0.5891802", "0.5891802", "0.589180...
0.69869375
3
GET /materia GET /materia.json
def index @materias = Materia.paginate(:page => params[:page], :per_page => 10) respond_to do |format| format.html # index.html.erb format.json { render json: @materias } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end", "def new\n @materia = Materia.new\n\n ...
[ "0.82624835", "0.80277884", "0.73540914", "0.7079396", "0.7031596", "0.70232874", "0.7022402", "0.69139475", "0.69139475", "0.6878738", "0.6867903", "0.68512285", "0.6801849", "0.6768132", "0.675158", "0.6740052", "0.6681204", "0.6674433", "0.6668899", "0.6586753", "0.6586753...
0.7283887
3
GET /materia/1 GET /materia/1.json
def show @materia = Materia.find(params[:id]) @planificacion = @materia.planificaciones.build(params[:planificacion]) @material = Material.new respond_to do |format| format.html # show.html.erb format.json { render json: @materia } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end", "def new\n @materia = Materia.new\n\n ...
[ "0.83487815", "0.810231", "0.73854226", "0.72923934", "0.72697955", "0.7196712", "0.71269166", "0.709939", "0.7034882", "0.7011298", "0.7011298", "0.6985706", "0.6873503", "0.68282586", "0.68282586", "0.6819437", "0.6818944", "0.6818944", "0.6815715", "0.6804412", "0.67631334...
0.6919528
12
GET /materia/new GET /materia/new.json
def new @materia = Materia.new @docentes = Docente.find(:all) @cursos = Curso.find(:all) respond_to do |format| format.html # new.html.erb format.json { render json: @materia } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @materia }\n end\n end", "def create\n @materia = Materia.new(params[:materia])\n\n respond_to do |format|\n if @materia.save\n format.html { redirect_to @ma...
[ "0.8375051", "0.7918986", "0.78413016", "0.7809895", "0.7774968", "0.77506053", "0.77388936", "0.76980144", "0.76881987", "0.7620924", "0.7560578", "0.7560578", "0.7559082", "0.7529225", "0.75175047", "0.74958587", "0.74689573", "0.74656636", "0.746438", "0.746438", "0.746438...
0.8082897
1