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
Delivers a new HTML email template for the given parameters
def payment_subscription_canceled(payment_subscription, company_phone) attachments.inline['consult.png'] = email_cdn_file '/img/consult.png' @plan = Plan.find_by!( id: payment_subscription[:plan_id] ) @company = Company.find_by!( id: company_phone[:company_id] ) @company_phone = company_phone emails = payment_subscription.company_phone.extensions.admin mail( to: emails.map(&:email), subject: '¡Tu subscripción a GurúComm se ha cancelado!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def plan_no_balance(company, company_phone) @company = company @company_phone = company_phone mail( to: company_phone.extensions.admin.first.email, subject: '¡Tu plan en GurúComm se ha reactivado!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def plan_with_balance(company, company_phone) @company = company @company_phone = company_phone mail( to: company_phone.extensions.admin.first.email, subject: '¡En GurúComm agradecemos tu recarga!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def voicemail_new(voicemail, extension) attachments.inline['voicemail.png'] = email_cdn_file '/img/voicemail.png' @voicemail = voicemail @extension = extension @company_phone = @extension.company_phone @company = @company_phone.company attachments['voicemail.wav'] = read_url_file voicemail.audiofile mail( to: extension.email, subject: '¡En GurúComm, tienes un nuevo mensaje de voz!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters.
def reset_password_instructions(resource, token, _options) @resource = resource @token = token mail( to: resource.email, subject: ['¿Solicitaste un cambio de contraseña en tus servicios de ', 'GurúComm?'].join('') ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mail_templated!(template_name, tokens, options = {})\n options[:subject] = EmailTemplate.render_subject(template_name, tokens, options)\n options_body = options[:body].present? ? options[:body] : \"\"\n @body = EmailTemplate.render_body(template_name, tokens, options) \n @body = @body.present? ? @b...
[ "0.6623623", "0.6386677", "0.63668495", "0.6258935", "0.61969596", "0.61768985", "0.6137182", "0.6123373", "0.6005435", "0.60023266", "0.59847164", "0.597279", "0.5938208", "0.59065074", "0.5886088", "0.5886088", "0.5871227", "0.585331", "0.5834434", "0.5834434", "0.58182776"...
0.0
-1
Delivers a new HTML email template for the given parameters
def minute_plan_new(minute_plan) attachments.inline['money.png'] = email_cdn_file '/img/money.png' @minute_plan = minute_plan @company_phone = minute_plan.payment_subscription.company_phone @company = @company_phone.company mail( to: @company_phone.extensions.admin.first.email, subject: '¡Tu plan de minutos con GurúComm está activado!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def minute_plan_percentage_reminder(minute_plan) attachments.inline['saldo.png'] = email_cdn_file '/img/saldo.png' @minute_plan = minute_plan @minute_plan = minute_plan @company_phone = minute_plan.payment_subscription.company_phone @company = @company_phone.company mail( to: @company_phone.extensions.admin.first.email, subject: '¡Tu plan GurúComm se está terminando!' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def minute_plan_empty(minute_plan) attachments.inline['saldo.png'] = email_cdn_file '/img/saldo.png' @minute_plan = minute_plan @company_phone = minute_plan.payment_subscription.company_phone @company = @company_phone.company mail( to: @company_phone.extensions.admin.first.email, subject: '¡Tu plan de minutos GurúComm se terminó! :(' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def admin_behavior_warning(email, company_phone, notification) @company_phone = company_phone @company = @company_phone.company @notification = notification mail( to: email, subject: 'GurúComm | Una línea esta cerca del límite de uso' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def admin_behavior_cancel(email, company_phone, notification) @company_phone = company_phone @company = @company_phone.company @notification = notification mail( to: email, subject: 'GurúComm | Una línea fue cancelada por rebasar el límite de uso' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def user_behavior_cancel(email, company_phone, notification) @company_phone = company_phone @company = @company_phone.company @notification = notification mail( to: email, subject: 'GurúComm | Tu línea fue cancelada por rebasar el límite de uso' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def sentiment_too_low(call) @call = call @company_phone = call.company_phone @company = @company_phone.company attachments['call.wav'] = read_url_file call.audiofile mail( to: @company_phone.extensions.admin.first.email, subject: 'GurúComm | Llamada negativa' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def trial_ended(company_phone) attachments.inline['consult.png'] = email_cdn_file('/img/consult.png') @company_phone = company_phone @company = @company_phone.company @pay_url = "#{@landing_url}/pago?api_key=#{@company.api_key}" mail( to: @company_phone.extensions.admin.first.email, subject: 'GurúComm | Tu periodo de prueba ha finalizado' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def trial_warning(company_phone) @company_phone = company_phone @company = @company_phone.company @pay_url = "#{@landing_url}/pago?api_key=#{@company.api_key}" mail( to: @company_phone.extensions.admin.first.email, subject: 'GurúComm | Te queda un día de tu periodo de prueba' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.67770433", "0.66957134", "0.6587878", "0.6558606", "0.64843655", "0.6415694", "0.6407799", "0.6277284", "0.6237926", "0.62356037", "0.61948043", "0.61871976", "0.61804605", "0.6140911", "0.60619575", "0.60419685", "0.6034594", "0.6010198", "0.6008101", "0.6008101", "0.5977...
0.0
-1
Delivers a new HTML email template for the given parameters
def trial_early(company_phone) @company_phone = company_phone @company = @company_phone.company @trial_discount = ENV['TRIAL_EARLY_BUY_DISCOUNT'] @pay_url = "#{@landing_url}/pago?api_key=#{@company.api_key}" @discount_limit = @company.trial_ends_at.localtime.strftime('%d/%m/%Y a las %H:%M') mail( to: @company_phone.extensions.admin.first.email, subject: 'GurúComm | Nos da gusto saber que estás usando GurúComm' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template for the given parameters
def email_support_code(extension) @extension = extension @company_phone = @extension.company_phone @company = @company_phone.company mail( to: extension.email, subject: 'GurúComm | Código de soporte' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem...
[ "0.6778288", "0.6695501", "0.6587717", "0.6559556", "0.648509", "0.6417009", "0.6407714", "0.6276688", "0.6239319", "0.62355417", "0.61955315", "0.6187832", "0.61812514", "0.61393625", "0.6062192", "0.604328", "0.6034051", "0.60109484", "0.6006722", "0.6006722", "0.5978661", ...
0.0
-1
Delivers a new HTML email template as a reminder for active current balance remaining 5 days before expiry date
def balance_reminder(company_phone, total_current_balance) env_days_parameter = 'REMAINING_DAYS_TO_EXPIRE_MINUTE_PLANS' days_before_expire_minute_plan = ENV[env_days_parameter].to_i @remaining_balance = total_current_balance @company_phone = company_phone @company = @company_phone.company @days_before_expire = days_before_expire_minute_plan mail( to: @company_phone.extensions.admin.first.email, subject: 'GurúComm | Recordatorio no pierdas tu saldo' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reminder(user:)\n @user = user\n @expiration = @user.trial_ends_at\n @subject = \"Your free trail to My Site Archive expires in #{time_ago_in_words(@expiration)}.\"\n\n mail to: @user.email, subject: @subject\n end", "def new_html_email(html, triggered_by_user_test)\n if triggered_...
[ "0.6552668", "0.64817804", "0.6399094", "0.63795996", "0.634971", "0.6276933", "0.6275194", "0.6229337", "0.6196038", "0.6172639", "0.6159178", "0.613212", "0.6092085", "0.6058609", "0.6041599", "0.60322964", "0.6029608", "0.5992609", "0.59843165", "0.59687924", "0.5956137", ...
0.61317015
12
sets the appropriate external urls for +landing_url+, +dashboard_url+ and inline attachments to be rendered as part of the given HTML template This method should be called as part of a +before_action+ filter call.
def set_external_urls! @landing_url = ENV['LANDING_URL'] @dashboard_url = ENV['DASHBOARD_URL'] @facebook_url = ENV['FACEBOOK_URL'] @twitter_url = ENV['TWITTER_URL'] @desk_url = ENV['DESK_URL'] @linkedin_url = ENV['DESK_URL'] @telephone_support = ENV['TELEPHONE_SUPPORT'] @email_support = ENV['EMAIL_SUPPORT'] attachments.inline['logo.png'] = email_cdn_file '/img/main-logo.png' # Footer attachments.inline['corazon.png'] = email_cdn_file '/img/corazon.png' attachments.inline['fb.png'] = email_cdn_file '/img/fb.png' attachments.inline['tw.png'] = email_cdn_file '/img/tw.png' attachments.inline['linkedin.png'] = email_cdn_file '/img/linkedin.png' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure\n # fetching page via before filter\n if @page.redirects_to_external?\n render action: 'configure_external', layout: !request.xhr?\n else\n @page_layouts = PageLayout.layouts_with_own_for_select(@page.page_layout, session[:language_id], @page.layoutpage?)\n ...
[ "0.53090364", "0.51494175", "0.5115328", "0.48511735", "0.47918582", "0.4743964", "0.471601", "0.47107232", "0.4705543", "0.47029603", "0.46918395", "0.465588", "0.46466857", "0.46458763", "0.4630865", "0.4627193", "0.462109", "0.46180728", "0.46074802", "0.45886412", "0.4574...
0.6382871
0
adds social media icons to the emails that use them This method should be called as part of a +before_action+ filter call on company_new and trial_warning methods
def attach_social_tags! attachments.inline['facebook.png'] = email_cdn_file '/img/facebook.png' attachments.inline['twitter.png'] = email_cdn_file '/img/twitter.png' attachments.inline['chat.png'] = email_cdn_file '/img/chat.png' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_badges!\n attachments.inline['play-store.png'] = email_cdn_file '/img/play-store.png'\n attachments.inline['app-store.png'] = email_cdn_file '/img/app-store.png'\n end", "def feed_icon(activity)\n img = case activity_type(activity)\n when \"StatusUpdate\"\n \"friend_g...
[ "0.6199915", "0.61491656", "0.6090152", "0.6077255", "0.60573024", "0.5990878", "0.5947843", "0.59304893", "0.58562", "0.58555245", "0.58251786", "0.58075905", "0.56138057", "0.55532616", "0.5510738", "0.5508289", "0.54722774", "0.5455515", "0.54345936", "0.53919286", "0.5366...
0.74284124
0
adds support phone & mail icons to the emails that use them This method should be called as part of a +before_action+ filter call on trial_early payment_new payment_subscription_canceled minute_plan_new minute_plan_empty minute_plan_percentage_reminder methods
def attach_support! attachments.inline['phone.png'] = email_cdn_file '/img/phone.png' attachments.inline['voicemail.png'] = email_cdn_file '/img/voicemail.png' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirmation_instructions(record, token, opts={})\n attachments.inline['logo_512.png'] = File.read('app/assets/images/logo_128.png')\n super\n end", "def regular_reminder_email\n @retailers = Spree::Retailer.active\n \n respond_to do |format|\n format.html { render :template => \"spree/o...
[ "0.562233", "0.5578662", "0.5563325", "0.5563325", "0.55483896", "0.55201787", "0.55012023", "0.5481392", "0.54556954", "0.54071635", "0.5384363", "0.53150487", "0.52873194", "0.5261762", "0.52574843", "0.5252874", "0.52498627", "0.5241363", "0.5240746", "0.52296656", "0.5199...
0.63260674
0
adds iOS and Android badges to the emails that use them This method should be called as part of a +before_action+ filter call on company_new, extension_delete and extension_new_or_updated methods
def attach_badges! attachments.inline['play-store.png'] = email_cdn_file '/img/play-store.png' attachments.inline['app-store.png'] = email_cdn_file '/img/app-store.png' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badges\n end", "def apply_badges\n if rule_applies?\n grant_badge if new_or_multiple?\n else\n remove_badge if @rule.temporary\n end\n end", "def badge; end", "def mobile_badge_image\n badge_type.image_url + year.to_s + \"mobile.png\"\n end", "def for_badge(badge); ...
[ "0.59965456", "0.58933884", "0.57727754", "0.5615012", "0.559246", "0.5496168", "0.5407213", "0.54036534", "0.5373714", "0.52673113", "0.52600044", "0.5222109", "0.51394635", "0.5133382", "0.50618035", "0.5024284", "0.50239956", "0.5021503", "0.50212395", "0.5013394", "0.4997...
0.6323218
0
reads and returns the file at ENV['EMAIL_CDN_URL'] + path
def email_cdn_file(path) read_url_file ENV['EMAIL_CDN_URL'] + path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(path)\n response = with_remote do |http|\n http.get(path)\n end\n response.body\n end", "def get_file(url)\n get(url).body\n end", "def get_gh_file_content(filename)\n uri = \"https://raw.githubusercontent.com/fastruby/rails-template/main/config_files/#{filename}\"\n Net::HTT...
[ "0.6293314", "0.6210323", "0.61470664", "0.6138817", "0.6077216", "0.60676473", "0.59741396", "0.5904558", "0.58938485", "0.58417934", "0.58401716", "0.57988685", "0.5784872", "0.5779484", "0.57762784", "0.57670915", "0.574853", "0.57331055", "0.5722627", "0.57137346", "0.567...
0.9157742
0
reads and returns the file at the given url
def read_url_file(url) uri = URI.parse url uri.read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(url)\n get(url).body\n end", "def get_file(url); end", "def fetch_file_from_url(url)\n logger.debug \"Starting GET of file from #{url}\"\n start_time = Time.now\n uri = URI.parse(url)\n if (uri.kind_of?(URI::HTTP))\n resp = Net::HTTP.get_response(uri)\n case r...
[ "0.8464559", "0.8463074", "0.7862287", "0.77374774", "0.77045053", "0.77045053", "0.75278807", "0.7524531", "0.7440609", "0.7440609", "0.7422633", "0.7366121", "0.72938246", "0.72565514", "0.7237698", "0.7172112", "0.71653265", "0.7153033", "0.7153033", "0.707602", "0.7063308...
0.869932
0
GET /discover or / or /en/:page_slug
def index # BE CAREFUL only to use `public_videos` when building these queries! fields = cms_data&.data&.fields @seo_title = fields&.seo_title || "Discovery Veue" @cms_components = fields&.components set_default_variables && return if @cms_components.blank? @cms_components = map_cms_components(@cms_components) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if params[:page_url].blank? && params[:locale].blank?\n redirect_to get_railsgun_url(railsgun_home)\n elsif params[:page_url].blank? && !params[:locale].blank?\n redirect_to get_railsgun_url(railsgun_home, {:lang => params[:locale]})\n else\n page_url = params[:page_url]\n s...
[ "0.65962285", "0.62297976", "0.61665815", "0.61482304", "0.61147326", "0.60971075", "0.60721165", "0.6051502", "0.598533", "0.5956202", "0.58564866", "0.58133847", "0.580523", "0.5772595", "0.57597715", "0.57587016", "0.57554924", "0.56706315", "0.564366", "0.56385547", "0.56...
0.0
-1
def tags= fieldrelated access
def [](key); @data["@fields"][key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags\n @fields.tag_list\n end", "def tags() ; info[:tags] ; end", "def tags() ; info[:tags] ; end", "def tags=(_arg0); end", "def tags\n ...
[ "0.7404364", "0.7404364", "0.7404364", "0.7404364", "0.7404364", "0.72426945", "0.70814645", "0.70814645", "0.6829164", "0.6828394", "0.6828394", "0.6824623", "0.6774287", "0.67511135", "0.67423594", "0.67423594", "0.65948194", "0.65948194", "0.6566592", "0.65248257", "0.6523...
0.0
-1
Time this email address was last sent an email (doesn't necessarily mean that it arrived)
def time_last_received a = emails_received.order("created_at DESC").first a.created_at if a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_delivered_date_time\n return @last_delivered_date_time\n end", "def message_received_date_time\n return @message_received_date_time\n end", "def sent_date_time\n return @sent_date_time\n end", "def sent_at\n # Use d...
[ "0.7081448", "0.68963015", "0.68715584", "0.6816574", "0.6763651", "0.6763651", "0.6763651", "0.67434067", "0.67338675", "0.67338675", "0.669013", "0.6677694", "0.6621591", "0.6596714", "0.65939665", "0.6583094", "0.6528618", "0.65231556", "0.6404718", "0.63978624", "0.637687...
0.6945195
1
TODO: Fairly simplistic. This should be expanded to somehow take into consideration stages and selected practices
def calculate_completeness_score total = 0.0 counted = 0.0 fields.keys.each do |key| total += 1 if self[key] counted += 1 end end write_attributes(completeness_score: counted / total) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage; end", "def stage; end", "def passes; end", "def passes; end", "def production_curtailment; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def decisions_that_will_move_to_next_stage\n return @decisions_that_will_...
[ "0.64323187", "0.64323187", "0.56538475", "0.56538475", "0.56337494", "0.5587805", "0.5587805", "0.5587805", "0.5587805", "0.5487599", "0.5482249", "0.5474433", "0.5465796", "0.5363054", "0.52903986", "0.52803284", "0.5278802", "0.525838", "0.52550876", "0.52332217", "0.52310...
0.0
-1
TODO: Fairly simplistic. Should probably be normalized properly. Right now normalization is based on the highest impressions, and how this one stacks up. It should probably also take into consideration How many gardens this thing is in.
def calculate_popularity_score top_guide = (Guide.order_by("impressions_field" => :asc).last) at_most = (top_guide.impressions_field || 0).to_i normalized = impressions_field.to_f / at_most write_attributes(popularity_score: normalized) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized_weighting\n BigDecimal(weight.to_s) / ReputationRule.sum('weight')\n end", "def normalized; end", "def normalize\n unless @hits.empty? then \n max = highest_score\n min = lowest_score\n all.each do |hit| \n if (max == min) then\n hit.score = 1\n else\...
[ "0.5618492", "0.55880946", "0.5573474", "0.545358", "0.52956426", "0.52711225", "0.52146965", "0.5204148", "0.520347", "0.51950705", "0.517544", "0.5163803", "0.51611257", "0.5157315", "0.51511514", "0.5149564", "0.5134578", "0.5085123", "0.5076911", "0.50753504", "0.5049411"...
0.5380655
4
For each stage, find the overlapping needs, and then calculate the percentage overlap of each need ToDO this can be cleaned up, probably significantly by externalizing the basic_need structure.
def find_overlap_in(basic_needs) stages.each do |stage| basic_needs.each do |need| # This is bad structure if need[:name] == "Sun / Shade" build_overlap_and_total need, stage.light end if need[:name] == "Location" build_overlap_and_total need, stage.environment end if need[:name] == "Soil Type" build_overlap_and_total need, stage.soil end end end calculate_percents basic_needs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_progress\n if stages.any?\n from_stages = stages.collect{ |pr| pr.relative_progress }.sum\n end\n sum=(relative_milestone.to_f / milestones) * relative_expected_percentage\n sum + from_stages.to_f\n end", "def sort_cyclists_race_stage(race, current_stage)\n sorted_cyclists = []\...
[ "0.5507725", "0.5492235", "0.53057414", "0.5297229", "0.52926964", "0.522632", "0.5174879", "0.51081264", "0.510684", "0.50538296", "0.5050639", "0.5001935", "0.49572787", "0.4945214", "0.49226388", "0.49019447", "0.4883641", "0.48786342", "0.4867717", "0.48529574", "0.485037...
0.8318963
0
GET /accounts GET /accounts.xml
def index @accounts = Account.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @accounts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accounts\n get('/accounts')['accounts']\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end", "def get_accounts\n response_xml = http_get(@client, \"#{xero...
[ "0.7999446", "0.7898784", "0.7882117", "0.77555275", "0.7290948", "0.7235921", "0.71545166", "0.7096497", "0.70077676", "0.68644774", "0.6804482", "0.6804482", "0.6804482", "0.6792107", "0.67712724", "0.674755", "0.67264915", "0.67262393", "0.67228657", "0.6714263", "0.669006...
0.720842
8
GET /accounts/1 GET /accounts/1.xml
def show @account = Account.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @account } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accounts()\n http_get(accounts_url)\n end", "def accounts\n get('/accounts')['accounts']\n end", "def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end", "def index\n @accounts = User::Account.find(:all)\n respond_...
[ "0.7178206", "0.71770984", "0.7146679", "0.70491517", "0.70124394", "0.6996187", "0.6996187", "0.6996187", "0.6826577", "0.6818658", "0.68040127", "0.6797624", "0.67834985", "0.6768142", "0.67325836", "0.6600326", "0.65947014", "0.65493125", "0.65372556", "0.6475047", "0.6417...
0.6882682
10
GET /accounts/new GET /accounts/new.xml
def new @login = Login.new @account = Account.new( :language => 'English', :location_country => 'U.S.A.', :login => Login.new ) to_show_login # makes the encryption keys respond_to do |format| format.html # new.html.erb format.xml { render :xml => @account } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml ...
[ "0.77111924", "0.75883394", "0.75883394", "0.75883394", "0.7587143", "0.75608355", "0.7436955", "0.74114114", "0.73792976", "0.72590446", "0.701828", "0.6995072", "0.69235086", "0.689667", "0.687935", "0.68713456", "0.68598795", "0.6844322", "0.6844322", "0.6844322", "0.68443...
0.6312086
97
POST /accounts POST /accounts.xml
def create # logger.warn("PARAMS=#{params.inspect}"); @login = Login.new(params[:login]) @account = Account.new(params[:account]) @account.registered_at = DateTime.now @account.login = @login if session[:key].nil? or params[:login][:encrypted_pwd].nil? then flash[:notice] = 'You must enter a user name and password to enter' # return to_show_login redirect_to new return end # Process the password and create a salt value key = OpenSSL::PKey::RSA.new(session[:key]) pwd = key.private_decrypt(Base64.decode64(@login.encrypted_pwd)) @login.salt = OpenSSL::Digest::SHA1.new( OpenSSL::Random.random_bytes(256)).hexdigest @login.encrypted_pwd = OpenSSL::Digest::SHA1.new([@login.salt,pwd].to_s).hexdigest is_valid = @login.valid?() & @account.valid?() respond_to do |format| if is_valid @login.save @account.save format.html { redirect_to(login_path, :notice => 'Account was successfully created. Please log in to start adding recipes!') } format.xml { render :xml => @account, :status => :created, :location => @account } else to_show_login # makes the encryption keys format.html { render :action => "new" } format.xml { render :xml => @account.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_accounts(to_hash)\n end", "def create\n @account = Account.new(params[:account])\n @account.member = current_member\n logger.info @account.inspect\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Thanks for signing up!' \n ...
[ "0.6668082", "0.6515732", "0.6406301", "0.6206074", "0.6115153", "0.6086195", "0.60684645", "0.60646504", "0.6042878", "0.60046524", "0.59852195", "0.5982207", "0.5975718", "0.59496367", "0.59352857", "0.59255624", "0.59192026", "0.5915424", "0.5899621", "0.583657", "0.582662...
0.0
-1
PUT /accounts/1 PUT /accounts/1.xml
def update flash[:notice] = 'Currently no editing is allowed.' redirect_to recipes_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def upd...
[ "0.65522444", "0.654224", "0.65161276", "0.64527726", "0.63857067", "0.6344283", "0.63387793", "0.62924033", "0.62907106", "0.6289964", "0.62295306", "0.61875224", "0.61702245", "0.6134423", "0.6109747", "0.61048466", "0.61047214", "0.6085375", "0.6047652", "0.6043752", "0.60...
0.0
-1
DELETE /accounts/1 DELETE /accounts/1.xml
def original_destroy @account = Account.find(params[:id]) @account.destroy respond_to do |format| format.html { redirect_to(accounts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end", "def destroy\n @account = User::Account.find(params[:id])\n @accou...
[ "0.7477301", "0.734139", "0.7068001", "0.70302635", "0.7027548", "0.70255667", "0.70252687", "0.70252687", "0.7000348", "0.6984796", "0.69424415", "0.6934431", "0.69020754", "0.68642956", "0.6827316", "0.6758896", "0.673012", "0.665705", "0.66357344", "0.66250515", "0.657139"...
0.65398735
24
GET /asistencia GET /asistencia.json
def index @asistencias = Asistencium.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end", "def index\r\n# @asistencias = Asistencia.all\r\n seccion = params[:seccion_id]\r\n if params[:seccion...
[ "0.75600266", "0.73143697", "0.7168776", "0.704146", "0.7012732", "0.6930996", "0.69065595", "0.6894513", "0.6882119", "0.6871191", "0.6798488", "0.67658114", "0.67605203", "0.6752619", "0.6725564", "0.67229533", "0.67098093", "0.6695858", "0.6691336", "0.6687525", "0.6684758...
0.65267414
46
GET /asistencia/1 GET /asistencia/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html...
[ "0.7572319", "0.7076928", "0.7010165", "0.6945212", "0.6896277", "0.6886332", "0.6876898", "0.68524367", "0.68393075", "0.682729", "0.68036455", "0.6803478", "0.6791749", "0.6790876", "0.6776855", "0.6761636", "0.6755038", "0.6755038", "0.67497826", "0.6748071", "0.6740988", ...
0.0
-1
POST /asistencia POST /asistencia.json
def create @success=false @asistencium = Asistencium.new(asistencium_params) if @asistencium.valid? @asistencium.save @success=true redirect_to admin_asistencias_path, notice: "Asistencia creado exitosamente" else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format....
[ "0.67545015", "0.6707591", "0.66096956", "0.6539821", "0.6534024", "0.6513213", "0.65073633", "0.6471902", "0.6434892", "0.6431137", "0.6378253", "0.6373174", "0.6327346", "0.6323368", "0.63034075", "0.63012064", "0.6290246", "0.6289957", "0.628952", "0.62773144", "0.626122",...
0.0
-1
PATCH/PUT /asistencia/1 PATCH/PUT /asistencia/1.json
def update @success=true if Asistencium.exists?(params[:id]) @asistencium = Asistencium.find params[:id] if @asistencium.update(asistencium_params) redirect_to admin_asistencias_path, notice: "asistencium editado exitosamente" else flash.now[:alert] = "Ha ocurrido un error" render :edit end else redirect_to admin_asistencias_path, alert: "asistencium no existe" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @asistencia.update_attributes(params[:asistencia])\r\n format.html { redirect_to @asistencia, notice: 'Asistencia was successfully updated.' }\r\n format.json { head :no_content }\r\n else\...
[ "0.6816997", "0.67327106", "0.6724505", "0.6692245", "0.662558", "0.6580446", "0.65668964", "0.6565253", "0.6543985", "0.65366906", "0.65297323", "0.64796305", "0.6454453", "0.6443777", "0.6443777", "0.64276934", "0.640522", "0.6399912", "0.63956755", "0.63922125", "0.6362414...
0.0
-1
DELETE /asistencia/1 DELETE /asistencia/1.json
def destroy @asistencium.destroy respond_to do |format| format.html { redirect_to admin_asistencias_path, notice: 'Asistencium was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n @asistencia = Asistencia.find(params[:id])\r\n @asistencia.destroy\r\n\r\n respond_to do |format|\r\n# format.html { redirect_to asistencias_url }\r\n for...
[ "0.74417645", "0.7317931", "0.72524303", "0.72524303", "0.7251077", "0.7249009", "0.7210173", "0.71953976", "0.7189767", "0.7177145", "0.717164", "0.7159907", "0.7150328", "0.7125599", "0.7123554", "0.71109515", "0.7107753", "0.7100206", "0.709605", "0.7091088", "0.7088029", ...
0.69688445
58
Use callbacks to share common setup or constraints between actions.
def set_asistencium @asistencium = Asistencium.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 asistencium_params params.require(:asistencium).permit(:nombre, :apellido, :correo, :telefono, :institucion) 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
++ This method is for validating patient account number. | Patient account number Required alphabets, numeric, hyphen and | period only for BAC. Otherwise error message will throw. | Patient account number Required alphabets, numeric, hyphen, period | forward slash only for non BAC. Otherwise error message will throw. | No consecutive occurrence of special characters allowed | No maximum limit to any special characters except forward slash(3) | ++
def validate_patient_account_number error_message = "" error_message += "Patient Account Number should be Alphanumeric, hyphen or period only!" if $IS_PARTNER_BAC && !patient_account_number.blank? && (patient_account_number.match(/\.{2}|\-{2}|^[\-\.]+$/) || !patient_account_number.match(/^[A-Za-z0-9\-\.]*$/)) error_message += "Patient Account Number should be Alphanumeric, hyphen, period or forward slash only!" if !$IS_PARTNER_BAC && !patient_account_number.blank? && (patient_account_number.match(/\.{2}|\-{2}|\/{2}|^[\-\.\/]+$/) || !patient_account_number.match(/^[A-Za-z0-9\-\.\/]*$/) || patient_account_number.gsub(/[a-zA-Z0-9\.\-]/, '').match(/\/{4,}/)) errors.add(:base, error_message) unless error_message == "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_patient_account_number\n error_message = \"\"\n error_message += \" Account# - Required Alphanumeric, hyphen and period only!!\" if $IS_PARTNER_BAC &&\n !account_number.blank? &&\n (account_number.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !account_number.match(/^[A-Za-z0-9\\-\\.]...
[ "0.8801757", "0.6731357", "0.671379", "0.66163254", "0.64974374", "0.6358937", "0.61531025", "0.6129731", "0.61265916", "0.6122384", "0.60594535", "0.5988685", "0.59755933", "0.5954016", "0.5951452", "0.59211755", "0.5889629", "0.588145", "0.5881276", "0.5863973", "0.5853004"...
0.86132514
1
[5, 0, 7, 7, 5] = [[0, 4], [2,3]] (1) takes array (done) (2) return all and only pairs include 0,2 (done) (3) return pairs in dictionary order (done) [...] sort it : nlogn / BINARY SEARCH = log(n) [] i = 0 incrementing i j = length1 decrementing j
def two_sum(arr) output = [] (0...arr.length).each do |idx1| (idx1+1...arr.length).each do |idx2| output << [idx1, idx2] if arr[idx1] + arr[idx2] == 0 end end output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_possible_pairing_of_word(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n arr.each do |entry2|\n if reformed_array.include? [entry, entry2]\n \n elsif reformed_array.include? [entry2, entry]\n elsif entry != entry2 \n ...
[ "0.67509985", "0.6695043", "0.6661897", "0.66508126", "0.6636343", "0.6628136", "0.6576361", "0.656862", "0.6540317", "0.64646286", "0.640334", "0.6396252", "0.63799006", "0.6376302", "0.63674736", "0.6342688", "0.6341022", "0.6335232", "0.6329098", "0.6313472", "0.6311879", ...
0.0
-1
Given a circular linked list, implement an algorithm that returns the node at the beginning of the loop. A circular linked list is a linked list in which the node's next pointer points to an earlier node, so as to make a loop in the linked list Observation: If two cursors are used in a manner that would normally find the middle of the list, they will eventually collide. That collision point inside the cycle occurs k nodes before reaching the beginning of the loop, where k is also the distance from the beginning of the list to the beginning of the loop.
def detect_loop(head) cursor_fast = head cursor_slow = head loop do # Check for lack of loop return nil if cursor_fast.nil? || cursor_fast.next.nil? # Advance the fast cursor at twice the speed of the slow cursor until they # collide cursor_slow = cursor_slow.next cursor_fast = cursor_fast.next.next break if cursor_slow == cursor_fast end # The collision point occurs when the fast cursor is the same distance from # the beginning of the loop as the distance from the head to the beginning # of the loop, so advance from both head and the fast cursor until another # collision occurs # cursor_slow = head until cursor_fast == cursor_slow cursor_fast = cursor_fast.next cursor_slow = cursor_slow.next end cursor_fast end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cycle\r\n return if @head == nil # don't do anything if the linked list is empty\r\n\r\n # navigate to last node\r\n cursor = @head\r\n while cursor.next != nil\r\n cursor = cursor.next\r\n end\r\n\r\n cursor.next = @head # make the last node link to first node\r\n...
[ "0.67414737", "0.6527912", "0.6527912", "0.65191036", "0.65188247", "0.6511544", "0.6447735", "0.6407043", "0.63898945", "0.6302823", "0.62232095", "0.61114496", "0.61000025", "0.59957606", "0.5926878", "0.5922874", "0.5919919", "0.57871187", "0.5767431", "0.57560545", "0.572...
0.64709795
6
Pretty output for arrays.
def should_to_s(value) value.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettyify_array(gemspec_ruby, array_name); end", "def print_array my_array\n\t\tp my_array\n\tend", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr....
[ "0.71611035", "0.7069702", "0.7054517", "0.70245105", "0.6917496", "0.68706584", "0.6799308", "0.6679061", "0.663138", "0.65993106", "0.65501034", "0.65498114", "0.6529119", "0.65164644", "0.65143365", "0.6468345", "0.6422445", "0.6418643", "0.6392748", "0.6392748", "0.633552...
0.0
-1
Pretty output for arrays.
def should_to_s(value) value.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettyify_array(gemspec_ruby, array_name); end", "def print_array my_array\n\t\tp my_array\n\tend", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr....
[ "0.71611035", "0.7069702", "0.7054517", "0.70245105", "0.6917496", "0.68706584", "0.6799308", "0.6679061", "0.663138", "0.65993106", "0.65501034", "0.65498114", "0.6529119", "0.65164644", "0.65143365", "0.6468345", "0.6422445", "0.6418643", "0.6392748", "0.6392748", "0.633552...
0.0
-1
Pretty output for arrays.
def should_to_s(value) value.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettyify_array(gemspec_ruby, array_name); end", "def print_array my_array\n\t\tp my_array\n\tend", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr....
[ "0.71611035", "0.7069702", "0.7054517", "0.70245105", "0.6917496", "0.68706584", "0.6799308", "0.6679061", "0.663138", "0.65993106", "0.65501034", "0.65498114", "0.6529119", "0.65164644", "0.65143365", "0.6468345", "0.6422445", "0.6418643", "0.6392748", "0.6392748", "0.633552...
0.0
-1
Notify the user of the backup operation results. `status` indicates one of the following: `:success` : The backup completed successfully. : Notification will be sent if `on_success` is `true`. `:warning` : The backup completed successfully, but warnings were logged. : Notification will be sent if `on_warning` or `on_success` is `true`. `:failure` : The backup operation failed. : Notification will be sent if `on_warning` or `on_success` is `true`.
def notify!(status) msg = message.call(model, status: status_data_for(status)) hash = { alert_type: default_alert_type(status) } hash.store(:msg_title, @title) hash.store(:date_happened, @date_happened) if @date_happened hash.store(:priority, @priority) if @priority hash.store(:host, @host) if @host hash.store(:tags, @tags) if @tags hash.store(:aggregation_key, @aggregation_key) if @aggregation_key hash.store(:source_type_name, @source_type_name) if @source_type_name hash.store(:alert_type, @alert_type) if @alert_type send_event(msg, hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = '[Backup::%s]' % name\n send_message(message)\n end", "def notify!(status)\n ...
[ "0.8302567", "0.81163615", "0.8035674", "0.76550704", "0.7624028", "0.71310675", "0.64598274", "0.634433", "0.6258855", "0.56951016", "0.5646068", "0.56345576", "0.5628923", "0.56183267", "0.5610646", "0.5582544", "0.55593044", "0.5549896", "0.5547308", "0.5540462", "0.552084...
0.63804084
7
Dogapi::Client will raise an error if unsuccessful.
def send_event(msg, hash) client = Dogapi::Client.new(@api_key) event = Dogapi::Event.new(msg, hash) client.emit_event(event) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_error?; end", "def auth_client\n raise NOT_IMPLEMENTED_ERROR\n end", "def api_error; end", "def client_error(e, client); end", "def initialize(api_key, app_key, notify_to, repo_path = nil)\n logger.debug 'initializing DataDog API client'\n @dog = Dogapi::Client.new(api_...
[ "0.6470656", "0.62213147", "0.62198865", "0.6066208", "0.5948094", "0.58597744", "0.574712", "0.5728763", "0.5690179", "0.56892395", "0.5620163", "0.5617483", "0.5612539", "0.560688", "0.55932933", "0.55763817", "0.55290776", "0.5508524", "0.549509", "0.5492124", "0.5491995",...
0.0
-1
calling 2 methods and passing in arguments
def virus_effects predicted_deaths speed_of_spread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method1 a,b\n\tputs a\n\tputs b\nend", "def call(*args); end", "def two_method(x,y,z)\n\t\tx + y + z\nend", "def call(*args)\n __call__( args )\n end", "def _perform(args); end", "def method_2_1(arg1, arg2)\n puts arg1 + ' ' + arg2\n end", "def perform(*args); end", "def calls...
[ "0.701875", "0.68105364", "0.6707624", "0.65806717", "0.6535579", "0.65243864", "0.6398131", "0.6387322", "0.6387322", "0.6314835", "0.6305624", "0.6294379", "0.6232037", "0.62242407", "0.61752045", "0.61752045", "0.61752045", "0.61752045", "0.61752045", "0.61752045", "0.6175...
0.0
-1
if/else depending on population_density prints what state will lose of deaths
def predicted_deaths # predicted deaths is solely based on population density counter = 200 x = 0.4 until counter == 0 if @population_density >= counter number_of_deaths = (@population * x).floor p "#{@state} will lose #{number_of_deaths} people in this outbreak" break elsif @population_density < 50 number_of_deaths = (@population * 0.05).floor p "#{@state} will lose #{number_of_deaths} people in this outbreak" break end counter -= 50 x -= 0.1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population *...
[ "0.8265052", "0.82431424", "0.82431424", "0.82431424", "0.82431424", "0.82431424", "0.82431424", "0.82120097", "0.81742996", "0.81545526", "0.815236", "0.8129759", "0.8062783", "0.8061636", "0.8038405", "0.8014647", "0.80029947", "0.80029947", "0.80029947", "0.80029947", "0.8...
0.0
-1
conditional statements prints the speed of spreading
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affectedm # by additional factors we haven't added into this functionality. counter = 200 x = 0.5 until counter == 0 if @population_density >= counter speed = x puts " and will spread across the state in #{speed} months.\n\n" break elsif @population_density < 50 puts " and will spread across the state in 2.5 months.\n\n" break end counter -= 50 x += 0.5 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_line_speed\n @line_show_fast = CP::CMS::TEXT_TYPE_OR_SKIP\n end", "def pedal_faster\n\t\t@speed += 10\n\tend", "def pedal_faster\n @current_speed = @current_speed+1\n end", "def go_very_slow\n puts \"I am a heavy truck and like going very slow.\"\n end", "def speed\n render_sta...
[ "0.57609963", "0.5734824", "0.56546307", "0.55030155", "0.54740286", "0.5470399", "0.5455529", "0.5413609", "0.5397303", "0.5389544", "0.5333332", "0.5327279", "0.53178734", "0.52777255", "0.5277581", "0.5255289", "0.5254368", "0.52482146", "0.52191305", "0.52086246", "0.5201...
0.0
-1
Get the matcher for the supplied key and value. Will determine the class name from the key.
def matcher(key, value) if value.is_a?(Hash) name = "Humanoid::Matchers::#{value.keys.first.gsub("$", "").camelize}" return name.constantize.new(attributes[key]) end Default.new(attributes[key]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key_matcher(key)\n HasKeyMatcher.new(key)\n end", "def get(node, key)\n return nil unless map.key?(key)\n\n map[key].map do |matcher|\n return matcher[:klass] if node_matches?(node, matcher)\n end\n nil\n end", "def find(key)\n new(key: key, name: TYPES[ke...
[ "0.65061283", "0.6500671", "0.6051914", "0.59384984", "0.5671765", "0.5660972", "0.5643733", "0.54870015", "0.5404456", "0.5403583", "0.5388436", "0.53764033", "0.53764033", "0.52970207", "0.52968675", "0.5274466", "0.52665186", "0.52074903", "0.5173323", "0.51571083", "0.513...
0.7497748
0
returns a boolean indicating if this order contains items priced at wholesale prices. NB: this relies on line item pricing not changing between when the order was confirmed and when it was measured as wholesale.
def wholesale? line_items.any? do |line_item| product = line_item.product # a product could have multiple wholesale prices [ product.wholesale_price, product.wholesale_subscription_price ].include? line_item.price end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priced?()\n priced = true\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do |line|\n if (not line.price or line.price == 0)\n priced = false\n end\n end\n return priced\n end", "def absolutely_priced?\n ...
[ "0.714045", "0.6787406", "0.6571844", "0.642971", "0.61430776", "0.6069102", "0.6065739", "0.60589856", "0.6015011", "0.5976082", "0.5967763", "0.5965184", "0.5959917", "0.5936331", "0.59055287", "0.58939075", "0.58862907", "0.5879605", "0.58463895", "0.58039707", "0.57928723...
0.8281438
0
override this, don't let the button show up if they have less
def minimum_spend_met? !(user.try(:wholesaler?) && item_total.to_f < MINIMUM_ITEM_TOTAL) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def megaButton\n @showMega = true\n end", "def show_less\n show_container.span(:class => 'response-show-less').click\n end", "def button_up(id)\n super(id)\n @buttons_up << id unless @buttons_up.include?(id)\n end", "def initially_hide_button\n @hidden_submit = true\n end", "...
[ "0.6270329", "0.6022702", "0.59824187", "0.5939828", "0.58913714", "0.58903563", "0.58859366", "0.58678293", "0.5840026", "0.5823529", "0.5756683", "0.5750584", "0.57475156", "0.57207686", "0.5692939", "0.5648793", "0.5645724", "0.5634077", "0.5622886", "0.56168836", "0.55967...
0.0
-1
Indicate whether two records match.
def match?(rec_1, rec_2) (rec_1.is_a?(ApplicationRecord) || rec_2.is_a?(ApplicationRecord)) && (rec_1.class.try(:base_class) == rec_2.class.try(:base_class)) && (rec_1.attributes == rec_2.attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identical?(record1, record2)\n if regexp\n if (str1_match_data = regexp.match(record1.whole)) and (str2_match_data = regexp.match(record2.whole))\n str1_match_data.captures.join.downcase == str2_match_data.captures.join.downcase\n else\n nil\n end\n ...
[ "0.702897", "0.700874", "0.6474112", "0.64460033", "0.6412726", "0.63998085", "0.63897574", "0.6389092", "0.6388061", "0.63669556", "0.63639224", "0.63442314", "0.63100874", "0.619606", "0.6194118", "0.61918914", "0.61667085", "0.6162497", "0.6162497", "0.61593837", "0.612716...
0.7414413
0
Translate hash keys/values into SQL conditions.
def sql_clauses(hash, join: :and, connector: join) result = hash.map { |k, v| sql_clause(k, v) }.compact_blank! connector &&= connector.to_s.strip.upcase connector ? result.join(" #{connector} ") : result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_to_condition(table, hash)\n conditions = hash.map do |attr, value|\n if value.is_a?(Array) && value.size > 1\n table[attr].in(value)\n elsif value.is_a?(Array)\n table[attr].eq(value[0])\n else\n table[attr].eq(value)\n end\n end\n\n co...
[ "0.7059284", "0.66898036", "0.6487951", "0.6442158", "0.6428471", "0.6364653", "0.63304013", "0.6308633", "0.6295559", "0.6287349", "0.61964273", "0.6194195", "0.6180047", "0.6163046", "0.6136359", "0.6132564", "0.6120727", "0.6106248", "0.60125774", "0.59997404", "0.5990649"...
0.6558469
2
Translate a key and value into a SQL condition.
def sql_clause(k, v = nil) k, v = *k.first if k.is_a?(Hash) v = Array.wrap(v) if v.is_a?(Range) v = v.strip if v.is_a?(String) v = v.split(/\s*,\s*/) if v.is_a?(String) && v.include?(',') return sql_test(k, v) unless v.is_a?(Array) v = v.uniq if v.many? && (v.map(&:class).uniq.size == 1) ranges = v.sort.chunk_while { |prev, this| prev.succ == this }.to_a ranges.map! { |r| (r.size >= 5) ? Range.new(r.first, r.last) : r } ranges, singles = ranges.partition { |r| r.is_a?(Range) } ranges.map! { |range| sql_test(k, range) } singles.flatten! else ranges = [] singles = v end if singles.present? singles.map! { |s| sql_quote(s) } ranges << "#{k} IS NULL" if singles.reject!(&:nil?) ranges << "#{k} IN (%s)" % singles.join(',') if singles.present? end if ranges.many? ranges.map! { |s| "(#{s})" }.join(' OR ') else ranges.first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{...
[ "0.65825796", "0.6576725", "0.6549438", "0.63017297", "0.6292038", "0.62187994", "0.62187994", "0.61489683", "0.6101031", "0.59304106", "0.5926755", "0.58977175", "0.58608675", "0.58470076", "0.58020765", "0.57661784", "0.57131344", "0.5709658", "0.56801903", "0.55398417", "0...
0.5993883
9
Look for a value in a standard database field.
def sql_match_pattern(column, value, **opt) '(%s)' % sql_test(column, value, **opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by(field, value)\n @base.send('find_by_' + field, value)\n end", "def has_value?(value)\n field(with: value)\n end", "def find_field(name_or_id)\n self.fields.detect { |field| field.matches?(name_or_id) }\n end", "def find(value)\n end", "def find_val...
[ "0.68409497", "0.640802", "0.63580143", "0.62126577", "0.6118324", "0.60872704", "0.6078539", "0.60477096", "0.60280037", "0.6026498", "0.59976876", "0.59919524", "0.59760445", "0.5957455", "0.5949271", "0.59472305", "0.59330523", "0.5868983", "0.58654076", "0.58654076", "0.5...
0.0
-1
Look for value in a JSONtype database column.
def sql_match_json(column, term, **opt) # JSON_CONTAINS(json_doc, candidate[, path]) # JSON_CONTAINS_PATH(json_doc, 'one'|'all', path[, path, ...]) # JSON_EXTRACT(json_doc, path[, path, ...]) # JSON_KEYS(json_doc[, path]) # JSON_OVERLAPS(json_doc1, json_doc2) # JSON_SEARCH(json_doc, 'one'|'all', search_str[, esc_char[, path, ...]]) # JSON_VALUE(json_doc, path) key, value = if term.is_a?(String) && term.include?(':') term.split(':', 2) else [nil, term] end if key.blank? name, _match, value = sql_name_value(column, value, **opt) "(JSON_SEARCH(#{name}, 'one', #{value}) IS NOT NULL)" elsif (value = value&.to_s&.strip).blank? || (value == '*') Log.warn("#{__method__}: fld match always exact") if false?(opt[:exact]) "JSON_CONTAINS_PATH(#{column}, '$.#{key}')" else # func = match_case ? "#{column}->'$.#{key}'" : "CAST(#{column}->>'$.#{key}' AS TEXT)" func = "JSON_EXTRACT(#{column}, '$.#{key}')" func = "CAST(JSON_UNQUOTE(#{func}) AS TEXT)" unless opt[:match_case] sql_match_pattern(func, value, **opt) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequel_json_column?\n return false unless record.is_a?(::Sequel::Model)\n return false unless column = record.class.db_schema[data_attribute]\n\n [:json, :jsonb].include?(column[:type])\n end", "def activerecord_json_column?\n return false unless activerecord?\n ...
[ "0.685199", "0.66126597", "0.61260897", "0.55755866", "0.5530703", "0.54978436", "0.5464136", "0.54629457", "0.5428967", "0.5427896", "0.5423991", "0.5414909", "0.5385554", "0.5362641", "0.53302306", "0.5322416", "0.5297104", "0.52746135", "0.522732", "0.52242494", "0.5197955...
0.6593178
2
Generate the SQL fragment which is the test of a name against a value.
def sql_test(name, value, **opt) sql_name_value(name, value, **opt).join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_name_value(name, value, **opt)\n opt.merge!(exact: true, match_case: true) if uuid?(value)\n match, term = sql_match_term(value, **opt)\n if !opt[:match_case] && !name.match?(/lower\\(/i) && term.match?(/'\\)?$/)\n name = \"CAST(lower(#{name}) AS TEXT)\"\n end\n [name, match, term]\n e...
[ "0.67215604", "0.6195884", "0.6141351", "0.58668095", "0.57721853", "0.5757973", "0.5751495", "0.5732079", "0.572591", "0.5715355", "0.56617546", "0.5650009", "0.5633433", "0.5617216", "0.5581369", "0.55488175", "0.5548132", "0.5545094", "0.5528269", "0.548424", "0.5480592", ...
0.78687024
0
Generate the SQL fragment elements for testing a name against a value.
def sql_name_value(name, value, **opt) opt.merge!(exact: true, match_case: true) if uuid?(value) match, term = sql_match_term(value, **opt) if !opt[:match_case] && !name.match?(/lower\(/i) && term.match?(/'\)?$/) name = "CAST(lower(#{name}) AS TEXT)" end [name, match, term] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_test(name, value, **opt)\n sql_name_value(name, value, **opt).join(' ')\n end", "def name\n \"\\\"#{filter_name}\\\" = \\\"#{filter_value}\\\"\"\n end", "def raw_sql\n \"SELECT * FROM users WHERE name = '#{@name}'\"\n end", "def define_query\n name = @name\n klass.send :defi...
[ "0.7084041", "0.5969448", "0.5763745", "0.5643403", "0.5541746", "0.54773396", "0.5456823", "0.5440834", "0.54360527", "0.54073757", "0.54007626", "0.5364282", "0.53577906", "0.5331831", "0.53271526", "0.5316955", "0.53038716", "0.5274727", "0.5180617", "0.5176438", "0.513313...
0.6432541
1
Generate the SQL operator and value from a term.
def sql_match_term(term, exact: false, match_case: false, **) case term when nil term = term.to_s when String term = term.strip when Symbol term = term.to_s.downcase if %i[nil null NULL * any ANY].include?(term) when Range return 'BETWEEN', ('%s AND %s' % term.minmax.map! { |v| sql_quote(v) }) when Array return 'IN', ('(%s)' % term.map { |v| sql_quote(v) }.join(', ')) else return '=', term.to_s end uuid = uuid?(term) exact = match_case = true if uuid term = term.downcase unless match_case return 'IS', 'NULL' if %w[nil null NULL].include?(term) return 'IS', 'NOT NULL' if %w[* any ANY].include?(term) return '=', "'#{term}'" if term.is_a?(Symbol) return '=', term if term.match(SQL_NUMBER) return $1, $2 if term.match(SQL_COMPARISON) pattern = ->(v) { !uuid && v.match?(SQL_PATTERN) } term = "%#{term}%" unless exact || pattern.(term) match = (exact && !pattern.(term)) ? '=' : 'LIKE' return match, "'#{term}'" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expr_to_s\n buf = ''\n each_term do |term|\n if term[:operator]\n buf << term[:operator]\n end\n buf << term[:token]\n end\n buf\n end", "def operands\n table_entry.last.operands.map{ |name| [name, WordField[name].get(@raw)] }\n end", "def sql(options = {})\n ...
[ "0.64538616", "0.6320846", "0.6234584", "0.6076877", "0.6057644", "0.60510445", "0.59876496", "0.5973441", "0.58863163", "0.58203715", "0.5784356", "0.5745413", "0.57110673", "0.5675433", "0.5655388", "0.5639539", "0.56383026", "0.561702", "0.5613961", "0.56068295", "0.556962...
0.5321493
42
Some JSON key names have numbers in them but SQL seems to have a problem with that for the names defined within "COLUMNS()".
def sanitize_sql_name(*name) name.join('_').presence&.gsub(/\d/) { |d| DIGIT_TO_ALPHA[d] || '_' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_column_names(json_data)\n data_string = JSON.dump json_data\n @column_translation.each do |old_name, new_name|\n data_string = data_string.gsub(old_name, new_name)\n end\n JSON.load data_string\n end", "def label_columns\n ensure_full_data!\n Array(@gapi_json[:la...
[ "0.6367993", "0.6066222", "0.58705723", "0.5867816", "0.58403987", "0.57561606", "0.56953764", "0.5672872", "0.5653595", "0.5640416", "0.56244683", "0.56169236", "0.5594612", "0.55925274", "0.5555068", "0.5523456", "0.5506282", "0.5506282", "0.5506282", "0.54926485", "0.54760...
0.0
-1
Make a string safe to use within an SQL LIKE statement.
def sanitize_sql_like(text, escape_character = '\\') text.to_s.gsub(/(^|.)([%_])/) do |s| ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end", "def to_sql_contains\n \"%#{to_sql_escaped_for_like}%\"\n end", "def escape_like(term)\n \"%#{term.gsub(/(?=[\\...
[ "0.7385563", "0.6844183", "0.64878905", "0.6482862", "0.64551556", "0.6444606", "0.6264207", "0.61460346", "0.6084994", "0.6083494", "0.6060963", "0.6040519", "0.60327023", "0.59753656", "0.5936593", "0.5854153", "0.5784377", "0.5774095", "0.5757768", "0.5702562", "0.56806904...
0.69368863
1
Return the value, quoted if necessary.
def sql_quote(value) value = value.to_s.downcase if %i[nil null NULL].include?(value) # noinspection RubyMismatchedReturnType case value when nil, 'nil', 'null', 'NULL' then nil when /^-?\d+$/ then value.to_i when SQL_NUMBER then value.to_f when String, Symbol then "'#{value}'" else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_if_needed(value)\n if string_value?(value)\n quote(value)\n else\n value.to_s\n end\n end", "def quote(value)\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n ...
[ "0.7661438", "0.75164783", "0.7421647", "0.72971934", "0.7161168", "0.7056601", "0.7038471", "0.7023857", "0.7007565", "0.6992068", "0.6967372", "0.6922901", "0.6859985", "0.6825371", "0.68226355", "0.6787316", "0.6785873", "0.6762206", "0.67481446", "0.67018574", "0.6691118"...
0.0
-1
The fields defined in the schema for this record.
def field_names @field_names ||= attribute_names.map(&:to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n self.class.fields(true)\n end", "def fields\n @fields\n ...
[ "0.88632923", "0.87994033", "0.87994033", "0.87994033", "0.8049191", "0.79976785", "0.7993513", "0.7928167", "0.7928167", "0.7884876", "0.78665996", "0.78600425", "0.7841013", "0.7817691", "0.77475935", "0.7722465", "0.7722465", "0.7722465", "0.7709612", "0.7696962", "0.76969...
0.0
-1
Translate hash keys/values into SQL LIKE statements.
def sql_match(*terms, join: :and, connector: join, **opt) json = (opt[:type] == :json) connector &&= connector.to_s.strip.upcase opt[:columns] &&= Array.wrap(opt[:columns]).compact.map(&:to_sym).presence opt[:columns] ||= field_names merge_match_terms(*terms, **opt).flat_map { |field, matches| matches.map do |value| json ? sql_match_json(field, value) : sql_match_pattern(field, value) end }.then { |result| connector ? result.join(" #{connector} ") : result } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where_hash_from_params(params, parameter_names)\n where_hash = {}\n parameter_names.each do |parameter_name|\n en = params[\"#{parameter_name}_equals\".to_sym]\n ln = params[\"#{parameter_name}_like\".to_sym]\n rn = params[\"#{parameter_name}_rlike\".to_sym]\n\n [en, ln, rn].each do |...
[ "0.5684992", "0.5597699", "0.5595574", "0.5578591", "0.55764294", "0.55647624", "0.55624586", "0.5510617", "0.5470855", "0.5404422", "0.5373028", "0.5341018", "0.5330492", "0.53260833", "0.53132296", "0.52847695", "0.52394825", "0.5223591", "0.5210877", "0.5208919", "0.520862...
0.0
-1
Dynamically create a derived table with JSON fields expanded into columns
def extended_table(extra = nil, **opt) sql = sql_extended_table(extra, **opt) ActiveRecord::Base.connection.exec_query(sql) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json_object(json_)\n Table.new(Structure.from_json_array(json_['axes'] || []), :load => json_['values'] || [])\n end", "def column_fields(json=true)\n data = @data.map do |data|\n data = data.dup\n editor = parse_column_editor(data.delete(\"editor\"))\n re...
[ "0.65715563", "0.6345794", "0.63451284", "0.6240622", "0.6133896", "0.61173844", "0.593769", "0.57932734", "0.57860583", "0.57658905", "0.5747949", "0.5725878", "0.5683273", "0.5661848", "0.56416744", "0.56411946", "0.56289005", "0.56271124", "0.5592629", "0.5579854", "0.5565...
0.0
-1
The fields defined in the schema for this record.
def field_names @field_names ||= (columns_hash.keys.map(&:to_sym) rescue []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n self.class.fields(true)\n end", "def fields\n @fields\n ...
[ "0.88632923", "0.87994033", "0.87994033", "0.87994033", "0.8049191", "0.79976785", "0.7993513", "0.7928167", "0.7928167", "0.7884876", "0.78665996", "0.78600425", "0.7841013", "0.7817691", "0.77475935", "0.7722465", "0.7722465", "0.7722465", "0.7709612", "0.7696962", "0.76969...
0.0
-1
Build a relation for finding records with columns containing matches on the given search term(s).
def matching(*terms, sort: nil, **opt) # noinspection RubyMismatchedReturnType where(sql_match(*terms, **opt)).tap do |relation| relation.order!(sort) if sort end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end", "def sea...
[ "0.6483928", "0.64726365", "0.6212907", "0.6025226", "0.5986527", "0.59569424", "0.5952432", "0.593782", "0.59293634", "0.5798972", "0.57935876", "0.5747424", "0.57308125", "0.5694576", "0.5689895", "0.5673995", "0.5656456", "0.56466544", "0.5628253", "0.55732554", "0.5552627...
0.54878056
25
update true if less than
def opcode7 if value_by_mode(1) < value_by_mode(2) update_value(1, 3) else update_value(0, 3) end move_pointer(4) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bust?; value > 21; end", "def was_more_than(num)\n return self < num\n end", "def <=(value)\n self < value or self == value\n end", "def >=( context )\n comparison( :>= )\n end", "def >=(p0) end", "def >=(p0) end", "def >=(p0) end", "def <(money_live_co...
[ "0.6849854", "0.67904645", "0.6329679", "0.62752056", "0.62100166", "0.62100166", "0.62100166", "0.6168788", "0.6159619", "0.61434907", "0.59991837", "0.59885436", "0.5987466", "0.59785163", "0.5969982", "0.5967705", "0.5952815", "0.59337336", "0.59306157", "0.59089226", "0.5...
0.0
-1
update true if equals
def opcode8 if value_by_mode(1) == value_by_mode(2) update_value(1, 3) else update_value(0, 3) end move_pointer(4) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n dirty_attributes = self.dirty_attributes\n return true if dirty_attributes.empty?\n repository.update(dirty_attributes, to_query) == 1\n end", "def update\n true\n end", "def eq=(value)\n self === value\n end", "def update\n\t\treturn true\n\tend", "de...
[ "0.6507474", "0.64653915", "0.63667107", "0.62960666", "0.62362236", "0.62171286", "0.61857957", "0.60645103", "0.60001755", "0.5998525", "0.5955101", "0.59344304", "0.5920594", "0.58921564", "0.5891039", "0.5889257", "0.5886437", "0.58760303", "0.58688664", "0.5868155", "0.5...
0.0
-1
Renumbers all lists for the server
def renumber_lists lists.order("upper(name) asc").each_with_index do |list, ndx| list.update(number: ndx+1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ls\n @response[:list] = []\n end", "def set_lists\n\t\t\t@lists = @intranet.lists\n\t\tend", "def lists\n client.get_lists\n end", "def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend", "def list\n get()\n end", "def all\n data = se...
[ "0.68101895", "0.66789746", "0.66670954", "0.6529834", "0.6510972", "0.6350229", "0.6332948", "0.6279833", "0.62786746", "0.6245788", "0.62267554", "0.6224536", "0.6197634", "0.6152803", "0.6151602", "0.6151602", "0.6151602", "0.61269844", "0.61225027", "0.6116399", "0.609527...
0.0
-1
GET /mantenimientos GET /mantenimientos.json
def index @mantenimientos = Mantenimiento.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html #...
[ "0.6756736", "0.6610033", "0.6501148", "0.64646304", "0.64140964", "0.63823724", "0.63782007", "0.6335021", "0.6311437", "0.629783", "0.6229855", "0.6228947", "0.62093997", "0.6206147", "0.620283", "0.6191317", "0.61790377", "0.6174485", "0.61334544", "0.6127571", "0.61269325...
0.7143513
0
GET /mantenimientos/1 GET /mantenimientos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mantenimientos = Mantenimiento.all\n end", "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id]...
[ "0.690894", "0.66934377", "0.6545909", "0.6516417", "0.650101", "0.64748204", "0.6468315", "0.64218974", "0.6412369", "0.63464844", "0.63402003", "0.63216287", "0.63168406", "0.6307301", "0.630365", "0.62918764", "0.6288877", "0.6273331", "0.62686163", "0.6265292", "0.6264301...
0.0
-1
POST /mantenimientos POST /mantenimientos.json
def create @mantenimiento = Mantenimiento.new(mantenimiento_params) respond_to do |format| if @mantenimiento.save format.html { redirect_to @mantenimiento, notice: 'Mantenimiento was successfully created.' } format.json { render action: 'show', status: :created, location: @mantenimiento } else format.html { render action: 'new' } format.json { render json: @mantenimiento.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @manteni = Manteni.new(manteni_params)\n\n respond_to do |format|\n if @manteni.save\n format.html { redirect_to @manteni, notice: 'Manteni was successfully created.' }\n format.json { render :show, status: :created, location: @manteni }\n else\n format.html { rend...
[ "0.6624934", "0.66184264", "0.6475281", "0.64308625", "0.63792324", "0.6374643", "0.6361217", "0.6359333", "0.63561237", "0.6313994", "0.630286", "0.6234747", "0.62221396", "0.62161106", "0.6206074", "0.6191863", "0.6189003", "0.6180026", "0.61603546", "0.6147323", "0.6133138...
0.6883179
0
PATCH/PUT /mantenimientos/1 PATCH/PUT /mantenimientos/1.json
def update respond_to do |format| if @mantenimiento.update(mantenimiento_params) format.html { redirect_to @mantenimiento, notice: 'Mantenimiento was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @mantenimiento.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render...
[ "0.6665983", "0.63396305", "0.63370097", "0.6331105", "0.62979436", "0.6282518", "0.62770057", "0.62375623", "0.62370723", "0.6208305", "0.61961204", "0.6182722", "0.6172243", "0.6169204", "0.61510694", "0.6140366", "0.6131581", "0.6103185", "0.6098779", "0.6091861", "0.60915...
0.6600553
1
DELETE /mantenimientos/1 DELETE /mantenimientos/1.json
def destroy @mantenimiento.destroy respond_to do |format| format.html { redirect_to mantenimientos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metodo = Met...
[ "0.7225141", "0.7152905", "0.711448", "0.71011007", "0.7055915", "0.7041739", "0.70356524", "0.7030221", "0.6976348", "0.6965798", "0.69624656", "0.6961761", "0.6961731", "0.6959417", "0.695752", "0.6956101", "0.69542867", "0.69525796", "0.6946999", "0.69356936", "0.69289374"...
0.7433324
0
Use callbacks to share common setup or constraints between actions.
def set_mantenimiento @mantenimiento = Mantenimiento.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 mantenimiento_params params.require(:mantenimiento).permit(:fecha, :observacion, :kilometraje, :precio, :autobus_id) 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
depends_on "cmake" => :build
def install bin.install "bin/vh-config" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_depends_on\n depends_on\n end", "def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend", "def ...
[ "0.686254", "0.67781746", "0.66052765", "0.64271224", "0.6400901", "0.63707", "0.6242236", "0.61636686", "0.61636686", "0.6134171", "0.60263425", "0.60263425", "0.60263425", "0.5948395", "0.5942616", "0.583918", "0.5780113", "0.574829", "0.57477295", "0.5711843", "0.5699821",...
0.0
-1
p find_sub_arrays([1,2,3]) == [[1], [1, 2], [1, 2, 3], [2], [2, 3], [3]]
def minSubLength(arr, i) subs = find_sub_arrays(arr) correct = subs.select { |array| array.sum >= i }.min_by { |x| x.length } p correct correct == nil ? 0 : correct.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_subarrays(nums_ary)\n subarrays = []\n last_index = nums_ary.size - 1\n 0.upto(last_index) do |start_index|\n start_index.upto(last_index) do |end_index|\n subarrays << nums_ary[start_index..end_index]\n end\n end\n subarrays.push([])\nend", "def find_sub(arr)\r\n sub_arrs = []\r\n (0....
[ "0.7876341", "0.7781031", "0.77504843", "0.7267668", "0.7220391", "0.6939838", "0.6932885", "0.6932885", "0.6932885", "0.6924559", "0.6898095", "0.6817452", "0.680128", "0.678818", "0.67842966", "0.67238736", "0.66701865", "0.66648114", "0.6646468", "0.6638392", "0.661282", ...
0.0
-1
sum_to Write a function sum_to(n) that uses recursion to calculate the sum from 1 to n (inclusive of n)
def sum_to(n) return nil if n <= 0 #negatives and 0 return 1 if n == 1 #base step #inclusive step 1 + sum_to(n) n + sum_to(n - 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_to(n)\n return n if n == 1\n n + sum_to(n-1)\nend", "def sum_to(n)\n return nil if n < 0\n return 0 if n == 0\n \n n += sum_to(n-1)\n end", "def sum_to(n)\n n > 1 ? n + sum_to(n - 1) : n < 1 ? [].first : 1\n end", "def sum_to(n)\n return nil if n<0\n return 1 if...
[ "0.85981184", "0.8559683", "0.8530582", "0.8507545", "0.84941673", "0.8444665", "0.84333414", "0.8430236", "0.841632", "0.8403925", "0.8399612", "0.83535653", "0.833905", "0.8311588", "0.82808644", "0.82430476", "0.8240722", "0.82366765", "0.81964016", "0.81646836", "0.814061...
0.85292953
3
add_numbers Write a function add_numbers(nums_array) that takes in an array of Fixnums returns the sum of those numbers
def add_numbers(nums_array) return nums_array.first if nums_array.length <= 1 nums_array.pop + add_numbers(nums_array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_numbers(nums_array)\n nums_array.inject { |sum, el| sum + el }\nend", "def add_numbers(nums_array)\n\treturn nil if nums_array.length == 0\n\n\treturn nums_array.first if nums_array.length == 1\n\n\treturn nums_array.shift + add_numbers(nums_array)\nend", "def add_array_numbers(array)\n result = ar...
[ "0.8321481", "0.8145767", "0.7997068", "0.79321647", "0.7924636", "0.79061484", "0.7863706", "0.779838", "0.7787222", "0.7779538", "0.77651525", "0.7717496", "0.7687968", "0.76708037", "0.765506", "0.7575416", "0.7575239", "0.75503", "0.7546713", "0.75199497", "0.75041205", ...
0.71962935
63
Returns the incoming nodes of given type(s). See outgoing
def incoming(type) if type Traverser.new(self).incoming(type) else raise "Not implemented getting all types of incoming relationship. Specify a relationship type" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incoming(rel_type)\n storage = _create_or_get_storage(rel_type)\n NodesDSL.new(storage, :incoming)\n end", "def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end", "def outgoing(...
[ "0.7142317", "0.62232655", "0.6207916", "0.61072206", "0.60522854", "0.58887696", "0.58807546", "0.56649673", "0.56043935", "0.55896485", "0.55781966", "0.55761564", "0.55543584", "0.5549155", "0.5546515", "0.5546515", "0.5538321", "0.5491513", "0.54120237", "0.5407619", "0.5...
0.6520767
2
Returns both incoming and outgoing nodes of given types(s) If a type is not given then it will return all types of relationships. See outgoing
def both(type=nil) if type Traverser.new(self).both(type) else Traverser.new(self) # default is both end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incoming(type)\n if type\n Traverser.new(self).incoming(type)\n else\n raise \"Not implemented getting all types of incoming relationship. Specify a relationship type\"\n end\n end", "def incoming(type)\n if type\n Traverser.new(self).incoming(type)\n else\n ...
[ "0.6791047", "0.6791047", "0.65442854", "0.6318667", "0.6318667", "0.6206933", "0.61162376", "0.6105379", "0.6017283", "0.5693931", "0.5489825", "0.5323396", "0.53031653", "0.5230954", "0.5222621", "0.5097625", "0.5088274", "0.5079315", "0.5066492", "0.50662243", "0.50646263"...
0.5225532
15
autocomplete :charity, :charityname, :full => true
def causeautocomplete searchtext = params['searchText'] if session[:roleid] == ADMIN_ROLE # this will do a like search ignoring case @searchcauseresults = Charity.where("charityname ILIKE ?", "%" + searchtext + "%") else # this will do a like search ignoring case @searchcauseresults = Charity.where("charityname ILIKE ?", "%" + searchtext + "%") .where(isapproved: true) end #if @searchcauseresults.count == 0 # @searchcauseresults = Charity.new #end render :json => @searchcauseresults end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocomplete; end", "def auto_complete_for_ces\r\n value = params[:term]\r\n field = %w(collectors locality mthd verbatim_method macro_habitat micro_habitat).include?(params[:field]) && params[:field]\r\n\r\n if field && value\r\n @ids = Ce.select(field.downcase).where([ \"ces.proj_id = ? AND L...
[ "0.7240297", "0.6941648", "0.6911547", "0.67861885", "0.6628645", "0.6534587", "0.65026283", "0.6486987", "0.6457894", "0.64491814", "0.6431876", "0.6429043", "0.6373171", "0.63536984", "0.63437504", "0.62989277", "0.62639594", "0.6257117", "0.6243306", "0.62384486", "0.62072...
0.65122473
6
Change last modified time for a remote file. NOTICE: OneDrive by default keeps multiple history version for this operation. NOTICE: You must turn off versioning to prevent multiple counts on disk quota. 3 attempts will be made due to delay after a file upload.
def set_mtime(time) attempt = 0 OneDriveFile.new(@od, @od.request(api_path, {fileSystemInfo: {lastModifiedDateTime: time.utc.iso8601}}, :patch)) rescue sleep 10 attempt += 1 retry if attempt <= 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_modified=(time)\n# File.utime(Time.now, time, file_path)\n end", "def last_modified=(time)\n ::File.utime(Time.now, time, file_path)\n end", "def remote_modified_time\n return @remote_modified_time if defined?(@remote_modified_time)\n @remote_modified_time = DateTime.parse(ht...
[ "0.73942596", "0.7123099", "0.70821166", "0.70780134", "0.7033456", "0.6901058", "0.6901058", "0.6816093", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", "0.6777888", ...
0.7189952
1
Use callbacks to share common setup or constraints between actions.
def set_account @account = current_user.accounts.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Only allow a trusted parameter "white list" through.
def account_params attributes = [:name, :avatar] attributes << :domain if Jumpstart::Multitenancy.domain? attributes << :subdomain if Jumpstart::Multitenancy.subdomain? params.require(:account).permit(*attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7122858", "0.70540553", "0.69476545", "0.6902004", "0.6735809", "0.671776", "0.668886", "0.66776645", "0.66611695", "0.6555913", "0.6527077", "0.64584446", "0.64516115", "0.64500964", "0.64474493", "0.6435065", "0.6413185", "0.6413185", "0.6391701", "0.6380101", "0.6380101...
0.0
-1
On entry, display a list of teams not yet assigned to regions, and let the user select regions for them
def handle_display(aff_id) @data.affiliate = Affiliate.with_id(aff_id) @data.list = list = @data.affiliate.paks_with_no_regions if list.empty? standard_page("Assign TeamPaks to Regions", {}, NO_WORK_TO_DO) return end common_display(list, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teams_data\n # selected_team = self.class.all[prompt.to_i-1]\n puts \"\"\n puts \"---------------------------\"\n puts \"Team Name: \" + self.full_name\n puts \"City: \" + self.city\n puts \"Division: \" + self.division\n puts \"Conference: \" + self.conference\...
[ "0.6015443", "0.57188195", "0.5717676", "0.5680936", "0.56181884", "0.54840577", "0.54619074", "0.54306406", "0.54306406", "0.54306406", "0.54306406", "0.54306406", "0.54306406", "0.5415354", "0.540966", "0.53790396", "0.5363355", "0.53551763", "0.5354704", "0.5344837", "0.53...
0.5003333
65
And get here when they've pushed the button...
def handle_assign(initial_assign) list = @data.list reg_opts = @data.reg_opts count = 0 list.each do |row| index = row['i'] mem_id = row['mem_id'] reg = @cgi["reg_#{index}"].to_i if !initial_assign || reg != Affiliate::NONE membership = Membership.with_id(mem_id) old_region = membership.mem_region || Affiliate::NONE if old_region != reg count += 1 if reg == Affiliate::NONE membership.mem_region = nil else membership.mem_region = reg end $store.transaction do membership.save membership.log(@session.user, "Assigned to region #{reg_opts[reg]}") end end end end note(case count when 0 then "No teams assigned" when 1 then "One team assigned" else "#{count} teams assigned" end) @session.dispatch(Portal) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_up(id); end", "def on_button_up(button_id, point)\n end", "def button_down; end", "def on_button_push\n @command.execute if @command\n end", "def undo_button_was_pushed()\n @undo_command.undo\n end", "def undo_button_was_pushed()\n @undo_command.undo\n end", "def button_up(id)...
[ "0.7219748", "0.7217859", "0.7086096", "0.7023441", "0.6808069", "0.6808069", "0.6803227", "0.6799426", "0.6798203", "0.6793319", "0.6793319", "0.67782366", "0.6759219", "0.65324867", "0.64887357", "0.64474523", "0.6420406", "0.6419271", "0.64011395", "0.6398971", "0.63902384...
0.0
-1
Called to assign a particular teampak to a region
def assign_search(aff_id) @data.affiliate = Affiliate.with_id(aff_id) assign_common end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(region)\n @task.region = region\n end", "def state=(val); region= val; end", "def set_region\n @region = Region.find_by_permalink(params[:id])\n end", "def set_join_region_to_place\n @join_region_to_place = JoinRegionToPlace.find(params[:id])\n end", "def set_region\n ...
[ "0.62049985", "0.61299837", "0.5963763", "0.59558284", "0.59284884", "0.5904294", "0.5904294", "0.5904294", "0.5895289", "0.5895289", "0.5895289", "0.5833126", "0.5833126", "0.5833126", "0.5833126", "0.5815104", "0.572614", "0.5659376", "0.55574864", "0.5489273", "0.545006", ...
0.0
-1
convert a list of memberships into the format e need for display
def display_list(teampaks) i = -1 @data.list = list = teampaks.map do |mem| i += 1 creator = mem.creator.contact { "mem_id" => mem.mem_id, "full_passport" => mem.full_passport, "mem_name" => mem.mem_name, "mem_schoolname" => mem.mem_schoolname, "coordinator" => creator.con_name, "con_city" => creator.mail.add_city, "con_zip" => creator.mail.add_zip, "reg_#{i}" => mem.mem_region, "i" => i, } end common_display(list, false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_memberships_list\n list = []\n self.ul(:class=>\"mygroup_items_list\").spans(:class=>\"mygroups_ellipsis_text\").each do |span|\n list << span.text\n end\n return list\n end", "def to_s\n \"I'm a Membership type=#{type} and I'm #{unassigned? ? 'unassigned' : 'assigned'}\"\n end", "...
[ "0.621892", "0.6159942", "0.6023782", "0.60106784", "0.599698", "0.5928128", "0.5899912", "0.5797541", "0.5767563", "0.5717156", "0.5704628", "0.5649116", "0.5563862", "0.55197024", "0.5518431", "0.55153346", "0.5507247", "0.5501782", "0.5491831", "0.54906803", "0.5490256", ...
0.0
-1
llama a metofo con bloque (como parametro) ejecutar sin bloque y sin yield daria un error
def ejecutar2(&bloque) if block_given? bloque.call #same as yield else puts 'No tiene bloque asignado' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foo\n #chamar um block\n yield #quando passarmos o block como parametro sera executado no lugar do yield\n yield #sera executado 2 vezes\nend", "def method_1 nombre, &bloque\n yield if block_given? # bloque.call if block_given? #llamamos a nuestro bloque\nend", "def foo\n\n yield # executa um...
[ "0.692498", "0.6875776", "0.67513293", "0.6687451", "0.6482234", "0.6448593", "0.63877875", "0.63877875", "0.63382447", "0.6296208", "0.6296208", "0.6296208", "0.6280859", "0.6260701", "0.6249568", "0.6249568", "0.6249568", "0.6249568", "0.6249568", "0.6249568", "0.6249568", ...
0.7856723
0
DELETE /rapports/1 DELETE /rapports/1.json
def destroy @rapport = Rapport.find(params[:id]) @rapport.destroy respond_to do |format| format.html { redirect_to zwemmer_path(@rapport.zwemmer) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @port.destroy\n respond_to do |format|\n format.html { redirect_to ports_url, notice: \"Port was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @port.destroy\n respond_to do |format|\n format.html { redirect_to ports_url, n...
[ "0.67348003", "0.67348003", "0.6658526", "0.6625482", "0.6606679", "0.6597524", "0.6554047", "0.65494597", "0.6475733", "0.64654106", "0.6358784", "0.63496685", "0.6323638", "0.6298954", "0.62646323", "0.6259176", "0.62590754", "0.62458676", "0.6220956", "0.6198041", "0.61774...
0.6087645
26
4. Write a method that counts down to zero using recursion.
def countdown num if num <= 0 puts "Happy New Year!" else puts num countdown(num - 1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend", "def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend", "def count_to_zero(number)\n if number <= 0\n pu...
[ "0.81881446", "0.81881446", "0.81881446", "0.81881446", "0.81881446", "0.81881446", "0.81278926", "0.789467", "0.7729146", "0.7627441", "0.7540072", "0.7486443", "0.7435517", "0.73971236", "0.7388163", "0.7281533", "0.7129505", "0.7129411", "0.70577735", "0.7025709", "0.69582...
0.6427699
59
For an object with a 'title', 'code' and 'description' attribute, make a link to that object showing its title as the link text, with a link title attribute consisting of the code and description (where either, both or neither may be an empty string or even nil). Returns the link.
def sections_augmented_link( obj ) title = "" title << obj.code unless obj.try( :code ).blank? title << "\n" unless title.empty? or obj.try( :description ).blank? title << obj.description unless obj.try( :description ).blank? content_tag( :span, link_to( h( obj.title ), obj ), :title => title ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def link(link, title, content)\n\t\tif (title)\n\t\t\treturn \"title : [#{content}|#{link}]\"\n\t\telse\n\t\t\treturn \"[#{content}|#{link}]\"\n\t\tend\n\tend", "def link(hash = {})\n title = hash[:title]\n prefix = hash[:prefix] || ''\...
[ "0.6736098", "0.66137296", "0.6510727", "0.6474653", "0.6470446", "0.6469565", "0.639342", "0.63266385", "0.629813", "0.62671417", "0.6153598", "0.6151359", "0.614746", "0.6100227", "0.6069745", "0.6031714", "0.60099757", "0.5995805", "0.5974694", "0.5967464", "0.59220576", ...
0.61726934
10