_id
stringlengths
2
6
title
stringlengths
9
130
partition
stringclasses
3 values
text
stringlengths
30
4.3k
language
stringclasses
1 value
meta_information
dict
q20600
Promisepay.ItemResource.find
train
def find(id, type = :full) case type when :full response = JSON.parse(@client.get("items/#{id}").body) Promisepay::Item.new(@client, response['items']) when :status
ruby
{ "resource": "" }
q20601
Promisepay.User.bank_account
train
def bank_account response = JSON.parse(@client.get("users/#{send(:id)}/bank_accounts").body)
ruby
{ "resource": "" }
q20602
Promisepay.User.card_account
train
def card_account response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
ruby
{ "resource": "" }
q20603
Promisepay.User.paypal_account
train
def paypal_account response = JSON.parse(@client.get("users/#{send(:id)}/paypal_accounts").body)
ruby
{ "resource": "" }
q20604
Promisepay.User.disbursement_account
train
def disbursement_account(account_id) options = { account_id: account_id
ruby
{ "resource": "" }
q20605
Promisepay.User.company
train
def company response = JSON.parse(@client.get("users/#{send(:id)}/companies").body)
ruby
{ "resource": "" }
q20606
Promisepay.FeeResource.find
train
def find(id) response = JSON.parse(@client.get("fees/#{id}").body)
ruby
{ "resource": "" }
q20607
Promisepay.FeeResource.create
train
def create(attributes) response = JSON.parse(@client.post('fees',
ruby
{ "resource": "" }
q20608
Promisepay.WalletAccount.withdraw
train
def withdraw(options = {}) response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/withdraw",
ruby
{ "resource": "" }
q20609
Promisepay.WalletAccount.deposit
train
def deposit(options = {}) response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/deposit",
ruby
{ "resource": "" }
q20610
Promisepay.WalletAccount.user
train
def user response = JSON.parse(@client.get("wallet_accounts/#{send(:id)}/users").body)
ruby
{ "resource": "" }
q20611
Promisepay.Transaction.fee
train
def fee response = JSON.parse(@client.get("transactions/#{send(:id)}/fees").body)
ruby
{ "resource": "" }
q20612
Promisepay.TokenResource.create
train
def create(type = :session, attributes) case type when :session if attributes && attributes[:fee_ids] && attributes[:fee_ids].is_a?(Array) attributes[:fee_ids] = attributes[:fee_ids].join(',') end response = @client.get('request_session_token', attributes) ...
ruby
{ "resource": "" }
q20613
Promisepay.ChargeResource.find_all
train
def find_all(options = {}) response = JSON.parse(@client.get('charges', options).body) charges = response.key?('charges') ? response['charges'] : []
ruby
{ "resource": "" }
q20614
DocRaptor.DocApi.create_async_doc
train
def create_async_doc(doc, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20615
DocRaptor.DocApi.create_doc
train
def create_doc(doc, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20616
DocRaptor.DocApi.get_async_doc
train
def get_async_doc(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20617
DocRaptor.DocApi.get_async_doc_status
train
def get_async_doc_status(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20618
Socializer.Person.likes
train
def likes verbs_of_interest = %w[like unlike] query = Activity.joins(:verb) .with_actor_id(id: guid) .with_target_id(id: nil)
ruby
{ "resource": "" }
q20619
Socializer.Person.likes?
train
def likes?(object) verbs_of_interest = %w[like unlike] query = Activity.joins(:verb) .with_activity_object_id(id: object.id) .with_actor_id(id: guid)
ruby
{ "resource": "" }
q20620
Socializer.CreateActivity.add_audience_to_activity
train
def add_audience_to_activity(activity:) object_ids_array.each do |audience_id| privacy = audience_privacy(audience_id: audience_id) audience = activity.audiences.build(privacy: privacy)
ruby
{ "resource": "" }
q20621
Socializer.AudienceList.call
train
def call audiences = [merge_icon(list: privacy_hash(privacy_symbol: :public), icon: "fa-globe")] audiences << merge_icon(list: privacy_hash(privacy_symbol: :circles), icon: "fa-google-circles")
ruby
{ "resource": "" }
q20622
Socializer.AudienceList.person_list
train
def person_list return Person.none if @query.blank? result = select_display_name_alias_and_guids(query: Person)
ruby
{ "resource": "" }
q20623
Socializer.ActivityObject.liked_by
train
def liked_by # subquery = Activity.where(activity_object_id: id) # people = Person.joins(activity_object: { actor_activities: :verb }) # .merge(subquery) # likers = people.merge(Verb.by_display_name("like")) # unlikers = people.merge(Verb.by_display_name("unlike")).plu...
ruby
{ "resource": "" }
q20624
Socializer.ApplicationDecorator.time_ago
train
def time_ago(options: {}) data = { behavior: "tooltip-on-hover", time_ago: "moment.js" } options.reverse_merge!(title:
ruby
{ "resource": "" }
q20625
Socializer.AddDefaultCircles.call
train
def call create_circle(display_name: "Friends", content: friends_content) create_circle(display_name: "Family", content: family_content) create_circle(display_name: "Acquaintances",
ruby
{ "resource": "" }
q20626
Socializer.ActivityAudienceList.call
train
def call list = [] @activity.audiences.each do |audience| if audience.public? message = I18n.t("tooltip.public", scope: "socializer.activities.audiences.index") return [message] end
ruby
{ "resource": "" }
q20627
Socializer.ActivityAudienceList.limited_audience_list
train
def limited_audience_list(activitable:) # The target audience is either a group or a person, # which means we can add it as it is in the audience list. return
ruby
{ "resource": "" }
q20628
Socializer.Activity.comments
train
def comments activitable_type = ActivityObject.with_activitable_type(type: Comment.name) @comments
ruby
{ "resource": "" }
q20629
Socializer.ActivityObjectDecorator.link_to_like_or_unlike
train
def link_to_like_or_unlike return unless helpers.current_user options = current_user_likes? ? like_options
ruby
{ "resource": "" }
q20630
Socializer.PersonDecorator.image_tag_avatar
train
def image_tag_avatar(size: nil, css_class: nil, alt: "Avatar", title: nil) width, height = parse_size(size: size) if size
ruby
{ "resource": "" }
q20631
Socializer.PersonDecorator.link_to_avatar
train
def link_to_avatar helpers.link_to(image_tag_avatar(title: model.display_name),
ruby
{ "resource": "" }
q20632
Socializer.PersonDecorator.toolbar_stream_links
train
def toolbar_stream_links list = combine_circles_and_memberships return if list.blank? html = [toolbar_links(list[0..2])] html <<
ruby
{ "resource": "" }
q20633
Clever.DataApi.get_contact
train
def get_contact(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20634
Clever.DataApi.get_contacts_for_student
train
def get_contacts_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20635
Clever.DataApi.get_course
train
def get_course(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20636
Clever.DataApi.get_course_for_section
train
def get_course_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20637
Clever.DataApi.get_district
train
def get_district(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20638
Clever.DataApi.get_district_admin
train
def get_district_admin(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20639
Clever.DataApi.get_district_for_contact
train
def get_district_for_contact(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20640
Clever.DataApi.get_district_for_course
train
def get_district_for_course(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20641
Clever.DataApi.get_district_for_district_admin
train
def get_district_for_district_admin(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20642
Clever.DataApi.get_district_for_school
train
def get_district_for_school(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20643
Clever.DataApi.get_district_for_school_admin
train
def get_district_for_school_admin(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20644
Clever.DataApi.get_district_for_section
train
def get_district_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20645
Clever.DataApi.get_district_for_student
train
def get_district_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20646
Clever.DataApi.get_district_for_teacher
train
def get_district_for_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20647
Clever.DataApi.get_district_for_term
train
def get_district_for_term(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20648
Clever.DataApi.get_school
train
def get_school(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20649
Clever.DataApi.get_school_admin
train
def get_school_admin(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20650
Clever.DataApi.get_school_for_section
train
def get_school_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20651
Clever.DataApi.get_school_for_student
train
def get_school_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20652
Clever.DataApi.get_school_for_teacher
train
def get_school_for_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20653
Clever.DataApi.get_schools_for_school_admin
train
def get_schools_for_school_admin(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20654
Clever.DataApi.get_schools_for_student
train
def get_schools_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20655
Clever.DataApi.get_schools_for_teacher
train
def get_schools_for_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20656
Clever.DataApi.get_section
train
def get_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20657
Clever.DataApi.get_sections_for_course
train
def get_sections_for_course(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20658
Clever.DataApi.get_sections_for_school
train
def get_sections_for_school(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20659
Clever.DataApi.get_sections_for_student
train
def get_sections_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20660
Clever.DataApi.get_sections_for_teacher
train
def get_sections_for_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20661
Clever.DataApi.get_sections_for_term
train
def get_sections_for_term(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20662
Clever.DataApi.get_student
train
def get_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20663
Clever.DataApi.get_students_for_contact
train
def get_students_for_contact(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20664
Clever.DataApi.get_students_for_school
train
def get_students_for_school(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20665
Clever.DataApi.get_students_for_section
train
def get_students_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20666
Clever.DataApi.get_students_for_teacher
train
def get_students_for_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20667
Clever.DataApi.get_teacher
train
def get_teacher(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20668
Clever.DataApi.get_teacher_for_section
train
def get_teacher_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20669
Clever.DataApi.get_teachers_with_http_info
train
def get_teachers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DataApi.get_teachers ..." end # resource path local_var_path = "/teachers" # query parameters query_params = {} query_params[:'limit'] = opts[:'limi...
ruby
{ "resource": "" }
q20670
Clever.DataApi.get_teachers_for_school
train
def get_teachers_for_school(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20671
Clever.DataApi.get_teachers_for_section
train
def get_teachers_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20672
Clever.DataApi.get_teachers_for_student
train
def get_teachers_for_student(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20673
Clever.DataApi.get_term
train
def get_term(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20674
Clever.DataApi.get_term_for_section
train
def get_term_for_section(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20675
Clever.EventsApi.get_event
train
def get_event(id, opts = {}) data, _status_code, _headers =
ruby
{ "resource": "" }
q20676
APN.Client.setup_socket
train
def setup_socket ctx = setup_certificate APN.log(:debug, "Connecting to #{@host}:#{@port}...") socket_tcp = TCPSocket.new(@host, @port)
ruby
{ "resource": "" }
q20677
Numo.Linalg.dot
train
def dot(a, b) a = NArray.asarray(a) b = NArray.asarray(b) case a.ndim when 1 case b.ndim when 1 func = blas_char(a, b) =~ /c|z/ ? :dotu : :dot Blas.call(func, a, b) else if b.contiguous? trans = 't' else if b.fortran_contiguous? ...
ruby
{ "resource": "" }
q20678
Numo.Linalg.matrix_power
train
def matrix_power(a, n) a = NArray.asarray(a) m,k = a.shape[-2..-1] unless m==k raise NArray::ShapeError, "input must be a square array" end unless Integer===n raise ArgumentError, "exponent must be an integer" end if n == 0 return a.class.eye(m) elsif n < 0 a = in...
ruby
{ "resource": "" }
q20679
Numo.Linalg.svdvals
train
def svdvals(a, driver:'svd') case driver.to_s when /^(ge)?sdd$/i, "turbo" Lapack.call(:gesdd, a, jobz:'N')[0]
ruby
{ "resource": "" }
q20680
Numo.Linalg.orth
train
def orth(a, rcond: -1) raise NArray::ShapeError, '2-d array is required' if a.ndim < 2 s, u,
ruby
{ "resource": "" }
q20681
Numo.Linalg.null_space
train
def null_space(a, rcond: -1) raise NArray::ShapeError, '2-d array is required' if a.ndim < 2 s, _u, vh = svd(a) tol = s.max * (rcond.nil? || rcond < 0 ? a.class::EPSILON * a.shape.max : rcond) k = (s >
ruby
{ "resource": "" }
q20682
Numo.Linalg.lu
train
def lu(a, permute_l: false) raise NArray::ShapeError, '2-d array is required' if a.ndim < 2 m, n = a.shape k = [m, n].min lu, ip = lu_fact(a) l = lu.tril.tap { |mat| mat[mat.diag_indices(0)] =
ruby
{ "resource": "" }
q20683
Numo.Linalg.lu_solve
train
def lu_solve(lu, ipiv, b, trans:"N") Lapack.call(:getrs, lu,
ruby
{ "resource": "" }
q20684
Numo.Linalg.eigvals
train
def eigvals(a) jobvl, jobvr = 'N','N' case blas_char(a) when /c|z/ w, = Lapack.call(:geev, a, jobvl:jobvl, jobvr:jobvr) else wr, wi, = Lapack.call(:geev,
ruby
{ "resource": "" }
q20685
Numo.Linalg.cond
train
def cond(a,ord=nil) if ord.nil? s = svdvals(a) s[false, 0]/s[false,
ruby
{ "resource": "" }
q20686
Numo.Linalg.det
train
def det(a) lu, piv, = Lapack.call(:getrf, a) idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
ruby
{ "resource": "" }
q20687
Numo.Linalg.slogdet
train
def slogdet(a) lu, piv, = Lapack.call(:getrf, a) idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1)) m = piv.eq(idx).count_false(axis:-1) % 2 sign = m * -2 + 1 lud = lu.diagonal if (lud.eq 0).any? return 0,
ruby
{ "resource": "" }
q20688
Numo.Linalg.inv
train
def inv(a, driver:"getrf", uplo:'U') case driver when /(ge|sy|he|po)sv$/ d = $1 b = a.new_zeros.eye solve(a, b, driver:d, uplo:uplo) when /(ge|sy|he)tr[fi]$/ d = $1 lu, piv = lu_fact(a) lu_inv(lu, piv) when /potr[fi]$/
ruby
{ "resource": "" }
q20689
AutoParse.Instance.valid?
train
def valid? unvalidated_fields = @data.keys.dup for property_key, schema_class in self.class.properties property_value = @data[property_key] if !self.class.validate_property_value( property_value, schema_class.data) return false end if property_value == n...
ruby
{ "resource": "" }
q20690
Crummy.ViewMethods.render_crumbs
train
def render_crumbs(options = {}) raise ArgumentError, "Renderer and block given" if options.has_key?(:renderer) && block_given? return yield(crumbs, options) if block_given? @_renderer ||= if options.has_key?(:renderer) options.delete(:renderer) else
ruby
{ "resource": "" }
q20691
Erector.Convenience.javascript
train
def javascript(value = nil, attributes = {}) if value.is_a?(Hash) attributes = value value = nil elsif block_given? && value raise ArgumentError, "You can't pass both a block and a value to javascript -- please choose one." end script(attributes.merge(:type => "text...
ruby
{ "resource": "" }
q20692
FinanceMath.Loan.pmt
train
def pmt(options = {}) future_value = options.fetch(:future_value, 0) type = options.fetch(:type, 0) ((@amount *
ruby
{ "resource": "" }
q20693
Erector.JQuery.jquery
train
def jquery(*args) event = if args.first.is_a? Symbol args.shift else :ready end txt = args.shift attributes = args.shift || {} javascript attributes do rawtext "\n"
ruby
{ "resource": "" }
q20694
Erector.AbstractWidget.capture_content
train
def capture_content original, @_output = output, Output.new yield original.widgets.concat(output.widgets) # todo: test!!!
ruby
{ "resource": "" }
q20695
Erector.AbstractWidget._emit_via
train
def _emit_via(parent, options = {}, &block) _emit(options.merge(:parent => parent, :output => parent.output,
ruby
{ "resource": "" }
q20696
Erector.Rails.render
train
def render(*args, &block) captured = helpers.capture do helpers.concat(helpers.render(*args, &block))
ruby
{ "resource": "" }
q20697
Erector.Rails.content_for
train
def content_for(*args,&block) if block helpers.content_for(*args,&block)
ruby
{ "resource": "" }
q20698
Erector.Text.character
train
def character(code_point_or_name) if code_point_or_name.is_a?(Symbol) require "erector/unicode" found = Erector::CHARACTERS[code_point_or_name] if found.nil? raise "Unrecognized character #{code_point_or_name}" end raw("&#x#{sprintf '%x', found};") elsif cod...
ruby
{ "resource": "" }
q20699
Resourceful.Response.method_missing
train
def method_missing(name, &block) @formats.push([name, block || proc {}])
ruby
{ "resource": "" }